summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2013-11-08 17:35:12 +0000
committerokan <okan>2013-11-08 17:35:12 +0000
commit3bb928a1c26c76d7e0a929ca3502c29170a83e53 (patch)
treed95e63a844ac922a3d3320ae019f81a83024cc58
parentc1bc6d37b385ff4dad1582583fd21f2c45b2c168 (diff)
downloadcwm-3bb928a1c26c76d7e0a929ca3502c29170a83e53.tar.gz
cwm-3bb928a1c26c76d7e0a929ca3502c29170a83e53.tar.xz
cwm-3bb928a1c26c76d7e0a929ca3502c29170a83e53.zip
stash WMProtocols in flags
-rw-r--r--calmwm.h8
-rw-r--r--client.c10
2 files changed, 7 insertions, 11 deletions
diff --git a/calmwm.h b/calmwm.h
index f0361ba..bedfde0 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -126,11 +126,6 @@ struct winname {
 };
 TAILQ_HEAD(winname_q, winname);
 
-enum wm_protocols {
-	_WM_DELETE_WINDOW	= 0x0001,
-	_WM_TAKE_FOCUS		= 0x0002,
-};
-
 struct client_ctx {
 	TAILQ_ENTRY(client_ctx) entry;
 	TAILQ_ENTRY(client_ctx) group_entry;
@@ -157,7 +152,6 @@ struct client_ctx {
 		int		 x;	/* x position */
 		int		 y;	/* y position */
 	} ptr;
-	enum wm_protocols	 xproto;
 #define CLIENT_HIDDEN			0x0001
 #define CLIENT_IGNORE			0x0002
 #define CLIENT_VMAXIMIZED		0x0004
@@ -166,6 +160,8 @@ struct client_ctx {
 #define CLIENT_GROUP			0x0020
 #define CLIENT_UNGROUP			0x0040
 #define CLIENT_INPUT			0x0080
+#define CLIENT_WM_DELETE_WINDOW		0x0100
+#define CLIENT_WM_TAKE_FOCUS		0x0200
 
 #define CLIENT_HIGHLIGHT		(CLIENT_GROUP | CLIENT_UNGROUP)
 #define CLIENT_MAXFLAGS			(CLIENT_VMAXIMIZED | CLIENT_HMAXIMIZED)
diff --git a/client.c b/client.c
index 6c9581d..f697cf2 100644
--- a/client.c
+++ b/client.c
@@ -212,11 +212,11 @@ client_setactive(struct client_ctx *cc, int fg)
 	if (fg) {
 		XInstallColormap(X_Dpy, cc->colormap);
 		if ((cc->flags & CLIENT_INPUT) ||
-		    ((cc->xproto & _WM_TAKE_FOCUS) == 0)) {
+		    ((cc->flags & CLIENT_WM_TAKE_FOCUS) == 0)) {
 			XSetInputFocus(X_Dpy, cc->win,
 			    RevertToPointerRoot, CurrentTime);
 		}
-		if (cc->xproto & _WM_TAKE_FOCUS)
+		if (cc->flags & CLIENT_WM_TAKE_FOCUS)
 			client_msg(cc, cwmh[WM_TAKE_FOCUS]);
 		conf_grab_mouse(cc->win);
 		/*
@@ -532,9 +532,9 @@ client_wm_protocols(struct client_ctx *cc)
 	if (XGetWMProtocols(X_Dpy, cc->win, &p, &j)) {
 		for (i = 0; i < j; i++) {
 			if (p[i] == cwmh[WM_DELETE_WINDOW])
-				cc->xproto |= _WM_DELETE_WINDOW;
+				cc->flags |= CLIENT_WM_DELETE_WINDOW;
 			else if (p[i] == cwmh[WM_TAKE_FOCUS])
-				cc->xproto |= _WM_TAKE_FOCUS;
+				cc->flags |= CLIENT_WM_TAKE_FOCUS;
 		}
 		XFree(p);
 	}
@@ -559,7 +559,7 @@ client_msg(struct client_ctx *cc, Atom proto)
 void
 client_send_delete(struct client_ctx *cc)
 {
-	if (cc->xproto & _WM_DELETE_WINDOW)
+	if (cc->flags & CLIENT_WM_DELETE_WINDOW)
 		client_msg(cc, cwmh[WM_DELETE_WINDOW]);
 	else
 		XKillClient(X_Dpy, cc->win);