From dfd7f8f804ff8c9ee8d9159df4b3a29aa967a78e Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 2 Feb 2005 14:51:43 +0000 Subject: [PATCH] Win32: More fulscreen improvements --- src/native/win32/org_lwjgl_opengl_Display.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/native/win32/org_lwjgl_opengl_Display.c b/src/native/win32/org_lwjgl_opengl_Display.c index 3363f81c..68cd3425 100644 --- a/src/native/win32/org_lwjgl_opengl_Display.c +++ b/src/native/win32/org_lwjgl_opengl_Display.c @@ -289,17 +289,24 @@ void closeWindow(HWND *hwnd, HDC *hdc) static void appActivate(bool active) { static bool inAppActivate = false; - isFocused = active; if (inAppActivate) { return; } inAppActivate = true; + isFocused = active; if (active) { if (isFullScreen) { restoreDisplayMode(); } ShowWindow(display_hwnd, SW_RESTORE); SetForegroundWindow(display_hwnd); + SetFocus(display_hwnd); + /* + * Calling wglMakeCurrent() (redundantly) seems to help some gfx cards + * restore from minimized to fullscreen. + */ + if (wglGetCurrentContext() == display_hglrc) + wglMakeCurrent(display_hdc, display_hglrc); } else if (isFullScreen) { ShowWindow(display_hwnd, SW_SHOWMINNOACTIVE); resetDisplayMode(NULL); @@ -315,9 +322,9 @@ LRESULT CALLBACK lwjglWindowProc(HWND hWnd, WPARAM wParam, LPARAM lParam) { - int xPos; - int yPos; - int dwheel; + int xPos; + int yPos; + int dwheel; switch (msg) { // disable screen saver and monitor power down messages which wreak havoc case WM_SYSCOMMAND: @@ -356,7 +363,7 @@ LRESULT CALLBACK lwjglWindowProc(HWND hWnd, isMinimized = true; break; } - return 0L; + break; case WM_MOUSEMOVE: { xPos = GET_X_LPARAM(lParam);