mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
dinput: Only call SetCursorPos if ClipCursor fails.
Fixes mouse sometimes jumping around in Mechwarrior Online on KDE/Wayland.
This commit is contained in:
parent
b1e54a5f04
commit
6ac127ebc6
Notes:
Alexandre Julliard
2024-11-18 23:18:33 +01:00
Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6833
1 changed files with 7 additions and 7 deletions
|
@ -313,13 +313,6 @@ static void warp_check( struct mouse *impl, BOOL force )
|
|||
impl->need_warp = FALSE;
|
||||
if (!GetClientRect( impl->base.win, &rect )) return;
|
||||
MapWindowPoints( impl->base.win, 0, (POINT *)&rect, 2 );
|
||||
if (!impl->clipped)
|
||||
{
|
||||
mapped_center.x = (rect.left + rect.right) / 2;
|
||||
mapped_center.y = (rect.top + rect.bottom) / 2;
|
||||
TRACE( "Warping mouse to x %+ld, y %+ld.\n", mapped_center.x, mapped_center.y );
|
||||
SetCursorPos( mapped_center.x, mapped_center.y );
|
||||
}
|
||||
if (impl->base.dwCoopLevel & DISCL_EXCLUSIVE)
|
||||
{
|
||||
/* make sure we clip even if the window covers the whole screen */
|
||||
|
@ -330,6 +323,13 @@ static void warp_check( struct mouse *impl, BOOL force )
|
|||
TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect ));
|
||||
impl->clipped = ClipCursor( &rect );
|
||||
}
|
||||
if (!impl->clipped)
|
||||
{
|
||||
mapped_center.x = (rect.left + rect.right) / 2;
|
||||
mapped_center.y = (rect.top + rect.bottom) / 2;
|
||||
TRACE( "Warping mouse to x %+ld, y %+ld.\n", mapped_center.x, mapped_center.y );
|
||||
SetCursorPos( mapped_center.x, mapped_center.y );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue