changeset: 158:e5dc1e1dbd83
user: Devin J. Pohly <djpohly_AT_djpohly.com>
date: Mon Oct 25 15:10:41 2010 -0400
files: st.c
description:
move code into new xresize func, add early exit to resize
diff -r d9633c1da765 -r e5dc1e1dbd83 st.c
--- a/st.c Sat Oct 16 20:54:19 2010 +0200
+++ b/st.c Mon Oct 25 15:10:41 2010 -0400
@@ -190,6 +190,7 @@
static void xinit(void);
static void xloadcols(void);
static void xseturgency(int);
+static void xresize(int, int);
static void expose(XEvent *);
static void visibility(XEvent *);
@@ -1258,6 +1259,14 @@
}
void
+xresize(int col, int row) {
+ xw.bufw = MAX(1, col * xw.cw);
+ xw.bufh = MAX(1, row * xw.ch);
+ XFreePixmap(xw.dis, xw.buf);
+ xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr));
+}
+
+void
xloadcols(void) {
int i, r, g, b;
XColor color;
@@ -1615,16 +1624,13 @@
xw.w = e->xconfigure.width;
xw.h = e->xconfigure.height;
- xw.bufw = xw.w - 2*BORDER;
- xw.bufh = xw.h - 2*BORDER;
- col = xw.bufw / xw.cw;
- row = xw.bufh / xw.ch;
+ col = (xw.w - 2*BORDER) / xw.cw;
+ row = (xw.h - 2*BORDER) / xw.ch;
+ if(col == term.col && row == term.row)
+ return;
tresize(col, row);
ttyresize(col, row);
- xw.bufh = MAX(1, xw.bufh);
- xw.bufw = MAX(1, xw.bufw);
- XFreePixmap(xw.dis, xw.buf);
- xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr));
+ xresize(col, row);
}
void
Received on Sun Oct 31 2010 - 19:28:15 CET
This archive was generated by hypermail 2.2.0 : Sun Oct 31 2010 - 19:36:04 CET