From: <eli...@us...> - 2008-10-28 09:57:38
|
Revision: 3139 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3139&view=rev Author: elias_naur Date: 2008-10-28 09:53:16 +0000 (Tue, 28 Oct 2008) Log Message: ----------- Windows: Merged native handling of undecorated and fullscreen window property Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java trunk/LWJGL/src/native/windows/context.c trunk/LWJGL/src/native/windows/context.h trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-10-27 14:04:12 UTC (rev 3138) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-10-28 09:53:16 UTC (rev 3139) @@ -163,8 +163,7 @@ did_maximize = false; this.parent = parent; long parent_hwnd = parent != null ? getHwnd(parent) : 0; - boolean isUndecorated = isUndecorated(); - this.hwnd = nCreateWindow(fullscreen, x, y, mode.getWidth(), mode.getHeight(), isUndecorated, parent != null, parent_hwnd); + this.hwnd = nCreateWindow(x, y, mode.getWidth(), mode.getHeight(), fullscreen || isUndecorated(), parent != null, parent_hwnd); if (hwnd == 0) { throw new LWJGLException("Failed to create window"); } @@ -188,7 +187,7 @@ throw e; } } - private native long nCreateWindow(boolean fullscreen, int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException; + private static native long nCreateWindow(int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException; private static boolean isUndecorated() { return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); @@ -421,8 +420,7 @@ private static native void nUpdate(); public void reshape(int x, int y, int width, int height) { - if (!isFullscreen) - nReshape(getHwnd(), x, y, width, height, isUndecorated(), parent != null); + nReshape(getHwnd(), x, y, width, height, isFullscreen || isUndecorated(), parent != null); } private static native void nReshape(long hwnd, int x, int y, int width, int height, boolean undecorated, boolean child); public native DisplayMode[] getAvailableDisplayModes() throws LWJGLException; Modified: trunk/LWJGL/src/native/windows/context.c =================================================================== --- trunk/LWJGL/src/native/windows/context.c 2008-10-27 14:04:12 UTC (rev 3138) +++ trunk/LWJGL/src/native/windows/context.c 2008-10-28 09:53:16 UTC (rev 3139) @@ -112,14 +112,11 @@ } } -void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool fullscreen, bool undecorated, bool child_window) { +void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window) { DWORD exstyle, windowflags; - if (fullscreen) { + if (undecorated) { exstyle = WS_EX_APPWINDOW; windowflags = WS_POPUP; - } else if (undecorated) { - exstyle = WS_EX_APPWINDOW; - windowflags = WS_POPUP; } else if (child_window) { exstyle = 0; windowflags = WS_CHILDWINDOW; @@ -132,23 +129,14 @@ *exstyle_return = exstyle; } -/* - * Create a window with the specified title, position, size, and - * fullscreen attribute. The window will have DirectInput associated - * with it. - * - * Returns true for success, or false for failure - */ -HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool fullscreen, bool undecorated, bool child_window, HWND parent) +HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent) { RECT clientSize; DWORD exstyle, windowflags; HWND new_hwnd; - getWindowFlags(&windowflags, &exstyle, fullscreen, undecorated, child_window); + getWindowFlags(&windowflags, &exstyle, undecorated, child_window); - // If we're not a fullscreen window, adjust the height to account for the - // height of the title bar (unless undecorated) clientSize.bottom = height; clientSize.left = 0; clientSize.right = width; @@ -497,5 +485,5 @@ HWND createDummyWindow(int origin_x, int origin_y) { if (!registerDummyWindow()) return NULL; - return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, false, NULL); -} \ No newline at end of file + return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, NULL); +} Modified: trunk/LWJGL/src/native/windows/context.h =================================================================== --- trunk/LWJGL/src/native/windows/context.h 2008-10-27 14:04:12 UTC (rev 3138) +++ trunk/LWJGL/src/native/windows/context.h 2008-10-28 09:53:16 UTC (rev 3139) @@ -80,7 +80,7 @@ /** * Return appropriate window and extended style flags from the given fullscreen and undecorated property */ -extern void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool fullscreen, bool undecorated, bool child_window); +extern void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window); /* * Create a window with the specified position, size, and @@ -89,7 +89,7 @@ * * Returns true for success, or false for failure */ -extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool fullscreen, bool undecorated, bool child_window, HWND parent); +extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent); extern int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer); Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c =================================================================== --- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-10-27 14:04:12 UTC (rev 3138) +++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-10-28 09:53:16 UTC (rev 3139) @@ -151,7 +151,7 @@ return org_lwjgl_WindowsSysImplementation_JNI_VERSION; } -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jobject self, jboolean fullscreen, jint x, jint y, jint width, jint height, jboolean undecorated, jboolean child_window, jlong parent_hwnd) { +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jclass unused, jint x, jint y, jint width, jint height, jboolean undecorated, jboolean child_window, jlong parent_hwnd) { HWND hwnd; static bool oneShotInitialised = false; if (!oneShotInitialised) { @@ -162,7 +162,7 @@ oneShotInitialised = true; } - hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, fullscreen, undecorated, child_window, (HWND)parent_hwnd); + hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, undecorated, child_window, (HWND)parent_hwnd); return (INT_PTR)hwnd; } @@ -299,7 +299,7 @@ DWORD exstyle, windowflags; RECT clientSize; - getWindowFlags(&windowflags, &exstyle, false, undecorated, child); + getWindowFlags(&windowflags, &exstyle, undecorated, child); // If we're not a fullscreen window, adjust the height to account for the // height of the title bar: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |