On Tue, Nov 01, 2022 at 10:47:40PM +0000, Luís Henriques wrote:
> Hi!
> 
> I've been seeing a bug since... forever (?) in cwm, and I finally decided
> to try to fix it.  Here's how I reproduce it:
> 
> 1. open emacs on group 1
> 2. start gnus, which will ask me a password
> 3. before emacs asks me the password, switch to group 2
> 4. go back to group 1 and... no emacs window
> 5. go to group 2 and back to 1 and emacs window is there waiting for input
> 
> There are probably easier ways to reproduce this, but this is how I got
> annoyed with it.
> 
> After some debug, what I see is that in group_show(), after switching back
> to group 1 (step 4.) the client does not have the CLIENT_HIDDEN flag set,
> although xu_get_wm_state for the window is set to 'IconicState'.  This is
> because xu_ewmh_handle_net_wm_state_msg() will call client_toggle_hidden()
> (action = _NET_WM_STATE_REMOVE).
> 
> The diff bellow fixes this behaviour (i.e. will toggle the flag only if
> the client group is currently active).  Is this the way to fix it?

Ping.  Any feedback on this patch, or no one else is seeing this annoying
behaviour?

Cheers,
--
Luís


> 
> Cheers,
> --
> Luís
> 
> 
> diff --git a/app/cwm/client.c b/app/cwm/client.c
> index e15005883ca6..991700d37155 100644
> --- a/app/cwm/client.c
> +++ b/app/cwm/client.c
> @@ -280,7 +280,10 @@ client_toggle_freeze(struct client_ctx *cc)
>  void
>  client_toggle_hidden(struct client_ctx *cc)
>  {
> -     cc->flags ^= CLIENT_HIDDEN;
> +     struct screen_ctx *sc = cc->sc;
> +
> +     if (sc->group_active == cc->gc)
> +             cc->flags ^= CLIENT_HIDDEN;
>       xu_ewmh_set_net_wm_state(cc);
>  }
>  
> 

Reply via email to