diff options
| -rw-r--r-- | st.c | 22 |
1 files changed, 14 insertions, 8 deletions
| @@ -190,6 +190,7 @@ static void xdrawcursor(void); | |||
| 190 | static void xinit(void); | 190 | static void xinit(void); |
| 191 | static void xloadcols(void); | 191 | static void xloadcols(void); |
| 192 | static void xseturgency(int); | 192 | static void xseturgency(int); |
| 193 | static void xresize(int, int); | ||
| 193 | 194 | ||
| 194 | static void expose(XEvent *); | 195 | static void expose(XEvent *); |
| 195 | static void visibility(XEvent *); | 196 | static void visibility(XEvent *); |
| @@ -1258,6 +1259,14 @@ tresize(int col, int row) { | |||
| 1258 | } | 1259 | } |
| 1259 | 1260 | ||
| 1260 | void | 1261 | void |
| 1262 | xresize(int col, int row) { | ||
| 1263 | xw.bufw = MAX(1, col * xw.cw); | ||
| 1264 | xw.bufh = MAX(1, row * xw.ch); | ||
| 1265 | XFreePixmap(xw.dis, xw.buf); | ||
| 1266 | xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); | ||
| 1267 | } | ||
| 1268 | |||
| 1269 | void | ||
| 1261 | xloadcols(void) { | 1270 | xloadcols(void) { |
| 1262 | int i, r, g, b; | 1271 | int i, r, g, b; |
| 1263 | XColor color; | 1272 | XColor color; |
| @@ -1615,16 +1624,13 @@ resize(XEvent *e) { | |||
| 1615 | 1624 | ||
| 1616 | xw.w = e->xconfigure.width; | 1625 | xw.w = e->xconfigure.width; |
| 1617 | xw.h = e->xconfigure.height; | 1626 | xw.h = e->xconfigure.height; |
| 1618 | xw.bufw = xw.w - 2*BORDER; | 1627 | col = (xw.w - 2*BORDER) / xw.cw; |
| 1619 | xw.bufh = xw.h - 2*BORDER; | 1628 | row = (xw.h - 2*BORDER) / xw.ch; |
| 1620 | col = xw.bufw / xw.cw; | 1629 | if(col == term.col && row == term.row) |
| 1621 | row = xw.bufh / xw.ch; | 1630 | return; |
| 1622 | tresize(col, row); | 1631 | tresize(col, row); |
| 1623 | ttyresize(col, row); | 1632 | ttyresize(col, row); |
| 1624 | xw.bufh = MAX(1, xw.bufh); | 1633 | xresize(col, row); |
| 1625 | xw.bufw = MAX(1, xw.bufw); | ||
| 1626 | XFreePixmap(xw.dis, xw.buf); | ||
| 1627 | xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); | ||
| 1628 | } | 1634 | } |
| 1629 | 1635 | ||
| 1630 | void | 1636 | void |
