From: <sp...@us...> - 2010-03-31 23:56:31
|
Revision: 3302 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3302&view=rev Author: spasi Date: 2010-03-31 23:56:24 +0000 (Wed, 31 Mar 2010) Log Message: ----------- Fixed mouse grabbing on secondary monitors. Added extra device polling when vsync is enabled, to reduce input lag. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2010-03-31 21:15:12 UTC (rev 3301) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2010-03-31 23:56:24 UTC (rev 3302) @@ -627,6 +627,7 @@ display_impl.update(); } + pollDevices(); } /** @@ -666,8 +667,9 @@ throw new RuntimeException(e); } } + if ( swap_interval != 0 ) // Handle events again when vsync is enabled, to reduced input lag. + processMessages(); - pollDevices(); if ( parent_resized ) { reshape(); parent_resized = false; Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2010-03-31 21:15:12 UTC (rev 3301) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2010-03-31 23:56:24 UTC (rev 3302) @@ -542,6 +542,7 @@ if (getForegroundWindow() != hwnd && !hasParent) return; getGlobalClientRect(hwnd, rect); + /* -- This is wrong on multi-monitor setups int local_offset_x = rect.left; int local_offset_y = rect.top; getGlobalClientRect(getDesktopWindow(), rect2); @@ -551,6 +552,9 @@ nSetCursorPosition(center_x, center_y); int local_x = center_x - local_offset_x; int local_y = center_y - local_offset_y; + */ + int local_x = (rect.right - rect.left) / 2; + int local_y = (rect.bottom - rect.top) / 2; if (current_display != null) current_display.setMousePosition(local_x, transformY(hwnd, local_y)); } Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c =================================================================== --- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2010-03-31 21:15:12 UTC (rev 3301) +++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2010-03-31 23:56:24 UTC (rev 3302) @@ -121,8 +121,10 @@ PM_REMOVE // removal options )) { + if (msg.message == WM_QUIT) + break; + TranslateMessage(&msg); DispatchMessage(&msg); - TranslateMessage(&msg); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |