diff options
author | taiyu <taiyu.len@gmail.com> | 2015-08-21 10:28:37 -0700 |
---|---|---|
committer | taiyu <taiyu.len@gmail.com> | 2015-08-21 10:28:37 -0700 |
commit | 1a1ac64662a603fdeb7025bed3822e24f9158076 (patch) | |
tree | 4ac14ed2cb3942072824a3376337ea5492bf4e75 /sway/layout.c | |
parent | Merge pull request #110 from minus7/sign-comparsion-fix (diff) | |
download | sway-1a1ac64662a603fdeb7025bed3822e24f9158076.tar.gz sway-1a1ac64662a603fdeb7025bed3822e24f9158076.tar.zst sway-1a1ac64662a603fdeb7025bed3822e24f9158076.zip |
bugfixes, renames
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/sway/layout.c b/sway/layout.c index 573c6f70..446ad066 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -35,7 +35,7 @@ void add_child(swayc_t *parent, swayc_t *child) { | |||
35 | child->parent = parent; | 35 | child->parent = parent; |
36 | // set focus for this container | 36 | // set focus for this container |
37 | if (parent->children->length == 1) { | 37 | if (parent->children->length == 1) { |
38 | set_focused_container_for(parent, child); | 38 | parent->focused = child; |
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
@@ -46,7 +46,7 @@ void add_floating(swayc_t *ws, swayc_t *child) { | |||
46 | child->parent = ws; | 46 | child->parent = ws; |
47 | child->is_floating = true; | 47 | child->is_floating = true; |
48 | if (!ws->focused) { | 48 | if (!ws->focused) { |
49 | set_focused_container_for(ws, child); | 49 | ws->focused = child; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
@@ -71,7 +71,7 @@ swayc_t *replace_child(swayc_t *child, swayc_t *new_child) { | |||
71 | new_child->parent = child->parent; | 71 | new_child->parent = child->parent; |
72 | 72 | ||
73 | if (child->parent->focused == child) { | 73 | if (child->parent->focused == child) { |
74 | set_focused_container_for(child->parent, new_child); | 74 | child->parent->focused = new_child; |
75 | } | 75 | } |
76 | child->parent = NULL; | 76 | child->parent = NULL; |
77 | return parent; | 77 | return parent; |
@@ -100,7 +100,7 @@ swayc_t *remove_child(swayc_t *child) { | |||
100 | // Set focused to new container | 100 | // Set focused to new container |
101 | if (parent->focused == child) { | 101 | if (parent->focused == child) { |
102 | if (parent->children->length > 0) { | 102 | if (parent->children->length > 0) { |
103 | set_focused_container_for(parent, parent->children->items[i?i-1:0]); | 103 | parent->focused = parent->children->items[i?i-1:0]; |
104 | } else { | 104 | } else { |
105 | parent->focused = NULL; | 105 | parent->focused = NULL; |
106 | } | 106 | } |
@@ -328,35 +328,6 @@ void arrange_windows(swayc_t *container, double width, double height) { | |||
328 | layout_log(&root_container, 0); | 328 | layout_log(&root_container, 0); |
329 | } | 329 | } |
330 | 330 | ||
331 | swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent) { | ||
332 | if (parent->children == NULL) { | ||
333 | return NULL; | ||
334 | } | ||
335 | |||
336 | // Search for floating workspaces | ||
337 | int i; | ||
338 | if (parent->type == C_WORKSPACE) { | ||
339 | for (i = 0; i < parent->floating->length; ++i) { | ||
340 | swayc_t *child = parent->floating->items[i]; | ||
341 | if (child->handle == handle) { | ||
342 | return child; | ||
343 | } | ||
344 | } | ||
345 | } | ||
346 | |||
347 | for (i = 0; i < parent->children->length; ++i) { | ||
348 | swayc_t *child = parent->children->items[i]; | ||
349 | if (child->handle == handle) { | ||
350 | return child; | ||
351 | } else { | ||
352 | swayc_t *res; | ||
353 | if ((res = get_swayc_for_handle(handle, child))) { | ||
354 | return res; | ||
355 | } | ||
356 | } | ||
357 | } | ||
358 | return NULL; | ||
359 | } | ||
360 | 331 | ||
361 | swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir) { | 332 | swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir) { |
362 | swayc_t *parent = container->parent; | 333 | swayc_t *parent = container->parent; |