[hackers] [st] Cleaning up the fixed window size and the resizing of clients. || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Tue, 4 Sep 2012 22:46:44 +0200 (CEST)

changeset: 274:22a275cc9b1c
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Tue Sep 04 22:44:33 2012 +0200
files: st.c
description:
Cleaning up the fixed window size and the resizing of clients.


diff -r 23a25a84db57 -r 22a275cc9b1c st.c
--- a/st.c Tue Sep 04 22:06:54 2012 +0200
+++ b/st.c Tue Sep 04 22:44:33 2012 +0200
_AT_@ -841,6 +841,8 @@
 
         w.ws_row = term.row;
         w.ws_col = term.col;
+ w.ws_xpixel = xw.w;
+ w.ws_ypixel = xw.h;
         w.ws_xpixel = w.ws_ypixel = 0;
         if(ioctl(cmdfd, TIOCSWINSZ, &w) < 0)
                 fprintf(stderr, "Couldn't set window size: %s\n", SERRNO);
_AT_@ -1910,12 +1912,15 @@
                         xw.fx = sw + xw.fx - xw.fw - 1;
                 if(xw.fy < 0)
                         xw.fy = sh + xw.fy - xw.fh - 1;
+
+ xw.h = xw.fh;
+ xw.w = xw.fw;
         } else {
                 /* window - default size */
                 xw.h = 2*BORDER + term.row * xw.ch;
                 xw.w = 2*BORDER + term.col * xw.cw;
- xw.fw = xw.w;
- xw.fh = xw.h;
+ xw.fx = 0;
+ xw.fy = 0;
         }
 
         /* font */
_AT_@ -1940,7 +1945,7 @@
 
         parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr);
         xw.win = XCreateWindow(xw.dpy, parent, xw.fx, xw.fy,
- xw.fw, xw.fh, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
+ xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
                         XDefaultVisual(xw.dpy, xw.scr),
                         CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
                         | CWColormap,
_AT_@ -2254,8 +2259,8 @@
                 return;
         if(tresize(col, row))
                 draw();
+ xresize(col, row);
         ttyresize(col, row);
- xresize(col, row);
 }
 
 bool
_AT_@ -2310,6 +2315,7 @@
         unsigned int wr, hr;
 
         xw.fw = xw.fh = xw.fx = xw.fy = 0;
+ xw.isfixed = False;
 
         for(i = 1; i < argc; i++) {
                 switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) {
Received on Tue Sep 04 2012 - 22:46:44 CEST

This archive was generated by hypermail 2.3.0 : Tue Sep 04 2012 - 22:48:06 CEST