Hi Anselm,
> I like this patch and will apply it to 5.4 which is going to be
> released until the weekend.
One problem with it is that you don't really know where keyboard input
will be going (dwm being focus-follows-mouse by default). I use another
patch on top of that (attached) to draw a selfgcolor border around the
last focusable window when an unfocusable window is selected, but I'm
not sure recycling selfgcolor is kosher...
Plus you may want to rename focus() to selectwin() or something.
> I should get broadband today that I'll be ack online and can support
> questions regarding my upcoming st and libtg release.
So, when's the st release and does libtg (if that's the name of the
not-completely-secret project) use XCB? :)
Regards,
Peter
diff --git a/dwm.c b/dwm.c
index 133f420..56f9485 100644
--- a/dwm.c
+++ b/dwm.c
@@ -232,6 +232,7 @@ static Bool otherwm;
static Bool running = True;
static Client *clients = NULL;
static Client *sel = NULL;
+static Client *foc = NULL;
static Client *stack = NULL;
static Cursor cursor[CurLast];
static Display *dpy;
@@ -627,8 +628,14 @@ focus(Client *c) {
attachstack(c);
grabbuttons(c, True);
XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
- if(c->isfocusable)
- XSetInputFocus(dpy, c->win, RevertToPointerRoot,
CurrentTime);
+ if(c->isfocusable) {
+ if(foc && foc != c)
+ XSetWindowBorder(dpy, foc->win,
dc.norm[ColBorder]);
+ foc = c;
+ XSetInputFocus(dpy, foc->win, RevertToPointerRoot,
CurrentTime);
+ }
+ else if(foc)
+ XSetWindowBorder(dpy, foc->win, dc.sel[ColFG]);
}
else
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);