Adding the isfreesize version of the sizehints patch ref. #229

This commit is contained in:
bakkeby 2022-02-11 10:10:28 +01:00
parent a0751271bc
commit 90e4dfc0cf
3 changed files with 36 additions and 4 deletions

View File

@ -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

25
dwm.c
View File

@ -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;

View File

@ -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