From f540aef1986fca8d9fff41aa0e3f63a81b3bc801 Mon Sep 17 00:00:00 2001 From: pelya Date: Thu, 30 Sep 2010 15:16:12 +0300 Subject: [PATCH] Fix for on-screen buttons misplaced sometimes when waking from background --- .../sdl-1.3/src/video/android/SDL_androidvideo.c | 13 ++++++++----- .../src/video/android/SDL_touchscreenkeyboard.c | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.c b/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.c index 730af5f32..c691b5bef 100644 --- a/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.c +++ b/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.c @@ -47,8 +47,8 @@ // The device screen dimensions to draw on -int SDL_ANDROID_sWindowWidth = 640; -int SDL_ANDROID_sWindowHeight = 480; +int SDL_ANDROID_sWindowWidth = 0; +int SDL_ANDROID_sWindowHeight = 0; // Extremely wicked JNI environment to call Java functions from C code static JNIEnv* JavaEnv = NULL; @@ -88,9 +88,12 @@ int SDL_ANDROID_CallJavaSwapBuffers() JNIEXPORT void JNICALL JAVA_EXPORT_NAME(DemoRenderer_nativeResize) ( JNIEnv* env, jobject thiz, jint w, jint h ) { - SDL_ANDROID_sWindowWidth = w; - SDL_ANDROID_sWindowHeight = h; - __android_log_print(ANDROID_LOG_INFO, "libSDL", "Physical screen resolution is %dx%d", w, h); + if( SDL_ANDROID_sWindowWidth == 0 ) + { + SDL_ANDROID_sWindowWidth = w; + SDL_ANDROID_sWindowHeight = h; + __android_log_print(ANDROID_LOG_INFO, "libSDL", "Physical screen resolution is %dx%d", w, h); + } } JNIEXPORT void JNICALL 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 39c853132..c26780b50 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 @@ -673,7 +673,7 @@ static int setupScreenKeyboardButton( int buttonID, Uint8 * charBuf ) memcpy(&w, charBuf, sizeof(int)); memcpy(&h, charBuf + sizeof(int), sizeof(int)); - memcpy(&format, charBuf+ 2*sizeof(int), sizeof(int)); + memcpy(&format, charBuf + 2*sizeof(int), sizeof(int)); w = ntohl(w); h = ntohl(h); format = ntohl(format);