mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-02-18 18:01:22 +00:00
2 Windows mouse input fixes
fixed incorrect clip rectangle fixed incorrect window center point for in_mouse 2
This commit is contained in:
parent
945cf03af5
commit
d0878f3807
1 changed files with 14 additions and 6 deletions
|
@ -192,9 +192,14 @@ static winmouse_t winmouse;
|
||||||
|
|
||||||
void winmouse_t::UpdateWindowCenter()
|
void winmouse_t::UpdateWindowCenter()
|
||||||
{
|
{
|
||||||
const RECT& rect = g_wv.monitorRects[g_wv.monitor];
|
RECT rect;
|
||||||
window_center_x = (int)( rect.left + rect.right ) / 2;
|
GetClientRect( g_wv.hWnd, &rect );
|
||||||
window_center_y = (int)( rect.top + rect.bottom ) / 2;
|
POINT center;
|
||||||
|
center.x = rect.right / 2;
|
||||||
|
center.y = rect.bottom / 2;
|
||||||
|
MapWindowPoints( g_wv.hWnd, HWND_DESKTOP, ¢er, 1 );
|
||||||
|
window_center_x = (int)center.x;
|
||||||
|
window_center_y = (int)center.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -391,10 +396,13 @@ static void IN_SetCursorSettings( qbool active )
|
||||||
if (active) {
|
if (active) {
|
||||||
while (ShowCursor(FALSE) >= 0)
|
while (ShowCursor(FALSE) >= 0)
|
||||||
;
|
;
|
||||||
RECT rc;
|
RECT rect;
|
||||||
SetCapture( g_wv.hWnd );
|
SetCapture( g_wv.hWnd );
|
||||||
GetWindowRect( g_wv.hWnd, &rc );
|
GetClientRect( g_wv.hWnd, &rect );
|
||||||
ClipCursor( &rc );
|
POINT points[2] = { { rect.left, rect.top }, { rect.right, rect.bottom } };
|
||||||
|
MapWindowPoints( g_wv.hWnd, HWND_DESKTOP, points, 2 );
|
||||||
|
rect = { points[0].x, points[0].y, points[1].x, points[1].y };
|
||||||
|
ClipCursor( &rect );
|
||||||
} else {
|
} else {
|
||||||
while (ShowCursor(TRUE) < 0)
|
while (ShowCursor(TRUE) < 0)
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in a new issue