[mutter] laters: Use 'before-update' signal from stage
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] laters: Use 'before-update' signal from stage
- Date: Thu, 2 Jul 2020 20:53:45 +0000 (UTC)
commit 110ed7ff8a8f8bcf17224844759926ea4be13ef6
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri May 29 23:33:46 2020 +0200
laters: Use 'before-update' signal from stage
Instead of the 'pre-paint' signal on MetaCompositor, rely directly on
the 'before-update' signal on the stage. A reason for this is that the
callback should not only invoked in connection to painting, but updating
in general. Currently the 'pre-paint' signal is emitted no matter
whether there were any painting or not, but that's both misleading and
will go away.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
src/compositor/compositor.c | 13 +++++++++++--
src/compositor/meta-later.c | 23 +++++++++++------------
2 files changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 5918c90474..ff6a6aa73e 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -1246,10 +1246,16 @@ meta_compositor_get_property (GObject *object,
static void
meta_compositor_init (MetaCompositor *compositor)
{
+}
+
+static void
+meta_compositor_constructed (GObject *object)
+{
+ MetaCompositor *compositor = META_COMPOSITOR (object);
MetaCompositorPrivate *priv =
meta_compositor_get_instance_private (compositor);
- MetaBackend *backend = meta_get_backend ();
- ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
+ ClutterBackend *clutter_backend =
+ meta_backend_get_clutter_backend (priv->backend);
priv->context = clutter_backend->cogl_context;
@@ -1265,6 +1271,8 @@ meta_compositor_init (MetaCompositor *compositor)
NULL);
priv->laters = meta_laters_new (compositor);
+
+ G_OBJECT_CLASS (meta_compositor_parent_class)->constructed (object);
}
static void
@@ -1303,6 +1311,7 @@ meta_compositor_class_init (MetaCompositorClass *klass)
object_class->set_property = meta_compositor_set_property;
object_class->get_property = meta_compositor_get_property;
+ object_class->constructed = meta_compositor_constructed;
object_class->dispose = meta_compositor_dispose;
klass->remove_window = meta_compositor_real_remove_window;
diff --git a/src/compositor/meta-later.c b/src/compositor/meta-later.c
index 67e229d38a..9265f2e44a 100644
--- a/src/compositor/meta-later.c
+++ b/src/compositor/meta-later.c
@@ -50,7 +50,7 @@ struct _MetaLaters
GSList *laters[META_LATER_N_TYPES];
- gulong pre_paint_handler_id;
+ gulong before_update_handler_id;
};
static MetaLater *
@@ -165,8 +165,8 @@ run_repaint_laters (GSList **laters_list)
}
static void
-on_pre_paint (MetaCompositor *compositor,
- MetaLaters *laters)
+on_before_update (ClutterStage *stage,
+ MetaLaters *laters)
{
unsigned int i;
GSList *l;
@@ -187,11 +187,7 @@ on_pre_paint (MetaCompositor *compositor,
}
if (needs_schedule_update)
- {
- ClutterStage *stage = meta_compositor_get_stage (compositor);
-
- clutter_stage_schedule_update (stage);
- }
+ clutter_stage_schedule_update (stage);
}
static gboolean
@@ -320,14 +316,16 @@ meta_later_remove (unsigned int later_id)
MetaLaters *
meta_laters_new (MetaCompositor *compositor)
{
+ ClutterStage *stage = meta_compositor_get_stage (compositor);
MetaLaters *laters;
laters = g_new0 (MetaLaters, 1);
laters->compositor = compositor;
- laters->pre_paint_handler_id = g_signal_connect (compositor, "pre-paint",
- G_CALLBACK (on_pre_paint),
- laters);
+ laters->before_update_handler_id =
+ g_signal_connect (stage, "before-update",
+ G_CALLBACK (on_before_update),
+ laters);
return laters;
}
@@ -335,11 +333,12 @@ meta_laters_new (MetaCompositor *compositor)
void
meta_laters_free (MetaLaters *laters)
{
+ ClutterStage *stage = meta_compositor_get_stage (laters->compositor);
unsigned int i;
for (i = 0; i < G_N_ELEMENTS (laters->laters); i++)
g_slist_free_full (laters->laters[i], (GDestroyNotify) meta_later_unref);
- g_clear_signal_handler (&laters->pre_paint_handler_id, laters->compositor);
+ g_clear_signal_handler (&laters->before_update_handler_id, stage);
g_free (laters);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]