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

Resizing windows with tablet pen is extremely jerky #5232

Closed
Xyene opened this issue Apr 19, 2020 · 1 comment · Fixed by #5254
Closed

Resizing windows with tablet pen is extremely jerky #5232

Xyene opened this issue Apr 19, 2020 · 1 comment · Fixed by #5254
Labels
bug Not working as intended input/tablet

Comments

@Xyene
Copy link
Member

Xyene commented Apr 19, 2020

I'm running sway master. If I open a blank workspace and open two apps, resizing them via mouse is smooth/instant. If I do the same with my tablet pen, the resizing is very jerky, and trails the pen position by over a second. Pen movement is otherwise very smooth.

My mouse sends events (as per evhz) at 1000 Hz, while my tablet only at 250 Hz, so if anything it seems like the mouse should place a higher load on sway. I'm not too sure how to go about tracking this down.

I'm happy to provide other information that might be useful.

Xyene added a commit to Xyene/sway that referenced this issue Apr 20, 2020
This fixes resizing containers being very jerky under pointer emulation.

Refs swaywm#5232.
@Xyene
Copy link
Member Author

Xyene commented Apr 20, 2020

The PR I've opened addresses the simple case of resizing a non-v2 surface. With it applied, the problem persists for v2 surfaces (a simple test-case is gedit, which binds tablet v2 handlers).

I've found the cause, but don't know what the most acceptable fix here would be. The root cause is here:

sway/sway/input/cursor.c

Lines 524 to 528 in 2b15cf4

if (!surface || !wlr_surface_accepts_tablet_v2(tablet->tablet_v2, surface)) {
wlr_tablet_v2_tablet_tool_notify_proximity_out(sway_tool->tablet_v2_tool);
cursor_motion(cursor, time_msec, input_device->wlr_device, dx, dy, dx, dy);
return;
}

When we're emulating pointer events or are e.g. in the gap between two windows, we call cursor_motion. That eventually calls the seat's motion callback.

cursor_do_rebase(cursor, time_msec, node, surface, sx, sy);
if (surface && seat_is_input_allowed(cursor->seat, surface)) {
wlr_seat_pointer_notify_motion(seat->wlr_seat, time_msec, sx, sy);
}

...which calls cursor_do_rebase that actually handles the resizing.

The problem seems to be that the drag is started with the emulated pointer, but when the tablet pen enters a tablet v2 surface, emulated pointer events stop being generated... so the resize is "stuck".

This means in a layout like the one below, you can only resize the left window by dragging right, and the right window by dragging left, but not the other way (since then the pen would enter the tablet v2 gedit surface).

handle_motion etc. all have calls to wlr_seat_pointer_* in them, so unless I'm missing something a bunch of that code would need to be refactored.

I think it's mainly tricky because the tablet support code tends to directly use a bunch of the mouse code, which tends to work because that mouse code doesn't fire pointer events — but in this case, that doesn't generalize.

emersion pushed a commit that referenced this issue Apr 22, 2020
This fixes resizing containers being very jerky under pointer emulation.

Refs #5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit refactors `cursor_rebase` into `cursor_update_image`, and
moves sending pointer events to the two existing call sites. This will
enable this code to be reused for tablets.

Refs swaywm#5232
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit refactors `cursor_rebase` into `cursor_update_image`, and
moves sending pointer events to the two existing call sites. This will
enable this code to be reused for tablets.

Refs swaywm#5232
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit refactors `cursor_rebase` into `cursor_update_image`, and
moves sending pointer events to the two existing call sites. This will
enable this code to be reused for tablets.

Refs swaywm#5232
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit refactors `cursor_rebase` into `cursor_update_image`, and
moves sending pointer events to the two existing call sites. This will
enable this code to be reused for tablets.

Refs swaywm#5232
Xyene added a commit to Xyene/sway that referenced this issue Apr 25, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 26, 2020
This commit refactors `cursor_rebase` into `cursor_update_image`, and
moves sending pointer events to the two existing call sites. This will
enable this code to be reused for tablets.

Refs swaywm#5232
Xyene added a commit to Xyene/sway that referenced this issue Apr 26, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 26, 2020
This commit refactors `cursor_rebase` into `cursor_update_image`, and
moves sending pointer events to the two existing call sites. This will
enable this code to be reused for tablets.

Refs swaywm#5232
Xyene added a commit to Xyene/sway that referenced this issue Apr 26, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue Apr 26, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
@Xyene Xyene added bug Not working as intended input/tablet labels Apr 29, 2020
Xyene added a commit to Xyene/sway that referenced this issue May 1, 2020
This commit refactors `cursor_rebase` into `cursor_update_image`, and
moves sending pointer events to the two existing call sites. This will
enable this code to be reused for tablets.

Refs swaywm#5232
Xyene added a commit to Xyene/sway that referenced this issue May 1, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue May 1, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
Xyene added a commit to Xyene/sway that referenced this issue May 1, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes swaywm#5232.
emersion pushed a commit that referenced this issue May 2, 2020
This commit refactors `cursor_rebase` into `cursor_update_image`, and
moves sending pointer events to the two existing call sites. This will
enable this code to be reused for tablets.

Refs #5232
emersion pushed a commit that referenced this issue May 2, 2020
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes #5232.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended input/tablet
Development

Successfully merging a pull request may close this issue.

1 participant