diff options
author | Luke Smith <luke@lukesmith.xyz> | 2018-12-16 20:10:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-16 20:10:20 -0500 |
commit | edbc788d2063cb0ba19487234f53f90aba347975 (patch) | |
tree | e1164ddb28519f11e9cd246a43a0a887d5a2acd6 /x.c | |
parent | ee16dfb8f38f159011a1c45e8c6ba4b39e267bc9 (diff) | |
parent | 7a1a92ff3f331047245837ddd055298ceb013a62 (diff) |
Merge pull request #31 from terriblephrases/master
Upstream updates
Diffstat (limited to 'x.c')
-rw-r--r-- | x.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -699,6 +699,8 @@ cresize(int width, int height) col = (win.w - 2 * borderpx) / win.cw; row = (win.h - 2 * borderpx) / win.ch; + col = MAX(1, col); + row = MAX(1, row); tresize(col, row); xresize(col, row); @@ -708,8 +710,8 @@ cresize(int width, int height) void xresize(int col, int row) { - win.tw = MAX(1, col * win.cw); - win.th = MAX(1, row * win.ch); + win.tw = col * win.cw; + win.th = row * win.ch; XFreePixmap(xw.dpy, xw.buf); xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, @@ -758,12 +760,12 @@ xloadcols(void) static int loaded; Color *cp; - dc.collen = MAX(LEN(colorname), 256); - dc.col = xmalloc(dc.collen * sizeof(Color)); - if (loaded) { for (cp = dc.col; cp < &dc.col[dc.collen]; ++cp) XftColorFree(xw.dpy, xw.vis, xw.cmap, cp); + } else { + dc.collen = MAX(LEN(colorname), 256); + dc.col = xmalloc(dc.collen * sizeof(Color)); } for (i = 0; i < dc.collen; i++) @@ -833,15 +835,17 @@ xhints(void) sizeh = XAllocSizeHints(); - sizeh->flags = PSize | PResizeInc | PBaseSize; + sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize; sizeh->height = win.h; sizeh->width = win.w; sizeh->height_inc = win.ch; sizeh->width_inc = win.cw; sizeh->base_height = 2 * borderpx; sizeh->base_width = 2 * borderpx; + sizeh->min_height = win.ch + 2 * borderpx; + sizeh->min_width = win.cw + 2 * borderpx; if (xw.isfixed) { - sizeh->flags |= PMaxSize | PMinSize; + sizeh->flags |= PMaxSize; sizeh->min_width = sizeh->max_width = win.w; sizeh->min_height = sizeh->max_height = win.h; } |