mirror of
https://github.com/vale981/spectrwm
synced 2025-03-04 17:31:40 -05:00
Fix the damned enternotify code for real.
Weed out VirtualNotify (switch ws and border crossings) and InferiorNotify (focus on self, aka touching its own border). Then check for ConfigureNotify to see if a window is being deleted or moved to another work space. This is the smaller hammer for the QLength trick that used to be in there. If we still have focus issues we need to work those but this is worth going in.
This commit is contained in:
parent
37c079137c
commit
c292d0eb67
1 changed files with 24 additions and 3 deletions
27
scrotwm.c
27
scrotwm.c
|
@ -3935,17 +3935,38 @@ void
|
|||
enternotify(XEvent *e)
|
||||
{
|
||||
XCrossingEvent *ev = &e->xcrossing;
|
||||
XEvent cne;
|
||||
struct ws_win *win;
|
||||
|
||||
DNPRINTF(SWM_D_EVENT, "enternotify: window: %lu\n", ev->window);
|
||||
DNPRINTF(SWM_D_EVENT, "enternotify: window: %lu mode %d detail %d\n",
|
||||
ev->window, ev->mode, ev->detail);
|
||||
|
||||
/*
|
||||
* all these checks need to be in this order because the
|
||||
* XCheckTypedWindowEvent relies on weeding out the previous events
|
||||
*
|
||||
* making this code an option would enable a follow mouse for focus
|
||||
* feature
|
||||
*/
|
||||
|
||||
/*
|
||||
* happens when a window is created or destroyed and the border
|
||||
* crosses the mouse pointer
|
||||
* crosses the mouse pointer and when switching ws
|
||||
*/
|
||||
if (QLength(display))
|
||||
if (ev->mode == NotifyNormal && ev->detail == NotifyVirtual)
|
||||
return;
|
||||
|
||||
/* this window already has focus */
|
||||
if (ev->mode == NotifyNormal && ev->detail == NotifyInferior)
|
||||
return;
|
||||
|
||||
/* this window is being deleted or moved to another ws */
|
||||
if (XCheckTypedWindowEvent(display, ev->window, ConfigureNotify,
|
||||
&cne) == True) {
|
||||
XPutBackEvent(display, &cne);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((win = find_window(ev->window)) == NULL)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue