app: [API] remove StageEvent and Stage

StageEvent served only redundant purposes:

- To detect whether the window has focus. That is covered by
  key.FocusEvent.
- To detect whether the window is currently visible. That is covered by
  the absence or presence of FrameEvents.
- To detect when the window native handle is valid. That is
  covered by ViewEvent.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-12-15 16:45:02 -06:00
parent f3fc0d62b8
commit d58d386b9b
9 changed files with 41 additions and 162 deletions
-12
View File
@@ -115,7 +115,6 @@ func newWindow(win *callbacks, options []Option) {
w.Configure(options)
w.blur()
w.processEvent(JSViewEvent{Element: cont})
w.processEvent(StageEvent{Stage: StageRunning})
w.resize()
w.draw(true)
}
@@ -195,17 +194,6 @@ func (w *window) addEventListeners() {
}
return w.browserHistory.Call("back")
})
w.addEventListener(w.document, "visibilitychange", func(this js.Value, args []js.Value) interface{} {
ev := StageEvent{}
switch w.document.Get("visibilityState").String() {
case "hidden", "prerender", "unloaded":
ev.Stage = StagePaused
default:
ev.Stage = StageRunning
}
w.processEvent(ev)
return nil
})
w.addEventListener(w.cnv, "mousemove", func(this js.Value, args []js.Value) interface{} {
w.pointerEvent(pointer.Move, 0, 0, args[0])
return nil