summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--calmwm.h1
-rw-r--r--client.c3
-rw-r--r--grab.c2
-rw-r--r--xevents.c19
4 files changed, 18 insertions, 7 deletions
diff --git a/calmwm.h b/calmwm.h
index 67bb1df..d2e908d 100644
--- a/calmwm.h
+++ b/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/client.c b/client.c
index 20b5cc1..8a329f0 100644
--- a/client.c
+++ b/client.c
@@ -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/grab.c b/grab.c
index f7e9589..9e29b3c 100644
--- a/grab.c
+++ b/grab.c
@@ -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/xevents.c b/xevents.c
index fed91e6..e70d218 100644
--- a/xevents.c
+++ b/xevents.c
@@ -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;
 		}