[mutter/wip/carlosg/performance-improvements: 21/23] compositor: Use queue_redraw vmethod over repaint-scheduled signal



commit c93ff677e8212648ec0df2d7be99f51fe16866e8
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun May 7 03:04:31 2017 +0200

    compositor: Use queue_redraw vmethod over repaint-scheduled signal
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782344

 src/compositor/meta-window-actor.c |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 4306124..3dd9d46 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -82,7 +82,6 @@ struct _MetaWindowActorPrivate
   guint             send_frame_messages_timer;
   gint64            frame_drawn_time;
 
-  guint             repaint_scheduled_id;
   guint             size_changed_id;
 
   /*
@@ -194,6 +193,18 @@ frame_data_free (FrameData *frame)
   g_slice_free (FrameData, frame);
 }
 
+static gboolean
+meta_window_actor_queue_redraw (ClutterActor       *actor,
+                                ClutterActor       *leaf,
+                                ClutterPaintVolume *paint_volume)
+{
+  MetaWindowActor *self = META_WINDOW_ACTOR (actor);
+  MetaWindowActorPrivate *priv = self->priv;
+
+  priv->repaint_scheduled = TRUE;
+  return CLUTTER_ACTOR_CLASS (meta_window_actor_parent_class)->queue_redraw (actor, leaf, paint_volume);
+}
+
 static void
 meta_window_actor_class_init (MetaWindowActorClass *klass)
 {
@@ -211,6 +222,7 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
 
   actor_class->paint = meta_window_actor_paint;
   actor_class->get_paint_volume = meta_window_actor_get_paint_volume;
+  actor_class->queue_redraw = meta_window_actor_queue_redraw;
 
   /**
    * MetaWindowActor::first-frame:
@@ -297,16 +309,6 @@ surface_size_changed (MetaSurfaceActor *actor,
   meta_window_actor_update_shape (self);
 }
 
-static void
-surface_repaint_scheduled (MetaSurfaceActor *actor,
-                           gpointer          user_data)
-{
-  MetaWindowActor *self = META_WINDOW_ACTOR (user_data);
-  MetaWindowActorPrivate *priv = self->priv;
-
-  priv->repaint_scheduled = TRUE;
-}
-
 static gboolean
 is_argb32 (MetaWindowActor *self)
 {
@@ -396,9 +398,7 @@ set_surface (MetaWindowActor  *self,
 
   if (priv->surface)
     {
-      g_signal_handler_disconnect (priv->surface, priv->repaint_scheduled_id);
       g_signal_handler_disconnect (priv->surface, priv->size_changed_id);
-      priv->repaint_scheduled_id = 0;
       clutter_actor_remove_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
       g_object_unref (priv->surface);
     }
@@ -408,8 +408,6 @@ set_surface (MetaWindowActor  *self,
   if (priv->surface)
     {
       g_object_ref_sink (priv->surface);
-      priv->repaint_scheduled_id = g_signal_connect (priv->surface, "repaint-scheduled",
-                                                     G_CALLBACK (surface_repaint_scheduled), self);
       priv->size_changed_id = g_signal_connect (priv->surface, "size-changed",
                                                 G_CALLBACK (surface_size_changed), self);
       clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));


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