mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 18:01:29 +00:00
Merge pull request #265 from sce/better_logging
debug_log: Improve container_log so that debug lines are aligned.
This commit is contained in:
commit
cbd7348704
|
@ -16,44 +16,43 @@
|
||||||
extern log_importance_t v;
|
extern log_importance_t v;
|
||||||
|
|
||||||
/* XXX:DEBUG:XXX */
|
/* XXX:DEBUG:XXX */
|
||||||
static void container_log(const swayc_t *c) {
|
static void container_log(const swayc_t *c, int depth) {
|
||||||
fprintf(stderr, "focus:%c|",
|
fprintf(stderr, "focus:%c",
|
||||||
c == get_focused_view(&root_container) ? 'K':
|
c == get_focused_view(&root_container) ? 'K':
|
||||||
c == get_focused_container(&root_container) ? 'F' : // Focused
|
c == get_focused_container(&root_container) ? 'F' : // Focused
|
||||||
c == swayc_active_workspace() ? 'W' : // active workspace
|
c == swayc_active_workspace() ? 'W' : // active workspace
|
||||||
c == &root_container ? 'R' : // root
|
c == &root_container ? 'R' : // root
|
||||||
'X');// not any others
|
'X');// not any others
|
||||||
fprintf(stderr,"(%p)",c);
|
for (int i = 6; i > depth; i--) { fprintf(stderr, " "); }
|
||||||
fprintf(stderr,"(p:%p)",c->parent);
|
fprintf(stderr,"|(%p)",c);
|
||||||
fprintf(stderr,"(f:%p)",c->focused);
|
fprintf(stderr,"(p:%-8p)",c->parent);
|
||||||
fprintf(stderr,"(h:%ld)",c->handle);
|
fprintf(stderr,"(f:%-8p)",c->focused);
|
||||||
fprintf(stderr,"Type:");
|
fprintf(stderr,"(h:%2ld)",c->handle);
|
||||||
fprintf(stderr,
|
fprintf(stderr,"Type:%-4s|",
|
||||||
c->type == C_ROOT ? "Root|" :
|
c->type == C_ROOT ? "root" :
|
||||||
c->type == C_OUTPUT ? "Output|" :
|
c->type == C_OUTPUT ? "op" :
|
||||||
c->type == C_WORKSPACE ? "Workspace|" :
|
c->type == C_WORKSPACE ? "ws" :
|
||||||
c->type == C_CONTAINER ? "Container|" :
|
c->type == C_CONTAINER ? "cont" :
|
||||||
c->type == C_VIEW ? "View|" : "Unknown|");
|
c->type == C_VIEW ? "view" : "?");
|
||||||
fprintf(stderr,"layout:");
|
fprintf(stderr,"layout:%-5s|",
|
||||||
fprintf(stderr,
|
c->layout == L_NONE ? "-" :
|
||||||
c->layout == L_NONE ? "NONE|" :
|
c->layout == L_HORIZ ? "Horiz":
|
||||||
c->layout == L_HORIZ ? "Horiz|":
|
c->layout == L_VERT ? "Vert":
|
||||||
c->layout == L_VERT ? "Vert|":
|
c->layout == L_STACKED ? "Stack":
|
||||||
c->layout == L_STACKED ? "Stacked|":
|
c->layout == L_FLOATING ? "Float":
|
||||||
c->layout == L_FLOATING ? "Floating|":
|
"Unknown");
|
||||||
"Unknown|");
|
fprintf(stderr, "w:%4.f|h:%4.f|", c->width, c->height);
|
||||||
fprintf(stderr, "w:%.f|h:%.f|", c->width, c->height);
|
fprintf(stderr, "x:%4.f|y:%4.f|", c->x, c->y);
|
||||||
fprintf(stderr, "x:%.f|y:%.f|", c->x, c->y);
|
fprintf(stderr, "g:%3d|",c->gaps);
|
||||||
fprintf(stderr, "g:%d|",c->gaps);
|
|
||||||
fprintf(stderr, "vis:%c|", c->visible?'t':'f');
|
fprintf(stderr, "vis:%c|", c->visible?'t':'f');
|
||||||
fprintf(stderr, "name:%.16s|", c->name);
|
fprintf(stderr, "children:%2d|",c->children?c->children->length:0);
|
||||||
fprintf(stderr, "children:%d\n",c->children?c->children->length:0);
|
fprintf(stderr, "name:%.16s\n", c->name);
|
||||||
}
|
}
|
||||||
void layout_log(const swayc_t *c, int depth) {
|
void layout_log(const swayc_t *c, int depth) {
|
||||||
if (L_DEBUG > v) return;
|
if (L_DEBUG > v) return;
|
||||||
int i, d;
|
int i, d;
|
||||||
int e = c->children ? c->children->length : 0;
|
int e = c->children ? c->children->length : 0;
|
||||||
container_log(c);
|
container_log(c, depth);
|
||||||
if (e) {
|
if (e) {
|
||||||
for (i = 0; i < e; ++i) {
|
for (i = 0; i < e; ++i) {
|
||||||
fputc('|',stderr);
|
fputc('|',stderr);
|
||||||
|
|
Loading…
Reference in a new issue