https://bugs.winehq.org/show_bug.cgi?id=38791
Bug ID: 38791 Summary: In server/queue.c, clipping cursor to empty rectangle is off by one pixel (affects "The Long Dark") Product: Wine Version: 1.7.45 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wineserver Assignee: wine-bugs@winehq.org Reporter: buhr@asaurus.net Distribution: ---
Created attachment 51716 --> https://bugs.winehq.org/attachment.cgi?id=51716 Patch to clip empty rectangles to top left pixel
In server/queue.c functions set_clip_rectangle() and queue_hardware_message(), the cursor position is clipped to the rectangle desktop->cursor.clip. However, if the clipping rectangle has zero width and height, the cursor position is set to a position offset by (-1,-1) from the top-left corner of the rectangle instead of *at* the top-left corner. An empty clipping rectangle is arguably invalid, but at least one application relies on the cursor being clipped to the top-left:
The game "The Long Dark" (Steam, Sandbox Alpha v.244) uses such an empty clipping rectangle while the character is moving. Because of this bug, mouse events (including button press and release events with no movement) cause a shifting of the view down and to the right.
The attached patch fixes the issue.
https://bugs.winehq.org/show_bug.cgi?id=38791
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |sebastian@fds-team.de
--- Comment #1 from Sebastian Lackner sebastian@fds-team.de --- Hello,
the patch looks correct, but patches are not picked up here from bugzilla. Could you please take a look at http://wiki.winehq.org/SubmittingPatches and afterwards submit it to the wine-patches mailing list?
Although I agree that the patch is most likely correct, to convince other developers it basically never hurts to add a testcase. It also makes sure that restructuring the code doesn't accidentially break it again in the future.
In this case such a testcase should probably be added to dlls/user32/tests/, both input.c and monitor.c already contain some ClipCursor() function calls. If you need help writing such a test, feel free to ask me.
Regards, Sebastian
https://bugs.winehq.org/show_bug.cgi?id=38791
--- Comment #2 from Kevin Buhr buhr@asaurus.net --- Thanks for the info. I wrote a test, and it ruined my beautiful patch: it looks like, in the empty rectangle case, Windows clips to the top-left *or* one pixel off depending on the direction of the clip, and multiple clips (e.g., calling ClipCursor(rect) multiple times with the same empty rectangle) may toggle between the two states. So, this will require a little more work anyway.
https://bugs.winehq.org/show_bug.cgi?id=38791
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |STAGED Staged patchset| |https://github.com/wine-com | |pholio/wine-staging/tree/ma | |ster/patches/user32-Clip_Cu | |rsor Ever confirmed|0 |1 CC| |dmitry@baikal.ru, | |erich.e.hoover@wine-staging | |.com, michael@fds-team.de
https://bugs.winehq.org/show_bug.cgi?id=38791
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Staged patchset|https://github.com/wine-com |https://github.com/wine-com |pholio/wine-staging/tree/ma |pholio/wine-staging/tree/ma |ster/patches/user32-Clip_Cu |ster/patches/server-ClipCur |rsor |sor
https://bugs.winehq.org/show_bug.cgi?id=38791
tokktokk fdsfgs@krutt.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fdsfgs@krutt.org
https://bugs.winehq.org/show_bug.cgi?id=38791
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nerv@dawncrow.de Staged patchset|https://github.com/wine-com |https://github.com/wine-sta |pholio/wine-staging/tree/ma |ging/wine-staging/tree/mast |ster/patches/server-ClipCur |er/patches/server-ClipCurso |sor |r
https://bugs.winehq.org/show_bug.cgi?id=38791
Andrew Eikum aeikum@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |aeikum@codeweavers.com
--- Comment #3 from Andrew Eikum aeikum@codeweavers.com --- The patch has been accepted into Wine. Should we close this?
commit 5ff6a116972089f8e112dd4234d57689a60ab4dc Author: Sebastian Lackner sebastian@fds-team.de Date: Mon Feb 18 08:26:11 2019 -0600
server: Improve handling of cursor position clipping for empty rectangle.
https://bugs.winehq.org/show_bug.cgi?id=38791
Matteo Bruni matteo.mystral@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|STAGED |RESOLVED Fixed by SHA1| |5ff6a116972089f8e112dd4234d | |57689a60ab4dc Resolution|--- |FIXED
--- Comment #4 from Matteo Bruni matteo.mystral@gmail.com --- (In reply to Andrew Eikum from comment #3)
The patch has been accepted into Wine. Should we close this?
I think so.
https://bugs.winehq.org/show_bug.cgi?id=38791
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 4.4.