aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-25 21:39:48 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-25 21:39:48 +1000
commite496cc99f86e69ba8d965b7863111ff33f5c05e6 (patch)
treecf281ddfcafd731d7ea63cf80d2723deef8b4f77 /sway/tree/layout.c
parentMerge pull request #2028 from RyanDwyer/fix-move-workspace (diff)
downloadsway-e496cc99f86e69ba8d965b7863111ff33f5c05e6.tar.gz
sway-e496cc99f86e69ba8d965b7863111ff33f5c05e6.tar.zst
sway-e496cc99f86e69ba8d965b7863111ff33f5c05e6.zip
Fix focus bug when moving between outputs
When moving focus left or right to an adjacent output, only select the first or last child in the new workspace if the workspace's layout is horizontalish. If it's a verticalish layout, use the last focused container.
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 91759f7b..e32e0d7d 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -586,11 +586,19 @@ static struct sway_container *get_swayc_in_output_direction(
586 if (ws->children->length > 0) { 586 if (ws->children->length > 0) {
587 switch (dir) { 587 switch (dir) {
588 case MOVE_LEFT: 588 case MOVE_LEFT:
589 // get most right child of new output 589 if (ws->layout == L_HORIZ || ws->layout == L_TABBED) {
590 return ws->children->items[ws->children->length-1]; 590 // get most right child of new output
591 return ws->children->items[ws->children->length-1];
592 } else {
593 return seat_get_focus_inactive(seat, ws);
594 }
591 case MOVE_RIGHT: 595 case MOVE_RIGHT:
592 // get most left child of new output 596 if (ws->layout == L_HORIZ || ws->layout == L_TABBED) {
593 return ws->children->items[0]; 597 // get most left child of new output
598 return ws->children->items[0];
599 } else {
600 return seat_get_focus_inactive(seat, ws);
601 }
594 case MOVE_UP: 602 case MOVE_UP:
595 case MOVE_DOWN: { 603 case MOVE_DOWN: {
596 struct sway_container *focused = 604 struct sway_container *focused =