aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2013-06-10 21:37:30 +0000
committerokan2013-06-10 21:37:30 +0000
commitd4e68ce6f6bb6effbb27c5607734c3da30e7baa9 (patch)
tree037de4d342ccf0585c2808032e762294c46cade1
parent047b95bd58c952fb5fbf9a6f97782a916cc9fe87 (diff)
downloadcwm-d4e68ce6f6bb6effbb27c5607734c3da30e7baa9.tar.gz
move synthetic responses and have client_msg only work with WM_PROTOCOLS,
since that's all ClientMessageEvent is for anyway.
Diffstat (limited to '')
-rw-r--r--calmwm.h6
-rw-r--r--client.c47
-rw-r--r--xevents.c4
-rw-r--r--xutil.c37
4 files changed, 47 insertions, 47 deletions
diff --git a/calmwm.h b/calmwm.h
index 4dbaf67..70ed03a 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.h,v 1.211 2013/05/27 23:20:45 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.212 2013/06/10 21:37:30 okan Exp $
*/
#ifndef _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 cb52c50..ce870fe 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.133 2013/05/23 16:52:39 okan Exp $
+ * $OpenBSD: client.c,v 1.134 2013/06/10 21:37:30 okan Exp $
*/
#include <sys/param.h>
@@ -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 c7fc215..90eaee7 100644
--- a/xevents.c
+++ b/xevents.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: xevents.c,v 1.84 2013/06/10 20:11:43 okan Exp $
+ * $OpenBSD: xevents.c,v 1.85 2013/06/10 21:37:30 okan Exp $
*/
/*
@@ -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 719afa8..53e75a9 100644
--- a/xutil.c
+++ b/xutil.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: xutil.c,v 1.68 2013/05/27 23:20:45 okan Exp $
+ * $OpenBSD: xutil.c,v 1.69 2013/06/10 21:37:30 okan Exp $
*/
#include <sys/param.h>
@@ -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)
{