about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--calmwm.h1
-rw-r--r--xevents.c7
-rw-r--r--xutil.c1
3 files changed, 4 insertions, 5 deletions
diff --git a/calmwm.h b/calmwm.h
index 033ed5a..032e8b8 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -527,6 +527,7 @@ enum {
 	WM_PROTOCOLS,
 	_MOTIF_WM_HINTS,
 	UTF8_STRING,
+	WM_CHANGE_STATE,
 	CWMH_NITEMS
 };
 enum {
diff --git a/xevents.c b/xevents.c
index 9849fb5..174985d 100644
--- a/xevents.c
+++ b/xevents.c
@@ -340,16 +340,13 @@ static void
 xev_handle_clientmessage(XEvent *ee)
 {
 	XClientMessageEvent	*e = &ee->xclient;
-	Atom			 xa_wm_change_state;
 	struct client_ctx	*cc;
 
-	xa_wm_change_state = XInternAtom(X_Dpy, "WM_CHANGE_STATE", False);
-
 	if ((cc = client_find(e->window)) == NULL)
 		return;
 
-	if (e->message_type == xa_wm_change_state && e->format == 32 &&
-	    e->data.l[0] == IconicState)
+	if (e->message_type == cwmh[WM_CHANGE_STATE].atom &&
+	    e->format == 32 && e->data.l[0] == IconicState)
 		client_hide(cc);
 }
 
diff --git a/xutil.c b/xutil.c
index a2a6bec..764116a 100644
--- a/xutil.c
+++ b/xutil.c
@@ -239,6 +239,7 @@ struct atom_ctx cwmh[CWMH_NITEMS] = {
 	{"WM_PROTOCOLS",		None},
 	{"_MOTIF_WM_HINTS",		None},
 	{"UTF8_STRING",			None},
+	{"WM_CHANGE_STATE",		None},
 };
 struct atom_ctx ewmh[EWMH_NITEMS] = {
 	{"_NET_SUPPORTED",		None},