aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@djpohly.com>2010-10-25 15:26:47 -0400
committerDevin J. Pohly <djpohly@djpohly.com>2010-10-25 15:26:47 -0400
commit90a56203a074eb3cd38e988d402b932e42dffd6b (patch)
tree241a62ec279b335c98d18daa834d4a788beaae82 /st.c
parenta6790adae71810318bf4b687f0804afb3a01ef12 (diff)
downloadst-90a56203a074eb3cd38e988d402b932e42dffd6b.tar.gz
st-90a56203a074eb3cd38e988d402b932e42dffd6b.tar.bz2
copy old pixmap to new on resize
Diffstat (limited to 'st.c')
-rw-r--r--st.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/st.c b/st.c
index 594b0d3..734ad0a 100644
--- 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