diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-18 23:08:45 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-18 23:08:45 +1000 |
commit | 24a90e5d86441fc345356eb3767e5a6880dcedbd (patch) | |
tree | dbf14c684b7802c2f2876fc8b11636bec26abc3d /sway/commands/swap.c | |
parent | Merge pull request #2868 from emersion/xcursor-env (diff) | |
download | sway-24a90e5d86441fc345356eb3767e5a6880dcedbd.tar.gz sway-24a90e5d86441fc345356eb3767e5a6880dcedbd.tar.zst sway-24a90e5d86441fc345356eb3767e5a6880dcedbd.zip |
Remove cursor warping from seat_set_focus
Because cursor warping was the default behaviour in seat_set_focus,
there may be cases where we may have been warping the cursor
unintentionally. This patch removes cursor warping from seat_set_focus
and only does it in the focus command. This is managed by a static
function in focus.c.
To know whether to warp or not, we need to know which node had focus
previously. To keep track of this easily, seat->prev_focus has been
introduced and is set to the previous in seat_set_focus.
Diffstat (limited to 'sway/commands/swap.c')
-rw-r--r-- | sway/commands/swap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/commands/swap.c b/sway/commands/swap.c index 9cc0d5c2..8a6dfdbd 100644 --- a/sway/commands/swap.c +++ b/sway/commands/swap.c | |||
@@ -61,13 +61,13 @@ static void swap_focus(struct sway_container *con1, | |||
61 | enum sway_container_layout layout2 = container_parent_layout(con2); | 61 | enum sway_container_layout layout2 = container_parent_layout(con2); |
62 | if (focus == con1 && (layout2 == L_TABBED || layout2 == L_STACKED)) { | 62 | if (focus == con1 && (layout2 == L_TABBED || layout2 == L_STACKED)) { |
63 | if (workspace_is_visible(ws2)) { | 63 | if (workspace_is_visible(ws2)) { |
64 | seat_set_focus_warp(seat, &con2->node, false); | 64 | seat_set_focus(seat, &con2->node); |
65 | } | 65 | } |
66 | seat_set_focus_container(seat, ws1 != ws2 ? con2 : con1); | 66 | seat_set_focus_container(seat, ws1 != ws2 ? con2 : con1); |
67 | } else if (focus == con2 && (layout1 == L_TABBED | 67 | } else if (focus == con2 && (layout1 == L_TABBED |
68 | || layout1 == L_STACKED)) { | 68 | || layout1 == L_STACKED)) { |
69 | if (workspace_is_visible(ws1)) { | 69 | if (workspace_is_visible(ws1)) { |
70 | seat_set_focus_warp(seat, &con1->node, false); | 70 | seat_set_focus(seat, &con1->node); |
71 | } | 71 | } |
72 | seat_set_focus_container(seat, ws1 != ws2 ? con1 : con2); | 72 | seat_set_focus_container(seat, ws1 != ws2 ? con1 : con2); |
73 | } else if (ws1 != ws2) { | 73 | } else if (ws1 != ws2) { |