Skip to content
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

Fix cursor warping unnecessarily #5895

Merged
merged 1 commit into from
May 6, 2024

Conversation

Agent00Ming
Copy link
Contributor

@Agent00Ming Agent00Ming commented May 5, 2024

modified:   src/protocols/PointerConstraints.cpp

Describe your PR, what does it fix/add?

Fixes #5881 and fixes #5774

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

Can't reproduce any of the other issues mentioned in #5774 with or without the change made in 2e76376 so it might reintroduce those issues. None from my testing in Minecraft (xwayland and pseudo-wayland with system GLFW), Blender and some other steam games.

Is it ready for merging, or does it need work?

Ready.

@vaxerski
Copy link
Member

vaxerski commented May 5, 2024

I'll wait for the reporters

@bubba-champion
Copy link

With this change, I can no longer reproduce the problem described in #5774.

@vaxerski
Copy link
Member

vaxerski commented May 5, 2024

doesn't make sense though... if it's not locked, it means it's confined. So... warp when it's confined? That's what we are trying to battle though?

Maybe the flag is set wrong?

@Agent00Ming
Copy link
Contributor Author

Agent00Ming commented May 5, 2024

The warp in activate() might be redundant (?).
logging patch

This behaviour is rather strange actually:
(deactivate() is called only when focus is changed via keybind)

Minecraft (wayland compatible GLFW)
[[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Deactivate: locked=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Deactivate: locked=true
[LOG] [PointerConstraints] Activate: locked=true

locked is only ever true and it seems that something else is warping the pointer to the center when opening the pause menu/inventory.

Minecraft (XWayland)
[LOG] [PointerConstraints] Activate: locked!=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Activate: locked!=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Deactivate: locked=true
[LOG] [PointerConstraints] Activate: locked!=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Deactivate: locked=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Deactivate: locked=true
[LOG] [PointerConstraints] Activate: locked=true

locked is false when closing any menu and is immediately true right after. Two activate() calls happen each time you close a menu but not when focus is regained on mouseover.

The only time I got locked to not be true was with Minecraft on XWayland. No other mouse grab interactions I've tested did that.

.NET XWayland program that grabs mouse
[LOG] [PointerConstraints] Activate: locked!=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Deactivate: locked=true
[LOG] [PointerConstraints] Activate: locked!=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Deactivate: locked=true
[LOG] [PointerConstraints] Activate: locked!=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Deactivate: locked=true
[LOG] [PointerConstraints] Activate: locked!=true
[LOG] [PointerConstraints] Activate: locked=true
[LOG] [PointerConstraints] Deactivate: locked=true
[LOG] [PointerConstraints] Activate: locked!=true
[LOG] [PointerConstraints] Activate: locked=true

@calebaden
Copy link

I tested this patch in Blender and StarCitizen and it has fixed the issues from #5881.

	modified:   src/protocols/PointerConstraints.cpp
@Agent00Ming
Copy link
Contributor Author

I've looked at the history of the old restraint impl and it seems like these warps are simply a remnant from #4889. The warp in deactivate() doesn't end up ever doing anything from my testing. The warp in activate() only seems to introduce issues and I couldn't find the reason why it was added. Everything seems to work on the surface though.

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, makes sense.

@vaxerski
Copy link
Member

vaxerski commented May 6, 2024

can someone verify the new patch works tho?

@bubba-champion
Copy link

With the new patch, the issue is still not reproducible. I can't say anything about the crashes/freezes mentioned in #5774 (comment), since I haven't encountered them.

@vaxerski
Copy link
Member

vaxerski commented May 6, 2024

cool, merging then. Thanks!

@vaxerski vaxerski merged commit fa69de8 into hyprwm:main May 6, 2024
8 of 9 checks passed
@Agent00Ming Agent00Ming deleted the constraint-warp-fix branch May 11, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cursor teleporting in blender pointer-constraints: cursor position issue
4 participants