summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2022-02-11 10:10:28 +0100
committerbakkeby <[email protected]>2022-02-11 11:43:36 +0100
commit90e4dfc0cf76a3126981c443dd3013a7ccf049bc (patch)
tree2092089db22c26035fdb3f5a86478fdbcc0b9566
parenta0751271bc6f3d45f165f750915e464f90336d0d (diff)
downloaddwm-flexipatch-90e4dfc0cf76a3126981c443dd3013a7ccf049bc.tar.gz
dwm-flexipatch-90e4dfc0cf76a3126981c443dd3013a7ccf049bc.zip
Adding the isfreesize version of the sizehints patch ref. #229
-rw-r--r--README.md2
-rw-r--r--dwm.c25
-rw-r--r--patches.def.h13
3 files changed, 36 insertions, 4 deletions
diff --git a/README.md b/README.md
index 3fc48f5..abec291 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,8 @@ If you are experiencing issues then you may want to check out the [Known Issues]
### Changelog:
+2022-02-11 - Added the isfreesize version of the sizehints patch
+
2021-11-23 - Added the taglabels and underlinetags patches
2021-09-08 - Added the alwayscenter patch
diff --git a/dwm.c b/dwm.c
index 03ea7c3..95d7cf8 100644
--- a/dwm.c
+++ b/dwm.c
@@ -368,6 +368,9 @@ struct Client {
#if PLACEMOUSE_PATCH
int beingmoved;
#endif // PLACEMOUSE_PATCH
+ #if SIZEHINTS_ISFREESIZE_PATCH
+ int isfreesize;
+ #endif // SIZEHINTS_ISFREESIZE_PATCH
#if SWALLOW_PATCH
int isterminal, noswallow;
pid_t pid;
@@ -515,6 +518,9 @@ typedef struct {
#if SELECTIVEFAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH && !FAKEFULLSCREEN_PATCH
int isfakefullscreen;
#endif // SELECTIVEFAKEFULLSCREEN_PATCH
+ #if SIZEHINTS_ISFREESIZE_PATCH
+ int isfreesize;
+ #endif // SIZEHINTS_ISFREESIZE_PATCH
#if ISPERMANENT_PATCH
int ispermanent;
#endif // ISPERMANENT_PATCH
@@ -825,6 +831,9 @@ applyrules(Client *c)
#if SWALLOW_PATCH
c->noswallow = -1;
#endif // SWALLOW_PATCH
+ #if SIZEHINTS_ISFREESIZE_PATCH
+ c->isfreesize = 1;
+ #endif // SIZEHINTS_ISFREESIZE_PATCH
c->isfloating = 0;
c->tags = 0;
XGetClassHint(dpy, c->win, &ch);
@@ -863,6 +872,9 @@ applyrules(Client *c)
c->isterminal = r->isterminal;
c->noswallow = r->noswallow;
#endif // SWALLOW_PATCH
+ #if SIZEHINTS_ISFREESIZE_PATCH
+ c->isfreesize = r->isfreesize;
+ #endif // SIZEHINTS_ISFREESIZE_PATCH
c->isfloating = r->isfloating;
c->tags |= r->tags;
#if SCRATCHPADS_PATCH
@@ -4533,11 +4545,11 @@ updatesizehints(Client *c)
if (!XGetWMNormalHints(dpy, c->win, &size, &msize))
/* size is uninitialized, ensure that size.flags aren't used */
- #if SIZEHINTS_PATCH || SIZEHINTS_RULED_PATCH
+ #if SIZEHINTS_PATCH || SIZEHINTS_RULED_PATCH || SIZEHINTS_ISFREESIZE_PATCH
size.flags = 0;
#else
size.flags = PSize;
- #endif // SIZEHINTS_PATCH | SIZEHINTS_RULED_PATCH
+ #endif // SIZEHINTS_PATCH | SIZEHINTS_RULED_PATCH | SIZEHINTS_ISFREESIZE_PATCH
if (size.flags & PBaseSize) {
c->basew = size.base_width;
c->baseh = size.base_height;
@@ -4569,8 +4581,13 @@ updatesizehints(Client *c)
c->maxa = (float)size.max_aspect.x / size.max_aspect.y;
} else
c->maxa = c->mina = 0.0;
- #if SIZEHINTS_PATCH || SIZEHINTS_RULED_PATCH
- if (size.flags & PSize) {
+ #if SIZEHINTS_PATCH || SIZEHINTS_RULED_PATCH || SIZEHINTS_ISFREESIZE_PATCH
+ #if SIZEHINTS_ISFREESIZE_PATCH
+ if ((size.flags & PSize) && c->isfreesize)
+ #else
+ if (size.flags & PSize)
+ #endif // SIZEHINTS_ISFREESIZE_PATCH
+ {
c->basew = size.base_width;
c->baseh = size.base_height;
c->isfloating = 1;
diff --git a/patches.def.h b/patches.def.h
index 037c5ee..3d59e2e 100644
--- a/patches.def.h
+++ b/patches.def.h
@@ -970,6 +970,19 @@
*/
#define SIZEHINTS_RULED_PATCH 0
+/* This patch makes dwm obey even "soft" sizehints for new clients. The isfreesize
+ * version is similar to the sizehints ruled patch except it allows you to specify
+ * via client rules which clients this should apply to. Soft sizehints applies by
+ * default to clients that are not ruled, and will be disabled by default for clients
+ * that are.
+ *
+ * Example client rule enabling soft sizehints:
+ * - RULE(.wintype = WTYPE "DIALOG", .isfloating = 1, .isfreesize = 1)
+ *
+ * https://dwm.suckless.org/patches/sizehints/
+ */
+#define SIZEHINTS_ISFREESIZE_PATCH 0
+
/* In a multi-head setup monitor 0 is by default the primary screen, with the left and right
* screen being monitor 1 and 2 respectively. This patch sorts screens left to right (or
* top to bottom in a vertical layout) which aims to address some inconsistencies when it