|
From: <eli...@us...> - 2008-10-27 14:04:16
|
Revision: 3138
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3138&view=rev
Author: elias_naur
Date: 2008-10-27 14:04:12 +0000 (Mon, 27 Oct 2008)
Log Message:
-----------
Windows: Only clip mouse to window borders if the lwjgl window is the foreground window
Modified Paths:
--------------
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/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-10-13 19:51:26 UTC (rev 3137)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-10-27 14:04:12 UTC (rev 3138)
@@ -511,7 +511,11 @@
private static native long getDC(long hwnd);
private static native long getDesktopWindow();
+ private static native long getForegroundWindow();
+
static void centerCursor(long hwnd) {
+ if (getForegroundWindow() != hwnd)
+ return;
getGlobalClientRect(hwnd, rect);
int local_offset_x = rect.left;
int local_offset_y = rect.top;
@@ -721,7 +725,7 @@
}
private void updateClipping() {
- if ((isFullscreen || (mouse != null && mouse.isGrabbed())) && !isMinimized && isFocused) {
+ if ((isFullscreen || (mouse != null && mouse.isGrabbed())) && !isMinimized && isFocused && getForegroundWindow() == getHwnd()) {
try {
setupCursorClipping(getHwnd());
} catch (LWJGLException e) {
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-10-13 19:51:26 UTC (rev 3137)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-10-27 14:04:12 UTC (rev 3138)
@@ -198,6 +198,10 @@
buffer[1] = point.y;
}
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getForegroundWindow(JNIEnv *env, jclass unused) {
+ return (INT_PTR)GetForegroundWindow();
+}
+
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDesktopWindow(JNIEnv *env, jclass unused) {
return (INT_PTR)GetDesktopWindow();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|