fixed container_map

applies to the passed in container now as well.
fixes workspaces staying always marked visible.
also set workspaces to not visible by default; happens when you move a
container to a new workspace that thus is not visible
This commit is contained in:
minus 2015-08-27 00:44:47 +02:00
parent 873a51f7e2
commit 6bbfd65735

View file

@ -152,7 +152,7 @@ swayc_t *new_workspace(swayc_t *output, const char *name) {
workspace->width = output->width; workspace->width = output->width;
workspace->height = output->height; workspace->height = output->height;
workspace->name = strdup(name); workspace->name = strdup(name);
workspace->visible = true; workspace->visible = false;
workspace->floating = create_list(); workspace->floating = create_list();
add_child(output, workspace); add_child(output, workspace);
@ -503,18 +503,17 @@ bool swayc_is_active(swayc_t *view) {
void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), void *data) { void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), void *data) {
if (container) { if (container) {
f(container, data);
int i; int i;
if (container->children) { if (container->children) {
for (i = 0; i < container->children->length; ++i) { for (i = 0; i < container->children->length; ++i) {
swayc_t *child = container->children->items[i]; swayc_t *child = container->children->items[i];
f(child, data);
container_map(child, f, data); container_map(child, f, data);
} }
} }
if (container->floating) { if (container->floating) {
for (i = 0; i < container->floating->length; ++i) { for (i = 0; i < container->floating->length; ++i) {
swayc_t *child = container->floating->items[i]; swayc_t *child = container->floating->items[i];
f(child, data);
container_map(child, f, data); container_map(child, f, data);
} }
} }