diff options
Diffstat (limited to 'x.c')
-rw-r--r-- | x.c | 31 |
1 files changed, 27 insertions, 4 deletions
@@ -1009,7 +1009,7 @@ xicdestroy(XIC xim, XPointer client, XPointer call) } void -xinit(int cols, int rows) +xinit(int w, int h) { XGCValues gcvalues; Window parent; @@ -1034,8 +1034,16 @@ xinit(int cols, int rows) xloadcols(); /* adjust fixed window geometry */ - win.w = 2 * borderpx + cols * win.cw; - win.h = 2 * borderpx + rows * win.ch; + switch (geometry) { + case CellGeometry: + win.w = 2 * borderpx + w * win.cw; + win.h = 2 * borderpx + h * win.ch; + break; + case PixelGeometry: + win.w = w; + win.h = h; + break; + } if (xw.gm & XNegative) xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2; if (xw.gm & YNegative) @@ -1956,6 +1964,12 @@ main(int argc, char *argv[]) case 'g': xw.gm = XParseGeometry(EARGF(usage()), &xw.l, &xw.t, &cols, &rows); + geometry = CellGeometry; + break; + case 'G': + xw.gm = XParseGeometry(EARGF(usage()), + &xw.l, &xw.t, &width, &height); + geometry = PixelGeometry; break; case 'i': xw.isfixed = 1; @@ -1992,10 +2006,19 @@ run: setlocale(LC_CTYPE, ""); XSetLocaleModifiers(""); + switch (geometry) { + case CellGeometry: + xinit(cols, rows); + break; + case PixelGeometry: + xinit(width, height); + cols = (win.w - 2 * borderpx) / win.cw; + rows = (win.h - 2 * borderpx) / win.ch; + break; + } cols = MAX(cols, 1); rows = MAX(rows, 1); tnew(cols, rows); - xinit(cols, rows); xsetenv(); selinit(); run(); |