
<20080517120940.GP8845@darcs.net> <20080517181853.GD14897@mytv> <20080518012443.GT8845@darcs.net>
Message-ID:
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:
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?
The mouseFocused functionality would still be useful for letting updatePointer know that it's not supposed to move the pointer around. The changes discussed won't completely fix the race conditions inherent in the laggy X protocol, so the check that updatePointer currently does (w==w') isn't sufficient for preventing unwanted pointer warping. I won't have a chance to look into making or testing a patch until a week or two from today due to being currently xmonad-less, does someone else want to take a stab at it? -Klaus