diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-06 15:54:03 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-04-06 15:54:03 -0400 |
commit | df0d57b91660913659ba032fcb188b2d65e5c689 (patch) | |
tree | 4e3977c3fb499d92150d895cacb49f4d8dbdc7e1 | |
parent | Fix moving to parallel container on another output (diff) | |
download | sway-df0d57b91660913659ba032fcb188b2d65e5c689.tar.gz sway-df0d57b91660913659ba032fcb188b2d65e5c689.tar.zst sway-df0d57b91660913659ba032fcb188b2d65e5c689.zip |
Fix issue with incorrectly rejiggered workspaces
-rw-r--r-- | sway/debug-tree.c | 12 | ||||
-rw-r--r-- | sway/tree/layout.c | 9 |
2 files changed, 15 insertions, 6 deletions
diff --git a/sway/debug-tree.c b/sway/debug-tree.c index 07c48a25..d803d07b 100644 --- a/sway/debug-tree.c +++ b/sway/debug-tree.c | |||
@@ -38,6 +38,7 @@ static int draw_container(cairo_t *cairo, struct sway_container *container, | |||
38 | container_type_to_str(container->type), container->id, container->name, | 38 | container_type_to_str(container->type), container->id, container->name, |
39 | layout_to_str(container->layout), | 39 | layout_to_str(container->layout), |
40 | container->width, container->height, container->x, container->y); | 40 | container->width, container->height, container->x, container->y); |
41 | cairo_save(cairo); | ||
41 | cairo_rectangle(cairo, x + 2, y, text_width - 2, text_height); | 42 | cairo_rectangle(cairo, x + 2, y, text_width - 2, text_height); |
42 | cairo_set_source_u32(cairo, 0xFFFFFFE0); | 43 | cairo_set_source_u32(cairo, 0xFFFFFFE0); |
43 | cairo_fill(cairo); | 44 | cairo_fill(cairo); |
@@ -45,17 +46,21 @@ static int draw_container(cairo_t *cairo, struct sway_container *container, | |||
45 | if (container->children) { | 46 | if (container->children) { |
46 | for (int i = 0; i < container->children->length; ++i) { | 47 | for (int i = 0; i < container->children->length; ++i) { |
47 | struct sway_container *child = container->children->items[i]; | 48 | struct sway_container *child = container->children->items[i]; |
49 | if (child->parent == container) { | ||
50 | cairo_set_source_u32(cairo, 0x000000FF); | ||
51 | } else { | ||
52 | cairo_set_source_u32(cairo, 0xFF0000FF); | ||
53 | } | ||
48 | height += draw_container(cairo, child, focus, x + 10, y + height); | 54 | height += draw_container(cairo, child, focus, x + 10, y + height); |
49 | } | 55 | } |
50 | } | 56 | } |
51 | cairo_set_source_u32(cairo, 0xFFFFFFE0); | 57 | cairo_set_source_u32(cairo, 0xFFFFFFE0); |
52 | cairo_rectangle(cairo, x, y, 2, height); | 58 | cairo_rectangle(cairo, x, y, 2, height); |
53 | cairo_fill(cairo); | 59 | cairo_fill(cairo); |
60 | cairo_restore(cairo); | ||
54 | cairo_move_to(cairo, x, y); | 61 | cairo_move_to(cairo, x, y); |
55 | if (focus == container) { | 62 | if (focus == container) { |
56 | cairo_set_source_u32(cairo, 0xFF0000FF); | 63 | cairo_set_source_u32(cairo, 0x0000FFFF); |
57 | } else { | ||
58 | cairo_set_source_u32(cairo, 0x000000FF); | ||
59 | } | 64 | } |
60 | pango_printf(cairo, "monospace", 1, false, "%s id:%zd '%s' %s %dx%d@%d,%d", | 65 | pango_printf(cairo, "monospace", 1, false, "%s id:%zd '%s' %s %dx%d@%d,%d", |
61 | container_type_to_str(container->type), container->id, container->name, | 66 | container_type_to_str(container->type), container->id, container->name, |
@@ -95,6 +100,7 @@ void update_debug_tree() { | |||
95 | if (seat != NULL) { | 100 | if (seat != NULL) { |
96 | focus = seat_get_focus(seat); | 101 | focus = seat_get_focus(seat); |
97 | } | 102 | } |
103 | cairo_set_source_u32(cairo, 0x000000FF); | ||
98 | draw_container(cairo, &root_container, focus, 0, 0); | 104 | draw_container(cairo, &root_container, focus, 0, 0); |
99 | 105 | ||
100 | cairo_surface_flush(surface); | 106 | cairo_surface_flush(surface); |
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index a3bee883..5dbf4830 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -334,9 +334,12 @@ void container_move(struct sway_container *container, | |||
334 | } | 334 | } |
335 | case C_WORKSPACE: | 335 | case C_WORKSPACE: |
336 | if (!is_parallel(current->layout, move_dir)) { | 336 | if (!is_parallel(current->layout, move_dir)) { |
337 | // Special case | 337 | if (current->children->length != 1) { |
338 | wlr_log(L_DEBUG, "Rejiggering the workspace"); | 338 | // Special case |
339 | workspace_rejigger(current, container, move_dir); | 339 | wlr_log(L_DEBUG, "Rejiggering the workspace (%d kiddos)", |
340 | current->children->length); | ||
341 | workspace_rejigger(current, container, move_dir); | ||
342 | } | ||
340 | return; | 343 | return; |
341 | } else { | 344 | } else { |
342 | wlr_log(L_DEBUG, "Selecting output"); | 345 | wlr_log(L_DEBUG, "Selecting output"); |