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

Klaus Weidner kweidner at pobox.com
Fri Jun 13 15:35:45 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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xmonad-core-ignore-obsolete-crossing-events.dpatch
Type: application/octet-stream
Size: 4976 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/xmonad/attachments/20080613/838d5240/xmonad-core-ignore-obsolete-crossing-events.obj

More information about the xmonad mailing list