From eac0920f49a728ad6a3809528c4757b73e4cd8af Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 22 Aug 2015 14:44:47 -0400 Subject: Set x/y positions for output containers --- sway/container.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 5d544934..41d21c3b 100644 --- a/sway/container.c +++ b/sway/container.c @@ -59,7 +59,7 @@ swayc_t *new_output(wlc_handle handle) { const char *name = wlc_output_get_name(handle); sway_log(L_DEBUG, "Added output %lu:%s", handle, name); - struct output_config *oc ; + struct output_config *oc = NULL; int i; for (i = 0; i < config->output_configs->length; ++i) { oc = config->output_configs->items[i]; @@ -83,6 +83,23 @@ swayc_t *new_output(wlc_handle handle) { output->handle = handle; output->name = name ? strdup(name) : NULL; output->gaps = config->gaps_outer + config->gaps_inner / 2; + + // Find position for it + if (oc && oc->x != -1 && oc->y != -1) { + output->x = oc->x; + output->y = oc->y; + } else { + int x = 0; + for (i = 0; i < root_container.children->length; ++i) { + swayc_t *c = root_container.children->items[i]; + if (c->type == C_OUTPUT) { + if (c->width + c->x > x) { + x = c->width + c->x; + } + } + } + output->x = x; + } add_child(&root_container, output); -- cgit v1.2.3 From 07229edfe627762df9c27ed2700d737f74bb7b88 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 22 Aug 2015 15:19:02 -0400 Subject: Implement output positioning :tada: --- sway/container.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 41d21c3b..67a34551 100644 --- a/sway/container.c +++ b/sway/container.c @@ -86,6 +86,7 @@ swayc_t *new_output(wlc_handle handle) { // Find position for it if (oc && oc->x != -1 && oc->y != -1) { + sway_log(L_DEBUG, "Set %s position to %d, %d", name, oc->x, oc->y); output->x = oc->x; output->y = oc->y; } else { -- cgit v1.2.3 From 36cd180f02cf032fa1d041540fff236061c3df5a Mon Sep 17 00:00:00 2001 From: taiyu Date: Sat, 22 Aug 2015 18:25:05 -0700 Subject: fixed vanishing floating view --- sway/container.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'sway/container.c') 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); -- cgit v1.2.3 From 98fad060e28c81c8340afbb473615f7889a6097a Mon Sep 17 00:00:00 2001 From: Luminarys Date: Sun, 23 Aug 2015 12:22:33 -0500 Subject: Added in glitchy disabling --- sway/container.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 127e1ecd..6debeea3 100644 --- a/sway/container.c +++ b/sway/container.c @@ -70,6 +70,10 @@ swayc_t *new_output(wlc_handle handle) { oc = NULL; } + if (oc && !oc->enabled) { + return NULL; + } + swayc_t *output = new_swayc(C_OUTPUT); if (oc && oc->width != -1 && oc->height != -1) { output->width = oc->width; -- cgit v1.2.3 From e01cf0b56654ff459a98a90e5e35615ad8d9203e Mon Sep 17 00:00:00 2001 From: Luminarys Date: Sun, 23 Aug 2015 12:22:45 -0500 Subject: Added in glitchy disabling --- sway/container.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 6debeea3..d4f7c693 100644 --- a/sway/container.c +++ b/sway/container.c @@ -70,9 +70,9 @@ swayc_t *new_output(wlc_handle handle) { oc = NULL; } - if (oc && !oc->enabled) { - return NULL; - } + if (oc && !oc->enabled) { + return NULL; + } swayc_t *output = new_swayc(C_OUTPUT); if (oc && oc->width != -1 && oc->height != -1) { -- cgit v1.2.3