+typedef struct {
+ win_t *win; // the window
+ int x, y, w, h; // position of window (in this tag)
+} flt_t;
+
+typedef struct {
+ list_t *cols; // of col_t
+ col_t *col; // focused col
+ list_t *flts; // of flt_t
+ flt_t *flt; // focused flt
+ layer_t layer; // focused layer
+ win_t *geom; // display size and position
+} dpy_t;
+
+typedef struct {
+ list_t *dpys; // of dpy_t
+ dpy_t *dpy; // focused dpy
+ int name; // tag name
+} tag_t;
+
+typedef struct {
+ list_t *tags; // of tag_t
+ tag_t *tag; // focused tag
+ win_t *root; // root/background window
+ list_t *screens; // display geometry
+} wm_t;
+
+#define WIN(node) ((win_t*)(node)->data)
+#define ROW(node) ((row_t*)(node)->data)
+#define COL(node) ((col_t*)(node)->data)
+#define FLT(node) ((flt_t*)(node)->data)
+#define DPY(node) ((dpy_t*)(node)->data)
+#define TAG(node) ((tag_t*)(node)->data)
+
+#define tag_foreach_col(tag, dpy, col, row, win) \
+ for (list_t *dpy = tag ->dpys; dpy; dpy = dpy->next) \
+ for (list_t *col = DPY(dpy)->cols; col; col = col->next) \
+ for (list_t *row = COL(col)->rows; row; row = row->next) \
+ for (win_t *win = ROW(row)->win; win; win = NULL)
+
+#define tag_foreach_flt(tag, dpy, flt, win) \
+ for (list_t *dpy = tag ->dpys; dpy; dpy = dpy->next) \
+ for (list_t *flt = DPY(dpy)->flts; flt; flt = flt->next) \
+ for (win_t *win = FLT(flt)->win; win; win = NULL) \
+
+/* Window management data
+ * wm_* macros represent the currently focused item
+ * _only_ wm_focus protects against NULL pointers */
+static wm_t *wm;
+#define wm_tag wm->tag
+#define wm_dpy wm->tag->dpy
+#define wm_col wm->tag->dpy->col
+#define wm_row wm->tag->dpy->col->row
+#define wm_flt wm->tag->dpy->flt
+#define wm_focus get_focus()
+