diff options
Diffstat (limited to 'sway/debug-tree.c')
-rw-r--r-- | sway/debug-tree.c | 12 |
1 files changed, 9 insertions, 3 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); |