+static int searchl(tag_t *tag, win_t *target,
+ list_t **_dpy, list_t **_col, list_t **_row)
+{
+ 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) {
+ win_t *win = ROW(row)->win;
+ if (win == target) {
+ if (_dpy) *_dpy = dpy;
+ if (_col) *_col = col;
+ if (_row) *_row = row;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int search(tag_t *tag, win_t *target,
+ dpy_t **_dpy, col_t **_col, row_t **_row)
+{
+ list_t *dpy, *col, *row;
+ if (searchl(tag, target, &dpy, &col, &row)) {
+ if (_dpy) *_dpy = DPY(dpy);
+ if (_col) *_col = COL(col);
+ if (_row) *_row = ROW(row);
+ return 1;
+ }
+ return 0;
+}
+