summaryrefslogtreecommitdiff
path: root/patch/decorationhints.c
diff options
context:
space:
mode:
Diffstat (limited to 'patch/decorationhints.c')
-rw-r--r--patch/decorationhints.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/patch/decorationhints.c b/patch/decorationhints.c
new file mode 100644
index 0000000..78be5ea
--- /dev/null
+++ b/patch/decorationhints.c
@@ -0,0 +1,39 @@
+static Atom motifatom;
+
+void
+updatemotifhints(Client *c)
+{
+ Atom real;
+ int format;
+ unsigned char *p = NULL;
+ unsigned long n, extra;
+ unsigned long *motif;
+ int width, height;
+
+ if (!decorhints)
+ return;
+
+ if (XGetWindowProperty(dpy, c->win, motifatom, 0L, 5L, False, motifatom,
+ &real, &format, &n, &extra, &p) == Success && p != NULL) {
+ motif = (unsigned long*)p;
+ if (motif[MWM_HINTS_FLAGS_FIELD] & MWM_HINTS_DECORATIONS) {
+ width = WIDTH(c);
+ height = HEIGHT(c);
+
+ if (motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_ALL ||
+ motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_BORDER ||
+ motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_TITLE)
+ #if SETBORDERPX_PATCH
+ c->bw = c->oldbw = c->mon->borderpx;
+ #else
+ c->bw = c->oldbw = borderpx;
+ #endif // SETBORDERPX_PATCH
+ else
+ c->bw = c->oldbw = 0;
+
+ resize(c, c->x, c->y, width - (2*c->bw), height - (2*c->bw), 0);
+ }
+ XFree(p);
+ }
+}
+