From d4e68ce6f6bb6effbb27c5607734c3da30e7baa9 Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 10 Jun 2013 21:37:30 +0000 Subject: move synthetic responses and have client_msg only work with WM_PROTOCOLS, since that's all ClientMessageEvent is for anyway. --- client.c | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'client.c') 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 @@ -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 @@ -422,6 +422,26 @@ client_raise(struct client_ctx *cc) XRaiseWindow(X_Dpy, cc->win); } +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) { @@ -518,12 +538,27 @@ 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); } -- cgit v1.2.3-2-gb3c3