From 05f969074e39c5adeb5d7390d8255b83cf351866 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Mon, 17 Aug 2015 00:38:34 -0500 Subject: Added in basic floating toggling --- sway/container.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 4321b6ce..87e48e91 100644 --- a/sway/container.c +++ b/sway/container.c @@ -81,6 +81,7 @@ swayc_t *new_workspace(swayc_t * output, const char *name) { workspace->height = output->height; workspace->name = strdup(name); workspace->visible = true; + workspace->floating = create_list(); add_child(output, workspace); return workspace; @@ -134,6 +135,9 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { view->name = strdup(title); view->visible = true; + // TODO: properly set this + view->is_floating = false; + //Case of focused workspace, just create as child of it if (sibling->type == C_WORKSPACE) { add_child(sibling, view); @@ -192,23 +196,32 @@ swayc_t *destroy_view(swayc_t *view) { if (parent->type == C_CONTAINER) { return destroy_container(parent); } + return parent; } - swayc_t *find_container(swayc_t *container, bool (*test)(swayc_t *view, void *data), void *data) { if (!container->children) { return NULL; } + // Special case for checking floating stuff int i; + if (container->type == C_WORKSPACE) { + for (i = 0; i < container->floating->length; ++i) { + swayc_t *child = container->floating->items[i]; + if (test(child, data)) { + return child; + } + } + } for (i = 0; i < container->children->length; ++i) { swayc_t *child = container->children->items[i]; if (test(child, data)) { return child; } else { - swayc_t *_ = find_container(child, test, data); - if (_) { - return _; + swayc_t *res = find_container(child, test, data); + if (res) { + return res; } } } -- cgit v1.2.3