From 5733ad58e5a3989f5cb836d42a1cebf3884e7c36 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sat, 5 Sep 2015 23:08:09 +0100 Subject: [PATCH] gdk: master clock: only process mapped & realized stages When using Clutter embed inside a Gtk application, a stage might end up realized but not visible. In this case we might discard doing any kind of animation processing. https://bugzilla.gnome.org/show_bug.cgi?id=754671 --- clutter/gdk/clutter-master-clock-gdk.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/clutter/gdk/clutter-master-clock-gdk.c b/clutter/gdk/clutter-master-clock-gdk.c index 228d31f12..2a5db8a44 100644 --- a/clutter/gdk/clutter-master-clock-gdk.c +++ b/clutter/gdk/clutter-master-clock-gdk.c @@ -385,11 +385,12 @@ clutter_master_clock_gdk_listen_to_stage (ClutterMasterClockGdk *master_clock, } static void -clutter_master_clock_gdk_stage_realized (ClutterStage *stage, - GParamSpec *spec, - ClutterMasterClockGdk *master_clock) +clutter_master_clock_gdk_stage_visibility (ClutterStage *stage, + GParamSpec *spec, + ClutterMasterClockGdk *master_clock) { - if (clutter_actor_is_realized (CLUTTER_ACTOR (stage))) + ClutterActor *actor = CLUTTER_ACTOR (stage); + if (clutter_actor_is_mapped (actor)) clutter_master_clock_gdk_listen_to_stage (master_clock, stage); else clutter_master_clock_gdk_remove_stage_clock (master_clock, stage); @@ -400,11 +401,11 @@ clutter_master_clock_gdk_stage_added (ClutterStageManager *manager, ClutterStage *stage, ClutterMasterClockGdk *master_clock) { - g_signal_connect (stage, "notify::realized", - G_CALLBACK (clutter_master_clock_gdk_stage_realized), + g_signal_connect (stage, "notify::mapped", + G_CALLBACK (clutter_master_clock_gdk_stage_visibility), master_clock); - clutter_master_clock_gdk_listen_to_stage (master_clock, stage); + clutter_master_clock_gdk_stage_visibility (stage, NULL, master_clock); } static void @@ -415,7 +416,7 @@ clutter_master_clock_gdk_stage_removed (ClutterStageManager *manager, clutter_master_clock_gdk_remove_stage_clock (master_clock, stage); g_signal_handlers_disconnect_by_func (stage, - clutter_master_clock_gdk_stage_realized, + clutter_master_clock_gdk_stage_visibility, master_clock); }