diff options
author | 2020-06-06 22:43:02 -0400 | |
---|---|---|
committer | 2020-06-08 18:23:09 -0400 | |
commit | 14e887bc3dee8441ba51a593ccdc49e381d33f82 (patch) | |
tree | f0e2deddae116fdd0c0bbaa09f962d1603b29542 /sway/input/seatop_default.c | |
parent | swaynag: allow specifying more buttons which execute and dismiss (diff) | |
download | sway-14e887bc3dee8441ba51a593ccdc49e381d33f82.tar.gz sway-14e887bc3dee8441ba51a593ccdc49e381d33f82.tar.zst sway-14e887bc3dee8441ba51a593ccdc49e381d33f82.zip |
input: tweak resize behavior to not change tab focus on border click
If a resize is triggered on a tabbed or stacked container, change focus
to the tab which already had inactive focus, rather than to the tab
whose border was clicked -- otherwise, we'd change the active tab when
the user probably just wanted to resize.
Diffstat (limited to 'sway/input/seatop_default.c')
-rw-r--r-- | sway/input/seatop_default.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 3ef816fd..6e3c7744 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c | |||
@@ -327,7 +327,16 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
327 | // Handle tiling resize via border | 327 | // Handle tiling resize via border |
328 | if (cont && resize_edge && button == BTN_LEFT && | 328 | if (cont && resize_edge && button == BTN_LEFT && |
329 | state == WLR_BUTTON_PRESSED && !is_floating) { | 329 | state == WLR_BUTTON_PRESSED && !is_floating) { |
330 | seat_set_focus_container(seat, cont); | 330 | // If a resize is triggered on a tabbed or stacked container, change |
331 | // focus to the tab which already had inactive focus -- otherwise, we'd | ||
332 | // change the active tab when the user probably just wanted to resize. | ||
333 | struct sway_container *cont_to_focus = cont; | ||
334 | enum sway_container_layout layout = container_parent_layout(cont); | ||
335 | if (layout == L_TABBED || layout == L_STACKED) { | ||
336 | cont_to_focus = seat_get_focus_inactive_view(seat, &cont->parent->node); | ||
337 | } | ||
338 | |||
339 | seat_set_focus_container(seat, cont_to_focus); | ||
331 | seatop_begin_resize_tiling(seat, cont, edge); | 340 | seatop_begin_resize_tiling(seat, cont, edge); |
332 | return; | 341 | return; |
333 | } | 342 | } |