diff options
author | 2020-05-04 17:34:28 -0400 | |
---|---|---|
committer | 2020-05-25 10:01:00 +0200 | |
commit | 5d13f647f9384e59012c0f829651911564bb5365 (patch) | |
tree | b768fac3dac8328d1efc7c9b4e96aa461ab7c9a5 /sway/input/seatop_default.c | |
parent | common/log: use bright black rather than black for SWAY_DEBUG (diff) | |
download | sway-5d13f647f9384e59012c0f829651911564bb5365.tar.gz sway-5d13f647f9384e59012c0f829651911564bb5365.tar.zst sway-5d13f647f9384e59012c0f829651911564bb5365.zip |
input/tablet: add seatop_down entry for tablet input
Currently, when tablet input exits a window during an implicit grab, it
passes focus to another window.
For instance, this is problematic when trying to drag a scrollbar, and
exiting the window — the scrollbar motion stops. Additionally,
without `focus_follows_mouse no`, the tablet passes focus to whatever
surface it goes over regardless of if there is an active implicit.
If the tablet is over a surface that does not bind tablet handlers, sway
will fall back to pointer emulation, and all of this works fine. It
probably should have consistent behavior between emulated and
not-emulated input, though.
This commit adds a condition for entering seatop_down when a tablet's
tool tip goes down, and exiting when it goes up. Since events won't be
routed through seatop_default, this prevents windows losing focus during
implicit grabs.
Closes #5302.
Diffstat (limited to 'sway/input/seatop_default.c')
-rw-r--r-- | sway/input/seatop_default.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 64a17157..32c7318b 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c | |||
@@ -198,6 +198,25 @@ static void state_add_button(struct seatop_default_event *e, uint32_t button) { | |||
198 | * Functions used by handle_button / | 198 | * Functions used by handle_button / |
199 | *--------------------------------*/ | 199 | *--------------------------------*/ |
200 | 200 | ||
201 | static void handle_tablet_tool_tip(struct sway_seat *seat, | ||
202 | struct sway_tablet_tool *tool, uint32_t time_msec, | ||
203 | enum wlr_tablet_tool_tip_state state) { | ||
204 | if (state != WLR_TABLET_TOOL_TIP_DOWN) { | ||
205 | return; | ||
206 | } | ||
207 | |||
208 | struct sway_cursor *cursor = seat->cursor; | ||
209 | |||
210 | struct wlr_surface *surface = NULL; | ||
211 | double sx, sy; | ||
212 | struct sway_node *node = node_at_coords(seat, | ||
213 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); | ||
214 | |||
215 | if (surface && node && node->type == N_CONTAINER) { | ||
216 | seatop_begin_down(seat, node->sway_container, time_msec, sx, sy); | ||
217 | } | ||
218 | } | ||
219 | |||
201 | static void handle_button(struct sway_seat *seat, uint32_t time_msec, | 220 | static void handle_button(struct sway_seat *seat, uint32_t time_msec, |
202 | struct wlr_input_device *device, uint32_t button, | 221 | struct wlr_input_device *device, uint32_t button, |
203 | enum wlr_button_state state) { | 222 | enum wlr_button_state state) { |
@@ -649,6 +668,7 @@ static const struct sway_seatop_impl seatop_impl = { | |||
649 | .button = handle_button, | 668 | .button = handle_button, |
650 | .pointer_motion = handle_pointer_motion, | 669 | .pointer_motion = handle_pointer_motion, |
651 | .pointer_axis = handle_pointer_axis, | 670 | .pointer_axis = handle_pointer_axis, |
671 | .tablet_tool_tip = handle_tablet_tool_tip, | ||
652 | .tablet_tool_motion = handle_tablet_tool_motion, | 672 | .tablet_tool_motion = handle_tablet_tool_motion, |
653 | .rebase = handle_rebase, | 673 | .rebase = handle_rebase, |
654 | .allow_set_cursor = true, | 674 | .allow_set_cursor = true, |