Hi,

I have a shy client (stalonetray) that hides at start-up.

What normally happens with new clients assigned to group 0 is
this:

- client appears
- client is initialized by cwm
- cwm decides it should be in group 0
- group_assign() sends it a _NET_WM_DESKTOP property change
  request

So far so good, but with stalonetray it doesn't stop there:

- cwm receives a _NET_WM_DESKTOP property change notification
  (presumabily from the client)
- cwm moves the client to group 0
- group_movetogroup(), due to its internal logic, decides to hide
  the client
- client_hide() sends it a WM_STATE property change request
- group_assign() sends it another _NET_WM_DESKTOP property change
  request
- no further _NET_WM_DESKTOP property change notifications are
  received, so that's it

This patch fixes the case of moving clients from group 0 to group
0, as done for other groups.

Yours,
Vadik.

-- 
The Consultant's Curse:
        When the customer has beaten upon you long enough, give him
what he asks for, instead of what he needs.  This is very strong
medicine, and is normally only required once.
Index: group.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.121
diff -u -r1.121 group.c
--- group.c	10 Nov 2015 20:05:33 -0000	1.121
+++ group.c	25 Nov 2015 16:36:02 -0000
@@ -152,19 +152,21 @@
 group_movetogroup(struct client_ctx *cc, int idx)
 {
 	struct screen_ctx	*sc = cc->sc;
-	struct group_ctx	*gc;
+	struct group_ctx	*gc = NULL;
 
 	if (idx < 0 || idx >= CALMWM_NGROUPS)
 		errx(1, "group_movetogroup: index out of range (%d)", idx);
 
-	TAILQ_FOREACH(gc, &sc->groupq, entry) {
-		if (gc->num == idx)
-			break;
+	if (idx != 0) {
+		TAILQ_FOREACH(gc, &sc->groupq, entry) {
+			if (gc->num == idx)
+				break;
+		}
 	}
 
 	if (cc->gc == gc)
 		return;
-	if (group_holds_only_hidden(gc))
+	if (gc != NULL && group_holds_only_hidden(gc))
 		client_hide(cc);
 	group_assign(gc, cc);
 }

Reply via email to