summaryrefslogtreecommitdiff
path: root/sway/container.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2016-07-04 16:03:23 -0400
committerGitHub <[email protected]>2016-07-04 16:03:23 -0400
commit33c923be731c0bb1c399bf3bd1011aa969e591d8 (patch)
tree93c374e26425460bfa7ad1bc1528a1b9b5725a8e /sway/container.c
parent33abcd9573155d36f8a40936d06a44704287a99b (diff)
parente07b8c8d7cfaaf6667a766c9d42d59fc14e98872 (diff)
Merge pull request #735 from zandrmartin/get-tree-command
implement `get_tree` command
Diffstat (limited to 'sway/container.c')
-rw-r--r--sway/container.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/sway/container.c b/sway/container.c
index 21538ab4..a7e46571 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -75,6 +75,30 @@ static void free_swayc(swayc_t *cont) {
free(cont);
}
+static void update_root_geometry() {
+ int width = 0;
+ int height = 0;
+ swayc_t *child;
+ int child_width;
+ int child_height;
+
+ for (int i = 0; i < root_container.children->length; ++i) {
+ child = root_container.children->items[i];
+ child_width = child->width + child->x;
+ child_height = child->height + child->y;
+ if (child_width > width) {
+ width = child_width;
+ }
+
+ if (child_height > height) {
+ height = child_height;
+ }
+ }
+
+ root_container.width = width;
+ root_container.height = height;
+}
+
// New containers
swayc_t *new_output(wlc_handle handle) {
@@ -167,6 +191,7 @@ swayc_t *new_output(wlc_handle handle) {
}
free(ws_name);
+ update_root_geometry();
return output;
}
@@ -361,7 +386,7 @@ void floating_view_sane_size(swayc_t *view) {
view->desired_width = config->floating_maximum_width;
}
- sway_log(L_DEBUG, "Sane values for view to %d x %d @ %.f, %.f",
+ sway_log(L_DEBUG, "Sane values for view to %d x %d @ %.f, %.f",
view->desired_width, view->desired_height, view->x, view->y);
return;
@@ -393,6 +418,7 @@ swayc_t *destroy_output(swayc_t *output) {
}
sway_log(L_DEBUG, "OUTPUT: Destroying output '%" PRIuPTR "'", output->handle);
free_swayc(output);
+ update_root_geometry();
return &root_container;
}