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



commit 18eb66de061d9b59484a5a4d43c00e9a21c0104e
Author: Jonas Ådahl <jadahl gmail com>
Date:   Mon Jul 24 16:03:02 2017 +0800

    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

 cogl/cogl/cogl-mutter.h                    |    3 ++-
 cogl/cogl/cogl-renderer-private.h          |    1 +
 cogl/cogl/cogl-renderer.c                  |    4 +++-
 src/backends/native/meta-renderer-native.c |    3 ++-
 src/backends/x11/meta-renderer-x11.c       |    3 ++-
 5 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/cogl/cogl/cogl-mutter.h b/cogl/cogl/cogl-mutter.h
index a1cd7e3..13de039 100644
--- a/cogl/cogl/cogl-mutter.h
+++ b/cogl/cogl/cogl-mutter.h
@@ -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___ */
diff --git a/cogl/cogl/cogl-renderer-private.h b/cogl/cogl/cogl-renderer-private.h
index a833a68..03b0c30 100644
--- a/cogl/cogl/cogl-renderer-private.h
+++ b/cogl/cogl/cogl-renderer-private.h
@@ -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;
diff --git a/cogl/cogl/cogl-renderer.c b/cogl/cogl/cogl-renderer.c
index 23cd3f8..0152e87 100644
--- a/cogl/cogl/cogl-renderer.c
+++ b/cogl/cogl/cogl-renderer.c
@@ -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;
 }
 
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 521da03..d7d2d47 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -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;
 }
diff --git a/src/backends/x11/meta-renderer-x11.c b/src/backends/x11/meta-renderer-x11.c
index 90924e0..2e2958b 100644
--- a/src/backends/x11/meta-renderer-x11.c
+++ b/src/backends/x11/meta-renderer-x11.c
@@ -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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]