summaryrefslogtreecommitdiffstats
path: root/sway/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/log.c')
-rw-r--r--sway/log.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/sway/log.c b/sway/log.c
index 5bd3c8dc..9b9a9dc0 100644
--- a/sway/log.c
+++ b/sway/log.c
@@ -82,3 +82,62 @@ bool sway_assert(bool condition, const char* format, ...) {
82 82
83 return false; 83 return false;
84} 84}
85
86#include "workspace.h"
87
88/* XXX:DEBUG:XXX */
89static void container_log(const swayc_t *c) {
90 fprintf(stderr, "focus:%c|",
91 c->is_focused ? 'F' : //Focused
92 c == active_workspace ? 'W' : //active workspace
93 c == &root_container ? 'R' : //root
94 'X');//not any others
95 fprintf(stderr,"(%p)",c);
96 fprintf(stderr,"(p:%p)",c->parent);
97 fprintf(stderr,"(f:%p)",c->focused);
98 fprintf(stderr,"(h:%ld)",c->handle);
99 fprintf(stderr,"Type:");
100 fprintf(stderr,
101 c->type == C_ROOT ? "Root|" :
102 c->type == C_OUTPUT ? "Output|" :
103 c->type == C_WORKSPACE ? "Workspace|" :
104 c->type == C_CONTAINER ? "Container|" :
105 c->type == C_VIEW ? "View|" : "Unknown|");
106 fprintf(stderr,"layout:");
107 fprintf(stderr,
108 c->layout == L_NONE ? "NONE|" :
109 c->layout == L_HORIZ ? "Horiz|":
110 c->layout == L_VERT ? "Vert|":
111 c->layout == L_STACKED ? "Stacked|":
112 c->layout == L_FLOATING ? "Floating|":
113 "Unknown|");
114 fprintf(stderr, "w:%d|h:%d|", c->width, c->height);
115 fprintf(stderr, "x:%d|y:%d|", c->x, c->y);
116 fprintf(stderr, "vis:%c|", c->visible?'t':'f');
117 fprintf(stderr, "wgt:%d|", c->weight);
118 fprintf(stderr, "name:%.16s|", c->name);
119 fprintf(stderr, "children:%d\n",c->children?c->children->length:0);
120}
121void layout_log(const swayc_t *c, int depth) {
122 int i, d;
123 int e = c->children ? c->children->length : 0;
124 container_log(c);
125 if (e) {
126 for (i = 0; i < e; ++i) {
127 fputc('|',stderr);
128 for (d = 0; d < depth; ++d) fputc('-', stderr);
129 layout_log(c->children->items[i], depth + 1);
130 }
131 }
132 if (c->type == C_WORKSPACE) {
133 e = c->floating?c->floating->length:0;
134 if (e) {
135 for (i = 0; i < e; ++i) {
136 fputc('|',stderr);
137 for (d = 0; d < depth; ++d) fputc('=', stderr);
138 layout_log(c->floating->items[i], depth + 1);
139 }
140 }
141 }
142}
143/* XXX:DEBUG:XXX */