[mutter] clutter/stage: Make clutter_stage_schedule_update() always schedule



commit b8003807b0772e97354302b5cc2825e0b22c6c83
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Apr 16 19:42:03 2020 +0200

    clutter/stage: Make clutter_stage_schedule_update() always schedule
    
    We could call clutter_stage_schedule_update() and it wouldn't actually
    schedule anything, as the master frame clock only tries to reschedule if
    1) there is an active timeline, 2) there are pending relayouts, 3) there
    are pending redraws, or 4) there are pending events. Thus, a call to
    clutter_stage_schedule_update() didn't have any effect if it was called
    at the wrong time.
    
    Fix this by adding a boolean state "needs_update" to the stage, set on
    clutter_stage_schedule_update() and cleared on
    _clutter_stage_do_update(), that will make the master clock reschedule
    an update if it is TRUE.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1218

 clutter/clutter/clutter-stage.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index ca0ab44de9..7aa46517c1 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -142,6 +142,8 @@ struct _ClutterStagePrivate
 
   int update_freeze_count;
 
+  gboolean needs_update;
+
   guint redraw_pending         : 1;
   guint throttle_motion_events : 1;
   guint min_size_changed       : 1;
@@ -1308,7 +1310,9 @@ _clutter_stage_needs_update (ClutterStage *stage)
 
   priv = stage->priv;
 
-  return priv->redraw_pending || g_hash_table_size (priv->pending_relayouts) > 0;
+  return (priv->redraw_pending ||
+          priv->needs_update ||
+          g_hash_table_size (priv->pending_relayouts) > 0);
 }
 
 void
@@ -1499,6 +1503,8 @@ _clutter_stage_do_update (ClutterStage *stage)
 
   priv->stage_was_relayout = FALSE;
 
+  priv->needs_update = FALSE;
+
   /* if the stage is being destroyed, or if the destruction already
    * happened and we don't have an StageWindow any more, then we
    * should bail out
@@ -3453,6 +3459,8 @@ _clutter_stage_schedule_update (ClutterStage *stage)
   if (stage_window == NULL)
     return;
 
+  stage->priv->needs_update = TRUE;
+
   return _clutter_stage_window_schedule_update (stage_window,
                                                 stage->priv->sync_delay);
 }


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