[gtk+] widget: Call size_allocate vfunc directly when possible
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget: Call size_allocate vfunc directly when possible
- Date: Mon, 14 Sep 2015 13:16:39 +0000 (UTC)
commit 68e50d20a7f765b3b5c6196f0d4de134fc111bac
Author: Alexander Larsson <alexl redhat com>
Date: Mon Sep 14 15:05:37 2015 +0200
widget: Call size_allocate vfunc directly when possible
This avoids all the overhead of signal emissions when it is not used.
gtk/gtkwidget.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4206c40..7a05785 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5969,7 +5969,10 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
goto out;
priv->allocated_baseline = baseline;
- g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation);
+ if (g_signal_has_handler_pending (widget, widget_signals[SIZE_ALLOCATE], 0, FALSE))
+ g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation);
+ else
+ GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget, &real_allocation);
/* Size allocation is god... after consulting god, no further requests or allocations are needed */
priv->alloc_needed = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]