From 8e9d3e92d8c56cd209a4fee6174013dd64782352 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 22 Jul 2015 20:21:33 +0100 Subject: [PATCH] onscreen: Use the CoglRenderer API for retrieving the X visual Instead of peeking into the winsys vtable. --- cogl/cogl-onscreen.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c index 4768509b8..e7af2a100 100644 --- a/cogl/cogl-onscreen.c +++ b/cogl/cogl-onscreen.c @@ -44,6 +44,10 @@ #include "cogl-poll-private.h" #include "cogl-gtype-private.h" +#ifdef COGL_HAS_X11_SUPPORT +#include "cogl-xlib-renderer.h" +#endif + static void _cogl_onscreen_free (CoglOnscreen *onscreen); COGL_OBJECT_DEFINE_WITH_CODE_GTYPE (Onscreen, onscreen, @@ -447,18 +451,17 @@ cogl_x11_onscreen_get_window_xid (CoglOnscreen *onscreen) uint32_t cogl_x11_onscreen_get_visual_xid (CoglOnscreen *onscreen) { - CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); - const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); + CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context; XVisualInfo *visinfo; uint32_t id; /* This should only be called for xlib based onscreens */ - _COGL_RETURN_VAL_IF_FAIL (winsys->xlib_get_visual_info != NULL, 0); + visinfo = cogl_xlib_renderer_get_visual_info (ctx->display->renderer); + if (visinfo == NULL) + return 0; - visinfo = winsys->xlib_get_visual_info (); id = (uint32_t)visinfo->visualid; - XFree (visinfo); return id; } #endif /* COGL_HAS_X11_SUPPORT */