summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2008-05-17 03:59:54 +0000
committerokan <okan>2008-05-17 03:59:54 +0000
commit9a58e74401a651b770e1f6fcbf5f7edfcc4ee9d1 (patch)
tree34eb9a1fdeb929b921f37150b911f3c44fd6f89f
parent5034a77849c3a0ed91b67d1de65f063c9056cbc7 (diff)
downloadcwm-9a58e74401a651b770e1f6fcbf5f7edfcc4ee9d1.tar.gz
cwm-9a58e74401a651b770e1f6fcbf5f7edfcc4ee9d1.tar.xz
cwm-9a58e74401a651b770e1f6fcbf5f7edfcc4ee9d1.zip
fix cwm's current XShape support from Edd Barrett -thanks.
XShape events should be handled at some point.

ok oga@
-rw-r--r--calmwm.h1
-rw-r--r--client.c38
-rw-r--r--grab.c1
3 files changed, 25 insertions, 15 deletions
diff --git a/calmwm.h b/calmwm.h
index 5fdf989..06ba4ba 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -355,6 +355,7 @@ struct client_ctx	*client_mrunext(struct client_ctx *cc);
 struct client_ctx	*client_mruprev(struct client_ctx *cc);
 void			 client_gethints(struct client_ctx *cc);
 void			 client_freehints(struct client_ctx *cc);
+void			 client_do_shape(struct client_ctx *);
 
 void			 xev_handle_maprequest(struct xevent *, XEvent *);
 void			 xev_handle_unmapnotify(struct xevent *, XEvent *);
diff --git a/client.c b/client.c
index 96c0351..9de07a5 100644
--- a/client.c
+++ b/client.c
@@ -139,21 +139,6 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
 	    DefaultVisual(X_Dpy, sc->which),
 	    CWOverrideRedirect | CWBackPixel | CWEventMask, &pxattr);
 
-	if (Doshape) {
-		XRectangle *r;
-		int n, tmp;
-
-		XShapeSelectInput(X_Dpy, cc->win, ShapeNotifyMask);
-
-		r = XShapeGetRectangles(X_Dpy, cc->win, ShapeBounding,
-		    &n, &tmp);
-		if (n > 1)
-			XShapeCombineShape(X_Dpy, cc->pwin, ShapeBounding,
-			    0,	0, /* XXX border */
-			    cc->win, ShapeBounding, ShapeSet);
-		XFree(r);
-	}
-
 	cc->active = 0;
 	client_draw_border(cc);
 
@@ -188,6 +173,27 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
 	return (cc);
 }
 
+void
+client_do_shape(struct client_ctx *cc)
+{
+	/* Windows not rectangular require more effort */
+	XRectangle *r;
+	int n, tmp;
+
+	if (Doshape) {
+		XShapeSelectInput(X_Dpy, cc->win, ShapeNotifyMask);
+
+		r = XShapeGetRectangles(X_Dpy, cc->win, ShapeBounding,
+		    &n, &tmp);
+
+		if (n > 1)
+			XShapeCombineShape(X_Dpy, cc->pwin, ShapeBounding,
+			    cc->bwidth,	cc->bwidth, cc->win, ShapeBounding,
+			    ShapeSet);
+		XFree(r);
+	}
+}
+
 int
 client_delete(struct client_ctx *cc, int sendevent, int ignorewindow)
 {
@@ -458,6 +464,8 @@ 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 d488394..3aeffc6 100644
--- a/grab.c
+++ b/grab.c
@@ -101,6 +101,7 @@ grab_sweep(struct client_ctx *cc)
 			XReparentWindow(X_Dpy, sc->menuwin, sc->rootwin, 0, 0);
 			xu_ptr_ungrab();
 			client_ptrwarp(cc);
+			client_do_shape(cc);
 			return;
 		}
 	}