From dedefbf9a9be4ee582893a88e451c4b74edaaae9 Mon Sep 17 00:00:00 2001 From: pelya Date: Sat, 4 May 2013 17:44:36 +0000 Subject: [PATCH] Fire button in OpenArena will not toggle other buttons if you slide finger to them --- .../ballfield/AndroidAppSettings.cfg | 2 +- .../jni/application/ballfield/ballfield.cpp | 2 ++ .../commandergenius/commandergenius | 2 +- project/jni/application/openarena/engine | 2 +- .../video/android/SDL_touchscreenkeyboard.c | 18 +++++++++++++++--- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/project/jni/application/ballfield/AndroidAppSettings.cfg b/project/jni/application/ballfield/AndroidAppSettings.cfg index 08466b91f..bee8d6ecb 100644 --- a/project/jni/application/ballfield/AndroidAppSettings.cfg +++ b/project/jni/application/ballfield/AndroidAppSettings.cfg @@ -34,7 +34,7 @@ AppUsesMultitouch=y AppRecordsAudio=n NonBlockingSwapBuffers=n RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE" -AppTouchscreenKeyboardKeysAmount=1 +AppTouchscreenKeyboardKeysAmount=4 AppTouchscreenKeyboardKeysAmountAutoFire=0 RedefinedKeysScreenKb="0 1 2 3 4 5 6 7 8 9" RedefinedKeysScreenKbNames="0 1 2 3 4 5 6 7 8 9" diff --git a/project/jni/application/ballfield/ballfield.cpp b/project/jni/application/ballfield/ballfield.cpp index 46bb8b42a..807783daf 100644 --- a/project/jni/application/ballfield/ballfield.cpp +++ b/project/jni/application/ballfield/ballfield.cpp @@ -562,6 +562,8 @@ int main(int argc, char* argv[]) SDL_ANDROID_GetScreenKeyboardButtonPos(i, &r); __android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "{ %d, %d, %d, %d },", r.x, r.y, r.x+r.h, r.y+r.w); } + //SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 1); + //SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, 1); while(1) { diff --git a/project/jni/application/commandergenius/commandergenius b/project/jni/application/commandergenius/commandergenius index d4f7bca76..6f28771d5 160000 --- a/project/jni/application/commandergenius/commandergenius +++ b/project/jni/application/commandergenius/commandergenius @@ -1 +1 @@ -Subproject commit d4f7bca76e2e65cbbb13dec8952dea7c3a1600cb +Subproject commit 6f28771d57ca7d878e3cfee08014651b854b9c7f diff --git a/project/jni/application/openarena/engine b/project/jni/application/openarena/engine index 1c3f8aa9c..7d4816a25 160000 --- a/project/jni/application/openarena/engine +++ b/project/jni/application/openarena/engine @@ -1 +1 @@ -Subproject commit 1c3f8aa9c102c1a1c70e18b2bcb0a955decc2033 +Subproject commit 7d4816a25a1637106129a1f3c6a2a9e513f6d92d diff --git a/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c b/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c index 5dbfe9b48..6f9ead6c3 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c +++ b/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c @@ -44,7 +44,7 @@ // TODO: this code is a HUGE MESS -enum { MAX_BUTTONS = SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM-1, MAX_BUTTONS_AUTOFIRE = 2, BUTTON_TEXT_INPUT = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, BUTTON_ARROWS = MAX_BUTTONS } ; // Max amount of custom buttons +enum { MAX_BUTTONS = SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM-1, MAX_BUTTONS_AUTOFIRE = 2, BUTTON_TEXT_INPUT = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, BUTTON_ARROWS = SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD } ; // Max amount of custom buttons int SDL_ANDROID_isTouchscreenKeyboardUsed = 0; static short touchscreenKeyboardTheme = 0; @@ -56,7 +56,7 @@ static float transparency = 128.0f/255.0f; static SDL_Rect arrows, arrowsExtended, buttons[MAX_BUTTONS], buttonsAutoFireRect[MAX_BUTTONS_AUTOFIRE]; static SDL_Rect arrowsDraw, buttonsDraw[MAX_BUTTONS]; -static SDLKey buttonKeysyms[MAX_BUTTONS] = { +static SDLKey buttonKeysyms[MAX_BUTTONS] = { SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_0)), SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_1)), SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_2)), @@ -535,7 +535,19 @@ unsigned SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int po if( action == MOUSE_MOVE ) { // Process cases when pointer enters button area (it won't send keypress twice if button already pressed) - processed |= SDL_ANDROID_processTouchscreenKeyboard(x, y, MOUSE_DOWN, pointerId); + int processOtherButtons = 1; + for( i = 0; i < MAX_BUTTONS; i++ ) + { + if( buttonsGenerateSdlEvents[i] && pointerInButtonRect[i] == pointerId ) + { + processOtherButtons = 0; + break; + } + } + if( processOtherButtons ) + { + processed |= SDL_ANDROID_processTouchscreenKeyboard(x, y, MOUSE_DOWN, pointerId); + } // Process cases when pointer leaves button area // TODO: huge code size, split it or somehow make it more readable