diff options
-rw-r--r-- | include/container.h | 4 | ||||
-rw-r--r-- | sway/commands.c | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/include/container.h b/include/container.h index 157b996a..d027f369 100644 --- a/include/container.h +++ b/include/container.h | |||
@@ -97,6 +97,10 @@ struct sway_container { | |||
97 | * Which of this container's children has focus. | 97 | * Which of this container's children has focus. |
98 | */ | 98 | */ |
99 | struct sway_container *focused; | 99 | struct sway_container *focused; |
100 | /** | ||
101 | * If this container's children include a fullscreen view, this is that view. | ||
102 | */ | ||
103 | struct sway_container *fullscreen; | ||
100 | }; | 104 | }; |
101 | 105 | ||
102 | enum visibility_mask { | 106 | enum visibility_mask { |
diff --git a/sway/commands.c b/sway/commands.c index 205798ec..74b307e6 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -1349,15 +1349,18 @@ static struct cmd_results *cmd_fullscreen(int argc, char **argv) { | |||
1349 | return error; | 1349 | return error; |
1350 | } | 1350 | } |
1351 | swayc_t *container = get_focused_view(&root_container); | 1351 | swayc_t *container = get_focused_view(&root_container); |
1352 | swayc_t *workspace = swayc_parent_by_type(container, C_WORKSPACE); | ||
1352 | bool current = swayc_is_fullscreen(container); | 1353 | bool current = swayc_is_fullscreen(container); |
1353 | wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current); | 1354 | wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current); |
1354 | // Resize workspace if going from fullscreen -> notfullscreen | 1355 | // Resize workspace if going from fullscreen -> notfullscreen |
1355 | // otherwise just resize container | 1356 | // otherwise just resize container |
1356 | if (current) { | 1357 | if (current) { |
1357 | container = swayc_parent_by_type(container, C_WORKSPACE); | 1358 | arrange_windows(workspace, -1, -1); |
1359 | workspace->fullscreen = container; | ||
1360 | } else { | ||
1361 | arrange_windows(container, -1, -1); | ||
1362 | workspace->fullscreen = NULL; | ||
1358 | } | 1363 | } |
1359 | // Only resize container when going into fullscreen | ||
1360 | arrange_windows(container, -1, -1); | ||
1361 | 1364 | ||
1362 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 1365 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
1363 | } | 1366 | } |