Fixed mouse grabbing on secondary monitors.
Added extra device polling when vsync is enabled, to reduce input lag.
This commit is contained in:
parent
0f711dc537
commit
6998610cce
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue