aboutsummaryrefslogtreecommitdiffstats
path: root/applied/dwm-sizehints-isfreesize-6.2.diff
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2022-08-12 12:40:18 +0200
committerJoe <bousset.rudy@gmail.com>2022-08-12 12:40:18 +0200
commitbc0b589fcc3592ab1d7b420a4a47f5a10fa9464c (patch)
treebdff1d887754aa975cc0bcc98787d129234038c8 /applied/dwm-sizehints-isfreesize-6.2.diff
parentgaps update (diff)
downloaddwm-bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c.tar.gz
dwm-bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c.tar.bz2
dwm-bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c.tar.xz
dwm-bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c.tar.zst
dwm-bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c.zip
update
Diffstat (limited to 'applied/dwm-sizehints-isfreesize-6.2.diff')
-rw-r--r--applied/dwm-sizehints-isfreesize-6.2.diff103
1 files changed, 103 insertions, 0 deletions
diff --git a/applied/dwm-sizehints-isfreesize-6.2.diff b/applied/dwm-sizehints-isfreesize-6.2.diff
new file mode 100644
index 0000000..bd9e5da
--- /dev/null
+++ b/applied/dwm-sizehints-isfreesize-6.2.diff
@@ -0,0 +1,103 @@
+From 5d4e92801206d47090236498d35f199e46dd07f6 Mon Sep 17 00:00:00 2001
+From: MLquest8 <miskuzius@gmail.com>
+Date: Sat, 20 Jun 2020 15:40:43 +0400
+Subject: [PATCH] sizehints-ruled now with a separate rule "isfreesize" and
+ cleaner code.
+
+---
+ config.def.h | 8 +++++---
+ dwm.c | 16 +++++++++++++---
+ 2 files changed, 18 insertions(+), 6 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..0e4a5ea 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -26,9 +26,11 @@ static const Rule rules[] = {
+ * WM_CLASS(STRING) = instance, class
+ * WM_NAME(STRING) = title
+ */
+- /* class instance title tags mask isfloating monitor */
+- { "Gimp", NULL, NULL, 0, 1, -1 },
+- { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
++ /* class instance title tags mask isfloating isfreesize monitor */
++ { "Gimp", NULL, NULL, 0, 1, 1, -1 },
++ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
++ { "st", NULL, NULL, 0, 0, 0, -1 },
++ { "St", NULL, NULL, 0, 0, 0, -1 }, /* St with Xresources patch */
+ };
+
+ /* layout(s) */
+diff --git a/dwm.c b/dwm.c
+index 9fd0286..73825d1 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -92,7 +92,7 @@ struct Client {
+ int basew, baseh, incw, inch, maxw, maxh, minw, minh;
+ int bw, oldbw;
+ unsigned int tags;
+- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
++ int isfixed, isfloating, isfreesize, isurgent, neverfocus, oldstate, isfullscreen;
+ Client *next;
+ Client *snext;
+ Monitor *mon;
+@@ -138,6 +138,7 @@ typedef struct {
+ const char *title;
+ unsigned int tags;
+ int isfloating;
++ int isfreesize;
+ int monitor;
+ } Rule;
+
+@@ -287,6 +288,7 @@ applyrules(Client *c)
+
+ /* rule matching */
+ c->isfloating = 0;
++ c->isfreesize = 1;
+ c->tags = 0;
+ XGetClassHint(dpy, c->win, &ch);
+ class = ch.res_class ? ch.res_class : broken;
+@@ -299,6 +301,7 @@ applyrules(Client *c)
+ && (!r->instance || strstr(instance, r->instance)))
+ {
+ c->isfloating = r->isfloating;
++ c->isfreesize = r->isfreesize;
+ c->tags |= r->tags;
+ for (m = mons; m && m->num != r->monitor; m = m->next);
+ if (m)
+@@ -1952,7 +1955,7 @@ updatesizehints(Client *c)
+
+ if (!XGetWMNormalHints(dpy, c->win, &size, &msize))
+ /* size is uninitialized, ensure that size.flags aren't used */
+- size.flags = PSize;
++ size.flags = 0;
+ if (size.flags & PBaseSize) {
+ c->basew = size.base_width;
+ c->baseh = size.base_height;
+@@ -1984,6 +1987,11 @@ updatesizehints(Client *c)
+ c->maxa = (float)size.max_aspect.x / size.max_aspect.y;
+ } else
+ c->maxa = c->mina = 0.0;
++ if((size.flags & PSize) && c->isfreesize) {
++ c->basew = size.base_width;
++ c->baseh = size.base_height;
++ c->isfloating = 1;
++ }
+ c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
+ }
+
+@@ -2012,8 +2020,10 @@ updatewindowtype(Client *c)
+
+ if (state == netatom[NetWMFullscreen])
+ setfullscreen(c, 1);
+- if (wtype == netatom[NetWMWindowTypeDialog])
++ if (wtype == netatom[NetWMWindowTypeDialog]) {
+ c->isfloating = 1;
++ c->isfreesize = 1;
++ }
+ }
+
+ void
+--
+2.26.2
+