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.
This commit is contained in:
parent
3de1a3958e
commit
d77247117c
|
@ -520,8 +520,8 @@ static void handle_tablet_tool_position(struct sway_cursor *cursor,
|
|||
double sx, sy;
|
||||
struct wlr_surface *surface = NULL;
|
||||
struct sway_seat *seat = cursor->seat;
|
||||
node_at_coords(seat, cursor->cursor->x, cursor->cursor->y,
|
||||
&surface, &sx, &sy);
|
||||
struct sway_node *focused_node = node_at_coords(seat, cursor->cursor->x,
|
||||
cursor->cursor->y, &surface, &sx, &sy);
|
||||
struct sway_tablet_tool *sway_tool = tool->data;
|
||||
|
||||
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,
|
|||
wlr_tablet_v2_tablet_tool_notify_proximity_in(sway_tool->tablet_v2_tool,
|
||||
tablet->tablet_v2, surface);
|
||||
|
||||
if (focused_node && config->focus_follows_mouse != FOLLOWS_NO) {
|
||||
seat_set_focus(seat, focused_node);
|
||||
}
|
||||
|
||||
wlr_tablet_v2_tablet_tool_notify_motion(sway_tool->tablet_v2_tool, sx, sy);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue