From: <eli...@us...> - 2007-07-28 21:20:00
|
Revision: 2859 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2859&view=rev Author: elias_naur Date: 2007-07-28 14:19:58 -0700 (Sat, 28 Jul 2007) Log Message: ----------- Windows: Don't be too aggressive in clipping the cursor. Fixes a problem where the window is moved out of the screen when clicking the title bar while having the mouse grabbed Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2007-07-28 20:46:17 UTC (rev 2858) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2007-07-28 21:19:58 UTC (rev 2859) @@ -220,6 +220,8 @@ setForegroundWindow(getHwnd()); setFocus(getHwnd()); did_maximize = true; + if (isFullscreen) + checkCursorClip(); } else if (isFullscreen) { showWindow(getHwnd(), SW_SHOWMINNOACTIVE); resetDisplayMode(); @@ -629,7 +631,7 @@ return false; } - private boolean doHandleMessage(long hwnd, int msg, long wParam, long lParam, long millis) { + private void checkCursorClip() { if ((isFullscreen || (mouse != null && mouse.isGrabbed())) && !isMinimized && isFocused) { try { setupCursorClipping(getHwnd()); @@ -639,6 +641,14 @@ } else { resetCursorClipping(); } + } + + private void setMinimized(boolean m) { + isMinimized = m; + checkCursorClip(); + } + + private boolean doHandleMessage(long hwnd, int msg, long wParam, long lParam, long millis) { switch (msg) { // disable screen saver and monitor power down messages which wreak havoc case WM_ACTIVATE: @@ -656,10 +666,10 @@ switch ((int)wParam) { case SIZE_RESTORED: case SIZE_MAXIMIZED: - isMinimized = false; + setMinimized(false); break; case SIZE_MINIMIZED: - isMinimized = true; + setMinimized(true); break; } return false; @@ -667,6 +677,7 @@ int xPos = (int)(short)(lParam & 0xFFFF); int yPos = transformY(getHwnd(), (int)(short)((lParam >> 16) & 0xFFFF)); handleMouseMoved(xPos, yPos, millis); + checkCursorClip(); return true; case WM_MOUSEWHEEL: int dwheel = (int)(short)((wParam >> 16) & 0xFFFF); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |