st

Simple Terminal from suckless utilities
git clone git://git.thepablogq.xyz/st
Log | Files | Refs | README | LICENSE

commit d85f7319a2c0d0bc53c1e0be6539284823fe7389
parent 12435817723b44189bd412937403c401e5bbc136
Author: Devin J. Pohly <djpohly@djpohly.com>
Date:   Mon, 25 Oct 2010 15:26:47 -0400

copy old pixmap to new on resize

Diffstat:
Mst.c | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/st.c b/st.c @@ -1260,10 +1260,24 @@ tresize(int col, int row) { void xresize(int col, int row) { + Pixmap newbuf; + int oldw, oldh; + + oldw = xw.bufw; + oldh = xw.bufh; xw.bufw = MAX(1, col * xw.cw); xw.bufh = MAX(1, row * xw.ch); + newbuf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); + XCopyArea(xw.dis, xw.buf, newbuf, dc.gc, 0, 0, xw.bufw, xw.bufh, 0, 0); XFreePixmap(xw.dis, xw.buf); - xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); + XSetForeground(xw.dis, dc.gc, dc.col[DefaultBG]); + if(xw.bufw > oldw) + XFillRectangle(xw.dis, newbuf, dc.gc, oldw, 0, + xw.bufw-oldw, MIN(xw.bufh, oldh)); + if(xw.bufh > oldh) + XFillRectangle(xw.dis, newbuf, dc.gc, 0, oldh, + xw.bufw, xw.bufh-oldh); + xw.buf = newbuf; } void