Re: [dev] [PATCH] st: fix BORDER after XDBE patch

From: Brandon Invergo <brandon_AT_invergo.net>
Date: Fri, 03 Aug 2012 15:42:34 +0200

Crap, thanks for catching this. I just pushed it to default. Works
great, thanks again!
-brandon

Gaetan Bisson <bisson_AT_archlinux.org> writes:

> Hi,
>
> The BORDER setting to st has recently been broken by the XDBE patch;
> this is fixed by the patch below, which also removes bufh/bufw since
> they are now redundant with the w/h members.
>
> Cheers.
>
> --
> Gaetan
>
>
> diff -Naur old/st.c new/st.c
> --- old/st.c 2012-07-28 22:27:26.000000000 +1000
> +++ new/st.c 2012-08-03 01:27:50.284714975 +1000
> _AT_@ -186,8 +186,6 @@
> int scr;
> int w; /* window width */
> int h; /* window height */
> - int bufw; /* pixmap width */
> - int bufh; /* pixmap height */
> int ch; /* char height */
> int cw; /* char width */
> char state; /* focus, redraw, visible */
> _AT_@ -1621,8 +1619,8 @@
>
> void
> xresize(int col, int row) {
> - xw.bufw = MAX(1, col * xw.cw);
> - xw.bufh = MAX(1, row * xw.ch);
> + xw.w = MAX(1, 2*BORDER + col * xw.cw);
> + xw.h = MAX(1, 2*BORDER + row * xw.ch);
> }
>
> void
> _AT_@ -1671,7 +1669,7 @@
> xclear(int x1, int y1, int x2, int y2) {
> XSetForeground(xw.dpy, dc.gc, dc.col[IS_SET(MODE_REVERSE) ? DefaultFG : DefaultBG]);
> XFillRectangle(xw.dpy, xw.buf, dc.gc,
> - x1 * xw.cw, y1 * xw.ch,
> + BORDER + x1 * xw.cw, BORDER + y1 * xw.ch,
> (x2-x1+1) * xw.cw, (y2-y1+1) * xw.ch);
> }
>
> _AT_@ -1757,10 +1755,8 @@
> xloadcols();
>
> /* window - default size */
> - xw.bufh = term.row * xw.ch;
> - xw.bufw = term.col * xw.cw;
> - xw.h = xw.bufh + 2*BORDER;
> - xw.w = xw.bufw + 2*BORDER;
> + xw.h = 2*BORDER + term.row * xw.ch;
> + xw.w = 2*BORDER + term.col * xw.cw;
>
> attrs.background_pixel = dc.col[DefaultBG];
> attrs.border_pixel = dc.col[DefaultBG];
> _AT_@ -1807,7 +1803,7 @@
> void
> xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
> int fg = base.fg, bg = base.bg, temp;
> - int winx = x*xw.cw, winy = y*xw.ch + dc.font.ascent, width = charlen*xw.cw;
> + int winx = BORDER+x*xw.cw, winy = BORDER+y*xw.ch + dc.font.ascent, width = charlen*xw.cw;
> XFontSet fontset = dc.font.set;
> int i;
>
Received on Fri Aug 03 2012 - 15:42:34 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 03 2012 - 15:48:03 CEST