diff --git a/dwm.c b/dwm.c index 77a91ac..133f420 100644 --- a/dwm.c +++ b/dwm.c @@ -86,7 +86,7 @@ struct Client { int basew, baseh, incw, inch, maxw, maxh, minw, minh; int bw, oldbw; unsigned int tags; - Bool isfixed, isfloating, isurgent; + Bool isfixed, isfloating, isurgent, isfocusable; Client *next; Client *snext; Window win; @@ -627,7 +627,8 @@ focus(Client *c) { attachstack(c); grabbuttons(c, True); XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); - XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); + if(c->isfocusable) + XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); } else XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); @@ -869,6 +870,7 @@ manage(Window w, XWindowAttributes *wa) { c->w = wa->width; c->h = wa->height; c->oldbw = wa->border_width; + c->isfocusable = True; if(c->w == sw && c->h == sh) { c->x = sx; c->y = sy; @@ -890,6 +892,7 @@ manage(Window w, XWindowAttributes *wa) { XSetWindowBorder(dpy, w, dc.norm[ColBorder]); configure(c); /* propagates border_width, if size doesn't change */ updatesizehints(c); + updatewmhints(c); XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); grabbuttons(c, False); updatetitle(c); @@ -1637,6 +1640,7 @@ updatewmhints(Client *c) { } else c->isurgent = (wmh->flags & XUrgencyHint) ? True : False; + c->isfocusable = !(wmh->flags & InputHint) || wmh->input; XFree(wmh); }