summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2014-04-27 00:07:53 -0400
committerOwen W. Taylor <otaylor@fishsoup.net>2014-07-17 18:01:03 -0400
commit0cdb938551f6aaafac80758829e21c0cb7b1f81d (patch)
treebc1649d25b52c85747ff9be4a11f999640ff688c
parent93bcd0dd58d61b93b584558cba8f616448ab883e (diff)
downloadcogl-0cdb938551f6aaafac80758829e21c0cb7b1f81d.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.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/examples/cogl-x11-tfp.c b/examples/cogl-x11-tfp.c
index b5803d01..b5859431 100644
--- a/examples/cogl-x11-tfp.c
+++ b/examples/cogl-x11-tfp.c
@@ -139,7 +139,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),
@@ -171,6 +172,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);