diff options
Diffstat (limited to 'sway/commands/fullscreen.c')
-rw-r--r-- | sway/commands/fullscreen.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/sway/commands/fullscreen.c b/sway/commands/fullscreen.c index ac65dffb..3bbe00c5 100644 --- a/sway/commands/fullscreen.c +++ b/sway/commands/fullscreen.c | |||
@@ -12,18 +12,18 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) { | |||
12 | if ((error = checkarg(argc, "fullscreen", EXPECTED_LESS_THAN, 2))) { | 12 | if ((error = checkarg(argc, "fullscreen", EXPECTED_LESS_THAN, 2))) { |
13 | return error; | 13 | return error; |
14 | } | 14 | } |
15 | struct sway_container *container = | 15 | struct sway_node *node = config->handler_context.node; |
16 | config->handler_context.current_container; | 16 | struct sway_container *container = config->handler_context.container; |
17 | if (container->type == C_WORKSPACE && container->children->length == 0) { | 17 | struct sway_workspace *workspace = config->handler_context.workspace; |
18 | if (node->type == N_WORKSPACE && workspace->tiling->length == 0) { | ||
18 | return cmd_results_new(CMD_INVALID, "fullscreen", | 19 | return cmd_results_new(CMD_INVALID, "fullscreen", |
19 | "Can't fullscreen an empty workspace"); | 20 | "Can't fullscreen an empty workspace"); |
20 | } | 21 | } |
21 | if (container->type == C_WORKSPACE) { | 22 | if (node->type == N_WORKSPACE) { |
22 | // Wrap the workspace's children in a container so we can fullscreen it | 23 | // Wrap the workspace's children in a container so we can fullscreen it |
23 | struct sway_container *workspace = container; | 24 | container = workspace_wrap_children(workspace); |
24 | container = workspace_wrap_children(container); | ||
25 | workspace->layout = L_HORIZ; | 25 | workspace->layout = L_HORIZ; |
26 | seat_set_focus(config->handler_context.seat, container); | 26 | seat_set_focus(config->handler_context.seat, &container->node); |
27 | } | 27 | } |
28 | bool enable = !container->is_fullscreen; | 28 | bool enable = !container->is_fullscreen; |
29 | 29 | ||
@@ -32,9 +32,7 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) { | |||
32 | } | 32 | } |
33 | 33 | ||
34 | container_set_fullscreen(container, enable); | 34 | container_set_fullscreen(container, enable); |
35 | 35 | arrange_workspace(workspace); | |
36 | struct sway_container *workspace = container_parent(container, C_WORKSPACE); | ||
37 | arrange_windows(workspace->parent); | ||
38 | 36 | ||
39 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 37 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
40 | } | 38 | } |