From b3cbe6ba11ba964efa35f179af518130273082c2 Mon Sep 17 00:00:00 2001 From: okan Date: Sat, 14 Jun 2008 22:04:11 +0000 Subject: [PATCH] (mostly) proper xshape event support ok oga@ --- app/cwm/calmwm.h | 3 ++- app/cwm/client.c | 5 +---- app/cwm/grab.c | 4 ++-- app/cwm/xevents.c | 21 +++++++++++++++++---- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 88f44a7f1..41f4c94b6 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/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. * - * $Id: calmwm.h,v 1.52 2008/06/14 21:48:54 okan Exp $ + * $Id: calmwm.h,v 1.53 2008/06/14 22:04:11 okan Exp $ */ #ifndef _CALMWM_H_ @@ -384,6 +384,7 @@ void xev_handle_keypress(struct xevent *, XEvent *); void xev_handle_keyrelease(struct xevent *, XEvent *); void xev_handle_expose(struct xevent *, XEvent *); void xev_handle_clientmessage(struct xevent *, XEvent *); +void xev_handle_shape(struct xevent *, XEvent *); #define XEV_QUICK(a, b, c, d, e) do { \ xev_register(xev_new(a, b, c, d, e)); \ diff --git a/app/cwm/client.c b/app/cwm/client.c index 8b6c35916..70c4bd62a 100644 --- a/app/cwm/client.c +++ b/app/cwm/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. * - * $Id: client.c,v 1.29 2008/06/12 04:59:51 okan Exp $ + * $Id: client.c,v 1.30 2008/06/14 22:04:11 okan Exp $ */ #include "headers.h" @@ -140,7 +140,6 @@ client_new(Window win, struct screen_ctx *sc, int mapped) CWOverrideRedirect | CWBackPixel | CWEventMask, &pxattr); cc->active = 0; - client_draw_border(cc); XAddToSaveSet(X_Dpy, cc->win); XSetWindowBorderWidth(X_Dpy, cc->win, 0); @@ -463,8 +462,6 @@ client_draw_border(struct client_ctx *cc) XClearWindow(X_Dpy, cc->pwin); } - - client_do_shape(cc); } u_long diff --git a/app/cwm/grab.c b/app/cwm/grab.c index 153b70e08..46f9133d6 100644 --- a/app/cwm/grab.c +++ b/app/cwm/grab.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. * - * $Id: grab.c,v 1.17 2008/06/12 18:55:35 okan Exp $ + * $Id: grab.c,v 1.18 2008/06/14 22:04:11 okan Exp $ */ #include "headers.h" @@ -94,6 +94,7 @@ grab_sweep(struct client_ctx *cc) cc->bwidth, cc->bwidth, cc->geom.width, cc->geom.height); + client_do_shape(cc); break; case ButtonRelease: XUnmapWindow(X_Dpy, sc->menuwin); @@ -107,7 +108,6 @@ grab_sweep(struct client_ctx *cc) cc->ptr.y = cc->geom.height - cc->bwidth; client_ptrwarp(cc); - client_do_shape(cc); return; } } diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c index 5ab7d707d..60fd30cb8 100644 --- a/app/cwm/xevents.c +++ b/app/cwm/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. * - * $Id: xevents.c,v 1.19 2008/06/14 21:48:54 okan Exp $ + * $Id: xevents.c,v 1.20 2008/06/14 22:04:11 okan Exp $ */ /* @@ -260,7 +260,6 @@ xev_handle_buttonrelease(struct xevent *xev, XEvent *ee) group_sticky_toggle_exit(cc); xev_register(xev); - } void @@ -354,6 +353,16 @@ out: xev_register(xev); } +void +xev_handle_shape(struct xevent *xev, XEvent *ee) +{ + XShapeEvent *sev = (XShapeEvent *) ee; + struct client_ctx *cc; + + if ((cc = client_find(sev->window)) != NULL) + client_do_shape(cc); +} + /* * X Event handling */ @@ -411,8 +420,10 @@ xev_handle_expose(struct xevent *xev, XEvent *ee) XExposeEvent *e = &ee->xexpose; struct client_ctx *cc; - if ((cc = client_find(e->window)) != NULL && e->count == 0) + if ((cc = client_find(e->window)) != NULL && e->count == 0) { client_draw_border(cc); + client_do_shape(cc); + } xev_register(xev); } @@ -478,7 +489,9 @@ xev_loop(void) case ClientMessage: ASSIGN1(xclient); break; - default: /* XXX - still need shape event support. */ + default: + if (e.type == Shape_ev) + xev_handle_shape(xev, &e); break; }