about summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2013-06-10 21:37:30 +0000
committerokan <okan>2013-06-10 21:37:30 +0000
commit6059073a5fedd7ef3d97e44ea8eb1511d82087b9 (patch)
tree5dce4ef37808169037ff90fddb1ff962823e3f71
parentb365ceac0e5370ac151362aa077e2620f9ec9d09 (diff)
downloadcwm-6059073a5fedd7ef3d97e44ea8eb1511d82087b9.tar.gz
cwm-6059073a5fedd7ef3d97e44ea8eb1511d82087b9.tar.xz
cwm-6059073a5fedd7ef3d97e44ea8eb1511d82087b9.zip
move synthetic responses and have client_msg only work with WM_PROTOCOLS,
since that's all ClientMessageEvent is for anyway.
-rw-r--r--calmwm.h4
-rw-r--r--client.c45
-rw-r--r--xevents.c2
-rw-r--r--xutil.c35
4 files changed, 43 insertions, 43 deletions
diff --git a/calmwm.h b/calmwm.h
index 62f574a..ba0e15d 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -311,6 +311,7 @@ struct mwm_hints {
 __dead void		 usage(void);
 
 void			 client_applysizehints(struct client_ctx *);
+void			 client_config(struct client_ctx *);
 struct client_ctx	*client_current(void);
 void			 client_cycle(struct screen_ctx *, int);
 void			 client_cycle_leave(struct screen_ctx *,
@@ -327,6 +328,7 @@ void			 client_leave(struct client_ctx *);
 void			 client_lower(struct client_ctx *);
 void			 client_map(struct client_ctx *);
 void			 client_maximize(struct client_ctx *);
+void			 client_msg(struct client_ctx *, Atom);
 void			 client_move(struct client_ctx *);
 struct client_ctx	*client_init(Window, struct screen_ctx *, int);
 void			 client_ptrsave(struct client_ctx *);
@@ -446,7 +448,6 @@ void			 xev_loop(void);
 
 void			 xu_btn_grab(Window, int, u_int);
 void			 xu_btn_ungrab(Window, int, u_int);
-void			 xu_configure(struct client_ctx *);
 void			 xu_getatoms(void);
 int			 xu_getprop(Window, Atom, Atom, long, u_char **);
 int			 xu_get_wm_state(Window, int *);
@@ -457,7 +458,6 @@ int			 xu_ptr_grab(Window, u_int, Cursor);
 int			 xu_ptr_regrab(u_int, Cursor);
 void			 xu_ptr_setpos(Window, int, int);
 void			 xu_ptr_ungrab(void);
-void			 xu_sendmsg(Window, Atom, Atom);
 void			 xu_set_wm_state(Window win, int);
 void			 xu_xft_draw(struct screen_ctx *, const char *,
 			     int, int, int);
diff --git a/client.c b/client.c
index 650dbaa..c8e3221 100644
--- a/client.c
+++ b/client.c
@@ -123,7 +123,7 @@ client_init(Window win, struct screen_ctx *sc, int mapped)
 	client_transient(cc);
 
 	/* Notify client of its configuration. */
-	xu_configure(cc);
+	client_config(cc);
 
 	(state == IconicState) ? client_hide(cc) : client_unhide(cc);
 
@@ -400,14 +400,14 @@ client_resize(struct client_ctx *cc, int reset)
 
 	XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x,
 	    cc->geom.y, cc->geom.w, cc->geom.h);
-	xu_configure(cc);
+	client_config(cc);
 }
 
 void
 client_move(struct client_ctx *cc)
 {
 	XMoveWindow(X_Dpy, cc->win, cc->geom.x, cc->geom.y);
-	xu_configure(cc);
+	client_config(cc);
 }
 
 void
@@ -423,6 +423,26 @@ client_raise(struct client_ctx *cc)
 }
 
 void
+client_config(struct client_ctx *cc)
+{
+	XConfigureEvent	 cn;
+
+	bzero(&cn, sizeof(cn));
+	cn.type = ConfigureNotify;
+	cn.event = cc->win;
+	cn.window = cc->win;
+	cn.x = cc->geom.x;
+	cn.y = cc->geom.y;
+	cn.width = cc->geom.w;
+	cn.height = cc->geom.h;
+	cn.border_width = cc->bwidth;
+	cn.above = None;
+	cn.override_redirect = 0;
+
+	XSendEvent(X_Dpy, cc->win, False, StructureNotifyMask, (XEvent *)&cn);
+}
+
+void
 client_ptrwarp(struct client_ctx *cc)
 {
 	int	 x = cc->ptr.x, y = cc->ptr.y;
@@ -519,11 +539,26 @@ client_wm_protocols(struct client_ctx *cc)
 }
 
 void
+client_msg(struct client_ctx *cc, Atom proto)
+{
+	XClientMessageEvent	 cm;
+
+	bzero(&cm, sizeof(cm));
+	cm.type = ClientMessage;
+	cm.window = cc->win;
+	cm.message_type = cwmh[WM_PROTOCOLS].atom;
+	cm.format = 32;
+	cm.data.l[0] = proto;
+	cm.data.l[1] = CurrentTime;
+
+	XSendEvent(X_Dpy, cc->win, False, NoEventMask, (XEvent *)&cm);
+}
+
+void
 client_send_delete(struct client_ctx *cc)
 {
 	if (cc->xproto & _WM_DELETE_WINDOW)
-		xu_sendmsg(cc->win,
-		    cwmh[WM_PROTOCOLS].atom, cwmh[WM_DELETE_WINDOW].atom);
+		client_msg(cc, cwmh[WM_DELETE_WINDOW].atom);
 	else
 		XKillClient(X_Dpy, cc->win);
 }
diff --git a/xevents.c b/xevents.c
index 80cb554..812e959 100644
--- a/xevents.c
+++ b/xevents.c
@@ -169,7 +169,7 @@ xev_handle_configurerequest(XEvent *ee)
 		wc.border_width = cc->bwidth;
 
 		XConfigureWindow(X_Dpy, cc->win, e->value_mask, &wc);
-		xu_configure(cc);
+		client_config(cc);
 	} else {
 		/* let it do what it wants, it'll be ours when we map it. */
 		wc.x = e->x;
diff --git a/xutil.c b/xutil.c
index 56325b6..6eeaf72 100644
--- a/xutil.c
+++ b/xutil.c
@@ -105,41 +105,6 @@ xu_key_grab(Window win, u_int mask, KeySym keysym)
 		    True, GrabModeAsync, GrabModeAsync);
 }
 
-void
-xu_configure(struct client_ctx *cc)
-{
-	XConfigureEvent	 ce;
-
-	ce.type = ConfigureNotify;
-	ce.event = cc->win;
-	ce.window = cc->win;
-	ce.x = cc->geom.x;
-	ce.y = cc->geom.y;
-	ce.width = cc->geom.w;
-	ce.height = cc->geom.h;
-	ce.border_width = cc->bwidth;
-	ce.above = None;
-	ce.override_redirect = 0;
-
-	XSendEvent(X_Dpy, cc->win, False, StructureNotifyMask, (XEvent *)&ce);
-}
-
-void
-xu_sendmsg(Window win, Atom type, Atom atm)
-{
-	XClientMessageEvent	 e;
-
-	bzero(&e, sizeof(e));
-	e.type = ClientMessage;
-	e.window = win;
-	e.message_type = type;
-	e.format = 32;
-	e.data.l[0] = atm;
-	e.data.l[1] = CurrentTime;
-
-	XSendEvent(X_Dpy, win, False, 0L, (XEvent *)&e);
-}
-
 int
 xu_getprop(Window win, Atom atm, Atom type, long len, u_char **p)
 {