[gtk+] widget: Only check display debug flags if the global ones are set



commit ec18661bbb19f98f7fab3e6360379f892bc4dd92
Author: Timm Bäder <mail baedert org>
Date:   Sat Oct 14 07:37:06 2017 +0200

    widget: Only check display debug flags if the global ones are set
    
    The gtk_widget_get_display call in this if statement is showing up in
    profiles. It ends up walking up the hierarchy to the toplevel to get its
    GdkScreen, etc. so it is relatively costly. Avoid that call in most
    cases by first checking if the RESIZE debugging is enabled for any of
    the displays and only then checking if it is enabled for the widget's
    display.

 gtk/gtkwidget.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 1968ce4..10b7836 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5358,7 +5358,8 @@ gtk_widget_size_allocate (GtkWidget           *widget,
     }
 
 #ifdef G_ENABLE_DEBUG
-  if (GTK_DISPLAY_DEBUG_CHECK (gtk_widget_get_display (widget), RESIZE))
+  if (GTK_DEBUG_CHECK (RESIZE) &&
+      GTK_DISPLAY_DEBUG_CHECK (gtk_widget_get_display (widget), RESIZE))
     {
       priv->highlight_resize = TRUE;
       gtk_widget_queue_draw (widget);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]