From b603479fe220629506580a6adcd94840799be8ff Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 19 May 2024 22:04:00 -0400 Subject: [PATCH] Add a debug flag for CSS deprecations It seems better not to spam everybody with this all the time. --- gtk/gtkcssprovider.c | 10 ++++++---- gtk/gtkdebug.h | 1 + gtk/gtkmain.c | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c index bbd2197c66..d9eafdae83 100644 --- a/gtk/gtkcssprovider.c +++ b/gtk/gtkcssprovider.c @@ -184,10 +184,12 @@ gtk_css_provider_parsing_error (GtkCssProvider *provider, { char *s = gtk_css_section_to_string (section); - g_warning ("Theme parser %s: %s: %s", - error->domain == GTK_CSS_PARSER_WARNING ? "warning" : "error", - s, - error->message); + if (GTK_DEBUG_CHECK (CSS) || + !g_error_matches (error, GTK_CSS_PARSER_WARNING, GTK_CSS_PARSER_WARNING_DEPRECATED)) + g_warning ("Theme parser %s: %s: %s", + error->domain == GTK_CSS_PARSER_WARNING ? "warning" : "error", + s, + error->message); g_free (s); } diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h index c9b1493b8a..2ca4a999ca 100644 --- a/gtk/gtkdebug.h +++ b/gtk/gtkdebug.h @@ -96,6 +96,7 @@ typedef enum { GTK_DEBUG_A11Y = 1 << 17, GTK_DEBUG_ICONFALLBACK = 1 << 18, GTK_DEBUG_INVERT_TEXT_DIR = 1 << 19, + GTK_DEBUG_CSS = 1 << 20, } GtkDebugFlags; #define GTK_DEBUG_CHECK(type) G_UNLIKELY (gtk_get_debug_flags () & GTK_DEBUG_##type) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 46604b9c80..2222954706 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -200,6 +200,7 @@ static const GdkDebugKey gtk_debug_keys[] = { { "accessibility", GTK_DEBUG_A11Y, "Information about accessibility state changes" }, { "iconfallback", GTK_DEBUG_ICONFALLBACK, "Information about icon fallback" }, { "invert-text-dir", GTK_DEBUG_INVERT_TEXT_DIR, "Invert the default text direction" }, + { "css", GTK_DEBUG_CSS, "Information about deprecated CSS features" }, }; /* This checks to see if the process is running suid or sgid