From 1eaeb815f2ef88199978ccc1a3336cbc2f4b9647 Mon Sep 17 00:00:00 2001 From: pelya Date: Mon, 30 Aug 2010 12:24:20 +0300 Subject: [PATCH] Whole screen does not act as button0 if touchscreen keyboard used --- .../sdl-1.3/src/video/android/SDL_androidinput.c | 7 +++++-- .../sdl-1.3/src/video/android/SDL_androidinput.h | 3 ++- .../src/video/android/SDL_touchscreenkeyboard.c | 16 +++++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.c b/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.c index 46e5b49f4..1f06e0f1a 100644 --- a/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.c +++ b/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.c @@ -55,7 +55,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j if(pointerId > MAX_MULTITOUCH_POINTERS) pointerId = MAX_MULTITOUCH_POINTERS; - if( SDL_android_processTouchscreenKeyboard(x, y, action, pointerId) ) + if( SDL_ANDROID_isTouchscreenKeyboardUsed && SDL_ANDROID_processTouchscreenKeyboard(x, y, action, pointerId) ) return; #if SDL_VIDEO_RENDER_RESIZE @@ -88,7 +88,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j SDL_PrivateJoystickButton(CurrentJoysticks[pointerId+1], 0, SDL_RELEASED); } } - if( !isMouseUsed ) + if( !isMouseUsed && !SDL_ANDROID_isTouchscreenKeyboardUsed ) { SDL_keysym keysym; if( action != MOUSE_MOVE ) @@ -96,6 +96,9 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j return; } + if( !isMouseUsed ) + return; + if( action == MOUSE_DOWN || action == MOUSE_UP ) { #if SDL_VERSION_ATLEAST(1,3,0) diff --git a/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.h b/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.h index 1f33cd2c4..27a72a7cd 100644 --- a/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.h +++ b/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.h @@ -172,7 +172,8 @@ enum MOUSE_ACTION { MOUSE_DOWN = 0, MOUSE_UP=1, MOUSE_MOVE=2 }; enum { MAX_MULTITOUCH_POINTERS = 5 }; -extern int SDL_android_processTouchscreenKeyboard(int x, int y, int action, int pointerId); +extern int SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int pointerId); +extern int SDL_ANDROID_isTouchscreenKeyboardUsed; #ifndef SDL_ANDROID_KEYCODE_0 #define SDL_ANDROID_KEYCODE_0 RETURN diff --git a/project/sdl/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c b/project/sdl/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c index 04624e77b..38300a583 100644 --- a/project/sdl/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c +++ b/project/sdl/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c @@ -45,7 +45,7 @@ #define MIN(X, Y) ((X) < (Y) ? (X) : (Y)) #define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) -static int isTouchscreenKeyboardUsed = 0; +int SDL_ANDROID_isTouchscreenKeyboardUsed = 0; static int touchscreenKeyboardTheme = 0; static int AutoFireButtonsNum = 0; @@ -212,7 +212,7 @@ static inline void drawCharTex(GLTexture_t * tex, SDL_Rect * pos, Uint8 r, Uint8 int SDL_ANDROID_drawTouchscreenKeyboard() { int i; - if( !isTouchscreenKeyboardUsed ) + if( !SDL_ANDROID_isTouchscreenKeyboardUsed ) return 0; if( touchscreenKeyboardTheme == 0 ) { @@ -303,13 +303,15 @@ static inline int ArrowKeysPressed(int x, int y) return ret; } -int SDL_android_processTouchscreenKeyboard(int x, int y, int action, int pointerId) +int SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int pointerId) { int i; SDL_keysym keysym; + /* if( !isTouchscreenKeyboardUsed ) return 0; + */ if( action == MOUSE_DOWN ) { @@ -374,8 +376,8 @@ int SDL_android_processTouchscreenKeyboard(int x, int y, int action, int pointer { if( OldCoords[pointerId] && !InsideRect(OldCoords[pointerId], x, y) ) { - SDL_android_processTouchscreenKeyboard(x, y, MOUSE_UP, pointerId); - return SDL_android_processTouchscreenKeyboard(x, y, MOUSE_DOWN, pointerId); + SDL_ANDROID_processTouchscreenKeyboard(x, y, MOUSE_UP, pointerId); + return SDL_ANDROID_processTouchscreenKeyboard(x, y, MOUSE_DOWN, pointerId); } else if( OldCoords[pointerId] == &arrows ) @@ -415,7 +417,7 @@ int SDL_android_processTouchscreenKeyboard(int x, int y, int action, int pointer if( OldCoords[pointerId] ) return 1; - return SDL_android_processTouchscreenKeyboard(x, y, MOUSE_DOWN, pointerId); + return SDL_ANDROID_processTouchscreenKeyboard(x, y, MOUSE_DOWN, pointerId); } return 0; }; @@ -520,7 +522,7 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thi JNIEXPORT void JNICALL JAVA_EXPORT_NAME(Settings_nativeSetTouchscreenKeyboardUsed) ( JNIEnv* env, jobject thiz) { - isTouchscreenKeyboardUsed = 1; + SDL_ANDROID_isTouchscreenKeyboardUsed = 1; } static int