aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-05-25 21:39:48 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-05-25 21:39:48 +1000
commite496cc99f86e69ba8d965b7863111ff33f5c05e6 (patch)
treecf281ddfcafd731d7ea63cf80d2723deef8b4f77
parent3c77f066a532efd3df0f2072d02fa4353b4a4511 (diff)
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.
-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(
if (ws->children->length > 0) {
switch (dir) {
case MOVE_LEFT:
- // get most right child of new output
- return ws->children->items[ws->children->length-1];
+ if (ws->layout == L_HORIZ || ws->layout == L_TABBED) {
+ // get most right child of new output
+ return ws->children->items[ws->children->length-1];
+ } else {
+ return seat_get_focus_inactive(seat, ws);
+ }
case MOVE_RIGHT:
- // get most left child of new output
- return ws->children->items[0];
+ if (ws->layout == L_HORIZ || ws->layout == L_TABBED) {
+ // get most left child of new output
+ return ws->children->items[0];
+ } else {
+ return seat_get_focus_inactive(seat, ws);
+ }
case MOVE_UP:
case MOVE_DOWN: {
struct sway_container *focused =