mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55: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
|
events chan Event
|
||||||
|
|
||||||
|
eventLock sync.Mutex
|
||||||
|
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
stage Stage
|
stage Stage
|
||||||
size image.Point
|
size image.Point
|
||||||
@@ -230,6 +232,8 @@ func (w *Window) contextDriver() interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) event(e Event) {
|
func (w *Window) event(e Event) {
|
||||||
|
w.eventLock.Lock()
|
||||||
|
defer w.eventLock.Unlock()
|
||||||
w.mu.Lock()
|
w.mu.Lock()
|
||||||
needAck := false
|
needAck := false
|
||||||
needRedraw := false
|
needRedraw := false
|
||||||
|
|||||||
Reference in New Issue
Block a user