diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-09 20:49:19 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-09 20:49:58 -0400 |
commit | 0078a6fa36d65704c55d426d022768e15b33a240 (patch) | |
tree | 666a30b5720eb704306d55daa5bfeb1be39f85ec /sway | |
parent | fullscreen: partially working (diff) | |
download | sway-0078a6fa36d65704c55d426d022768e15b33a240.tar.gz sway-0078a6fa36d65704c55d426d022768e15b33a240.tar.zst sway-0078a6fa36d65704c55d426d022768e15b33a240.zip |
Flesh out fullscreen support a bit
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 3 | ||||
-rw-r--r-- | sway/layout.c | 41 |
2 files changed, 17 insertions, 27 deletions
diff --git a/sway/commands.c b/sway/commands.c index b7794087..cee8bf84 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -224,7 +224,8 @@ int cmd_fullscreen(struct sway_config *config, int argc, char **argv) { | |||
224 | } | 224 | } |
225 | 225 | ||
226 | swayc_t *container = get_focused_container(&root_container); | 226 | swayc_t *container = get_focused_container(&root_container); |
227 | wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, true); | 227 | bool current = (wlc_view_get_state(container->handle) & WLC_BIT_FULLSCREEN) > 0; |
228 | wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current); | ||
228 | arrange_windows(container, -1, -1); | 229 | arrange_windows(container, -1, -1); |
229 | 230 | ||
230 | return 1; | 231 | return 1; |
diff --git a/sway/layout.c b/sway/layout.c index affcb83e..faf25c8c 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -41,29 +41,6 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
41 | } | 41 | } |
42 | return; | 42 | return; |
43 | case C_VIEW: | 43 | case C_VIEW: |
44 | // If the view is fullscreen, we need to tell wlc to draw it as such | ||
45 | if (wlc_view_get_state(container->handle) & WLC_BIT_FULLSCREEN) { | ||
46 | swayc_t *parent = container; | ||
47 | do { | ||
48 | parent = parent->parent; | ||
49 | } while(parent->type != C_OUTPUT); | ||
50 | |||
51 | sway_log(L_DEBUG, "res %d %d", parent->width, parent->height); | ||
52 | struct wlc_geometry geometry = { | ||
53 | .origin = { | ||
54 | .x = 0, | ||
55 | .y = 0 | ||
56 | }, | ||
57 | .size = { | ||
58 | .w = parent->width, | ||
59 | .h = parent->height | ||
60 | } | ||
61 | }; | ||
62 | |||
63 | wlc_view_set_geometry(container->handle, &geometry); | ||
64 | return; | ||
65 | } | ||
66 | |||
67 | sway_log(L_DEBUG, "Setting view to %d x %d @ %d, %d", width, height, container->x, container->y); | 44 | sway_log(L_DEBUG, "Setting view to %d x %d @ %d, %d", width, height, container->x, container->y); |
68 | struct wlc_geometry geometry = { | 45 | struct wlc_geometry geometry = { |
69 | .origin = { | 46 | .origin = { |
@@ -75,9 +52,21 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
75 | .h = height | 52 | .h = height |
76 | } | 53 | } |
77 | }; | 54 | }; |
78 | wlc_view_set_geometry(container->handle, &geometry); | 55 | if (wlc_view_get_state(container->handle) & WLC_BIT_FULLSCREEN) { |
79 | container->width = width; | 56 | swayc_t *parent = container; |
80 | container->height = height; | 57 | while(parent->type != C_OUTPUT) { |
58 | parent = parent->parent; | ||
59 | } | ||
60 | geometry.origin.x = 0; | ||
61 | geometry.origin.y = 0; | ||
62 | geometry.size.w = parent->width; | ||
63 | geometry.size.h = parent->height; | ||
64 | wlc_view_set_geometry(container->handle, &geometry); | ||
65 | } else { | ||
66 | wlc_view_set_geometry(container->handle, &geometry); | ||
67 | container->width = width; | ||
68 | container->height = height; | ||
69 | } | ||
81 | return; | 70 | return; |
82 | default: | 71 | default: |
83 | container->width = width; | 72 | container->width = width; |