diff options
author | Luminarys <kizunanohikari@gmail.com> | 2015-08-17 00:38:34 -0500 |
---|---|---|
committer | Luminarys <kizunanohikari@gmail.com> | 2015-08-17 00:38:34 -0500 |
commit | 05f969074e39c5adeb5d7390d8255b83cf351866 (patch) | |
tree | 3f31fc1f7f4d7c31620f012adfcb2e629b2d2042 /sway/container.c | |
parent | Fix format warnings (diff) | |
download | sway-05f969074e39c5adeb5d7390d8255b83cf351866.tar.gz sway-05f969074e39c5adeb5d7390d8255b83cf351866.tar.zst sway-05f969074e39c5adeb5d7390d8255b83cf351866.zip |
Added in basic floating toggling
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 21 |
1 files changed, 17 insertions, 4 deletions
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) { | |||
81 | workspace->height = output->height; | 81 | workspace->height = output->height; |
82 | workspace->name = strdup(name); | 82 | workspace->name = strdup(name); |
83 | workspace->visible = true; | 83 | workspace->visible = true; |
84 | workspace->floating = create_list(); | ||
84 | 85 | ||
85 | add_child(output, workspace); | 86 | add_child(output, workspace); |
86 | return workspace; | 87 | return workspace; |
@@ -134,6 +135,9 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { | |||
134 | view->name = strdup(title); | 135 | view->name = strdup(title); |
135 | view->visible = true; | 136 | view->visible = true; |
136 | 137 | ||
138 | // TODO: properly set this | ||
139 | view->is_floating = false; | ||
140 | |||
137 | //Case of focused workspace, just create as child of it | 141 | //Case of focused workspace, just create as child of it |
138 | if (sibling->type == C_WORKSPACE) { | 142 | if (sibling->type == C_WORKSPACE) { |
139 | add_child(sibling, view); | 143 | add_child(sibling, view); |
@@ -192,23 +196,32 @@ swayc_t *destroy_view(swayc_t *view) { | |||
192 | if (parent->type == C_CONTAINER) { | 196 | if (parent->type == C_CONTAINER) { |
193 | return destroy_container(parent); | 197 | return destroy_container(parent); |
194 | } | 198 | } |
199 | |||
195 | return parent; | 200 | return parent; |
196 | } | 201 | } |
197 | 202 | ||
198 | |||
199 | swayc_t *find_container(swayc_t *container, bool (*test)(swayc_t *view, void *data), void *data) { | 203 | swayc_t *find_container(swayc_t *container, bool (*test)(swayc_t *view, void *data), void *data) { |
200 | if (!container->children) { | 204 | if (!container->children) { |
201 | return NULL; | 205 | return NULL; |
202 | } | 206 | } |
207 | // Special case for checking floating stuff | ||
203 | int i; | 208 | int i; |
209 | if (container->type == C_WORKSPACE) { | ||
210 | for (i = 0; i < container->floating->length; ++i) { | ||
211 | swayc_t *child = container->floating->items[i]; | ||
212 | if (test(child, data)) { | ||
213 | return child; | ||
214 | } | ||
215 | } | ||
216 | } | ||
204 | for (i = 0; i < container->children->length; ++i) { | 217 | for (i = 0; i < container->children->length; ++i) { |
205 | swayc_t *child = container->children->items[i]; | 218 | swayc_t *child = container->children->items[i]; |
206 | if (test(child, data)) { | 219 | if (test(child, data)) { |
207 | return child; | 220 | return child; |
208 | } else { | 221 | } else { |
209 | swayc_t *_ = find_container(child, test, data); | 222 | swayc_t *res = find_container(child, test, data); |
210 | if (_) { | 223 | if (res) { |
211 | return _; | 224 | return res; |
212 | } | 225 | } |
213 | } | 226 | } |
214 | } | 227 | } |