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:
Elias Naur
2019-05-21 15:56:56 +02:00
parent da598663f7
commit bc481ea784
+4
View File
@@ -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