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

Klaus Weidner kweidner at pobox.com
Mon May 19 21:01:32 EDT 2008


<20080517120940.GP8845 at darcs.net> <20080517181853.GD14897 at mytv> <20080518012443.GT8845 at darcs.net>
Message-ID: <a2d30cf5209ca71f2074f3cb28b6edd3 at roundcube-imap.mailstore.pobox.com>
X-Sender: kweidner at pobox.com
Received: from 65.57.245.11 [65.57.245.11] with HTTP/1.1 (POST); Mon, 19 May
	2008 21:01:32 -0400
User-Agent: RoundCube Webmail/0.1
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit

On Sat, 17 May 2008 18:24:44 -0700, David Roundy <droundy at darcs.net> wrote:
> 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




More information about the xmonad mailing list