diff --git a/sowm.c b/sowm.c index 793826c..e228f01 100644 --- 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 index 750b297..80dad43 100644 --- 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;