From: Dana Jansens Date: Fri, 25 Jun 2010 12:55:34 +0000 (+0200) Subject: Change shape test program X-Git-Tag: cgl~23 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=63a7986aee258107ea370166c48e8d0b19d650e7;p=dana%2Fopenbox.git Change shape test program make it set an initial shape that also is inside the border and then resize and set a new shape after a pause --- diff --git a/tests/shape.c b/tests/shape.c index c3de7da3..3cdd8e08 100644 --- a/tests/shape.c +++ b/tests/shape.c @@ -28,9 +28,10 @@ int main () { Window win; XEvent report; XEvent msg; - int x=50,y=50,h=100,w=400; + int x=00,y=00,h=100,w=400; XWMHints hint; XRectangle xrect; + XSetWindowAttributes at; display = XOpenDisplay(NULL); @@ -39,9 +40,10 @@ int main () { return 0; } + at.override_redirect = True; win = XCreateWindow(display, RootWindow(display, 0), x, y, w, h, 10, CopyFromParent, CopyFromParent, - CopyFromParent, 0, NULL); + CopyFromParent, CWOverrideRedirect, &at); xrect.x = 10; xrect.y = 10; xrect.width = w - 20; @@ -50,11 +52,43 @@ int main () { ShapeBounding, 0, 0, &xrect, 1, ShapeSet, Unsorted); + xrect.x = -10; + xrect.y = -10; + xrect.width = w+20; + xrect.height = 10; + XShapeCombineRectangles(display, win, + ShapeBounding, 0, 0, &xrect, 1, + ShapeUnion, Unsorted); + XSetWindowBackground(display,win,BlackPixel(display,0)); + XSetWindowBorder(display, win, WhitePixel(display, 0)); XMapWindow(display, win); XFlush(display); + sleep(3); + + w *= 2; + h *= 2; + XResizeWindow(display, win, w, h); + xrect.x = 10; + xrect.y = 10; + xrect.width = w - 20; + xrect.height = h - 20; + XShapeCombineRectangles(display, win, + ShapeBounding, 0, 0, &xrect, 1, + ShapeSet, Unsorted); + + xrect.x = -10; + xrect.y = -10; + xrect.width = w+20; + xrect.height = 10; + XShapeCombineRectangles(display, win, + ShapeBounding, 0, 0, &xrect, 1, + ShapeUnion, Unsorted); + XFlush(display); + + while (1) { XNextEvent(display, &report);