[mutter/gnome-3-36] clutter/stage: Make clutter_stage_schedule_update() always schedule



commit bcca5ce817856b015ee75bee91dc2d2567802168
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
    (cherry picked from commit b8003807b0772e97354302b5cc2825e0b22c6c83)

 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 e2b63e7fe6..09c8010d52 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -145,6 +145,8 @@ struct _ClutterStagePrivate
 
   int update_freeze_count;
 
+  gboolean needs_update;
+
   guint redraw_pending         : 1;
   guint is_cursor_visible      : 1;
   guint throttle_motion_events : 1;
@@ -1312,7 +1314,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
@@ -1504,6 +1508,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
@@ -3698,6 +3704,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]