mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 17:05:38 +00:00
app,io/system: [API] add StageInactive when window is not in focus
Now, Gio will send one system.StageEvent with system.StageInactive when the window is not active. It is implemented on macOS and Windows. This change is not fully backward compatible, if your code compares the Stage (`stage < system.StageRunning`), you need to consider the new system.StageInactive. Signed-off-by: inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
+3
-3
@@ -552,7 +552,7 @@ func Java_org_gioui_GioView_onLowMemory(env *C.JNIEnv, class C.jclass) {
|
||||
func Java_org_gioui_GioView_onConfigurationChanged(env *C.JNIEnv, class C.jclass, view C.jlong) {
|
||||
w := cgo.Handle(view).Value().(*window)
|
||||
w.loadConfig(env, class)
|
||||
if w.stage >= system.StageRunning {
|
||||
if w.stage >= system.StageInactive {
|
||||
w.draw(env, true)
|
||||
}
|
||||
}
|
||||
@@ -563,7 +563,7 @@ func Java_org_gioui_GioView_onFrameCallback(env *C.JNIEnv, class C.jclass, view
|
||||
if !exist {
|
||||
return
|
||||
}
|
||||
if w.stage < system.StageRunning {
|
||||
if w.stage < system.StageInactive {
|
||||
return
|
||||
}
|
||||
if w.animating {
|
||||
@@ -596,7 +596,7 @@ func Java_org_gioui_GioView_onWindowInsets(env *C.JNIEnv, class C.jclass, view C
|
||||
left: int(left),
|
||||
right: int(right),
|
||||
}
|
||||
if w.stage >= system.StageRunning {
|
||||
if w.stage >= system.StageInactive {
|
||||
w.draw(env, true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user