mirror of
https://github.com/swaywm/sway.git
synced 2024-12-30 17:06:40 +01:00
parent
2231acb790
commit
f6da4dda4b
5 changed files with 37 additions and 1 deletions
|
@ -88,6 +88,10 @@ struct sway_container {
|
||||||
* Children of this container that are floated.
|
* Children of this container that are floated.
|
||||||
*/
|
*/
|
||||||
list_t *floating;
|
list_t *floating;
|
||||||
|
/**
|
||||||
|
* Unmanaged view handles in this container.
|
||||||
|
*/
|
||||||
|
list_t *unmanaged;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parent of this container. NULL for the root container.
|
* The parent of this container. NULL for the root container.
|
||||||
|
|
|
@ -38,6 +38,9 @@ static void free_swayc(swayc_t *cont) {
|
||||||
}
|
}
|
||||||
list_free(cont->children);
|
list_free(cont->children);
|
||||||
}
|
}
|
||||||
|
if (cont->unmanaged) {
|
||||||
|
list_free(cont->unmanaged);
|
||||||
|
}
|
||||||
if (cont->floating) {
|
if (cont->floating) {
|
||||||
while (cont->floating->length) {
|
while (cont->floating->length) {
|
||||||
free_swayc(cont->floating->items[0]);
|
free_swayc(cont->floating->items[0]);
|
||||||
|
@ -104,6 +107,7 @@ swayc_t *new_output(wlc_handle handle) {
|
||||||
output->name = name ? strdup(name) : NULL;
|
output->name = name ? strdup(name) : NULL;
|
||||||
output->width = size->w;
|
output->width = size->w;
|
||||||
output->height = size->h;
|
output->height = size->h;
|
||||||
|
output->unmanaged = create_list();
|
||||||
|
|
||||||
apply_output_config(oc, output);
|
apply_output_config(oc, output);
|
||||||
add_child(&root_container, output);
|
add_child(&root_container, output);
|
||||||
|
|
|
@ -220,6 +220,12 @@ static bool handle_view_created(wlc_handle handle) {
|
||||||
// refocus in-between command lists
|
// refocus in-between command lists
|
||||||
set_focused_container(newview);
|
set_focused_container(newview);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
swayc_t *output = swayc_parent_by_type(focused, C_OUTPUT);
|
||||||
|
wlc_handle *h = malloc(sizeof(wlc_handle));
|
||||||
|
*h = handle;
|
||||||
|
sway_log(L_DEBUG, "Adding unmanaged window %p to %p", h, output->unmanaged);
|
||||||
|
list_add(output->unmanaged, h);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -249,6 +255,21 @@ static void handle_view_destroyed(wlc_handle handle) {
|
||||||
swayc_t *parent = destroy_view(view);
|
swayc_t *parent = destroy_view(view);
|
||||||
remove_view_from_scratchpad(view);
|
remove_view_from_scratchpad(view);
|
||||||
arrange_windows(parent, -1, -1);
|
arrange_windows(parent, -1, -1);
|
||||||
|
} else {
|
||||||
|
// Is it unmanaged?
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < root_container.children->length; ++i) {
|
||||||
|
swayc_t *output = root_container.children->items[i];
|
||||||
|
int j;
|
||||||
|
for (j = 0; j < output->unmanaged->length; ++j) {
|
||||||
|
wlc_handle *_handle = output->unmanaged->items[j];
|
||||||
|
if (*_handle == handle) {
|
||||||
|
list_del(output->unmanaged, j);
|
||||||
|
free(_handle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
set_focused_container(get_focused_view(&root_container));
|
set_focused_container(get_focused_view(&root_container));
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,6 +465,12 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
|
||||||
sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y);
|
sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y);
|
||||||
arrange_windows_r(child, -1, -1);
|
arrange_windows_r(child, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bring all unmanaged views to the front
|
||||||
|
for (i = 0; i < container->unmanaged->length; ++i) {
|
||||||
|
wlc_handle *handle = container->unmanaged->items[i];
|
||||||
|
wlc_view_bring_to_front(*handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case C_VIEW:
|
case C_VIEW:
|
||||||
|
|
|
@ -247,6 +247,7 @@ bool workspace_switch(swayc_t *workspace) {
|
||||||
if (!set_focused_container(get_focused_view(workspace))) {
|
if (!set_focused_container(get_focused_view(workspace))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
arrange_windows(workspace, -1, -1);
|
swayc_t *output = swayc_parent_by_type(workspace, C_OUTPUT);
|
||||||
|
arrange_windows(output, -1, -1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue