diff --git a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h index 4a2c403d0..b9df63db7 100644 --- a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h +++ b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h @@ -100,6 +100,9 @@ extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardSize(void); /* Set a particular button to pass a mouse/multitouch events down to the application, by default all buttons block touch events */ extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(int buttonId, int generateEvents); +/* Prevent a button from sharing touch events with other buttons, if they overlap */ +extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardPreventButtonOverlap(int prevent); + /* Configure a button to stay pressed after touch, and un-press after second touch, to emulate Ctrl/Alt/Shift keys */ extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonStayPressedAfterTouch(int buttonId, int stayPressed); 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 61c1015c3..fb9f509cb 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 @@ -58,6 +58,7 @@ static SDL_Rect hiddenButtons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM]; static short buttonsize = 1; static short buttonDrawSize = 1; static float transparency = 128.0f/255.0f; +static int preventButtonOverlap = 0; static SDL_Rect arrows[MAX_JOYSTICKS], arrowsExtended[MAX_JOYSTICKS], buttons[MAX_BUTTONS]; static SDL_Rect arrowsDraw[MAX_JOYSTICKS], buttonsDraw[MAX_BUTTONS]; @@ -488,7 +489,34 @@ unsigned SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int po if( action == MOUSE_DOWN ) { //__android_log_print(ANDROID_LOG_INFO, "libSDL", "touch %03dx%03d ptr %d action %d", x, y, pointerId, action); - for( j = 0; j < joyAmount; j++ ) + int processOtherButtons = 1; + + for( i = 0; i < MAX_BUTTONS; i++ ) + { + if( ! buttons[i].h || ! buttons[i].w ) + continue; + if( InsideRect( &buttons[i], x, y) ) + { + processed |= 1<= SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM )