[metacity] theme: Allow disabling fallback colors in gtk:custom()
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] theme: Allow disabling fallback colors in gtk:custom()
- Date: Sun, 28 Sep 2014 16:03:20 +0000 (UTC)
commit 4aeac5854d1b9cd2fa7bf271b7545e1c6ea330ba
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Aug 7 18:55:30 2011 +0200
theme: Allow disabling fallback colors in gtk:custom()
gtk:custom() requires a fallback color in case the GTK+ theme in use
does not define the desired color. As in general the fallback color
will approximate the intended color, there is the risk of typos going
unnoticed. To make catching these kind of errors easier, allow to ignore
the fallback color specified (and fall back to a nice shade of pink
instead) by setting an environment variable.
https://bugzilla.gnome.org/show_bug.cgi?id=656112
src/ui/theme.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 72c5cd3..6195381 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -1198,8 +1198,15 @@ meta_color_spec_new_from_string (const char *str,
str[8] == 'o' && str[9] == 'm')
{
const char *color_name_start, *fallback_str_start, *end;
- char *color_name, *fallback_str;
+ char *color_name;
MetaColorSpec *fallback = NULL;
+ static gboolean debug, debug_set = FALSE;
+
+ if (!debug_set)
+ {
+ debug = g_getenv ("MUTTER_DISABLE_FALLBACK_COLOR") != NULL;
+ debug_set = TRUE;
+ }
if (str[10] != '(')
{
@@ -1240,9 +1247,18 @@ meta_color_spec_new_from_string (const char *str,
return NULL;
}
- fallback_str = g_strndup (fallback_str_start, end - fallback_str_start);
- fallback = meta_color_spec_new_from_string (fallback_str, err);
- g_free (fallback_str);
+ if (!debug)
+ {
+ char *fallback_str;
+ fallback_str = g_strndup (fallback_str_start,
+ end - fallback_str_start);
+ fallback = meta_color_spec_new_from_string (fallback_str, err);
+ g_free (fallback_str);
+ }
+ else
+ {
+ fallback = meta_color_spec_new_from_string ("pink", err);
+ }
if (fallback == NULL)
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]