[hackers] [dwm] [PATCH] per client resizehints

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Thu, 27 Oct 2016 14:34:34 +0200

---
Heyho Anselm,
here you go. Per client resize hints. Since the client struct is always
initialized with zeroes to preserve behaviour either the meaning has to be
reversed ("ignorehints"?) or a default rule with class, instance and title
set to NULL has to be added.
--Markus
 config.def.h | 7 +++----
 dwm.c        | 6 ++++--
 2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/config.def.h b/config.def.h
index deb1584..175ab7f 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -26,15 +26,14 @@ 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   resizehints   monitor */
+	{ "Gimp",     NULL,       NULL,       0,            1,           1,            -1 },
+	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           1,            -1 },
 };
 
 /* layout(s) */
 static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */
 static const int nmaster     = 1;    /* number of clients in master area */
-static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
 
 static const Layout layouts[] = {
 	/* symbol     arrange function */
diff --git a/dwm.c b/dwm.c
index ab448a3..5cd7609 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -93,7 +93,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, isurgent, neverfocus, oldstate, isfullscreen, resizehints;
 	Client *next;
 	Client *snext;
 	Monitor *mon;
_AT_@ -139,6 +139,7 @@ typedef struct {
 	const char *title;
 	unsigned int tags;
 	int isfloating;
+	int resizehints;
 	int monitor;
 } Rule;
 
_AT_@ -299,6 +300,7 @@ applyrules(Client *c)
 		&& (!r->instance || strstr(instance, r->instance)))
 		{
 			c->isfloating = r->isfloating;
+			c->resizehints = r->resizehints;
 			c->tags |= r->tags;
 			for (m = mons; m && m->num != r->monitor; m = m->next);
 			if (m)
_AT_@ -344,7 +346,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
 		*h = bh;
 	if (*w < bh)
 		*w = bh;
-	if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
+	if (c->resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
 		/* see last two sentences in ICCCM 4.1.2.3 */
 		baseismin = c->basew == c->minw && c->baseh == c->minh;
 		if (!baseismin) { /* temporarily remove base dimensions */
-- 
2.7.3
Received on Thu Oct 27 2016 - 14:34:34 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 27 2016 - 14:36:14 CEST