diff -rup dwm-6.0-orig/dwm.c dwm-6.0/dwm.c --- dwm-6.0-orig/dwm.c 2011-12-19 22:22:25.000000000 +0100 +++ dwm-6.0/dwm.c 2011-12-19 22:56:43.000000000 +0100 @@ -180,7 +180,6 @@ static void drawbar(Monitor *m); static void drawbars(void); static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); static void drawtext(const char *text, unsigned long col[ColLast], Bool invert); -static void enternotify(XEvent *e); static void expose(XEvent *e); static void focus(Client *c); static void focusin(XEvent *e); @@ -266,7 +265,6 @@ static void (*handler[LASTEvent]) (XEven [ConfigureRequest] = configurerequest, [ConfigureNotify] = configurenotify, [DestroyNotify] = destroynotify, - [EnterNotify] = enternotify, [Expose] = expose, [FocusIn] = focusin, [KeyPress] = keypress, @@ -456,6 +454,8 @@ buttonpress(XEvent *e) { } else if((c = wintoclient(ev->window))) { focus(c); + restack(selmon); + XAllowEvents(dpy, ReplayPointer, CurrentTime); click = ClkClientWin; } for(i = 0; i < LENGTH(buttons); i++) @@ -813,25 +813,6 @@ drawtext(const char *text, unsigned long } void -enternotify(XEvent *e) { - Client *c; - Monitor *m; - XCrossingEvent *ev = &e->xcrossing; - - if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) - return; - c = wintoclient(ev->window); - m = c ? c->mon : wintomon(ev->window); - if(m != selmon) { - unfocus(selmon->sel, True); - selmon = m; - } - else if(!c || c == selmon->sel) - return; - focus(c); -} - -void expose(XEvent *e) { Monitor *m; XExposeEvent *ev = &e->xexpose; @@ -994,18 +975,16 @@ grabbuttons(Client *c, Bool focused) { unsigned int i, j; unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask }; XUngrabButton(dpy, AnyButton, AnyModifier, c->win); - if(focused) { - for(i = 0; i < LENGTH(buttons); i++) - if(buttons[i].click == ClkClientWin) - for(j = 0; j < LENGTH(modifiers); j++) - XGrabButton(dpy, buttons[i].button, - buttons[i].mask | modifiers[j], - c->win, False, BUTTONMASK, - GrabModeAsync, GrabModeSync, None, None); - } - else + if(!focused) XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, - BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); + BUTTONMASK, GrabModeSync, GrabModeSync, None, None); + for(i = 0; i < LENGTH(buttons); i++) + if(buttons[i].click == ClkClientWin) + for(j = 0; j < LENGTH(modifiers); j++) + XGrabButton(dpy, buttons[i].button, + buttons[i].mask | modifiers[j], + c->win, False, BUTTONMASK, + GrabModeAsync, GrabModeSync, None, None); } }