Windows AWTInput: Make sure the cursor is contained within the window when the Mouse is grabbed.
This commit is contained in:
parent
e8d032973f
commit
46ce5679c8
|
@ -99,7 +99,14 @@ final class WindowsAWTInput extends AbstractAWTInput {
|
||||||
cached_mouse = new WindowsMouse(dinput, hwnd);
|
cached_mouse = new WindowsMouse(dinput, hwnd);
|
||||||
// cached_keyboard = new WindowsKeyboard(dinput, hwnd);
|
// cached_keyboard = new WindowsKeyboard(dinput, hwnd);
|
||||||
}
|
}
|
||||||
if (isGrabbed() && getCanvas().getCursor() != blank_cursor) {
|
if (isGrabbed()) {
|
||||||
|
/**
|
||||||
|
* DirectInput won't always stop the cursor from moving on top of the
|
||||||
|
* task bar and clicking on it. So we'll use ClipCursor to
|
||||||
|
* contain it while the cursor is grabbed.
|
||||||
|
*/
|
||||||
|
WindowsDisplay.setupCursorClipping(hwnd);
|
||||||
|
if (getCanvas().getCursor() != blank_cursor) {
|
||||||
cached_cursor = getCanvas().getCursor();
|
cached_cursor = getCanvas().getCursor();
|
||||||
/**
|
/**
|
||||||
* For some reason, DirectInput won't let us blank the cursor
|
* For some reason, DirectInput won't let us blank the cursor
|
||||||
|
@ -108,6 +115,8 @@ final class WindowsAWTInput extends AbstractAWTInput {
|
||||||
*/
|
*/
|
||||||
getCanvas().setCursor(blank_cursor);
|
getCanvas().setCursor(blank_cursor);
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
WindowsDisplay.resetCursorClipping();
|
||||||
grab(isGrabbed());
|
grab(isGrabbed());
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
LWJGLUtil.log("Failed to create windows mouse: " + e);
|
LWJGLUtil.log("Failed to create windows mouse: " + e);
|
||||||
|
|
|
@ -145,8 +145,8 @@ final class WindowsDisplay implements DisplayImplementation {
|
||||||
resetCursorClipping();
|
resetCursorClipping();
|
||||||
}
|
}
|
||||||
private static native void nDestroyWindow();
|
private static native void nDestroyWindow();
|
||||||
private static native void resetCursorClipping();
|
static native void resetCursorClipping();
|
||||||
private static native void setupCursorClipping(long hwnd) throws LWJGLException;
|
static native void setupCursorClipping(long hwnd) throws LWJGLException;
|
||||||
|
|
||||||
public void switchDisplayMode(DisplayMode mode) throws LWJGLException {
|
public void switchDisplayMode(DisplayMode mode) throws LWJGLException {
|
||||||
nSwitchDisplayMode(mode);
|
nSwitchDisplayMode(mode);
|
||||||
|
|
Loading…
Reference in New Issue