From e3f07a20e2fe0b7dea9edd25a24cbda2bb1ae7ed Mon Sep 17 00:00:00 2001 From: BogdanTheGeek Date: Tue, 17 Oct 2023 19:09:00 +0100 Subject: [PATCH] internal: driver: mobile: app: android: map gamepad keycodes --- internal/driver/mobile/app/android.go | 11 ++++++----- internal/driver/mobile/driver.go | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/internal/driver/mobile/app/android.go b/internal/driver/mobile/app/android.go index 24eb000330..599c7d4ed3 100644 --- a/internal/driver/mobile/app/android.go +++ b/internal/driver/mobile/app/android.go @@ -745,6 +745,12 @@ var androidKeycoe = map[int32]key.Code{ C.AKEYCODE_NUMPAD_ENTER: key.CodeKeypadEnter, C.AKEYCODE_NUMPAD_EQUALS: key.CodeKeypadEqualSign, C.AKEYCODE_VOLUME_MUTE: key.CodeMute, + + C.AKEYCODE_DPAD_UP: key.CodeDPadUp, + C.AKEYCODE_DPAD_DOWN: key.CodeDPadDown, + C.AKEYCODE_DPAD_LEFT: key.CodeDPadLeft, + C.AKEYCODE_DPAD_RIGHT: key.CodeDPadRight, + C.AKEYCODE_DPAD_CENTER: key.CodeDPadCenter, } func convAndroidKeyCode(aKeyCode int32) key.Code { @@ -767,11 +773,6 @@ func convAndroidKeyCode(aKeyCode int32) key.Code { C.AKEYCODE_ENDCALL C.AKEYCODE_STAR C.AKEYCODE_POUND - C.AKEYCODE_DPAD_UP - C.AKEYCODE_DPAD_DOWN - C.AKEYCODE_DPAD_LEFT - C.AKEYCODE_DPAD_RIGHT - C.AKEYCODE_DPAD_CENTER C.AKEYCODE_POWER C.AKEYCODE_CAMERA C.AKEYCODE_CLEAR diff --git a/internal/driver/mobile/driver.go b/internal/driver/mobile/driver.go index 5e06cffbdc..0c434b2737 100644 --- a/internal/driver/mobile/driver.go +++ b/internal/driver/mobile/driver.go @@ -471,6 +471,11 @@ var keyCodeMap = map[key.Code]fyne.KeyName{ key.CodeGraveAccent: fyne.KeyBackTick, key.CodeBackButton: mobile.KeyBack, + key.CodeDPadUp: mobile.KeyDPadUp, + key.CodeDPadDown: mobile.KeyDPadDown, + key.CodeDPadLeft: mobile.KeyDPadLeft, + key.CodeDPadRight: mobile.KeyDPadRight, + key.CodeDPadCenter: mobile.KeyDPadCenter, } func keyToName(code key.Code) fyne.KeyName {