aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-12-16 19:20:34 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-12-16 19:20:34 -0500
commitf6da4dda4b9598eab16d4d7d77a06693fa6df9c3 (patch)
tree20ef4c5270639ac0cf972ab75a497b9e461dccf2 /sway
parentMerge pull request #340 from mikkeloscar/seperator-separator (diff)
downloadsway-f6da4dda4b9598eab16d4d7d77a06693fa6df9c3.tar.gz
sway-f6da4dda4b9598eab16d4d7d77a06693fa6df9c3.tar.zst
sway-f6da4dda4b9598eab16d4d7d77a06693fa6df9c3.zip
Bring unmanaged windows to front on output arrange
Fixes #312
Diffstat (limited to 'sway')
-rw-r--r--sway/container.c4
-rw-r--r--sway/handlers.c21
-rw-r--r--sway/layout.c6
-rw-r--r--sway/workspace.c3
4 files changed, 33 insertions, 1 deletions
diff --git a/sway/container.c b/sway/container.c
index a40c483c..8165bbad 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -38,6 +38,9 @@ static void free_swayc(swayc_t *cont) {
38 } 38 }
39 list_free(cont->children); 39 list_free(cont->children);
40 } 40 }
41 if (cont->unmanaged) {
42 list_free(cont->unmanaged);
43 }
41 if (cont->floating) { 44 if (cont->floating) {
42 while (cont->floating->length) { 45 while (cont->floating->length) {
43 free_swayc(cont->floating->items[0]); 46 free_swayc(cont->floating->items[0]);
@@ -104,6 +107,7 @@ swayc_t *new_output(wlc_handle handle) {
104 output->name = name ? strdup(name) : NULL; 107 output->name = name ? strdup(name) : NULL;
105 output->width = size->w; 108 output->width = size->w;
106 output->height = size->h; 109 output->height = size->h;
110 output->unmanaged = create_list();
107 111
108 apply_output_config(oc, output); 112 apply_output_config(oc, output);
109 add_child(&root_container, output); 113 add_child(&root_container, output);
diff --git a/sway/handlers.c b/sway/handlers.c
index dea15acc..136ef577 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -220,6 +220,12 @@ static bool handle_view_created(wlc_handle handle) {
220 // refocus in-between command lists 220 // refocus in-between command lists
221 set_focused_container(newview); 221 set_focused_container(newview);
222 } 222 }
223 } else {
224 swayc_t *output = swayc_parent_by_type(focused, C_OUTPUT);
225 wlc_handle *h = malloc(sizeof(wlc_handle));
226 *h = handle;
227 sway_log(L_DEBUG, "Adding unmanaged window %p to %p", h, output->unmanaged);
228 list_add(output->unmanaged, h);
223 } 229 }
224 return true; 230 return true;
225} 231}
@@ -249,6 +255,21 @@ static void handle_view_destroyed(wlc_handle handle) {
249 swayc_t *parent = destroy_view(view); 255 swayc_t *parent = destroy_view(view);
250 remove_view_from_scratchpad(view); 256 remove_view_from_scratchpad(view);
251 arrange_windows(parent, -1, -1); 257 arrange_windows(parent, -1, -1);
258 } else {
259 // Is it unmanaged?
260 int i;
261 for (i = 0; i < root_container.children->length; ++i) {
262 swayc_t *output = root_container.children->items[i];
263 int j;
264 for (j = 0; j < output->unmanaged->length; ++j) {
265 wlc_handle *_handle = output->unmanaged->items[j];
266 if (*_handle == handle) {
267 list_del(output->unmanaged, j);
268 free(_handle);
269 break;
270 }
271 }
272 }
252 } 273 }
253 set_focused_container(get_focused_view(&root_container)); 274 set_focused_container(get_focused_view(&root_container));
254} 275}
diff --git a/sway/layout.c b/sway/layout.c
index 5c57d0a7..08d06d0b 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -465,6 +465,12 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
465 sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y); 465 sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y);
466 arrange_windows_r(child, -1, -1); 466 arrange_windows_r(child, -1, -1);
467 } 467 }
468
469 // Bring all unmanaged views to the front
470 for (i = 0; i < container->unmanaged->length; ++i) {
471 wlc_handle *handle = container->unmanaged->items[i];
472 wlc_view_bring_to_front(*handle);
473 }
468 } 474 }
469 return; 475 return;
470 case C_VIEW: 476 case C_VIEW:
diff --git a/sway/workspace.c b/sway/workspace.c
index f7134917..5e6ea799 100644
--- a/sway/workspace.c
+++ b/sway/workspace.c
@@ -247,6 +247,7 @@ bool workspace_switch(swayc_t *workspace) {
247 if (!set_focused_container(get_focused_view(workspace))) { 247 if (!set_focused_container(get_focused_view(workspace))) {
248 return false; 248 return false;
249 } 249 }
250 arrange_windows(workspace, -1, -1); 250 swayc_t *output = swayc_parent_by_type(workspace, C_OUTPUT);
251 arrange_windows(output, -1, -1);
251 return true; 252 return true;
252} 253}