[xmonad] patch: fix looping due to unnecessary window crossing events

Don Stewart dons at galois.com
Mon Jun 23 19:17:49 EDT 2008

> [ resent, the patch was buried in an older discussion. Let me know in
> case you prefer filing a bug. ]
> This patch fixes a race condition reported by David Roundy (Subject:
> Re: [xmonad] darcs patch: quick hack to avoid infinite (but breakable)
> loop when...):
> > The isMouseFocused hack introduced a race condition where if you click on a
> > tab to select a window, and then move the mouse down before the new window
> > is selected, the focus will alternate between the previously-focused and
> > newly-focused windows in an infinite loop.  This loop can be broken by
> > moving the mouse up to the tab area, but it's pretty unpleasant.  This race
> > condition is easily triggered on my laptop (and presumably on any older
> > computer running bloated applications like firefox).
> What is happening is apparently:
> a) click on tab causes window B to be focused (with mouseFocused true)
> b) mouse moves down into old window A, queueing an enter event for A
> c) xmonad maps window B, appearing under the mouse pointer
> d) enter event for B gets queued
> e) xmonad handles enter event for A, causing it to be focused
> f) xmonad maps window A, appearing under the mouse pointer
> g) enter event for B gets queued
> ... goto (c)
> The change is to ignore crossing events when the pointer is not currently in
> the window being reported as entered, for example due to having left it
> already, or if the windows were reshuffled due to keyboard commands.

Did this not get applied?  Or was there a reason it wasn't?

--- Don

More information about the xmonad mailing list