Store XVisualInfo into the Xlib renderer

We want to be able to retrieve the XVisualInfo used when creating the
GL context under GLX and EGL-X11, so that we can use the visual before
we have an onscreen frame buffer.
This commit is contained in:
Emmanuele Bassi 2015-07-22 20:17:52 +01:00
parent 0ad995746a
commit 19ca856810
4 changed files with 24 additions and 0 deletions

View File

@ -48,6 +48,8 @@ typedef struct _CoglXlibRenderer
CoglXlibTrapState *trap_state;
unsigned long outputs_update_serial;
XVisualInfo *xvisinfo;
} CoglXlibRenderer;
CoglBool

View File

@ -58,6 +58,11 @@ static GList *_cogl_xlib_renderers = NULL;
static void
destroy_xlib_renderer_data (void *user_data)
{
CoglXlibRenderer *data = user_data;
if (data->xvisinfo)
XFree (data->xvisinfo);
g_slice_free (CoglXlibRenderer, user_data);
}
@ -658,3 +663,15 @@ _cogl_xlib_renderer_output_for_rectangle (CoglRenderer *renderer,
return max_overlapped;
}
XVisualInfo *
cogl_xlib_renderer_get_visual_info (CoglRenderer *renderer)
{
CoglXlibRenderer *xlib_renderer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL);
xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
return xlib_renderer->xvisinfo;
}

View File

@ -34,6 +34,7 @@
#define __COGL_XLIB_RENDERER_H__
#include <X11/Xlib.h>
#include <X11/Xutil.h>
/* NB: this is a top-level header that can be included directly but we
* want to be careful not to define __COGL_H_INSIDE__ when this is
@ -169,6 +170,9 @@ cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer,
Display *
cogl_xlib_renderer_get_display (CoglRenderer *renderer);
XVisualInfo *
cogl_xlib_renderer_get_visual_info (CoglRenderer *renderer);
COGL_END_DECLS
/* The gobject introspection scanner seems to parse public headers in

View File

@ -1063,6 +1063,7 @@ cogl_xlib_handle_event
cogl_xlib_renderer_add_filter
cogl_xlib_renderer_get_display
cogl_xlib_renderer_get_foreign_display
cogl_xlib_renderer_get_visual_info
cogl_xlib_renderer_handle_event
cogl_xlib_renderer_remove_filter
cogl_xlib_renderer_set_event_retrieval_enabled