Add an option to trap mouse within window/display area.

This commit is contained in:
LunaMoo
2017-04-27 16:29:08 +02:00
parent a9d9063680
commit 26006e9d80
4 changed files with 11 additions and 0 deletions
+8
View File
@@ -233,12 +233,20 @@ namespace MainWindow
while (cursorCounter >= 0) {
cursorCounter = ShowCursor(FALSE);
}
if (g_Config.bMouseConfine) {
RECT rc;
GetClientRect(hwndDisplay, &rc);
ClientToScreen(hwndDisplay, reinterpret_cast<POINT*>(&rc.left));
ClientToScreen(hwndDisplay, reinterpret_cast<POINT*>(&rc.right));
ClipCursor(&rc);
}
} else {
hideCursor = !autoHide;
if (cursorCounter < 0) {
cursorCounter = ShowCursor(TRUE);
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
ClipCursor(NULL);
}
}