aboutsummaryrefslogtreecommitdiff
path: root/sway/container.c
diff options
context:
space:
mode:
authortaiyu <taiyu.len@gmail.com>2015-08-22 18:25:05 -0700
committertaiyu <taiyu.len@gmail.com>2015-08-22 18:25:05 -0700
commit36cd180f02cf032fa1d041540fff236061c3df5a (patch)
tree20c4c2a290a17aac05472fafc2eab0f1724bf298 /sway/container.c
parent1fd5962aeb5bab722a26182ad39fddecf43c6f95 (diff)
fixed vanishing floating view
Diffstat (limited to 'sway/container.c')
-rw-r--r--sway/container.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sway/container.c b/sway/container.c
index 67a34551..127e1ecd 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -299,7 +299,8 @@ swayc_t *destroy_workspace(swayc_t *workspace) {
return NULL;
}
- if (workspace->children->length == 0) {
+ // Do not destroy if there are children
+ if (workspace->children->length == 0 && workspace->floating->length == 0) {
sway_log(L_DEBUG, "%s: '%s'", __func__, workspace->name);
swayc_t *parent = workspace->parent;
free_swayc(workspace);
@@ -466,14 +467,16 @@ bool swayc_is_fullscreen(swayc_t *view) {
// Mapping
void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), void *data) {
- if (container && container->children && container->children->length) {
+ if (container) {
int i;
- for (i = 0; i < container->children->length; ++i) {
- swayc_t *child = container->children->items[i];
- f(child, data);
- container_map(child, f, data);
+ if (container->children) {
+ for (i = 0; i < container->children->length; ++i) {
+ swayc_t *child = container->children->items[i];
+ f(child, data);
+ container_map(child, f, data);
+ }
}
- if (container->type == C_WORKSPACE) {
+ if (container->floating) {
for (i = 0; i < container->floating->length; ++i) {
swayc_t *child = container->floating->items[i];
f(child, data);