move code into new xresize func, add early exit to resize
							parent
							
								
									722688d989
								
							
						
					
					
						commit
						1243581772
					
				
							
								
								
									
										22
									
								
								st.c
								
								
								
								
							
							
						
						
									
										22
									
								
								st.c
								
								
								
								
							|  | @ -190,6 +190,7 @@ static void xdrawcursor(void); | ||||||
| static void xinit(void); | static void xinit(void); | ||||||
| static void xloadcols(void); | static void xloadcols(void); | ||||||
| static void xseturgency(int); | static void xseturgency(int); | ||||||
|  | static void xresize(int, int); | ||||||
| 
 | 
 | ||||||
| static void expose(XEvent *); | static void expose(XEvent *); | ||||||
| static void visibility(XEvent *); | static void visibility(XEvent *); | ||||||
|  | @ -1257,6 +1258,14 @@ tresize(int col, int row) { | ||||||
| 	tsetscroll(0, row-1); | 	tsetscroll(0, row-1); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 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 | void | ||||||
| xloadcols(void) { | xloadcols(void) { | ||||||
| 	int i, r, g, b; | 	int i, r, g, b; | ||||||
|  | @ -1615,16 +1624,13 @@ resize(XEvent *e) { | ||||||
| 	 | 	 | ||||||
| 	xw.w = e->xconfigure.width; | 	xw.w = e->xconfigure.width; | ||||||
| 	xw.h = e->xconfigure.height; | 	xw.h = e->xconfigure.height; | ||||||
| 	xw.bufw = xw.w - 2*BORDER; | 	col = (xw.w - 2*BORDER) / xw.cw; | ||||||
| 	xw.bufh = xw.h - 2*BORDER; | 	row = (xw.h - 2*BORDER) / xw.ch; | ||||||
| 	col = xw.bufw / xw.cw; | 	if(col == term.col && row == term.row) | ||||||
| 	row = xw.bufh / xw.ch; | 		return; | ||||||
| 	tresize(col, row); | 	tresize(col, row); | ||||||
| 	ttyresize(col, row); | 	ttyresize(col, row); | ||||||
| 	xw.bufh = MAX(1, xw.bufh); | 	xresize(col, row); | ||||||
| 	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)); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  |  | ||||||
		Reference in New Issue