Fix for on-screen buttons misplaced sometimes when waking from background

This commit is contained in:
pelya
2010-09-30 15:16:12 +03:00
parent a7182ea391
commit f540aef198
2 changed files with 9 additions and 6 deletions

View File

@@ -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

View File

@@ -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);