[Xfce4-commits] [xfce/xfwm4] 03/04: Allow color substitution in themerc

noreply at xfce.org noreply at xfce.org
Thu Dec 18 23:31:10 CET 2014


This is an automated email from the git hooks/post-receive script.

olivier pushed a commit to branch master
in repository xfce/xfwm4.

commit 681f586f6395fd5aca1b53fec8076aceca80b4c1
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Thu Dec 18 23:26:53 2014 +0100

    Allow color substitution in themerc
    
    The idea is to be able to substitute colors
    by another, e.g.:
    
      active_text_color=active_text_color_2
      active_text_shadow_color=active_hilight_2
    
    This gives a lot more flexibility in color themes
    based on GTK colors.
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/settings.c |   35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/src/settings.c b/src/settings.c
index 37cbcff..286b19d 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -46,7 +46,7 @@
 
 #define CHANNEL_XFWM            "xfwm4"
 #define THEMERC                 "themerc"
-#define XPM_COLOR_SYMBOL_SIZE   22
+#define XPM_COLOR_SYMBOL_SIZE   24
 
 /* Forward static decls. */
 
@@ -351,6 +351,7 @@ loadTheme (ScreenInfo *screen_info, Settings *rc)
         "light",
         "dark",
         "mid",
+        "fg",
         "bg",
         "light",
         "dark",
@@ -359,6 +360,7 @@ loadTheme (ScreenInfo *screen_info, Settings *rc)
         "light",
         "dark",
         "mid",
+        "fg",
         "bg",
         "light",
         "dark",
@@ -381,6 +383,8 @@ loadTheme (ScreenInfo *screen_info, Settings *rc)
         "normal",
         "normal",
         "normal",
+        "normal",
+        "insensitive",
         "insensitive",
         "insensitive",
         "insensitive",
@@ -409,19 +413,42 @@ loadTheme (ScreenInfo *screen_info, Settings *rc)
     desc = NULL;
     i = 0;
 
-    while (ui_part[i] && ui_state[i])
+    /* Load gtk theme colors first */
+    for (i = 0; i < XPM_COLOR_SYMBOL_SIZE; i++)
     {
         gchar *color;
 
         color = getUIStyle  (widget, ui_part[i], ui_state[i]);
         setStringValue (rc[i].option, color, rc);
         g_free (color);
-        ++i;
     }
 
+    /* Then load xfwm4 theme values */
     theme = getThemeDir (getStringValue ("theme", rc), THEMERC);
     parseRc (THEMERC, theme, rc);
 
+    /* And finally redo a pass for transitive definitions of colors */
+    for (i = 0; i < XPM_COLOR_SYMBOL_SIZE; i++)
+    {
+        const gchar *value;
+
+        /*
+         * Allow color definition based on another, e.g:
+         * active_text_color=active_text_color_2
+         * active_text_shadow_color=active_hilight_2
+         * etc.
+         */
+        value = g_value_get_string(rc[i].value);
+        for (j = 0; j < XPM_COLOR_SYMBOL_SIZE; j++)
+        {
+            if (!g_ascii_strcasecmp (value, rc[j].option))
+            {
+                setStringValue (rc[i].option, g_value_get_string(rc[j].value), rc);
+                break;
+            }
+        }
+    }
+
     screen_info->params->shadow_delta_x =
         - getIntValue ("shadow_delta_x", rc);
     screen_info->params->shadow_delta_y =
@@ -656,6 +683,7 @@ loadSettings (ScreenInfo *screen_info)
         {"active_hilight_1", NULL, G_TYPE_STRING, FALSE},
         {"active_shadow_1", NULL, G_TYPE_STRING, FALSE},
         {"active_mid_1", NULL, G_TYPE_STRING, FALSE},
+        {"active_text_color_2", NULL, G_TYPE_STRING, FALSE},
         {"active_color_2", NULL, G_TYPE_STRING, FALSE},
         {"active_hilight_2", NULL, G_TYPE_STRING, FALSE},
         {"active_shadow_2", NULL, G_TYPE_STRING, FALSE},
@@ -664,6 +692,7 @@ loadSettings (ScreenInfo *screen_info)
         {"inactive_hilight_1", NULL, G_TYPE_STRING, FALSE},
         {"inactive_shadow_1", NULL, G_TYPE_STRING, FALSE},
         {"inactive_mid_1", NULL, G_TYPE_STRING, FALSE},
+        {"inactive_text_color_2", NULL, G_TYPE_STRING, FALSE},
         {"inactive_color_2", NULL, G_TYPE_STRING, FALSE},
         {"inactive_hilight_2", NULL, G_TYPE_STRING, FALSE},
         {"inactive_shadow_2", NULL, G_TYPE_STRING, FALSE},

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list