diff options
author | Tudor Brindus <me@tbrindus.ca> | 2020-03-14 15:40:57 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-04-24 18:54:48 +0200 |
commit | d77247117c6f6ebd637a3b4ac029015381de5466 (patch) | |
tree | dc90d16b2758193c759105ac12e5728c153cc02a | |
parent | config/output: reconfigure input devices on new output (diff) | |
download | sway-d77247117c6f6ebd637a3b4ac029015381de5466.tar.gz sway-d77247117c6f6ebd637a3b4ac029015381de5466.tar.zst sway-d77247117c6f6ebd637a3b4ac029015381de5466.zip |
input/cursor: correctly transfer focus when using tablet pen
Fixes #4819.
This commit ensures that `seat_set_focus` is called to transfer focus
when a window is selected via a pen. Previously, it would race with
`node_at_coords`, and only properly transfer focus if its returned
`surface` was NULL.
-rw-r--r-- | sway/input/cursor.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index f2c91bab..0649f468 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -520,8 +520,8 @@ static void handle_tablet_tool_position(struct sway_cursor *cursor, | |||
520 | double sx, sy; | 520 | double sx, sy; |
521 | struct wlr_surface *surface = NULL; | 521 | struct wlr_surface *surface = NULL; |
522 | struct sway_seat *seat = cursor->seat; | 522 | struct sway_seat *seat = cursor->seat; |
523 | node_at_coords(seat, cursor->cursor->x, cursor->cursor->y, | 523 | struct sway_node *focused_node = node_at_coords(seat, cursor->cursor->x, |
524 | &surface, &sx, &sy); | 524 | cursor->cursor->y, &surface, &sx, &sy); |
525 | struct sway_tablet_tool *sway_tool = tool->data; | 525 | struct sway_tablet_tool *sway_tool = tool->data; |
526 | 526 | ||
527 | if (!surface || !wlr_surface_accepts_tablet_v2(tablet->tablet_v2, surface)) { | 527 | if (!surface || !wlr_surface_accepts_tablet_v2(tablet->tablet_v2, surface)) { |
@@ -534,6 +534,10 @@ static void handle_tablet_tool_position(struct sway_cursor *cursor, | |||
534 | wlr_tablet_v2_tablet_tool_notify_proximity_in(sway_tool->tablet_v2_tool, | 534 | wlr_tablet_v2_tablet_tool_notify_proximity_in(sway_tool->tablet_v2_tool, |
535 | tablet->tablet_v2, surface); | 535 | tablet->tablet_v2, surface); |
536 | 536 | ||
537 | if (focused_node && config->focus_follows_mouse != FOLLOWS_NO) { | ||
538 | seat_set_focus(seat, focused_node); | ||
539 | } | ||
540 | |||
537 | wlr_tablet_v2_tablet_tool_notify_motion(sway_tool->tablet_v2_tool, sx, sy); | 541 | wlr_tablet_v2_tablet_tool_notify_motion(sway_tool->tablet_v2_tool, sx, sy); |
538 | } | 542 | } |
539 | 543 | ||