diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2014-04-27 00:07:53 -0400 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2014-07-03 13:35:02 -0400 |
commit | a4bc66325e0393f4976014a9b7628d3fe5eae34b (patch) | |
tree | 5bc14945529cb44ed3e37ece4a3de8495f434371 | |
parent | d9afc6dada485b26eddb0cd0f8e61253cb16d5c4 (diff) | |
download | cogl-a4bc66325e0393f4976014a9b7628d3fe5eae34b.tar.gz |
examples/cogl-x11-tfp.c: Wait for the window to be mapped
Wait for the main window (and hence the window we create within
the main window to redirect) to be mapped and become viewable
before we try to call XCompositeNameWindowPixmap() -
XComposeNameWindowPixmap() produces a BadMatch error on a
non-viewable window.
Reviewed-by: Robert Bragg <robert.bragg@intel.com>
-rw-r--r-- | examples/cogl-x11-tfp.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/examples/cogl-x11-tfp.c b/examples/cogl-x11-tfp.c index 91979a6f..7d4d7562 100644 --- a/examples/cogl-x11-tfp.c +++ b/examples/cogl-x11-tfp.c @@ -147,7 +147,8 @@ main (int argc, char **argv) DefaultRootWindow (xdpy), xvisinfo->visual, AllocNone); - mask = CWBorderPixel | CWColormap; + xattr.event_mask = StructureNotifyMask; + mask = CWBorderPixel | CWColormap | CWEventMask; xwin = XCreateWindow (xdpy, DefaultRootWindow (xdpy), @@ -179,6 +180,14 @@ main (int argc, char **argv) gc = XCreateGC (xdpy, tfp_xwin, 0, NULL); + while (TRUE) + { + XWindowEvent (xdpy, xwin, StructureNotifyMask, &xev); + + if (xev.xany.type == MapNotify) + break; + } + pixmap = XCompositeNameWindowPixmap (xdpy, tfp_xwin); tfp = cogl_texture_pixmap_x11_new (ctx, pixmap, TRUE, &error); |