aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonan Pigott <rpigott@berkeley.edu>2019-11-03 19:18:05 -0700
committerSimon Ser <contact@emersion.fr>2019-11-04 23:48:39 +0100
commit1f469e1692ea05720afb32ebf038afa19bd27154 (patch)
treea6e902064aaeb43aa542d991b4a886d541653e65
parent7efb5d467368ea9168cebc2473bc3c6942e031bb (diff)
focus: do nothing on focus prev|next for workspaces
-rw-r--r--sway/commands/focus.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 844d1293..d745aab5 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -16,7 +16,11 @@
static bool get_direction_from_next_prev(struct sway_container *container,
struct sway_seat *seat, const char *name, enum wlr_direction *out) {
- enum sway_container_layout parent_layout = container_parent_layout(container);
+ enum sway_container_layout parent_layout = L_NONE;
+ if (container) {
+ parent_layout = container_parent_layout(container);
+ }
+
if (strcasecmp(name, "prev") == 0) {
switch (parent_layout) {
case L_HORIZ:
@@ -27,6 +31,8 @@ static bool get_direction_from_next_prev(struct sway_container *container,
case L_STACKED:
*out = WLR_DIRECTION_UP;
break;
+ case L_NONE:
+ return true;
default:
return false;
}
@@ -40,6 +46,8 @@ static bool get_direction_from_next_prev(struct sway_container *container,
case L_STACKED:
*out = WLR_DIRECTION_DOWN;
break;
+ case L_NONE:
+ return true;
default:
return false;
}
@@ -399,6 +407,10 @@ struct cmd_results *cmd_focus(int argc, char **argv) {
}
}
+ if (!direction) {
+ return cmd_results_new(CMD_SUCCESS, NULL);
+ }
+
if (node->type == N_WORKSPACE) {
// Jump to the next output
struct sway_output *new_output =