[xmonad] darcs patch: quick hack to avoid infinite (but breakable) loop when...

David Roundy droundy at darcs.net
Sat May 17 21:24:44 EDT 2008


On Sat, May 17, 2008 at 11:18:53AM -0700, Klaus Weidner wrote:
> On Sat, May 17, 2008 at 05:09:41AM -0700, David Roundy wrote:
> > On Sat, May 17, 2008 at 03:12:49AM -0700, Klaus Weidner wrote:
> > > The unpatched behaviour restored by your patch is to clear the step (b)
> > > enter event. However, that does the wrong thing if moving the mouse
> > > quickly across multiple windows A-B-C, in that case B keeps the focus
> > > even though the mouse ended in window C.
> > 
> > I've never observed this, myself.  Perhaps it requires an even slower
> > computer than mine, or maybe a really slow layout?
> 
> The notebook I saw this on is pretty fast (Core 2 Duo), and I commonly
> saw this with a moderately complex (but not unreasonable) dualscreen
> setup including combineTwo and tabs on one screen, something like this:

Ah, I see, this involves two screens.  That explains why I never saw it.

> > > Probably the right thing to do would be to clear the pending crossing
> > > events in 'windows' whenever the layout manipulation moves/resizes/remaps
> > > windows, and not clear it if only the focus has changed. What would be
> > > a clean way to make that distinction?
> > 
> > Probably a better option would be to not clear crossing events at all, but
> > instead when we handle crossing events to first check if the mouse is still
> > in the said window.  If it's not, then we should ignore the event.
> 
> That sounds reasonable - how about a something like the following (not a
> real patch - I'm still away from my computer including next week and
> can't test this):
> 
> XMonad/Main.hs:
>  handle e@(CrossingEvent {ev_window = w, ev_event_type = t})
>      | t == enterNotify && ev_mode   e == notifyNormal
>                         && ev_detail e /= notifyInferior
> -    = whenX (asks $ focusFollowsMouse . config) (focus w)
> +    = whenX (asks $ focusFollowsMouse . config) $ do
> +        dpy <- asks display
> +        root <- asks theRoot
> +        (_,_,w',_,_,_,_,_) <- io $ queryPointer dpy root
> +        when (w == w') (focus w)
> 
> XMonad/Operations.hs:
>      mapM_ (flip setWMState withdrawnState) (W.allWindows old \\ W.allWindows ws)
> -
> -    unless isMouseFocused $ clearEvents enterWindowMask

Looks reasonable to me.  Of course, we'd probably also want to remove
isMouseFocused entirely, right?

David


More information about the xmonad mailing list