X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=6671041620077893cc02078bc6a72725057c0f64;hb=b6dd2f35e987ab55a904deff37194ee8507c7d7a;hp=2472fdf5f8978b048af638730299206544445255;hpb=0d214d4e314f6f42df24be140bb433e980319767;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index 2472fdf5..66710416 100644 --- a/src/events.c +++ b/src/events.c @@ -250,7 +250,11 @@ void HandleOtherEvents(Event *event) #if defined(TARGET_SDL2) case SDL_CONTROLLERBUTTONDOWN: case SDL_CONTROLLERBUTTONUP: + // for any game controller button event, disable overlay buttons + SetOverlayEnabled(FALSE); + HandleSpecialGameControllerButtons(event); + /* FALL THROUGH */ case SDL_CONTROLLERDEVICEADDED: case SDL_CONTROLLERDEVICEREMOVED: @@ -668,6 +672,9 @@ void HandleFingerEvent(FingerEvent *event) "KEY_PRESSED"); int i; + // for any touch input event, enable overlay buttons (if activated) + SetOverlayEnabled(TRUE); + Error(ERR_DEBUG, "::: key '%s' was '%s' [fingerId: %lld]", getKeyNameFromKey(key), key_status_name, event->fingerId); @@ -1148,9 +1155,16 @@ void HandleKeyEvent(KeyEvent *event) #endif #if defined(PLATFORM_ANDROID) - // always map the "back" button to the "escape" key on Android devices if (key == KSYM_Back) + { + // always map the "back" button to the "escape" key on Android devices key = KSYM_Escape; + } + else + { + // for any key event other than "back" button, disable overlay buttons + SetOverlayEnabled(FALSE); + } #endif HandleKeyModState(keymod, key_status); @@ -1526,9 +1540,11 @@ void HandleKey(Key key, int key_status) int i; #if defined(TARGET_SDL2) - /* map special "play/pause" media key to default key for play/pause actions */ + /* map special keys (media keys / remote control buttons) to default keys */ if (key == KSYM_PlayPause) key = KSYM_space; + else if (key == KSYM_Select) + key = KSYM_Return; #endif HandleSpecialGameControllerKeys(key, key_status);