From a5e9038297516dd47726394c7223bab793718f6f Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 12 Nov 2020 17:11:33 +0100 Subject: Added sizehints patch --- dwm.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index f623f20..3b8f890 100644 --- a/dwm.c +++ b/dwm.c @@ -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, isfreesize, isurgent, neverfocus, oldstate, isfullscreen; Client *next; Client *snext; Monitor *mon; @@ -141,6 +141,7 @@ typedef struct { const char *title; unsigned int tags; int isfloating; + int isfreesize; int monitor; } Rule; @@ -334,6 +335,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; @@ -346,6 +348,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) @@ -2270,7 +2273,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; @@ -2302,6 +2305,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); } @@ -2330,8 +2338,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 -- cgit v1.2.3