[gtk] widget: Don't always call get_display() when allocating
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] widget: Don't always call get_display() when allocating
- Date: Tue, 21 May 2019 06:39:29 +0000 (UTC)
commit a474beb7b846772e3cf7d8f67c3745650a328062
Author: Timm Bäder <mail baedert org>
Date: Mon May 20 13:46:36 2019 +0200
widget: Don't always call get_display() when allocating
The GTK_DISPLAY_DEBUG_CHECK macro will cleverly only call the function
if any of the display debug flags are set, so in the common case it
won't even be executed.
gtk/gtkwidget.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 99f83c4484..2bfdf1c196 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4289,9 +4289,6 @@ gtk_widget_allocate (GtkWidget *widget,
GtkCssStyle *style;
GtkBorder margin, border, padding;
GskTransform *css_transform;
-#ifdef G_ENABLE_DEBUG
- GdkDisplay *display;
-#endif
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (baseline >= -1);
@@ -4302,8 +4299,7 @@ gtk_widget_allocate (GtkWidget *widget,
goto out;
#ifdef G_ENABLE_DEBUG
- display = _gtk_widget_get_display (widget);
- if (GTK_DISPLAY_DEBUG_CHECK (display, RESIZE))
+ if (GTK_DISPLAY_DEBUG_CHECK (_gtk_widget_get_display (widget), RESIZE))
{
priv->highlight_resize = TRUE;
gtk_widget_queue_draw (widget);
@@ -4483,7 +4479,8 @@ gtk_widget_allocate (GtkWidget *widget,
/* Size allocation is god... after consulting god, no further requests or allocations are needed */
#ifdef G_ENABLE_DEBUG
- if (GTK_DISPLAY_DEBUG_CHECK (display, GEOMETRY) && gtk_widget_get_resize_needed (widget))
+ if (GTK_DISPLAY_DEBUG_CHECK (_gtk_widget_get_display (widget), GEOMETRY) &&
+ gtk_widget_get_resize_needed (widget))
{
g_warning ("%s %p or a child called gtk_widget_queue_resize() during size_allocate().",
gtk_widget_get_name (widget), widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]