[mutter] stage-view/cogl: Add frame listener in constructor()



commit 3dfe3a248db5ae9e27e850682cfe203fd0b9e3d1
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sun Aug 16 21:35:16 2020 +0200

    stage-view/cogl: Add frame listener in constructor()
    
    The onscreens are set on construction now, so no need to wait for it to
    be set after.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1407

 clutter/clutter/cogl/clutter-stage-cogl.c | 33 ++++++++++++++++---------------
 1 file changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c
index 4b07a40575..b53a6c16a4 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/clutter/cogl/clutter-stage-cogl.c
@@ -757,8 +757,22 @@ frame_cb (CoglOnscreen  *onscreen,
 }
 
 static void
-on_framebuffer_set (ClutterStageView *view)
+clutter_stage_view_cogl_dispose (GObject *object)
+{
+  ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (object);
+  ClutterStageViewCoglPrivate *view_priv =
+    clutter_stage_view_cogl_get_instance_private (view_cogl);
+
+  g_clear_handle_id (&view_priv->notify_presented_handle_id, g_source_remove);
+  g_clear_pointer (&view_priv->damage_history, clutter_damage_history_free);
+
+  G_OBJECT_CLASS (clutter_stage_view_cogl_parent_class)->dispose (object);
+}
+
+static void
+clutter_stage_view_cogl_constructed (GObject *object)
 {
+  ClutterStageView *view = CLUTTER_STAGE_VIEW (view_cogl);
   CoglFramebuffer *framebuffer;
 
   framebuffer = clutter_stage_view_get_onscreen (view);
@@ -770,19 +784,8 @@ on_framebuffer_set (ClutterStageView *view)
                                         view,
                                         NULL);
     }
-}
 
-static void
-clutter_stage_view_cogl_dispose (GObject *object)
-{
-  ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (object);
-  ClutterStageViewCoglPrivate *view_priv =
-    clutter_stage_view_cogl_get_instance_private (view_cogl);
-
-  g_clear_handle_id (&view_priv->notify_presented_handle_id, g_source_remove);
-  g_clear_pointer (&view_priv->damage_history, clutter_damage_history_free);
-
-  G_OBJECT_CLASS (clutter_stage_view_cogl_parent_class)->dispose (object);
+  G_OBJECT_CLASS (clutter_stage_view_cogl_parent_class)->constructed (object);
 }
 
 static void
@@ -792,9 +795,6 @@ clutter_stage_view_cogl_init (ClutterStageViewCogl *view_cogl)
     clutter_stage_view_cogl_get_instance_private (view_cogl);
 
   view_priv->damage_history = clutter_damage_history_new ();
-
-  g_signal_connect (view_cogl, "notify::framebuffer",
-                    G_CALLBACK (on_framebuffer_set), NULL);
 }
 
 static void
@@ -802,5 +802,6 @@ clutter_stage_view_cogl_class_init (ClutterStageViewCoglClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
+  object_class->constructed = clutter_stage_view_cogl_constructed;
   object_class->dispose = clutter_stage_view_cogl_dispose;
 }


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