commit 5547cc3a51607474f0939fe9bbe07dc45b4fe0ac
parent 5cc5d25823b09c57021d0226d6a698ab82d99028
Author: Dylan Araps <dylan.araps@gmail.com>
Date: Thu, 20 Feb 2020 15:59:48 +0200
sowm: Set minimum resize amount.
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/sowm.c b/sowm.c
@@ -58,8 +58,8 @@ void notify_motion(XEvent *e) {
XMoveResizeWindow(d, mouse.subwindow,
wx + (mouse.button == 1 ? xd : 0),
wy + (mouse.button == 1 ? yd : 0),
- ww + (mouse.button == 3 ? xd : 0),
- wh + (mouse.button == 3 ? yd : 0));
+ MAX(1, ww + (mouse.button == 3 ? xd : 0)),
+ MAX(1, wh + (mouse.button == 3 ? yd : 0)));
}
void key_press(XEvent *e) {
diff --git a/sowm.h b/sowm.h
@@ -3,6 +3,7 @@
#define win (client *t=0, *c=list; c && t!=list->prev; t=c, c=c->next)
#define ws_save(W) ws_list[W] = list
#define ws_sel(W) list = ws_list[ws = W]
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define win_size(W, gx, gy, gw, gh) \
XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \
@@ -12,7 +13,7 @@
#define mod_clean(mask) (mask & ~(numlock|LockMask) & \
(ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
-typedef union {
+typedef struct {
const char** com;
const int i;
const Window w;