[PATCH 0/1] MR10613: winemac: Handle reset parameter in ClipCursor.
At the moment, `ClipCursor()` sent to winemac with parameter `reset`=1 is ignored. This doesn't seem to match other drivers' behavior (e.g. winex11 does unclip if `reset`=1, and winewayland simply doesn't care about the value). It causes problem in following steps: - App (typically a game) enters fullscreen, with a display mode change. - Display mode changes, triggering cursor clipping for fullscreen. - App then leaves fullscreen, supposed to have cursor clipping reset, _but nothing happened_. - UNEXPECTED BEHAVIOR 1: Cursor remains confined in windowed mode. - App enters fullscreen again, with a display mode change identical to previous one. - UNEXPECTED BEHAVIOR 2: Clip rect shrinks to previous size of windowed mode, instead of fullscreen size. The second unexpected behavior is actually a side effect of the first one. Currently `[NSWindow setMouseConfinementRect]` is used to implement cursor clipping, and it doesn't handle window resizing "properly": the clip rect always becomes the minimum of size before and after resizing. Interestingly when app enter fullscreen again, a second `ClipCursor()` will be sent to winemac and overwrite clip rect (unclip and clip again), but it can still be skipped if the clip rect is identical to the previous one. Anyway these won't happen if `reset` is properly handled in the first place. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10613
From: Feifan He <feifan@codeweavers.com> --- dlls/winemac.drv/mouse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c index c655f56bd98..ee876d5355c 100644 --- a/dlls/winemac.drv/mouse.c +++ b/dlls/winemac.drv/mouse.c @@ -665,9 +665,7 @@ BOOL macdrv_ClipCursor(const RECT *clip, BOOL reset) TRACE("%s %u\n", wine_dbgstr_rect(clip), reset); - if (reset) return TRUE; - - if (clip) + if (!reset && clip) { rect = CGRectMake(clip->left, clip->top, max(1, clip->right - clip->left), max(1, clip->bottom - clip->top)); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10613
Makes sense to me; not sure why it wasn't done that way when that flag was added in !2981. setMouseConfinementRect is definitely not ideal but it's the best tool we've got. You can see my copious comments on the situation in cocoa_cursorclipping.m. I haven't heard any reports of confinement rects being worse than the old mode... probably I should remove the event tap code at some point, if we bump the minimum macOS to 10.13. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10613#note_135715
It's been a few years, but @rbernon do you remember if there was a reason for the `reset` behavior? (!2981 was the original MR, but it's not mentioned there) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10613#note_135717
participants (4)
-
Brendan Shanks (@bshanks) -
Feifan He -
Feifan He (@Feifan) -
Tim Clem (@tclem)