summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2017-12-29 12:54:54 +0000
committerokan <okan>2017-12-29 12:54:54 +0000
commit5ddaed415c895e56e7c1e6e7b881df8d3c4214bd (patch)
treed401df5768af9f7fc318281aa59561a530e97f98
parent156681f0a5af18704faab52929badc671390ec61 (diff)
downloadcwm-5ddaed415c895e56e7c1e6e7b881df8d3c4214bd.tar.gz
cwm-5ddaed415c895e56e7c1e6e7b881df8d3c4214bd.tar.xz
cwm-5ddaed415c895e56e7c1e6e7b881df8d3c4214bd.zip
add helper function client_show to bring together like actions for unhide/raise
-rw-r--r--calmwm.h1
-rw-r--r--client.c9
-rw-r--r--kbfunc.c5
-rw-r--r--xevents.c5
4 files changed, 12 insertions, 8 deletions
diff --git a/calmwm.h b/calmwm.h
index f6c9392..2ccf83a 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -412,6 +412,7 @@ void			 client_send_delete(struct client_ctx *);
 void			 client_set_wm_state(struct client_ctx *, long);
 void			 client_setactive(struct client_ctx *);
 void			 client_setname(struct client_ctx *);
+void			 client_show(struct client_ctx *);
 int			 client_snapcalc(int, int, int, int, int);
 void			 client_toggle_freeze(struct client_ctx *);
 void			 client_toggle_fullscreen(struct client_ctx *);
diff --git a/client.c b/client.c
index 5ce61e4..3a1ce01 100644
--- a/client.c
+++ b/client.c
@@ -532,6 +532,15 @@ 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);
diff --git a/kbfunc.c b/kbfunc.c
index 60e4b41..a662d02 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -471,10 +471,7 @@ kbfunc_menu_client(void *ctx, struct cargs *cargs)
 	if ((mi = menu_filter(sc, &menuq, "window", NULL, mflags,
 	    search_match_client, search_print_client)) != NULL) {
 		cc = (struct client_ctx *)mi->ctx;
-		if (cc->flags & CLIENT_HIDDEN)
-			client_unhide(cc);
-		else
-			client_raise(cc);
+		client_show(cc);
 		if (old_cc)
 			client_ptrsave(old_cc);
 		client_ptrwarp(cc);
diff --git a/xevents.c b/xevents.c
index 19798d3..95453f8 100644
--- a/xevents.c
+++ b/xevents.c
@@ -357,10 +357,7 @@ xev_handle_clientmessage(XEvent *ee)
 		if ((cc = client_find(e->window)) != NULL) {
 			if ((old_cc = client_current()) != NULL)
 				client_ptrsave(old_cc);
-			if (cc->flags & CLIENT_HIDDEN)
-				client_unhide(cc);
-			else
-				client_raise(cc);
+			client_show(cc);
 			client_ptrwarp(cc);
 		}
 	} else if (e->message_type == ewmh[_NET_WM_DESKTOP]) {