-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
streamline cursor clipping logic on windows #11237
base: main
Are you sure you want to change the base?
Conversation
2c8c77b
to
e494782
Compare
785d0ac
to
2414ed9
Compare
// This is verbatim translation of the old logic, | ||
// but I don't quite get what it's trying to do. | ||
// A clean-room implementation according to MSDN | ||
// documentation of GetClipCursor is provided in | ||
// a commented-out block below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've traced the origin of this logic to this commit:
e56f05b#diff-f2ae5c36a8afc0a9a343a6664ab306da2963213e180af8cd97b12397dcbb9ae7R1572
but still couldn't quite reason about what condition it's trying to check exactly, if @slouken could clarify then that would be extremely helpful.
c66107c
to
0fbe530
Compare
Fixes #7890
This commit does the following:
relative_mouse_center
field from Windows-specific per-windowSDL_WindowData
to the globalSDL_Mouse
struct, and the corresponding hint callbacks toSDL_mouse.c
instead ofSDL_windowswindow.c
SDL_HINT_MOUSE_RELATIVE_CLIP_INTERVAL
hint, instead solve the root issue with Window Procedure based approachWM_MOUSEMOVE
case of the Window to conditionally callWIN_UpdateClipCursor
upon receiving cursor motion if SDL is expecting the mouse to be clipped in some way.WIN_UpdateClipCursor
for better readability of each branch, and avoid calling the Platform API until it is absolutely necessary.relevant commits:
e56f05b (apr 2024)
6c96217 (mar 2024)
ab5351f (mar 2024)
50203d5 (dec 2020)
44f50c6 (jun 2020)
55b24b9 (sep 2018)