|
From: Elias N. <eli...@us...> - 2004-09-22 19:56:13
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19889/linux Modified Files: display.c display.h org_lwjgl_opengl_Display.c Log Message: Linux: Fixed problem with updating screen dimension globals Index: display.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/display.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- display.h 22 Sep 2004 19:25:16 -0000 1.5 +++ display.h 22 Sep 2004 19:56:02 -0000 1.6 @@ -43,6 +43,7 @@ #define _DISPLAY_H #include <jni.h> +#include "common_tools.h" typedef enum {XRANDR, XF86VIDMODE, NONE} extension; @@ -50,7 +51,7 @@ extern int getScreenModeHeight(void); extern jobject initDisplay(JNIEnv *env, int screen); extern void switchDisplayMode(JNIEnv * env, jobject mode, int screen); -extern void resetDisplayMode(int screen); +extern void resetDisplayMode(int screen, bool temporary); extern jobjectArray getAvailableDisplayModes(JNIEnv * env, int screen); extern int getGammaRampLength(int screen); extern void setGammaRamp(JNIEnv *env, jobject gamma_ramp_buffer, int screen); Index: display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/display.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- display.c 22 Sep 2004 19:25:15 -0000 1.2 +++ display.c 22 Sep 2004 19:56:02 -0000 1.3 @@ -225,7 +225,7 @@ return true; } -static bool setMode(Display *disp, int screen, int width, int height, int freq/*, bool lock_mode*/) { +static bool setMode(Display *disp, int screen, int width, int height, int freq, bool temporary) { if (current_extension == NONE) return false; int num_modes, i; @@ -256,6 +256,11 @@ continue; } result = true; + if (!temporary) { + current_width = width; + current_height = height; + current_freq = freq; + } break; } } @@ -368,7 +373,7 @@ printfDebug("Could not open display"); return; } - if (!setMode(disp, screen, current_width, current_height, current_freq)) + if (!setMode(disp, screen, current_width, current_height, current_freq, false)) printfDebug("Could not restore mode\n"); setCurrentGamma(disp, screen, NULL); XCloseDisplay(disp); @@ -392,20 +397,16 @@ throwException(env, "Could not open display"); return; } - if (setMode(disp, screen, width, height, freq)) { - current_width = width; - current_height = height; - current_freq = freq; - } else + if (!setMode(disp, screen, width, height, freq, false)) throwException(env, "Could not switch mode."); XCloseDisplay(disp); } -void resetDisplayMode(int screen) { +void resetDisplayMode(int screen, bool temporary) { Display *disp = XOpenDisplay(NULL); if (disp == NULL) return; - if (!setMode(disp, screen, saved_width, saved_height, saved_freq)) { + if (!setMode(disp, screen, saved_width, saved_height, saved_freq, temporary)) { printfDebug("Failed to reset mode"); } if (saved_gamma_ramp_length > 0) { Index: org_lwjgl_opengl_Display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- org_lwjgl_opengl_Display.c 22 Sep 2004 19:25:16 -0000 1.5 +++ org_lwjgl_opengl_Display.c 22 Sep 2004 19:56:02 -0000 1.6 @@ -207,7 +207,7 @@ updateInputGrab(); if (current_window_mode == FULLSCREEN_NETWM) { XIconifyWindow(getDisplay(), getCurrentWindow(), getCurrentScreen()); - resetDisplayMode(getCurrentScreen()); + resetDisplayMode(getCurrentScreen(), true); } return true; } @@ -664,7 +664,7 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_resetDisplayMode(JNIEnv *env, jclass clazz) { - resetDisplayMode(getCurrentScreen()); + resetDisplayMode(getCurrentScreen(), false); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Display_getGammaRampLength(JNIEnv *env, jclass clazz) { |