cogl: Add way to pass user data when setting custom renderer winsys

When creating a renderer with a custom winsys (which is always how
mutter uses cogl) make it possible to pass a user data with the winsys.
Still unused.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
This commit is contained in:
Jonas Ådahl 2017-07-24 16:03:02 +08:00
parent b32cccddf9
commit 18eb66de06
5 changed files with 10 additions and 4 deletions

View File

@ -43,6 +43,7 @@
#include <cogl/winsys/cogl-winsys-private.h>
void cogl_renderer_set_custom_winsys (CoglRenderer *renderer,
CoglCustomWinsysVtableGetter winsys_vtable_getter);
CoglCustomWinsysVtableGetter winsys_vtable_getter,
void *user_data);
#endif /* __COGL_MUTTER_H___ */

View File

@ -54,6 +54,7 @@ struct _CoglRenderer
const CoglDriverVtable *driver_vtable;
const CoglTextureDriver *texture_driver;
const CoglWinsysVtable *winsys_vtable;
void *custom_winsys_user_data;
CoglCustomWinsysVtableGetter custom_winsys_vtable_getter;
CoglWinsysID winsys_id_override;
GList *constraints;

View File

@ -566,8 +566,10 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
void
cogl_renderer_set_custom_winsys (CoglRenderer *renderer,
CoglCustomWinsysVtableGetter winsys_vtable_getter)
CoglCustomWinsysVtableGetter winsys_vtable_getter,
void *user_data)
{
renderer->custom_winsys_user_data = user_data;
renderer->custom_winsys_vtable_getter = winsys_vtable_getter;
}

View File

@ -1693,7 +1693,8 @@ meta_renderer_native_create_cogl_renderer (MetaRenderer *renderer)
cogl_renderer = cogl_renderer_new ();
cogl_renderer_set_custom_winsys (cogl_renderer,
get_native_cogl_winsys_vtable);
get_native_cogl_winsys_vtable,
NULL);
return cogl_renderer;
}

View File

@ -71,7 +71,8 @@ meta_renderer_x11_create_cogl_renderer (MetaRenderer *renderer)
Display *xdisplay = clutter_x11_get_default_display ();
cogl_renderer = cogl_renderer_new ();
cogl_renderer_set_custom_winsys (cogl_renderer, get_x11_cogl_winsys_vtable);
cogl_renderer_set_custom_winsys (cogl_renderer, get_x11_cogl_winsys_vtable,
NULL);
cogl_xlib_renderer_set_foreign_display (cogl_renderer, xdisplay);
/* Set up things so that if the INTEL_swap_event extension is not present,