When the pointer moves to a different client, the focus follows the
pointer, putting the client under the pointer in focus. However, when
the focus is changed using the keyboard, the pointer remains over the
client that is now out-of-focus. If using multiple screens, or if a
client decides to hide the pointer because it is over a text input,
this can make it very annoying to figure out the pointer location.
This commit makes sure that the pointer follows the focus when it
moves to a different client.
setfocus(Client *c) {
if(!c->neverfocus)
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
sendevent(c->win, wmatom[WMTakeFocus], NoEventMask, wmatom[WMTakeFocus], CurrentTime, 0, 0, 0);
}
selmon->seltags ^= 1; /* toggle sel tagset */
if(arg->ui & TAGMASK)
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
- focus(NULL);
arrange(selmon);
+ focus(NULL);
}
Client *