[xmonad] Patch [v2]: fix focus when user is moving the mouse

Klaus Weidner kweidner at pobox.com
Wed Apr 9 22:42:38 EDT 2008

I've attached an updated patch with the flag camelCased and additional
logic to ensure that the behavior stays mouse position independent when
adding or removing windows.

Please let me know if there's a better way to do this. I'm not sure if
there'd be a good place to clear the flag on relevant events without
needing to put code into the individual handlers.


On Wed, Apr 09, 2008 at 06:25:22PM -0500, Klaus Weidner wrote:
> Spencer Janssen <sjanssen at cse.unl.edu> wrote:
> > First, a minor nitpick: if you want this patch to be applied, please change all
> > identifiers to camelCase for consistency with the rest of xmonad.
> Sorry about that, I'll fix it. Is it okay to use "darcs unrecord" and
> redo the patch, or should it be incremental?
> > I foresee some problems with this patch.  Consider the following sequence of
> > events, starting from an empty workspace in the Tall layout:
> > 
> >  - increment nmaster to three
> >  - create three xterms
> >  - focus the second window with the mouse.  At this time mouse_focus
> >    will be set to True
> >  - position the mouse such that it occupies the upper half of the second window
> >  - close the second window without using an xmonad keybinding (typing 'exit' in
> >    an xterm will suffice)
> >  - the windows will shuffle about, and xmonad will set focus to the last window
> >    as usual.  Also, the first window will now be under the mouse pointer, and
> >    an entry event will be generated.
> > 
> > In the old system, this entry event is removed and all is well.  With your
> > proposed changes the entry event will not be removed, and focus will be changed
> > to the first window -- not good!
> This wouldn't bother me personally, but I understand the rationale that
> you had explained to Justin.
> Would it be sufficient to simply clear the mouseFocused flag in the event
> handlers for MapRequest/DestroyWindow/Unmap, so that any changes to the
> window list that are outside of the control of xmonad preserve the
> original behavior?
> -Klaus
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xmonad-core-mouse-focused.dpatch
Type: text/x-darcs-patch
Size: 2940 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/xmonad/attachments/20080409/a060eec2/xmonad-core-mouse-focused.bin

More information about the xmonad mailing list