mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
ui/app: serialize event handling
The frame callback for macOS comes in from a different thread than the UI thread. Serialize event handling to maintain the invariant that only one event is processed at a time. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -35,6 +35,8 @@ type Window struct {
|
||||
|
||||
events chan Event
|
||||
|
||||
eventLock sync.Mutex
|
||||
|
||||
mu sync.Mutex
|
||||
stage Stage
|
||||
size image.Point
|
||||
@@ -230,6 +232,8 @@ func (w *Window) contextDriver() interface{} {
|
||||
}
|
||||
|
||||
func (w *Window) event(e Event) {
|
||||
w.eventLock.Lock()
|
||||
defer w.eventLock.Unlock()
|
||||
w.mu.Lock()
|
||||
needAck := false
|
||||
needRedraw := false
|
||||
|
||||
Reference in New Issue
Block a user