diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-25 20:56:23 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-26 08:27:07 +1000 |
commit | 27a20a488465468511de9b2307941ac1bc4db8bf (patch) | |
tree | c5c1aff483cb089870ffebec00869347eec29f4c /sway/commands | |
parent | Merge pull request #2330 from progandy/set-modifier-locks (diff) | |
download | sway-27a20a488465468511de9b2307941ac1bc4db8bf.tar.gz sway-27a20a488465468511de9b2307941ac1bc4db8bf.tar.zst sway-27a20a488465468511de9b2307941ac1bc4db8bf.zip |
Allow containers to be fullscreen
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/fullscreen.c | 18 | ||||
-rw-r--r-- | sway/commands/move.c | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/sway/commands/fullscreen.c b/sway/commands/fullscreen.c index b423fd23..5ad06e40 100644 --- a/sway/commands/fullscreen.c +++ b/sway/commands/fullscreen.c | |||
@@ -14,18 +14,24 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) { | |||
14 | } | 14 | } |
15 | struct sway_container *container = | 15 | struct sway_container *container = |
16 | config->handler_context.current_container; | 16 | config->handler_context.current_container; |
17 | if (container->type != C_VIEW) { | 17 | if (container->type == C_WORKSPACE && container->children->length == 0) { |
18 | return cmd_results_new(CMD_INVALID, "fullscreen", | 18 | return cmd_results_new(CMD_INVALID, "fullscreen", |
19 | "Only views can fullscreen"); | 19 | "Can't fullscreen an empty workspace"); |
20 | } | 20 | } |
21 | struct sway_view *view = container->sway_view; | 21 | if (container->type == C_WORKSPACE) { |
22 | bool wants_fullscreen = !view->is_fullscreen; | 22 | // Wrap the workspace's children in a container so we can fullscreen it |
23 | struct sway_container *workspace = container; | ||
24 | container = container_wrap_children(container); | ||
25 | workspace->layout = L_HORIZ; | ||
26 | seat_set_focus(config->handler_context.seat, container); | ||
27 | } | ||
28 | bool enable = !container->is_fullscreen; | ||
23 | 29 | ||
24 | if (argc) { | 30 | if (argc) { |
25 | wants_fullscreen = parse_boolean(argv[0], view->is_fullscreen); | 31 | enable = parse_boolean(argv[0], container->is_fullscreen); |
26 | } | 32 | } |
27 | 33 | ||
28 | view_set_fullscreen(view, wants_fullscreen); | 34 | container_set_fullscreen(container, enable); |
29 | 35 | ||
30 | struct sway_container *workspace = container_parent(container, C_WORKSPACE); | 36 | struct sway_container *workspace = container_parent(container, C_WORKSPACE); |
31 | arrange_windows(workspace->parent); | 37 | arrange_windows(workspace->parent); |
diff --git a/sway/commands/move.c b/sway/commands/move.c index 1940043d..aede3d6c 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -196,7 +196,7 @@ static struct cmd_results *move_in_direction(struct sway_container *container, | |||
196 | "Cannot move workspaces in a direction"); | 196 | "Cannot move workspaces in a direction"); |
197 | } | 197 | } |
198 | if (container_is_floating(container)) { | 198 | if (container_is_floating(container)) { |
199 | if (container->type == C_VIEW && container->sway_view->is_fullscreen) { | 199 | if (container->is_fullscreen) { |
200 | return cmd_results_new(CMD_FAILURE, "move", | 200 | return cmd_results_new(CMD_FAILURE, "move", |
201 | "Cannot move fullscreen floating container"); | 201 | "Cannot move fullscreen floating container"); |
202 | } | 202 | } |