diff options
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | README.org | 3 | ||||
-rw-r--r-- | config.h | 13 | ||||
-rw-r--r-- | x.c | 31 | ||||
-rw-r--r-- | x.h | 5 |
5 files changed, 49 insertions, 6 deletions
@@ -32,11 +32,12 @@ You can find a list of patches and check what those I've applied are doing on st's patches page. Here is my list: + - anygeometry + - clipboard - bold is not bright - hidecursor - keyboard select - scrollback - - clipboard Settings -------- @@ -29,11 +29,12 @@ You can find a list of patches and check what those I've applied are doing on *st*'s [[https://st.suckless.org/patches/][patches]] page. Here is my list: +- /anygeometry/ - /bold is not bright/ +- /clipboard/ - /hidecursor/ - /keyboard select/ - /scrollback/ -- /clipboard/ * Settings Most settings are done by editing ~config.h~ and recompiling. @@ -140,6 +140,12 @@ const char *colorname[] = { /* + * Whether to use pixel geometry or cell geometry + */ + +static Geometry geometry = CellGeometry; + +/* * Default colors (colorname index) * foreground, background, cursor, reverse cursor */ @@ -149,6 +155,13 @@ unsigned int defaultcs = 258; unsigned int defaultrcs = 257; /* + * Default width and height (including borders!) + */ + +static unsigned int width = 564; +static unsigned int height = 364; + +/* * Default shape of cursor * 2: Block ("█") * 4: Underline ("_") @@ -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(); @@ -46,6 +46,11 @@ typedef struct { signed char appcursor; /* application cursor */ } Key; +typedef enum { + PixelGeometry, + CellGeometry +} Geometry; + /* X modifiers */ #define XK_ANY_MOD UINT_MAX #define XK_NO_MOD 0 |