mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
app,io/key,io/system: [API] replace system.CommandEvent with key.Event
It's much simpler to map the Android back button to a key.Event and let the usual key filtering determine whether to block its default behaviour. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-3
@@ -571,9 +571,7 @@ func Java_org_gioui_GioView_onFrameCallback(env *C.JNIEnv, class C.jclass, view
|
||||
//export Java_org_gioui_GioView_onBack
|
||||
func Java_org_gioui_GioView_onBack(env *C.JNIEnv, class C.jclass, view C.jlong) C.jboolean {
|
||||
w := cgo.Handle(view).Value().(*window)
|
||||
ev := &system.CommandEvent{Type: system.CommandBack}
|
||||
w.callbacks.Event(ev)
|
||||
if ev.Cancel {
|
||||
if w.callbacks.Event(key.Event{Name: key.NameBack}) {
|
||||
return C.JNI_TRUE
|
||||
}
|
||||
return C.JNI_FALSE
|
||||
|
||||
Reference in New Issue
Block a user