+/* Helpers */
+static int add_strut(win_t *root, win_t *win)
+{
+ /* Get X11 strut data */
+ Atom ret_type;
+ int ret_size;
+ unsigned long ret_items, bytes_left;
+ unsigned char *xdata;
+ int status = XGetWindowProperty(win->sys->dpy, win->sys->xid,
+ atoms[net_strut], 0L, 4L, False, XA_CARDINAL,
+ &ret_type, &ret_size, &ret_items, &bytes_left, &xdata);
+ if (status != Success || ret_size != 32 || ret_items != 4)
+ return 0;
+
+ int left = ((int*)xdata)[0];
+ int right = ((int*)xdata)[1];
+ int top = ((int*)xdata)[2];
+ int bottom = ((int*)xdata)[3];
+ if (left == 0 && right == 0 && top == 0 && bottom == 0)
+ return 0;
+
+ win->sys->strut.left = left;
+ win->sys->strut.right = right;
+ win->sys->strut.top = top;
+ win->sys->strut.bottom = bottom;
+ root->x += left;
+ root->y += top;
+ root->w -= left+right;
+ root->h -= top+bottom;
+ return 1;
+}
+
+static int del_strut(win_t *root, win_t *win)
+{
+ int left = win->sys->strut.left;
+ int right = win->sys->strut.right;
+ int top = win->sys->strut.top;
+ int bottom = win->sys->strut.bottom;
+ if (left == 0 && right == 0 && top == 0 && bottom == 0)
+ return 0;
+
+ root->x -= left;
+ root->y -= top;
+ root->w += left+right;
+ root->h += top+bottom;
+ return 1;
+}
+