summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2019-02-28 13:11:53 +0000
committerokan <okan>2019-02-28 13:11:53 +0000
commit8cd6d1154c6e5198403270a66fffb8a4f0c56cf6 (patch)
treea073224124051bc402358b7814f194f43d21c2db
parentcd4be1c17a537cc398520140c547370d1061b841 (diff)
downloadcwm-8cd6d1154c6e5198403270a66fffb8a4f0c56cf6.tar.gz
cwm-8cd6d1154c6e5198403270a66fffb8a4f0c56cf6.tar.xz
cwm-8cd6d1154c6e5198403270a66fffb8a4f0c56cf6.zip
Selectively hide and show clients based on state; merge client_unhide() and
client_show().
-rw-r--r--calmwm.h1
-rw-r--r--client.c17
-rw-r--r--group.c8
3 files changed, 9 insertions, 17 deletions
diff --git a/calmwm.h b/calmwm.h
index 15dd247..cbd4a83 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -435,7 +435,6 @@ void			 client_toggle_skip_taskbar(struct client_ctx *);
 void			 client_toggle_sticky(struct client_ctx *);
 void			 client_toggle_vmaximize(struct client_ctx *);
 void			 client_transient(struct client_ctx *);
-void			 client_unhide(struct client_ctx *);
 void			 client_urgency(struct client_ctx *);
 void 			 client_vtile(struct client_ctx *);
 void			 client_wm_hints(struct client_ctx *);
diff --git a/client.c b/client.c
index 46c70c1..19c2ab4 100644
--- a/client.c
+++ b/client.c
@@ -128,7 +128,7 @@ client_init(Window win, struct screen_ctx *sc, int active)
 	if (client_get_wm_state(cc) == IconicState)
 		client_hide(cc);
 	else
-		client_unhide(cc);
+		client_show(cc);
 
 	if (mapped) {
 		if (cc->gc) {
@@ -527,10 +527,10 @@ client_hide(struct client_ctx *cc)
 {
 	XUnmapWindow(X_Dpy, cc->win);
 
-	if (cc->flags & CLIENT_ACTIVE)
+	if (cc->flags & CLIENT_ACTIVE) {
+		cc->flags &= ~CLIENT_ACTIVE;
 		xu_ewmh_net_active_window(cc->sc, None);
-
-	cc->flags &= ~CLIENT_ACTIVE;
+	}
 	cc->flags |= CLIENT_HIDDEN;
 	client_set_wm_state(cc, IconicState);
 }
@@ -538,15 +538,6 @@ client_hide(struct client_ctx *cc)
 void
 client_show(struct client_ctx *cc)
 {
-	if (cc->flags & CLIENT_HIDDEN)
-		client_unhide(cc);
-	else
-		client_raise(cc);
-}
-
-void
-client_unhide(struct client_ctx *cc)
-{
 	XMapRaised(X_Dpy, cc->win);
 
 	cc->flags &= ~CLIENT_HIDDEN;
diff --git a/group.c b/group.c
index 30fe718..666186b 100644
--- a/group.c
+++ b/group.c
@@ -67,7 +67,8 @@ group_hide(struct group_ctx *gc)
 	screen_updatestackingorder(gc->sc);
 
 	TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
-		if (!(cc->flags & CLIENT_STICKY))
+		if (!(cc->flags & CLIENT_STICKY) &&
+		    !(cc->flags & CLIENT_HIDDEN))
 			client_hide(cc);
 	}
 }
@@ -78,8 +79,9 @@ group_show(struct group_ctx *gc)
 	struct client_ctx	*cc;
 
 	TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
-		if (!(cc->flags & CLIENT_STICKY))
-			client_unhide(cc);
+		if (!(cc->flags & CLIENT_STICKY) &&
+		     (cc->flags & CLIENT_HIDDEN))
+			client_show(cc);
 	}
 
 	group_restack(gc);