summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-08-11 10:17:02 +0200
committerbakkeby <[email protected]>2020-08-11 10:17:02 +0200
commit10f4d513ec5df78db1c2b83706c208c3032e64ca (patch)
treef4d973870d2583b491f217648ecdf8d25322f405 /patch
parent14e148be2a3dbcfd20cbf7c8f58c1c543f63c4b7 (diff)
downloaddwm-flexipatch-10f4d513ec5df78db1c2b83706c208c3032e64ca.tar.gz
dwm-flexipatch-10f4d513ec5df78db1c2b83706c208c3032e64ca.zip
Adding decoration hints patch
Diffstat (limited to 'patch')
-rw-r--r--patch/decorationhints.c34
-rw-r--r--patch/decorationhints.h8
-rw-r--r--patch/include.c3
-rw-r--r--patch/include.h3
4 files changed, 48 insertions, 0 deletions
diff --git a/patch/decorationhints.c b/patch/decorationhints.c
new file mode 100644
index 0000000..a7498ee
--- /dev/null
+++ b/patch/decorationhints.c
@@ -0,0 +1,34 @@
+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)
+ c->bw = c->oldbw = borderpx;
+ else
+ c->bw = c->oldbw = 0;
+
+ resize(c, c->x, c->y, width - (2*c->bw), height - (2*c->bw), 0);
+ }
+ XFree(p);
+ }
+} \ No newline at end of file
diff --git a/patch/decorationhints.h b/patch/decorationhints.h
new file mode 100644
index 0000000..3a9c641
--- /dev/null
+++ b/patch/decorationhints.h
@@ -0,0 +1,8 @@
+#define MWM_HINTS_FLAGS_FIELD 0
+#define MWM_HINTS_DECORATIONS_FIELD 2
+#define MWM_HINTS_DECORATIONS (1 << 1)
+#define MWM_DECOR_ALL (1 << 0)
+#define MWM_DECOR_BORDER (1 << 1)
+#define MWM_DECOR_TITLE (1 << 3)
+
+static void updatemotifhints(Client *c); \ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index 81901a1..68ff0c1 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -82,6 +82,9 @@
#if CYCLELAYOUTS_PATCH
#include "cyclelayouts.c"
#endif
+#if DECORATION_HINTS_PATCH
+#include "decorationhints.c"
+#endif
#if DRAGCFACT_PATCH && CFACTS_PATCH
#include "dragcfact.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index a556964..6b695a1 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -79,6 +79,9 @@
#if CYCLELAYOUTS_PATCH
#include "cyclelayouts.h"
#endif
+#if DECORATION_HINTS_PATCH
+#include "decorationhints.h"
+#endif
#if DRAGCFACT_PATCH && CFACTS_PATCH
#include "dragcfact.h"
#endif