Revision: 325 http://trac.macosforge.org/projects/xquartz/changeset/325 Author: gstaplin@apple.com Date: 2009-03-26 00:53:24 -0700 (Thu, 26 Mar 2009) Log Message: ----------- Improve the new triangle_glx_destroy_relation test, so that we can test some more state interactively. This is useful with LIBGL_DIAGNOSTIC. Modified Paths: -------------- AppleSGLX/trunk/tests/triangle_glx/triangle_glx_destroy_relation.c Modified: AppleSGLX/trunk/tests/triangle_glx/triangle_glx_destroy_relation.c =================================================================== --- AppleSGLX/trunk/tests/triangle_glx/triangle_glx_destroy_relation.c 2009-03-26 07:51:57 UTC (rev 324) +++ AppleSGLX/trunk/tests/triangle_glx/triangle_glx_destroy_relation.c 2009-03-26 07:53:24 UTC (rev 325) @@ -25,23 +25,28 @@ void event_loop(Display *dpy) { XEvent event; - + XWindowAttributes wattr; + while(1) { XNextEvent(dpy, &event); switch(event.type) { + case ButtonPress: + printf("event.xbutton.window 0x%lx\n", + event.xbutton.window); + XDestroyWindow(dpy, event.xbutton.window); + break; + case Expose: glXMakeCurrent(dpy, event.xexpose.window, ctx); + XGetWindowAttributes(dpy, event.xexpose.window, &wattr); + resize(dpy, event.xexpose.window, wattr.width, wattr.height); draw(dpy, event.xexpose.window); break; - - case KeyPress: { - XWindowAttributes wattr; - + + case KeyPress: { glXMakeCurrent(dpy, win2, ctx); - XGetWindowAttributes(dpy, win2, &wattr); - resize(dpy, win2, wattr.width, wattr.height); draw(dpy, win2); XFlush(dpy); @@ -97,7 +102,8 @@ attr.background_pixel = 0; attr.border_pixel = 0; attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; + attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask + | ButtonPressMask; win = XCreateWindow(dpy, root, /*x*/ 0, /*y*/ 0, /*width*/ 400, /*height*/ 400, @@ -113,6 +119,8 @@ CWBackPixel | CWBorderPixel | CWColormap | CWEventMask, &attr); + printf("win 0x%lx win2 0x%lx\n", win, win2); + ctx = glXCreateContext(dpy, visinfo, NULL, True); if(!ctx) { fprintf(stderr, "error: glXCreateContext failed!\n");