diff --git a/config.def.h b/config.def.h index cae2009..a7a9fa7 100644 --- a/config.def.h +++ b/config.def.h @@ -1,6 +1,7 @@ #ifndef CONFIG_H #define CONFIG_H +#define WHELLSTEP 5 #define MOD Mod4Mask const char* menu[] = {"dmenu_run", 0}; diff --git a/sowm.c b/sowm.c index 90ae3bc..cbb56b5 100644 --- a/sowm.c +++ b/sowm.c @@ -126,6 +126,15 @@ void button_press(XEvent *e) { win_size(e->xbutton.subwindow, &wx, &wy, &ww, &wh); XRaiseWindow(d, e->xbutton.subwindow); + + int sd = 0; + if(e->xbutton.button == Button4) sd = WHELLSTEP; + else if(e->xbutton.button == Button5) sd = -WHELLSTEP; + + XMoveResizeWindow(d, e->xbutton.subwindow, + wx - sd, wy - sd, + ww + sd*2, wh + sd*2); + mouse = e->xbutton; } @@ -295,7 +304,7 @@ void input_grab(Window root) { XGrabKey(d, code, keys[i].mod | modifiers[j], root, True, GrabModeAsync, GrabModeAsync); - for (i = 1; i < 4; i += 2) + for (i = 1; i < 6; i++) for (j = 0; j < sizeof(modifiers)/sizeof(*modifiers); j++) XGrabButton(d, i, MOD | modifiers[j], root, True, ButtonPressMask|ButtonReleaseMask|PointerMotionMask,