[wiki] [sites] [dwm][PATCH] added sizehints-isfreesize for 6.2. || MLquest8

From: <git_AT_suckless.org>
Date: Sat, 20 Jun 2020 14:14:04 +0200

commit 743240a5b9a388c950f57dceb185484da394fe3c
Author: MLquest8 <miskuzius_AT_gmail.com>
Date: Sat Jun 20 16:10:04 2020 +0400

    [dwm][PATCH] added sizehints-isfreesize for 6.2.

diff --git a/dwm.suckless.org/patches/sizehints/dwm-sizehints-isfreesize-6.2.diff b/dwm.suckless.org/patches/sizehints/dwm-sizehints-isfreesize-6.2.diff
new file mode 100644
index 00000000..bd9e5dab
--- /dev/null
+++ b/dwm.suckless.org/patches/sizehints/dwm-sizehints-isfreesize-6.2.diff
_AT_@ -0,0 +1,103 @@
+From 5d4e92801206d47090236498d35f199e46dd07f6 Mon Sep 17 00:00:00 2001
+From: MLquest8 <miskuzius_AT_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
+_AT_@ -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
+_AT_@ -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;
+_AT_@ -138,6 +138,7 @@ typedef struct {
+ const char *title;
+ unsigned int tags;
+ int isfloating;
++ int isfreesize;
+ int monitor;
+ } Rule;
+
+_AT_@ -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;
+_AT_@ -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)
+_AT_@ -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;
+_AT_@ -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);
+ }
+
+_AT_@ -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
+
diff --git a/dwm.suckless.org/patches/sizehints/index.md b/dwm.suckless.org/patches/sizehints/index.md
index e735c336..a2485f4b 100644
--- a/dwm.suckless.org/patches/sizehints/index.md
+++ b/dwm.suckless.org/patches/sizehints/index.md
_AT_@ -10,8 +10,11 @@ windows freely - only the initial state is affected.
 
 Ruled
 -----
-Ruled version is essentially the same patch except it obeys `isfloating` rule
-if it is available in `config.h` for the given client.
+This version adds `isfreesize` rule to config which if set to 1 will enable
+the functionality of the patch. If rules for the given client aren't set in
+config dwm will set it to `1` and the client will benefit from `isfreesize`
+rule if it has specific initial size requirements.
+`isfreesize` rule overrides `isfloating` rule in config.
 
 Vanilla
 -------
_AT_@ -22,8 +25,8 @@ There is no configuration for this version of the patch.
 
 Download
 --------
-* [dwm-sizehints-ruled-6.2.diff](dwm-sizehints-ruled-6.2.diff) (14/06/2020)
-* dwm-sizehints-ruled-6.2.diff (deprecated) (12/06/2020)
+* [dwm-sizehints-isfreesize-6.2.diff](dwm-sizehints-isfreesize-6.2.diff) (20/06/2020)
+* [dwm-sizehints-ruled-6.2.diff](dwm-sizehints-ruled-6.2.diff) (deprecated) (14/06/2020)
 * [dwm-sizehints-6.2.diff](dwm-sizehints-6.2.diff) (12/06/2020)
 * [dwm-sizehints-5.7.2.diff](dwm-sizehints-5.7.2.diff) (695B) (20091221)
 
Received on Sat Jun 20 2020 - 14:14:04 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 20 2020 - 14:24:41 CEST