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

Pointer constraints are applied inconsistently to tablet pen input #5268

Closed
Xyene opened this issue Apr 28, 2020 · 1 comment · Fixed by #5300
Closed

Pointer constraints are applied inconsistently to tablet pen input #5268

Xyene opened this issue Apr 28, 2020 · 1 comment · Fixed by #5300

Comments

@Xyene
Copy link
Member

Xyene commented Apr 28, 2020

This issue is largely an RFC regarding what sway should do regarding tablet/touch pointer emulation in the face of pointer constraints. Any input or feedback would be much appreciated :)

On non-tablet-v2 surfaces, pen input is emulated as pointer input, it currently reuses the existing pointer code. As a side-effect, this makes tablet input over a non-v2 surface constrained by pointer-constraints-unstable-v1 confines.

However, this is pretty surprising, and leads to seemingly buggy (though actually expected) behavior. Consider the below window layout: gedit is on the left and binds tablet, kitty is in the top right and does not, and the game osu! (which sets up a pointer confine, and does not bind tablet) is in the bottom right.

If the game window is focused, input via mouse cannot leave the window. However, tablet input can leave the window through the left side (because it hits the tablet v2 handler for gedit), but it can't leave through the top (because kitty requires pointer emulation as well, so the pen input remains confined).

This is inconsistent. I think that either pointer constraints should be uniformly applied to tablet (and touch!) input, or not at all.

Pros of confining tablet input:

  • An application that only expects pointer events to come from inside whatever confine it set would become confused by the emulated pointer events, which could land outside its confine. Hypothetically it could seriously misbehave, fail an assert, or something similar. I don't know of any such application, though it's possible to write one that does.
  • Not confining is consistent with XGrabPointer from X11, and XWayland translates XGrabPointer into a pointer constraint. XWayland apps that expected to grab all input, including tablet input, will fail to do so.

Cons of confining tablet input:

  • It's semantically wrong; the pointer constraint spec is explicitly about pointers. See also this.
  • GNOME doesn't confine tablet input, so it would be inconsistent between compositors.

Neither option seems flawless. A middle ground might be to not confine the tablet input, but to stop sending events of any form to the surface owning the confine if the pen has left it. That would solve the issue of the pathological application that crashes... but it still doesn't feel like great solution.

Either implementation would be easy enough to do, but I think sway should pick one way and stick with it.

@emersion
Copy link
Member

I think pointer-constraints should only apply to pointer input. To support the mentioned use-cases, we should make some wayland-protocols changes.

Xyene added a commit to Xyene/sway that referenced this issue May 2, 2020
Xyene added a commit to Xyene/sway that referenced this issue May 2, 2020
By default, pointer and tablet devices share the same seat, and so the
same cursor. After swaywm#5268, tablet input is not subject by pointer
constraints. So long as the tablet input is in the gaps between two
containers and the container owning the constraint hasn't yet lost
focus, the cursor would be warped into the surface before being warped
back out, repeating several times a second until focus is passed to
another surface.

This commit addresses this behavior by only warping on the first surface
commit since the pointer constraint was added.
Xyene added a commit to Xyene/sway that referenced this issue May 2, 2020
Xyene added a commit to Xyene/sway that referenced this issue May 2, 2020
By default, pointer and tablet devices share the same seat, and so the
same cursor. After swaywm#5268, tablet input is not subject by pointer
constraints. So long as the tablet input is in the gaps between two
containers and the container owning the constraint hasn't yet lost
focus, the cursor would be warped into the surface before being warped
back out, repeating several times a second until focus is passed to
another surface.

This commit addresses this behavior by only warping on the first surface
commit since the pointer constraint was added.
Xyene added a commit to Xyene/sway that referenced this issue May 3, 2020
By default, pointer and tablet devices share the same seat, and so the
same cursor. After swaywm#5268, tablet input is not subject by pointer
constraints. So long as the tablet input is in the gaps between two
containers and the container owning the constraint hasn't yet lost
focus, the cursor would be warped into the surface before being warped
back out, repeating several times a second until focus is passed to
another surface.

This commit addresses this behavior by only warping on the first surface
commit since the pointer constraint was added.
Xyene added a commit to Xyene/sway that referenced this issue May 4, 2020
By default, pointer and tablet devices share the same seat, and so the
same cursor. After swaywm#5268, tablet input is not subject by pointer
constraints. So long as the tablet input is in the gaps between two
containers and the container owning the constraint hasn't yet lost
focus, the cursor would be warped into the surface before being warped
back out, repeating several times a second until focus is passed to
another surface.

This commit addresses this behavior by only warping on the first surface
commit since the pointer constraint was added.
Xyene added a commit to Xyene/wlroots that referenced this issue May 12, 2020
This allows a compositor to know when warping back into the region is
appropriate.

Refs swaywm/sway#5268.
Xyene added a commit to Xyene/wlroots that referenced this issue May 13, 2020
This allows a compositor to know when warping back into the region is
appropriate.

Refs swaywm/sway#5268.
Xyene added a commit to Xyene/wlroots that referenced this issue May 13, 2020
This allows a compositor to know when warping back into the region is
appropriate.

Refs swaywm/sway#5268.
emersion pushed a commit to swaywm/wlroots that referenced this issue May 13, 2020
This allows a compositor to know when warping back into the region is
appropriate.

Refs swaywm/sway#5268.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants