app: introduce Config.Focused that tracks the window focus state

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-12-19 11:22:54 -06:00
parent 2a18a0c135
commit 9fe8b684e2
9 changed files with 35 additions and 15 deletions
+4 -2
View File
@@ -258,11 +258,13 @@ func (w *window) addEventListeners() {
return nil
})
w.addEventListener(w.tarea, "focus", func(this js.Value, args []js.Value) interface{} {
w.processEvent(key.FocusEvent{Focus: true})
w.config.Focused = true
w.processEvent(ConfigEvent{Config: w.config})
return nil
})
w.addEventListener(w.tarea, "blur", func(this js.Value, args []js.Value) interface{} {
w.processEvent(key.FocusEvent{Focus: false})
w.config.Focused = false
w.processEvent(ConfigEvent{Config: w.config})
w.blur()
return nil
})