-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
input/cursor: refactor cursor logic for reuse in tablet/touch #5254
Conversation
struct sway_node *node) { | ||
if (node && node->type == N_CONTAINER) { | ||
// Try a node's resize edge | ||
enum wlr_edges edge = find_resize_edge(node->sway_container, NULL, cursor); |
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.
Note for reviewer: the original code had
enum wlr_edges edge = find_resize_edge(node->sway_container, surface, cursor);
...but following the control flow, surface
was guaranteed to always be NULL
at that point.
ecde737
to
f5b0011
Compare
@@ -220,6 +223,9 @@ bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); | |||
|
|||
void drag_icon_update_position(struct sway_drag_icon *icon); | |||
|
|||
enum wlr_edges find_resize_edge(struct sway_container *cont, |
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'm not super big on the semantics of having this function exported from here; if anyone has a better home for it I'm happy to move it.
44f426b
to
2c93905
Compare
I think this should be ready for review, but maybe not merging without a bit more testing. The commits are probably best viewed in order, rather than through the full-PR diff. I'm running the following patches on my system, based on the latest master (which has the rest of the tablet fixes merged now):
...and hopefully if there are issues I'll run into them in the next few days. That said, these patches fix most of the issues I've personally encountered with tablets. @David96 or @imyxh, if either of you are feeling particularly brave, some more tablet user testing of these patches would go a long way 😄 Copy-pasteable commands if you choose to do so: $ cd /path/to/sway
$ curl -L https://github.com/swaywm/sway/pull/5254.diff | patch -p1
$ curl -L https://github.com/swaywm/sway/pull/5259.diff | patch -p1 Currently, this only adds a seatop handler for tablet motion. I think we ought to have one more at least for I would also like to rename the existing I think there are definitely some opportunities for reducing code duplication here, but I think it'd be best to figure out whether the current logic is buggy or not before adding abstractions to it. |
2c93905
to
847b9b1
Compare
Yes, please do in a separate commit. |
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.
Looks pretty good apart from these comments
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
847b9b1
to
94b878f
Compare
94b878f
to
b3821ba
Compare
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.
b3821ba
to
d96286c
Compare
Is there any specific operations you would like us to test? I just pulled your changes and am running sway with it right now - so far resizing windows appears to be smooth and from a superficial test, using the pen buttons seems to work better than ever (I have one eraser button and one that I bound to a select tool in my note taking app, the 2nd one never quite seemed to work right, now it does). Only thing I'm not sure about: that one button seems to be supposed to work as right click? At least in FF it does. I also was able to at one point use it together with my modifier key to resize a window without grabbing its border (a 1px one in my case, quite hard to grab with the pen ^^) - but in this case the resizing wasn't quite working. As soon as the pen touched the screen it stopped and in general it was quite sluggish (maybe the offset between cursor and border was added to the window size upon resize start? Felt like something like that). And after playing around with it a bit I'm now no longer able to resize a window with this method at all. The window I was using is alacritty so I think without native tablet tool support. But this might be a general thing and not related to this pull request - I never played around with resizing windows so far, as I usually use my keyboard for that. Also, I don't seem to be able to move windows supporting tablet tool events (tried with nemo and FF) using Mod+Pen. The events are just "eaten" by the client acting as if no modifier key was pressed. |
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.
LGTM, thanks!
Thanks for testing @David96, I didn't really have much of a test plan other than "it seems to work better" :)
Great!
I don't actually use the buttons on my pen so I've never noticed this, but I can confirm there's something weird going on here. My pen has two buttons. If I start
This is since we map tool tip down to left button press, and only enter the "move" state on left button press. On a v2 surface, we don't do this mapping, so never enter the move move. I've opened #5293 to track this. |
Fixes #5232 and hopefully other tablet bugs.
Will need rebasing after #5222 is merged.