[gtk+] gtkstylecontext: Add an optional warning when misusing GtkStyleContext



commit eba317228fd36c67513e2a46f5d1b57328db7033
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Nov 25 11:07:31 2014 -0800

    gtkstylecontext: Add an optional warning when misusing GtkStyleContext
    
    This allows someone to quickly debug more performance issues with
    G_DEBUG=fatal-warnings.

 gtk/gtkstylecontext.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 37f330d..3745804 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -745,6 +745,9 @@ style_values_lookup_for_state (GtkStyleContext *context,
   if (gtk_css_node_declaration_get_state (context->priv->info->decl) == state)
     return g_object_ref (style_values_lookup (context));
 
+  if (g_getenv ("GTK_STYLE_CONTEXT_WARNING"))
+    g_warning ("State does not match current state");
+
   decl = gtk_css_node_declaration_ref (context->priv->info->decl);
   gtk_css_node_declaration_set_state (&decl, state);
   values = _gtk_css_computed_values_new ();


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