Fixed mouse grabbing on secondary monitors.

Added extra device polling when vsync is enabled, to reduce input lag.
This commit is contained in:
Ioannis Tsakpinis 2010-03-31 23:56:24 +00:00
parent 0f711dc537
commit 6998610cce
3 changed files with 10 additions and 2 deletions

View File

@ -627,6 +627,7 @@ public final class Display {
display_impl.update();
}
pollDevices();
}
/**
@ -666,8 +667,9 @@ public final class Display {
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;

View File

@ -542,6 +542,7 @@ final class WindowsDisplay implements DisplayImplementation {
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 @@ final class WindowsDisplay implements DisplayImplementation {
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));
}

View File

@ -121,8 +121,10 @@ static void handleMessages(JNIEnv *env) {
PM_REMOVE // removal options
))
{
DispatchMessage(&msg);
if (msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}