mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 00:45:35 +00:00
ui/app: (wasm) avoid deadlock from focus changes
showTextInput is called from the window loop in window.go, but could result in an immediate event which then deadlocks waiting for the window loop to handle it. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+9
-5
@@ -318,11 +318,15 @@ func (w *window) setAnimating(anim bool) {
|
||||
}
|
||||
|
||||
func (w *window) showTextInput(show bool) {
|
||||
if show {
|
||||
w.focus()
|
||||
} else {
|
||||
w.blur()
|
||||
}
|
||||
// Run in a goroutine to avoid a deadlock if the
|
||||
// focus change result in an event.
|
||||
go func() {
|
||||
if show {
|
||||
w.focus()
|
||||
} else {
|
||||
w.blur()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func (w *window) draw(sync bool) {
|
||||
|
||||
Reference in New Issue
Block a user