[wiki] [sites] [st][patch][anysize] stop window resizing when moved via dwn[moveresize] patch See https://lists.suckless.org/hackers/2010/17635.html || Finn Rayment

From: <git_AT_suckless.org>
Date: Sat, 03 Oct 2020 15:10:30 +0200

commit f1e401e0d5304ce603aea5746b9ec8763a2c0bb0
Author: Finn Rayment <finn_AT_rayment.fr>
Date: Sat Oct 3 15:05:10 2020 +0200

    [st][patch][anysize] stop window resizing when moved via dwn[moveresize] patch
    See https://lists.suckless.org/hackers/2010/17635.html

diff --git a/st.suckless.org/patches/anysize/index.md b/st.suckless.org/patches/anysize/index.md
index 8b549729..e41b9f3b 100644
--- a/st.suckless.org/patches/anysize/index.md
+++ b/st.suckless.org/patches/anysize/index.md
_AT_@ -17,6 +17,7 @@ fill the entire space allocated to it.
 Download
 --------
 * [st-anysize-0.8.1.diff](st-anysize-0.8.1.diff)
+* [st-anysize-20201003-407a3d0.diff](st-anysize-20201003-407a3d0.diff)
 
 Authors
 -------
diff --git a/st.suckless.org/patches/anysize/st-anysize-20201003-407a3d0.diff b/st.suckless.org/patches/anysize/st-anysize-20201003-407a3d0.diff
new file mode 100644
index 00000000..b5f5d149
--- /dev/null
+++ b/st.suckless.org/patches/anysize/st-anysize-20201003-407a3d0.diff
_AT_@ -0,0 +1,153 @@
+From 407a3d065645ee814e04a6c62a2d2dea04a1c18c Mon Sep 17 00:00:00 2001
+From: Finn Rayment <finn_AT_rayment.fr>
+Date: Sat, 3 Oct 2020 14:47:04 +0200
+Subject: [PATCH] Applied anysize patch fix
+
+---
+ x.c | 52 ++++++++++++++++++++++++++++------------------------
+ 1 file changed, 28 insertions(+), 24 deletions(-)
+
+diff --git a/x.c b/x.c
+index 210f184..a11a992 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -81,6 +81,7 @@ typedef XftGlyphFontSpec GlyphFontSpec;
+ typedef struct {
+ int tw, th; /* tty width and height */
+ int w, h; /* window width and height */
++ int hborderpx, vborderpx;
+ int ch; /* char height */
+ int cw; /* char width */
+ int mode; /* window state/mode flags */
+_AT_@ -331,7 +332,7 @@ ttysend(const Arg *arg)
+ int
+ evcol(XEvent *e)
+ {
+- int x = e->xbutton.x - borderpx;
++ int x = e->xbutton.x - win.hborderpx;
+ LIMIT(x, 0, win.tw - 1);
+ return x / win.cw;
+ }
+_AT_@ -339,7 +340,7 @@ evcol(XEvent *e)
+ int
+ evrow(XEvent *e)
+ {
+- int y = e->xbutton.y - borderpx;
++ int y = e->xbutton.y - win.vborderpx;
+ LIMIT(y, 0, win.th - 1);
+ return y / win.ch;
+ }
+_AT_@ -721,6 +722,9 @@ cresize(int width, int height)
+ col = MAX(1, col);
+ row = MAX(1, row);
+
++ win.hborderpx = (win.w - col * win.cw) / 2;
++ win.vborderpx = (win.h - row * win.ch) / 2;
++
+ tresize(col, row);
+ xresize(col, row);
+ ttyresize(win.tw, win.th);
+_AT_@ -1121,8 +1125,8 @@ xinit(int cols, int rows)
+ xloadcols();
+
+ /* adjust fixed window geometry */
+- win.w = 2 * borderpx + cols * win.cw;
+- win.h = 2 * borderpx + rows * win.ch;
++ win.w = 2 * win.hborderpx + cols * win.cw;
++ win.h = 2 * win.vborderpx + rows * win.ch;
+ if (xw.gm & XNegative)
+ xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2;
+ if (xw.gm & YNegative)
+_AT_@ -1210,7 +1214,7 @@ xinit(int cols, int rows)
+ int
+ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y)
+ {
+- float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp;
++ float winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, xp, yp;
+ ushort mode, prevmode = USHRT_MAX;
+ Font *font = &dc.font;
+ int frcflags = FRC_NORMAL;
+_AT_@ -1343,7 +1347,7 @@ void
+ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
+ {
+ int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
+- int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch,
++ int winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch,
+ width = charlen * win.cw;
+ Color *fg, *bg, *temp, revfg, revbg, truefg, truebg;
+ XRenderColor colfg, colbg;
+_AT_@ -1433,17 +1437,17 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
+
+ /* Intelligent cleaning up of the borders. */
+ if (x == 0) {
+- xclear(0, (y == 0)? 0 : winy, borderpx,
++ xclear(0, (y == 0)? 0 : winy, win.vborderpx,
+ winy + win.ch +
+- ((winy + win.ch >= borderpx + win.th)? win.h : 0));
++ ((winy + win.ch >= win.vborderpx + win.th)? win.h : 0));
+ }
+- if (winx + width >= borderpx + win.tw) {
++ if (winx + width >= win.hborderpx + win.tw) {
+ xclear(winx + width, (y == 0)? 0 : winy, win.w,
+- ((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch)));
++ ((winy + win.ch >= win.vborderpx + win.th)? win.h : (winy + win.ch)));
+ }
+ if (y == 0)
+- xclear(winx, 0, winx + width, borderpx);
+- if (winy + win.ch >= borderpx + win.th)
++ xclear(winx, 0, winx + width, win.hborderpx);
++ if (winy + win.ch >= win.vborderpx + win.th)
+ xclear(winx, winy + win.ch, winx + width, win.h);
+
+ /* Clean up the region we want to draw to. */
+_AT_@ -1537,35 +1541,35 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
+ case 3: /* Blinking Underline */
+ case 4: /* Steady Underline */
+ XftDrawRect(xw.draw, &drawcol,
+- borderpx + cx * win.cw,
+- borderpx + (cy + 1) * win.ch - \
++ win.hborderpx + cx * win.cw,
++ win.vborderpx + (cy + 1) * win.ch - \
+ cursorthickness,
+ win.cw, cursorthickness);
+ break;
+ case 5: /* Blinking bar */
+ case 6: /* Steady bar */
+ XftDrawRect(xw.draw, &drawcol,
+- borderpx + cx * win.cw,
+- borderpx + cy * win.ch,
++ win.hborderpx + cx * win.cw,
++ win.vborderpx + cy * win.ch,
+ cursorthickness, win.ch);
+ break;
+ }
+ } else {
+ XftDrawRect(xw.draw, &drawcol,
+- borderpx + cx * win.cw,
+- borderpx + cy * win.ch,
++ win.hborderpx + cx * win.cw,
++ win.vborderpx + cy * win.ch,
+ win.cw - 1, 1);
+ XftDrawRect(xw.draw, &drawcol,
+- borderpx + cx * win.cw,
+- borderpx + cy * win.ch,
++ win.hborderpx + cx * win.cw,
++ win.vborderpx + cy * win.ch,
+ 1, win.ch - 1);
+ XftDrawRect(xw.draw, &drawcol,
+- borderpx + (cx + 1) * win.cw - 1,
+- borderpx + cy * win.ch,
++ win.hborderpx + (cx + 1) * win.cw - 1,
++ win.vborderpx + cy * win.ch,
+ 1, win.ch - 1);
+ XftDrawRect(xw.draw, &drawcol,
+- borderpx + cx * win.cw,
+- borderpx + (cy + 1) * win.ch - 1,
++ win.hborderpx + cx * win.cw,
++ win.vborderpx + (cy + 1) * win.ch - 1,
+ win.cw, 1);
+ }
+ }
+--
+2.28.0
+
Received on Sat Oct 03 2020 - 15:10:30 CEST

This archive was generated by hypermail 2.3.0 : Sat Oct 03 2020 - 15:12:42 CEST