X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=dwm.c;h=53e5cb206716777096bb50d0517e1b7bd11d0ec0;hb=68ff133857244347cc6c8512040f1eb32fe2ed2f;hp=1529372d2d88d1bc07ddc244e159cf490d19c7f3;hpb=cb4951dd54951611bb99924b9ae1d0a7c87f47cc;p=dwm.git diff --git a/dwm.c b/dwm.c index 1529372..53e5cb2 100644 --- a/dwm.c +++ b/dwm.c @@ -137,6 +137,7 @@ void eprint(const char *errstr, ...); void expose(XEvent *e); void floating(void); /* default floating layout */ void focus(Client *c); +void focusin(XEvent *e); void focusnext(const char *arg); void focusprev(const char *arg); Client *getclient(Window w); @@ -206,9 +207,10 @@ void (*handler[LASTEvent]) (XEvent *) = { [ConfigureNotify] = configurenotify, [DestroyNotify] = destroynotify, [EnterNotify] = enternotify, - [LeaveNotify] = leavenotify, [Expose] = expose, + [FocusIn] = focusin, [KeyPress] = keypress, + [LeaveNotify] = leavenotify, [MappingNotify] = mappingnotify, [MapRequest] = maprequest, [PropertyNotify] = propertynotify, @@ -710,6 +712,14 @@ focus(Client *c) { } void +focusin(XEvent *e) { /* there are some broken focus acquiring clients */ + XFocusChangeEvent *ev = &e->xfocus; + + if(sel && ev->window != sel->win) + XSetInputFocus(dpy, sel->win, RevertToPointerRoot, CurrentTime); +} + +void focusnext(const char *arg) { Client *c; @@ -1026,8 +1036,7 @@ manage(Window w, XWindowAttributes *wa) { XSetWindowBorder(dpy, w, dc.norm[ColBorder]); configure(c); /* propagates border_width, if size doesn't change */ updatesizehints(c); - XSelectInput(dpy, w, - StructureNotifyMask | PropertyChangeMask | EnterWindowMask); + XSelectInput(dpy, w, EnterWindowMask | FocusChangeMask | PropertyChangeMask | StructureNotifyMask); grabbuttons(c, False); updatetitle(c); if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success)) @@ -1514,6 +1523,7 @@ setup(void) { /* multihead support */ selscreen = XQueryPointer(dpy, root, &w, &w, &d, &d, &d, &d, &mask); + } void