diff options
author | Half-Shot <half-shot@molrams.com> | 2015-08-18 21:42:28 +0100 |
---|---|---|
committer | Half-Shot <half-shot@molrams.com> | 2015-08-18 21:42:28 +0100 |
commit | f314d951039031fd7f0bd8772b6916587ebb0846 (patch) | |
tree | 7287a3f02593906ae23aec234fbe6e2ca1b06d1d /sway/layout.c | |
parent | Beguin work on the move command. (diff) | |
parent | Improve README (more) (diff) | |
download | sway-f314d951039031fd7f0bd8772b6916587ebb0846.tar.gz sway-f314d951039031fd7f0bd8772b6916587ebb0846.tar.zst sway-f314d951039031fd7f0bd8772b6916587ebb0846.zip |
Merge branch 'master' of https://github.com/SirCmpwn/sway
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/sway/layout.c b/sway/layout.c index e2ea46a7..105359d2 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -1,11 +1,12 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdbool.h> | 2 | #include <stdbool.h> |
3 | #include <wlc/wlc.h> | 3 | #include <wlc/wlc.h> |
4 | #include "list.h" | ||
5 | #include "log.h" | ||
6 | #include "layout.h" | 4 | #include "layout.h" |
5 | #include "log.h" | ||
6 | #include "list.h" | ||
7 | #include "container.h" | 7 | #include "container.h" |
8 | #include "workspace.h" | 8 | #include "workspace.h" |
9 | #include "focus.h" | ||
9 | 10 | ||
10 | swayc_t root_container; | 11 | swayc_t root_container; |
11 | 12 | ||
@@ -79,9 +80,10 @@ swayc_t *remove_child(swayc_t *child) { | |||
79 | } | 80 | } |
80 | } | 81 | } |
81 | } | 82 | } |
83 | //Set focused to new container | ||
82 | if (parent->focused == child) { | 84 | if (parent->focused == child) { |
83 | if (parent->children->length > 0) { | 85 | if (parent->children->length > 0) { |
84 | parent->focused = parent->children->items[i?i-1:0]; | 86 | set_focused_container_for(parent, parent->children->items[i?i-1:0]); |
85 | } else { | 87 | } else { |
86 | parent->focused = NULL; | 88 | parent->focused = NULL; |
87 | } | 89 | } |
@@ -209,26 +211,42 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
209 | if (container->type == C_WORKSPACE) { | 211 | if (container->type == C_WORKSPACE) { |
210 | for (i = 0; i < container->floating->length; ++i) { | 212 | for (i = 0; i < container->floating->length; ++i) { |
211 | swayc_t *view = container->floating->items[i]; | 213 | swayc_t *view = container->floating->items[i]; |
212 | // Set the geometry | 214 | if (view->type == C_VIEW) { |
213 | struct wlc_geometry geometry = { | 215 | // Set the geometry |
214 | .origin = { | 216 | struct wlc_geometry geometry = { |
215 | .x = view->x, | 217 | .origin = { |
216 | .y = view->y | 218 | .x = view->x, |
217 | }, | 219 | .y = view->y |
218 | .size = { | 220 | }, |
219 | .w = view->width, | 221 | .size = { |
220 | .h = view->height | 222 | .w = view->width, |
223 | .h = view->height | ||
224 | } | ||
225 | }; | ||
226 | if (wlc_view_get_state(view->handle) & WLC_BIT_FULLSCREEN) { | ||
227 | swayc_t *parent = view; | ||
228 | while (parent->type != C_OUTPUT) { | ||
229 | parent = parent->parent; | ||
230 | } | ||
231 | geometry.origin.x = 0; | ||
232 | geometry.origin.y = 0; | ||
233 | geometry.size.w = parent->width; | ||
234 | geometry.size.h = parent->height; | ||
235 | wlc_view_set_geometry(view->handle, &geometry); | ||
236 | wlc_view_bring_to_front(view->handle); | ||
237 | } else { | ||
238 | wlc_view_set_geometry(view->handle, &geometry); | ||
239 | view->width = width; | ||
240 | view->height = height; | ||
241 | // Bring the views to the front in order of the list, the list | ||
242 | // will be kept up to date so that more recently focused views | ||
243 | // have higher indexes | ||
244 | // This is conditional on there not being a fullscreen view in the workspace | ||
245 | if (!container->focused | ||
246 | || !(wlc_view_get_state(container->focused->handle) & WLC_BIT_FULLSCREEN)) { | ||
247 | wlc_view_bring_to_front(view->handle); | ||
248 | } | ||
221 | } | 249 | } |
222 | }; | ||
223 | wlc_view_set_geometry(view->handle, &geometry); | ||
224 | |||
225 | // Bring the views to the front in order of the list, the list | ||
226 | // will be kept up to date so that more recently focused views | ||
227 | // have higher indexes | ||
228 | // This is conditional on there not being a fullscreen view in the workspace | ||
229 | if (!container->focused | ||
230 | || !(wlc_view_get_state(container->focused->handle) & WLC_BIT_FULLSCREEN)) { | ||
231 | wlc_view_bring_to_front(view->handle); | ||
232 | } | 250 | } |
233 | } | 251 | } |
234 | } | 252 | } |