From 9860867e1091bf5b5559d5bcdf37ff121e99bf75 Mon Sep 17 00:00:00 2001 From: Bakkeby Date: Wed, 26 Feb 2025 22:36:19 +0100 Subject: [PATCH] Adding dynamic padding patch - a variant of anysize that do not alter size hints ref. #168 --- patches.def.h | 9 +++++++++ st.h | 5 +++++ x.c | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/patches.def.h b/patches.def.h index b340aaa..ae7ac56 100644 --- a/patches.def.h +++ b/patches.def.h @@ -154,6 +154,15 @@ */ #define DYNAMIC_CURSOR_COLOR_PATCH 0 +/* This is a variant of the anysize patch that explicitly do not change the size increment hints, + * i.e. only keeping the dynamic padding which is the main thing the anysize patch introduces. + * In practice this means that the dynamic padding / anysize functionality only ever comes into + * effect when the size hints are intentionally ignored. + * An example of this would be dwm respecting the size hints of floating windows, but disrespecting + * the size hints when the window is tiled (provided that resizehints config is set to 0). + */ +#define DYNAMIC_PADDING_PATCH 0 + /* Reading and writing st's screen through a pipe, e.g. pass info to dmenu. * https://st.suckless.org/patches/externalpipe/ */ diff --git a/st.h b/st.h index 0464f24..4af046c 100644 --- a/st.h +++ b/st.h @@ -11,6 +11,11 @@ #include #include "patches.h" +#if DYNAMIC_PADDING_PATCH +#undef ANYSIZE_PATCH +#define ANYSIZE_PATCH 1 +#endif // DYNAMIC_PADDING_PATCH + /* macros */ #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) < (b) ? (b) : (a)) diff --git a/x.c b/x.c index a07b8cd..dde2900 100644 --- a/x.c +++ b/x.c @@ -1164,7 +1164,7 @@ xhints(void) sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize; sizeh->height = win.h; sizeh->width = win.w; - #if ANYSIZE_PATCH || ANYSIZE_SIMPLE_PATCH + #if ANYSIZE_PATCH && !DYNAMIC_PADDING_PATCH || ANYSIZE_SIMPLE_PATCH sizeh->height_inc = 1; sizeh->width_inc = 1; #else