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
This commit is contained in:
Lionel Landwerlin 2015-09-05 23:08:09 +01:00
parent 6183eb3632
commit 5733ad58e5

View File

@ -385,11 +385,12 @@ clutter_master_clock_gdk_listen_to_stage (ClutterMasterClockGdk *master_clock,
} }
static void static void
clutter_master_clock_gdk_stage_realized (ClutterStage *stage, clutter_master_clock_gdk_stage_visibility (ClutterStage *stage,
GParamSpec *spec, GParamSpec *spec,
ClutterMasterClockGdk *master_clock) 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); clutter_master_clock_gdk_listen_to_stage (master_clock, stage);
else else
clutter_master_clock_gdk_remove_stage_clock (master_clock, stage); clutter_master_clock_gdk_remove_stage_clock (master_clock, stage);
@ -400,11 +401,11 @@ clutter_master_clock_gdk_stage_added (ClutterStageManager *manager,
ClutterStage *stage, ClutterStage *stage,
ClutterMasterClockGdk *master_clock) ClutterMasterClockGdk *master_clock)
{ {
g_signal_connect (stage, "notify::realized", g_signal_connect (stage, "notify::mapped",
G_CALLBACK (clutter_master_clock_gdk_stage_realized), G_CALLBACK (clutter_master_clock_gdk_stage_visibility),
master_clock); master_clock);
clutter_master_clock_gdk_listen_to_stage (master_clock, stage); clutter_master_clock_gdk_stage_visibility (stage, NULL, master_clock);
} }
static void static void
@ -415,7 +416,7 @@ clutter_master_clock_gdk_stage_removed (ClutterStageManager *manager,
clutter_master_clock_gdk_remove_stage_clock (master_clock, stage); clutter_master_clock_gdk_remove_stage_clock (master_clock, stage);
g_signal_handlers_disconnect_by_func (stage, g_signal_handlers_disconnect_by_func (stage,
clutter_master_clock_gdk_stage_realized, clutter_master_clock_gdk_stage_visibility,
master_clock); master_clock);
} }