Skip to content

shell: implement pointer-constraints-unstable-v1#2357

Open
skygrango wants to merge 4 commits into
pop-os:masterfrom
skygrango:implement-pointer-constraints-unstable-v1
Open

shell: implement pointer-constraints-unstable-v1#2357
skygrango wants to merge 4 commits into
pop-os:masterfrom
skygrango:implement-pointer-constraints-unstable-v1

Conversation

@skygrango
Copy link
Copy Markdown
Contributor

@skygrango skygrango commented May 8, 2026

Needs Smithay/smithay#2027

I did the following:

  • Constraints are enabled when all conditions are met, like PointerTargetFocus, KeyboardTargetFocus, Constraint Region
  • Cursor Position Hint is applied when the constraint is removed
  • Support sliding confinement: original approach made the mouse easily stick to the edge of the window, I changed it to check the possibility of the x or y axis, which greatly improves the user experience.
  • Save cursor position hint in the seat to support Multiseats

This protocol feature is a very important to games, especially first-person and third-person games, many games control mouse behavior through pointer-constraints, some professional software also requires this feature, but I don't have any of them to test it.

If there are still issues with camera control with xwayland, then it's probably not a problem with this protocol.

I still recommend using PROTON_ENABLE_WAYLAND=1 whenever possible.

the games I have already tested:

  • Persona 5 Royal
  • Gray Zone Warfare
  • ARC Raiders
  • Crimson Desert
  • Minecraft
  • Ready or Not
  • Broken Arrow
  • Slay the Spire 2
  • Clair Obscur: Expedition 33
  • R.E.P.O
  • FINAL FANTASY XIV
  • HELLDIVERS 2

With this implementation, games can now be played in window mode, instead of having to be played in fullscreen to avoid pointer escape.

I know this PR is a bit too large, so please let me know if there's anything I need to add.

🍻

  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

@skygrango skygrango force-pushed the implement-pointer-constraints-unstable-v1 branch 5 times, most recently from 440115c to e2e2ca5 Compare May 8, 2026 16:47
@skygrango skygrango force-pushed the implement-pointer-constraints-unstable-v1 branch from e2e2ca5 to 92ad43e Compare May 11, 2026 03:08
skygrango added 2 commits May 11, 2026 17:25
fn new_constraint(): check PointerTargetFocus, KeyboardTargetFocus, and Region from constraint are valid before activrating constraints.
fn cursor_position_hint(): data saved in the seat and be applied after the constraints are removed
fn find_window(): iterate through all windows to find the window size
and offset
fn apply_cursor_hint(): when unlocked, receive the pointer cursor hint saved from seat and apply it

Other:
remove constraints when focus changes.
sliding confinement: help user to update valid x or y axis when the pointer is confined.
@skygrango skygrango force-pushed the implement-pointer-constraints-unstable-v1 branch from 92ad43e to 6bed83b Compare May 11, 2026 09:27
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.

1 participant