From 4b4c2b1afaac060751bdabbe6db6bc73ec8c115f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 28 Apr 2017 19:47:52 +0200 Subject: [PATCH] ClutterActor: Avoid frequent signal emission if possible Avoid signal emission for ::paint/::pick if no handlers are connected, which is the most frequent case. https://bugzilla.gnome.org/show_bug.cgi?id=782344 --- clutter/clutter/clutter-actor.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index 196d1ad8a..85fcda532 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -4015,7 +4015,11 @@ clutter_actor_continue_paint (ClutterActor *self) clutter_paint_node_unref (dummy); /* XXX:2.0 - Call the paint() virtual directly */ - g_signal_emit (self, actor_signals[PAINT], 0); + if (g_signal_has_handler_pending (self, actor_signals[PAINT], + 0, TRUE)) + g_signal_emit (self, actor_signals[PAINT], 0); + else + CLUTTER_ACTOR_GET_CLASS (self)->paint (self); } else { @@ -4029,7 +4033,11 @@ clutter_actor_continue_paint (ClutterActor *self) * * XXX:2.0 - Call the pick() virtual directly */ - g_signal_emit (self, actor_signals[PICK], 0, &col); + if (g_signal_has_handler_pending (self, actor_signals[PICK], + 0, TRUE)) + g_signal_emit (self, actor_signals[PICK], 0, &col); + else + CLUTTER_ACTOR_GET_CLASS (self)->pick (self, &col); } } else