[Cogl] [PATCH 4/7] examples/cogl-x11-tfp.c: Wait for the window to be mapped

Robert Bragg robert at sixbynine.org
Sun Jun 15 10:16:49 PDT 2014


Thanks this looks good to land to me:

Reviewed-by: Robert Bragg <robert at sixbynine.org>

--
Thanks
Robert

On Thu, Jun 12, 2014 at 7:11 PM,  <otaylor at redhat.com> wrote:
> From: "Owen W. Taylor" <otaylor at fishsoup.net>
>
> 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.
> ---
>  examples/cogl-x11-tfp.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/examples/cogl-x11-tfp.c b/examples/cogl-x11-tfp.c
> index 91979a6..7d4d756 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);
> --
> 1.9.3
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list