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
This commit is contained in:
parent
2afe3e9223
commit
110ed7ff8a
@ -1246,10 +1246,16 @@ meta_compositor_get_property (GObject *object,
|
|||||||
static void
|
static void
|
||||||
meta_compositor_init (MetaCompositor *compositor)
|
meta_compositor_init (MetaCompositor *compositor)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_compositor_constructed (GObject *object)
|
||||||
|
{
|
||||||
|
MetaCompositor *compositor = META_COMPOSITOR (object);
|
||||||
MetaCompositorPrivate *priv =
|
MetaCompositorPrivate *priv =
|
||||||
meta_compositor_get_instance_private (compositor);
|
meta_compositor_get_instance_private (compositor);
|
||||||
MetaBackend *backend = meta_get_backend ();
|
ClutterBackend *clutter_backend =
|
||||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
meta_backend_get_clutter_backend (priv->backend);
|
||||||
|
|
||||||
priv->context = clutter_backend->cogl_context;
|
priv->context = clutter_backend->cogl_context;
|
||||||
|
|
||||||
@ -1265,6 +1271,8 @@ meta_compositor_init (MetaCompositor *compositor)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
priv->laters = meta_laters_new (compositor);
|
priv->laters = meta_laters_new (compositor);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (meta_compositor_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1303,6 +1311,7 @@ meta_compositor_class_init (MetaCompositorClass *klass)
|
|||||||
|
|
||||||
object_class->set_property = meta_compositor_set_property;
|
object_class->set_property = meta_compositor_set_property;
|
||||||
object_class->get_property = meta_compositor_get_property;
|
object_class->get_property = meta_compositor_get_property;
|
||||||
|
object_class->constructed = meta_compositor_constructed;
|
||||||
object_class->dispose = meta_compositor_dispose;
|
object_class->dispose = meta_compositor_dispose;
|
||||||
|
|
||||||
klass->remove_window = meta_compositor_real_remove_window;
|
klass->remove_window = meta_compositor_real_remove_window;
|
||||||
|
@ -50,7 +50,7 @@ struct _MetaLaters
|
|||||||
|
|
||||||
GSList *laters[META_LATER_N_TYPES];
|
GSList *laters[META_LATER_N_TYPES];
|
||||||
|
|
||||||
gulong pre_paint_handler_id;
|
gulong before_update_handler_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
static MetaLater *
|
static MetaLater *
|
||||||
@ -165,7 +165,7 @@ run_repaint_laters (GSList **laters_list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_pre_paint (MetaCompositor *compositor,
|
on_before_update (ClutterStage *stage,
|
||||||
MetaLaters *laters)
|
MetaLaters *laters)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -187,12 +187,8 @@ on_pre_paint (MetaCompositor *compositor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (needs_schedule_update)
|
if (needs_schedule_update)
|
||||||
{
|
|
||||||
ClutterStage *stage = meta_compositor_get_stage (compositor);
|
|
||||||
|
|
||||||
clutter_stage_schedule_update (stage);
|
clutter_stage_schedule_update (stage);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
invoke_later_idle (gpointer data)
|
invoke_later_idle (gpointer data)
|
||||||
@ -320,13 +316,15 @@ meta_later_remove (unsigned int later_id)
|
|||||||
MetaLaters *
|
MetaLaters *
|
||||||
meta_laters_new (MetaCompositor *compositor)
|
meta_laters_new (MetaCompositor *compositor)
|
||||||
{
|
{
|
||||||
|
ClutterStage *stage = meta_compositor_get_stage (compositor);
|
||||||
MetaLaters *laters;
|
MetaLaters *laters;
|
||||||
|
|
||||||
laters = g_new0 (MetaLaters, 1);
|
laters = g_new0 (MetaLaters, 1);
|
||||||
laters->compositor = compositor;
|
laters->compositor = compositor;
|
||||||
|
|
||||||
laters->pre_paint_handler_id = g_signal_connect (compositor, "pre-paint",
|
laters->before_update_handler_id =
|
||||||
G_CALLBACK (on_pre_paint),
|
g_signal_connect (stage, "before-update",
|
||||||
|
G_CALLBACK (on_before_update),
|
||||||
laters);
|
laters);
|
||||||
|
|
||||||
return laters;
|
return laters;
|
||||||
@ -335,11 +333,12 @@ meta_laters_new (MetaCompositor *compositor)
|
|||||||
void
|
void
|
||||||
meta_laters_free (MetaLaters *laters)
|
meta_laters_free (MetaLaters *laters)
|
||||||
{
|
{
|
||||||
|
ClutterStage *stage = meta_compositor_get_stage (laters->compositor);
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (laters->laters); i++)
|
for (i = 0; i < G_N_ELEMENTS (laters->laters); i++)
|
||||||
g_slist_free_full (laters->laters[i], (GDestroyNotify) meta_later_unref);
|
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);
|
g_free (laters);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user