On Tue 2024.07.09 at 14:20 -0500, Tim Chase wrote:
> I think I've found a small issue with cwm where, if you have a
> single unfocused window in one group, and switch to that group,
> (from a focused window in another group) using window-cycle-ingroup
> doesn't change from nothing-focused to focusing the one in-group
> window.

Yes, this is all because cwm requires focus to set active and heavy use of
warp-to-focus because it tries to be "helpful". I'd argue cwm should never
touch the mouse (i.e. warp) and purely rely on stack for focus - haven't found
a simple and/or elegant solution to support everything at once - so it's all
"historical" behaviors/mistakes at this point. But duely noted.

> To reproduce:
> 
> 1) with the following .cwmrc file (not sure if "sticky yes" plays
> into this)
> 
>   sticky yes
>   bind-key 4-1 group-only-1
>   bind-key 4-2 group-only-2
>   bind-key 4-Tab window-cycle-ingroup
>   bind-key 4S-Tab window-rcycle-ingroup
> 
> and a ~/.xsession of only (mostly just to make sure we're not
> spawning other focusable windows)
> 
>   exec /usr/X11R6/bin/cwm
> 
> log in to xenodm/xenorcara
> 
> 2) mouse over the default xconsole instance to focus it and use
> CM-x to close the default xconsole instance
> 
> 3) use 4-1 (logo key + 1) to make sure you're in group #1
> 
> 4) use CM-Return to spawn terminal #1. Maybe type "echo group 1"
> here just to make it easy to identify
> 
> 5) move the mouse to some place other than the terminal window
> (focus remains on the window)
> 
> 6) use 4-2 to switch to group 2 (can't see the terminal now)
> 
> 7) use CM-Return to spawn a terminal #2 (it now has focus). Maybe
> type "echo group 2" here just to make it easy to identify
> 
> 8) move the mouse to such a location that it would not be over the
> first terminal (in the first group, launched in step #4)
> 
> 9) use 4-1 to switch back to group 1 (bringing back terminal #1,
> observing it doesn't have focus because the mouse wasn't over it)
> 
> 10) used 4-Tab (window-cycle-ingroup) to attempt to cycle the windows
> in this group
> 
> At this point I can't focus terminal #1 by cycling the windows in
> the group, even though it's in the group.  It requires me to move
> the mouse over the window to restore focus to that window.
> 
> Expected behavior:  in step #10, with nothing focused, it would
> move focus to that window.
> 
> If I don't launch Terminal #2 (step #7) to steal focus, the problem
> doesn't manifest, so there's something hinky where it decides which
> windows are in-group and can be focused, possibly short-cutting if
> there's only one window, wrongly presuming that it already has
> focus.  A little digging points me at the kbfunc_client_cycle()
> function in cwm/kbfunc.c where I'm guessing something bails early
> around line 441/442 (the return/break) without actually focusing
> the window (it looks like the client_raise() doesn't get called
> here).  Given the "XXX I hate this hack" note there, I'm hesitant
> to propose a diff. :-)
> 
> Hopefully that's adequate reproduction to make it easy to track
> down?
> 
> Thanks!
> 
> -tkc
> 
> After typing that up, it looks like you might also be able to
> reproduce it without switching groups by spawning terminal #1,
> spawning terminal #2 in the same group, M+LMB drag terminal#2
> somewhere else on the screen so the cursor won't end up over
> terminal#1, then control+d to exit terminal#2, leaving you in the
> same situation as step #9/#10.
> 
> 
> 
> 

Reply via email to