diff -up dwm-6.0/config.def.h dwm-6.0-focusonclick/config.def.h --- dwm-6.0/config.def.h 2011-12-19 09:02:46.000000000 -0600 +++ dwm-6.0-focusonclick/config.def.h 2012-11-24 17:48:19.867072611 -0600 @@ -13,6 +13,9 @@ static const unsigned int snap = 32 static const Bool showbar = True; /* False means no bar */ static const Bool topbar = True; /* False means bottom bar */ +/* False means using the scroll wheel on a window will not change focus */ +static const Bool focusonwheelscroll = False; + /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; diff -up dwm-6.0/dwm.c dwm-6.0-focusonclick/dwm.c --- dwm-6.0/dwm.c 2011-12-19 09:02:46.000000000 -0600 +++ dwm-6.0-focusonclick/dwm.c 2012-11-24 18:00:08.902254102 -0600 @@ -266,7 +266,6 @@ static void (*handler[LASTEvent]) (XEven [ConfigureRequest] = configurerequest, [ConfigureNotify] = configurenotify, [DestroyNotify] = destroynotify, - [EnterNotify] = enternotify, [Expose] = expose, [FocusIn] = focusin, [KeyPress] = keypress, @@ -455,7 +454,9 @@ buttonpress(XEvent *e) { click = ClkWinTitle; } else if((c = wintoclient(ev->window))) { - focus(c); + if (focusonwheelscroll || (ev->button != Button4 && ev->button != Button5)) + focus(c); + XAllowEvents(dpy, ReplayPointer, CurrentTime); click = ClkClientWin; } for(i = 0; i < LENGTH(buttons); i++) @@ -1001,11 +1002,11 @@ grabbuttons(Client *c, Bool focused) { XGrabButton(dpy, buttons[i].button, buttons[i].mask | modifiers[j], c->win, False, BUTTONMASK, - GrabModeAsync, GrabModeSync, None, None); + GrabModeSync, GrabModeSync, None, None); } else XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, - BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); + BUTTONMASK, GrabModeSync, GrabModeSync, None, None); } }