diff options
author | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-11-27 17:00:12 +0100 |
---|---|---|
committer | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-11-27 17:49:07 +0100 |
commit | c1d88acf7221aec4c58c18f93fc845393646e580 (patch) | |
tree | d943908ffba509cdeb1179e10a069c96632c6783 | |
parent | Merge pull request #263 from sce/floating_enable_disable (diff) | |
download | sway-c1d88acf7221aec4c58c18f93fc845393646e580.tar.gz sway-c1d88acf7221aec4c58c18f93fc845393646e580.tar.zst sway-c1d88acf7221aec4c58c18f93fc845393646e580.zip |
debug_log: Improve container_log so that debug lines are aligned.
Makes the log easier to read, and the developers more happy (this one at
least).
-rw-r--r-- | sway/debug_log.c | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/sway/debug_log.c b/sway/debug_log.c index 4cb97561..8b30ed45 100644 --- a/sway/debug_log.c +++ b/sway/debug_log.c | |||
@@ -16,44 +16,43 @@ | |||
16 | extern log_importance_t v; | 16 | extern log_importance_t v; |
17 | 17 | ||
18 | /* XXX:DEBUG:XXX */ | 18 | /* XXX:DEBUG:XXX */ |
19 | static void container_log(const swayc_t *c) { | 19 | static void container_log(const swayc_t *c, int depth) { |
20 | fprintf(stderr, "focus:%c|", | 20 | fprintf(stderr, "focus:%c", |
21 | c == get_focused_view(&root_container) ? 'K': | 21 | c == get_focused_view(&root_container) ? 'K': |
22 | c == get_focused_container(&root_container) ? 'F' : // Focused | 22 | c == get_focused_container(&root_container) ? 'F' : // Focused |
23 | c == swayc_active_workspace() ? 'W' : // active workspace | 23 | c == swayc_active_workspace() ? 'W' : // active workspace |
24 | c == &root_container ? 'R' : // root | 24 | c == &root_container ? 'R' : // root |
25 | 'X');// not any others | 25 | 'X');// not any others |
26 | fprintf(stderr,"(%p)",c); | 26 | for (int i = 6; i > depth; i--) { fprintf(stderr, " "); } |
27 | fprintf(stderr,"(p:%p)",c->parent); | 27 | fprintf(stderr,"|(%p)",c); |
28 | fprintf(stderr,"(f:%p)",c->focused); | 28 | fprintf(stderr,"(p:%-8p)",c->parent); |
29 | fprintf(stderr,"(h:%ld)",c->handle); | 29 | fprintf(stderr,"(f:%-8p)",c->focused); |
30 | fprintf(stderr,"Type:"); | 30 | fprintf(stderr,"(h:%2ld)",c->handle); |
31 | fprintf(stderr, | 31 | fprintf(stderr,"Type:%-4s|", |
32 | c->type == C_ROOT ? "Root|" : | 32 | c->type == C_ROOT ? "root" : |
33 | c->type == C_OUTPUT ? "Output|" : | 33 | c->type == C_OUTPUT ? "op" : |
34 | c->type == C_WORKSPACE ? "Workspace|" : | 34 | c->type == C_WORKSPACE ? "ws" : |
35 | c->type == C_CONTAINER ? "Container|" : | 35 | c->type == C_CONTAINER ? "cont" : |
36 | c->type == C_VIEW ? "View|" : "Unknown|"); | 36 | c->type == C_VIEW ? "view" : "?"); |
37 | fprintf(stderr,"layout:"); | 37 | fprintf(stderr,"layout:%-5s|", |
38 | fprintf(stderr, | 38 | c->layout == L_NONE ? "-" : |
39 | c->layout == L_NONE ? "NONE|" : | 39 | c->layout == L_HORIZ ? "Horiz": |
40 | c->layout == L_HORIZ ? "Horiz|": | 40 | c->layout == L_VERT ? "Vert": |
41 | c->layout == L_VERT ? "Vert|": | 41 | c->layout == L_STACKED ? "Stack": |
42 | c->layout == L_STACKED ? "Stacked|": | 42 | c->layout == L_FLOATING ? "Float": |
43 | c->layout == L_FLOATING ? "Floating|": | 43 | "Unknown"); |
44 | "Unknown|"); | 44 | fprintf(stderr, "w:%4.f|h:%4.f|", c->width, c->height); |
45 | fprintf(stderr, "w:%.f|h:%.f|", c->width, c->height); | 45 | fprintf(stderr, "x:%4.f|y:%4.f|", c->x, c->y); |
46 | fprintf(stderr, "x:%.f|y:%.f|", c->x, c->y); | 46 | fprintf(stderr, "g:%3d|",c->gaps); |
47 | fprintf(stderr, "g:%d|",c->gaps); | ||
48 | fprintf(stderr, "vis:%c|", c->visible?'t':'f'); | 47 | fprintf(stderr, "vis:%c|", c->visible?'t':'f'); |
49 | fprintf(stderr, "name:%.16s|", c->name); | 48 | fprintf(stderr, "children:%2d|",c->children?c->children->length:0); |
50 | fprintf(stderr, "children:%d\n",c->children?c->children->length:0); | 49 | fprintf(stderr, "name:%.16s\n", c->name); |
51 | } | 50 | } |
52 | void layout_log(const swayc_t *c, int depth) { | 51 | void layout_log(const swayc_t *c, int depth) { |
53 | if (L_DEBUG > v) return; | 52 | if (L_DEBUG > v) return; |
54 | int i, d; | 53 | int i, d; |
55 | int e = c->children ? c->children->length : 0; | 54 | int e = c->children ? c->children->length : 0; |
56 | container_log(c); | 55 | container_log(c, depth); |
57 | if (e) { | 56 | if (e) { |
58 | for (i = 0; i < e; ++i) { | 57 | for (i = 0; i < e; ++i) { |
59 | fputc('|',stderr); | 58 | fputc('|',stderr); |