Merge branch 'wip/alttab'
[mikachu/openbox.git] / render / theme.c
index ba1ce78..a6931be 100644 (file)
@@ -23,7 +23,7 @@
 #include "mask.h"
 #include "theme.h"
 #include "icon.h"
-#include "parser/parse.h"
+#include "obt/paths.h"
 
 #include <X11/Xlib.h>
 #include <X11/Xresource.h>
@@ -92,6 +92,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
     theme->a_hover_unfocused_max = RrAppearanceNew(inst, 1);
     theme->a_toggled_focused_unpressed_max = RrAppearanceNew(inst, 1);
     theme->a_toggled_unfocused_unpressed_max = RrAppearanceNew(inst, 1);
+    theme->a_toggled_hover_focused_max = RrAppearanceNew(inst, 1);
+    theme->a_toggled_hover_unfocused_max = RrAppearanceNew(inst, 1);
+    theme->a_toggled_focused_pressed_max = RrAppearanceNew(inst, 1);
+    theme->a_toggled_unfocused_pressed_max = RrAppearanceNew(inst, 1);
     theme->a_focused_unpressed_max = RrAppearanceNew(inst, 1);
     theme->a_focused_pressed_max = RrAppearanceNew(inst, 1);
     theme->a_unfocused_unpressed_max = RrAppearanceNew(inst, 1);
@@ -111,7 +115,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
     theme->a_menu_normal = RrAppearanceNew(inst, 0);
     theme->a_menu_selected = RrAppearanceNew(inst, 0);
     theme->a_menu_disabled = RrAppearanceNew(inst, 0);
-    theme->a_menu_disabled_selected = RrAppearanceNew(inst, 0);
+    /* a_menu_disabled_selected is copied from a_menu_selected */
     theme->a_menu_text_normal = RrAppearanceNew(inst, 1);
     theme->a_menu_text_selected = RrAppearanceNew(inst, 1);
     theme->a_menu_text_disabled = RrAppearanceNew(inst, 1);
@@ -182,7 +186,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
     if (!read_int(db, "padding.width", &theme->paddingx) ||
         theme->paddingx < 0 || theme->paddingx > 100)
         theme->paddingx = 3;
-    theme->paddingy = theme->paddingx;
+    if (!read_int(db, "padding.height", &theme->paddingy) ||
+        theme->paddingy < 0 || theme->paddingy > 100)
+        theme->paddingy = theme->paddingx;
     if (!read_int(db, "border.width", &theme->fbwidth) ||
         theme->fbwidth < 0 || theme->fbwidth > 100)
         theme->fbwidth = 1;
@@ -322,6 +328,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
                        theme->titlebut_unfocused_unpressed_color->g,
                        theme->titlebut_unfocused_unpressed_color->b);
     if (!read_color(db, inst,
+                    "window.active.button.toggled.unpressed.image.color",
+                    &theme->titlebut_toggled_focused_unpressed_color) &&
+        !read_color(db, inst,
                     "window.active.button.toggled.image.color",
                     &theme->titlebut_toggled_focused_unpressed_color))
         theme->titlebut_toggled_focused_unpressed_color =
@@ -330,6 +339,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
                        theme->titlebut_focused_pressed_color->g,
                        theme->titlebut_focused_pressed_color->b);
     if (!read_color(db, inst,
+                    "window.inactive.button.toggled.unpressed.image.color",
+                    &theme->titlebut_toggled_unfocused_unpressed_color) &&
+        !read_color(db, inst,
                     "window.inactive.button.toggled.image.color",
                     &theme->titlebut_toggled_unfocused_unpressed_color))
         theme->titlebut_toggled_unfocused_unpressed_color =
@@ -338,6 +350,38 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
                        theme->titlebut_unfocused_pressed_color->g,
                        theme->titlebut_unfocused_pressed_color->b);
     if (!read_color(db, inst,
+                    "window.active.button.toggled.hover.image.color",
+                    &theme->titlebut_toggled_hover_focused_color))
+        theme->titlebut_toggled_hover_focused_color =
+            RrColorNew(inst,
+                       theme->titlebut_toggled_focused_unpressed_color->r,
+                       theme->titlebut_toggled_focused_unpressed_color->g,
+                       theme->titlebut_toggled_focused_unpressed_color->b);
+    if (!read_color(db, inst,
+                    "window.inactive.button.toggled.hover.image.color",
+                    &theme->titlebut_toggled_hover_unfocused_color))
+        theme->titlebut_toggled_hover_unfocused_color =
+            RrColorNew(inst,
+                       theme->titlebut_toggled_unfocused_unpressed_color->r,
+                       theme->titlebut_toggled_unfocused_unpressed_color->g,
+                       theme->titlebut_toggled_unfocused_unpressed_color->b);
+    if (!read_color(db, inst,
+                    "window.active.button.toggled.pressed.image.color",
+                    &theme->titlebut_toggled_focused_pressed_color))
+        theme->titlebut_toggled_focused_pressed_color =
+            RrColorNew(inst,
+                       theme->titlebut_focused_pressed_color->r,
+                       theme->titlebut_focused_pressed_color->g,
+                       theme->titlebut_focused_pressed_color->b);
+    if (!read_color(db, inst,
+                    "window.inactive.button.toggled.pressed.image.color",
+                    &theme->titlebut_toggled_unfocused_pressed_color))
+        theme->titlebut_toggled_unfocused_pressed_color =
+            RrColorNew(inst,
+                       theme->titlebut_unfocused_pressed_color->r,
+                       theme->titlebut_unfocused_pressed_color->g,
+                       theme->titlebut_unfocused_pressed_color->b);
+    if (!read_color(db, inst,
                     "menu.title.text.color", &theme->menu_title_color))
         theme->menu_title_color = RrColorNew(inst, 0, 0, 0);
     if (!read_color(db, inst,
@@ -360,29 +404,6 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
                     &theme->menu_selected_color))
         theme->menu_selected_color = RrColorNew(inst, 0, 0, 0);
 
-    /* toggled hover = toggled unpressed (i.e. no change) */
-    theme->titlebut_toggled_hover_focused_color =
-        RrColorNew(inst,
-                   theme->titlebut_toggled_focused_unpressed_color->r,
-                   theme->titlebut_toggled_focused_unpressed_color->g,
-                   theme->titlebut_toggled_focused_unpressed_color->b);
-    theme->titlebut_toggled_hover_unfocused_color =
-        RrColorNew(inst,
-                   theme->titlebut_toggled_unfocused_unpressed_color->r,
-                   theme->titlebut_toggled_unfocused_unpressed_color->g,
-                   theme->titlebut_toggled_unfocused_unpressed_color->b);
-    /* toggled pressed = pressed (which is the toggled unpressed fallback..) */
-    theme->titlebut_toggled_focused_pressed_color =
-        RrColorNew(inst,
-                   theme->titlebut_focused_pressed_color->r,
-                   theme->titlebut_focused_pressed_color->g,
-                   theme->titlebut_focused_pressed_color->b);
-    theme->titlebut_toggled_unfocused_pressed_color =
-        RrColorNew(inst,
-                   theme->titlebut_unfocused_pressed_color->r,
-                   theme->titlebut_unfocused_pressed_color->g,
-                   theme->titlebut_unfocused_pressed_color->b);
-    
     /* load the image masks */
 
     /* maximize button masks */
@@ -517,26 +538,21 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
         theme->menu_bullet_mask = RrPixmapMaskNew(inst, 4, 7, (gchar*)data);
     }
 
+    /* up and down arrows */
+    {
+        guchar data[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 };
+        theme->down_arrow_mask = RrPixmapMaskNew(inst, 9, 4, (gchar*)data);
+    }
+    {
+        guchar data[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 };
+        theme->up_arrow_mask = RrPixmapMaskNew(inst, 9, 4, (gchar*)data);
+    }
+
     /* setup the default window icon */
     theme->def_win_icon = read_c_image(OB_DEFAULT_ICON_WIDTH,
                                        OB_DEFAULT_ICON_HEIGHT,
                                        OB_DEFAULT_ICON_pixel_data);
 
-    /* the toggled hover mask = the toggled unpressed mask (i.e. no change) */
-    theme->max_toggled_hover_mask =
-        RrPixmapMaskCopy(theme->max_toggled_mask);
-    theme->desk_toggled_hover_mask =
-        RrPixmapMaskCopy(theme->desk_toggled_mask);
-    theme->shade_toggled_hover_mask =
-        RrPixmapMaskCopy(theme->shade_toggled_mask);
-    /* the toggled pressed mask = the toggled unpressed mask (i.e. no change)*/
-    theme->max_toggled_pressed_mask =
-        RrPixmapMaskCopy(theme->max_toggled_mask);
-    theme->desk_toggled_pressed_mask =
-        RrPixmapMaskCopy(theme->desk_toggled_mask);
-    theme->shade_toggled_pressed_mask =
-        RrPixmapMaskCopy(theme->shade_toggled_mask);
-
     /* read the decoration textures */
     if (!read_appearance(db, inst,
                          "window.active.title.bg", theme->a_focused_title,
@@ -636,6 +652,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
                          TRUE))
         set_default_appearance(theme->a_unfocused_pressed_max);
     if (!read_appearance(db, inst,
+                         "window.active.button.toggled.unpressed.bg",
+                         theme->a_toggled_focused_unpressed_max,
+                         TRUE) &&
+        !read_appearance(db, inst,
                          "window.active.button.toggled.bg",
                          theme->a_toggled_focused_unpressed_max,
                          TRUE))
@@ -645,6 +665,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
             RrAppearanceCopy(theme->a_focused_pressed_max);
     }
     if (!read_appearance(db, inst,
+                         "window.inactive.button.toggled.unpressed.bg",
+                         theme->a_toggled_unfocused_unpressed_max,
+                         TRUE) &&
+        !read_appearance(db, inst,
                          "window.inactive.button.toggled.bg",
                          theme->a_toggled_unfocused_unpressed_max,
                          TRUE))
@@ -654,6 +678,42 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
             RrAppearanceCopy(theme->a_unfocused_pressed_max);
     }
     if (!read_appearance(db, inst,
+                         "window.active.button.toggled.hover.bg",
+                         theme->a_toggled_hover_focused_max,
+                         TRUE))
+    {
+        RrAppearanceFree(theme->a_toggled_hover_focused_max);
+        theme->a_toggled_hover_focused_max =
+            RrAppearanceCopy(theme->a_toggled_focused_unpressed_max);
+    }
+    if (!read_appearance(db, inst,
+                         "window.inactive.button.toggled.hover.bg",
+                         theme->a_toggled_hover_unfocused_max,
+                         TRUE))
+    {
+        RrAppearanceFree(theme->a_toggled_hover_unfocused_max);
+        theme->a_toggled_hover_unfocused_max =
+            RrAppearanceCopy(theme->a_toggled_unfocused_unpressed_max);
+    }
+    if (!read_appearance(db, inst,
+                         "window.active.button.toggled.pressed.bg",
+                         theme->a_toggled_focused_pressed_max,
+                         TRUE))
+    {
+        RrAppearanceFree(theme->a_toggled_focused_pressed_max);
+        theme->a_toggled_focused_pressed_max =
+            RrAppearanceCopy(theme->a_focused_pressed_max);
+    }
+    if (!read_appearance(db, inst,
+                         "window.inactive.button.toggled.pressed.bg",
+                         theme->a_toggled_unfocused_pressed_max,
+                         TRUE))
+    {
+        RrAppearanceFree(theme->a_toggled_unfocused_pressed_max);
+        theme->a_toggled_unfocused_pressed_max =
+            RrAppearanceCopy(theme->a_unfocused_pressed_max);
+    }
+    if (!read_appearance(db, inst,
                          "window.active.button.unpressed.bg",
                          theme->a_focused_unpressed_max,
                          TRUE))
@@ -682,17 +742,6 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
             RrAppearanceCopy(theme->a_unfocused_unpressed_max);
     }
 
-    /* toggled + hover = toggled unpressed (i.e. no change) */
-    theme->a_toggled_hover_focused_max =
-        RrAppearanceCopy(theme->a_toggled_focused_unpressed_max);
-    theme->a_toggled_hover_unfocused_max =
-        RrAppearanceCopy(theme->a_toggled_unfocused_unpressed_max);
-    /* toggled + pressed = pressed (which is the toggled fallback..) */
-    theme->a_toggled_focused_pressed_max =
-        RrAppearanceCopy(theme->a_focused_pressed_max);
-    theme->a_toggled_unfocused_pressed_max =
-        RrAppearanceCopy(theme->a_unfocused_pressed_max);
-
     theme->a_disabled_focused_close =
         RrAppearanceCopy(theme->a_disabled_focused_max);
     theme->a_disabled_unfocused_close =
@@ -716,7 +765,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
     theme->a_hover_focused_desk =
         RrAppearanceCopy(theme->a_hover_focused_max);
     theme->a_hover_unfocused_desk =
-        RrAppearanceCopy(theme->a_hover_unfocused_max); 
+        RrAppearanceCopy(theme->a_hover_unfocused_max);
     theme->a_toggled_hover_focused_desk =
         RrAppearanceCopy(theme->a_toggled_hover_focused_max);
     theme->a_toggled_hover_unfocused_desk =
@@ -858,13 +907,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
             j = (i > 0 ? 0 : 255);
             i = ABS(i*255/100);
 
-            theme->title_focused_shadow_color = RrColorNew(inst, j, j, j);
-            theme->title_focused_shadow_alpha = i;
             theme->osd_shadow_color = RrColorNew(inst, j, j, j);
             theme->osd_shadow_alpha = i;
         } else {
-            theme->title_focused_shadow_color = RrColorNew(inst, 0, 0, 0);
-            theme->title_focused_shadow_alpha = 50;
             theme->osd_shadow_color = RrColorNew(inst, 0, 0, 0);
             theme->osd_shadow_alpha = 50;
         }
@@ -968,13 +1013,13 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
 
     theme->a_menu_text_normal->texture[0].type =
         theme->a_menu_text_selected->texture[0].type =
-        theme->a_menu_text_disabled->texture[0].type = 
-        theme->a_menu_text_disabled_selected->texture[0].type = 
+        theme->a_menu_text_disabled->texture[0].type =
+        theme->a_menu_text_disabled_selected->texture[0].type =
         RR_TEXTURE_TEXT;
-    theme->a_menu_text_normal->texture[0].data.text.justify = 
+    theme->a_menu_text_normal->texture[0].data.text.justify =
         theme->a_menu_text_selected->texture[0].data.text.justify =
-        theme->a_menu_text_disabled->texture[0].data.text.justify = 
-        theme->a_menu_text_disabled_selected->texture[0].data.text.justify = 
+        theme->a_menu_text_disabled->texture[0].data.text.justify =
+        theme->a_menu_text_disabled_selected->texture[0].data.text.justify =
         RR_JUSTIFY_LEFT;
     theme->a_menu_text_normal->texture[0].data.text.font =
         theme->a_menu_text_selected->texture[0].data.text.font =
@@ -1020,7 +1065,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
             i = parse_inline_number(p + strlen("shadowtint="));
             j = (i > 0 ? 0 : 255);
             i = ABS(i*255/100);
-            
+
             theme->menu_text_normal_shadow_color = RrColorNew(inst, j, j, j);
             theme->menu_text_selected_shadow_color = RrColorNew(inst, j, j, j);
             theme->menu_text_disabled_shadow_color = RrColorNew(inst, j, j, j);
@@ -1055,180 +1100,180 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
     theme->a_menu_text_disabled_selected->texture[0].data.text.shadow_alpha =
         theme->menu_text_disabled_shadow_alpha;
 
-    theme->a_disabled_focused_max->texture[0].type = 
-        theme->a_disabled_unfocused_max->texture[0].type = 
-        theme->a_hover_focused_max->texture[0].type = 
-        theme->a_hover_unfocused_max->texture[0].type = 
-        theme->a_toggled_hover_focused_max->texture[0].type = 
-        theme->a_toggled_hover_unfocused_max->texture[0].type = 
-        theme->a_toggled_focused_unpressed_max->texture[0].type = 
-        theme->a_toggled_unfocused_unpressed_max->texture[0].type = 
-        theme->a_toggled_focused_pressed_max->texture[0].type = 
-        theme->a_toggled_unfocused_pressed_max->texture[0].type = 
-        theme->a_focused_unpressed_max->texture[0].type = 
-        theme->a_focused_pressed_max->texture[0].type = 
-        theme->a_unfocused_unpressed_max->texture[0].type = 
-        theme->a_unfocused_pressed_max->texture[0].type = 
-        theme->a_disabled_focused_close->texture[0].type = 
-        theme->a_disabled_unfocused_close->texture[0].type = 
-        theme->a_hover_focused_close->texture[0].type = 
-        theme->a_hover_unfocused_close->texture[0].type = 
-        theme->a_focused_unpressed_close->texture[0].type = 
-        theme->a_focused_pressed_close->texture[0].type = 
-        theme->a_unfocused_unpressed_close->texture[0].type = 
-        theme->a_unfocused_pressed_close->texture[0].type = 
-        theme->a_disabled_focused_desk->texture[0].type = 
-        theme->a_disabled_unfocused_desk->texture[0].type = 
-        theme->a_hover_focused_desk->texture[0].type = 
-        theme->a_hover_unfocused_desk->texture[0].type = 
-        theme->a_toggled_hover_focused_desk->texture[0].type = 
-        theme->a_toggled_hover_unfocused_desk->texture[0].type = 
-        theme->a_toggled_focused_unpressed_desk->texture[0].type = 
-        theme->a_toggled_unfocused_unpressed_desk->texture[0].type = 
-        theme->a_toggled_focused_pressed_desk->texture[0].type = 
-        theme->a_toggled_unfocused_pressed_desk->texture[0].type = 
-        theme->a_focused_unpressed_desk->texture[0].type = 
-        theme->a_focused_pressed_desk->texture[0].type = 
-        theme->a_unfocused_unpressed_desk->texture[0].type = 
-        theme->a_unfocused_pressed_desk->texture[0].type = 
-        theme->a_disabled_focused_shade->texture[0].type = 
-        theme->a_disabled_unfocused_shade->texture[0].type = 
-        theme->a_hover_focused_shade->texture[0].type = 
-        theme->a_hover_unfocused_shade->texture[0].type = 
-        theme->a_toggled_hover_focused_shade->texture[0].type = 
-        theme->a_toggled_hover_unfocused_shade->texture[0].type = 
-        theme->a_toggled_focused_unpressed_shade->texture[0].type = 
-        theme->a_toggled_unfocused_unpressed_shade->texture[0].type = 
-        theme->a_toggled_focused_pressed_shade->texture[0].type = 
-        theme->a_toggled_unfocused_pressed_shade->texture[0].type = 
-        theme->a_focused_unpressed_shade->texture[0].type = 
-        theme->a_focused_pressed_shade->texture[0].type = 
-        theme->a_unfocused_unpressed_shade->texture[0].type = 
-        theme->a_unfocused_pressed_shade->texture[0].type = 
-        theme->a_disabled_focused_iconify->texture[0].type = 
-        theme->a_disabled_unfocused_iconify->texture[0].type = 
-        theme->a_hover_focused_iconify->texture[0].type = 
-        theme->a_hover_unfocused_iconify->texture[0].type = 
-        theme->a_focused_unpressed_iconify->texture[0].type = 
-        theme->a_focused_pressed_iconify->texture[0].type = 
-        theme->a_unfocused_unpressed_iconify->texture[0].type = 
+    theme->a_disabled_focused_max->texture[0].type =
+        theme->a_disabled_unfocused_max->texture[0].type =
+        theme->a_hover_focused_max->texture[0].type =
+        theme->a_hover_unfocused_max->texture[0].type =
+        theme->a_toggled_hover_focused_max->texture[0].type =
+        theme->a_toggled_hover_unfocused_max->texture[0].type =
+        theme->a_toggled_focused_unpressed_max->texture[0].type =
+        theme->a_toggled_unfocused_unpressed_max->texture[0].type =
+        theme->a_toggled_focused_pressed_max->texture[0].type =
+        theme->a_toggled_unfocused_pressed_max->texture[0].type =
+        theme->a_focused_unpressed_max->texture[0].type =
+        theme->a_focused_pressed_max->texture[0].type =
+        theme->a_unfocused_unpressed_max->texture[0].type =
+        theme->a_unfocused_pressed_max->texture[0].type =
+        theme->a_disabled_focused_close->texture[0].type =
+        theme->a_disabled_unfocused_close->texture[0].type =
+        theme->a_hover_focused_close->texture[0].type =
+        theme->a_hover_unfocused_close->texture[0].type =
+        theme->a_focused_unpressed_close->texture[0].type =
+        theme->a_focused_pressed_close->texture[0].type =
+        theme->a_unfocused_unpressed_close->texture[0].type =
+        theme->a_unfocused_pressed_close->texture[0].type =
+        theme->a_disabled_focused_desk->texture[0].type =
+        theme->a_disabled_unfocused_desk->texture[0].type =
+        theme->a_hover_focused_desk->texture[0].type =
+        theme->a_hover_unfocused_desk->texture[0].type =
+        theme->a_toggled_hover_focused_desk->texture[0].type =
+        theme->a_toggled_hover_unfocused_desk->texture[0].type =
+        theme->a_toggled_focused_unpressed_desk->texture[0].type =
+        theme->a_toggled_unfocused_unpressed_desk->texture[0].type =
+        theme->a_toggled_focused_pressed_desk->texture[0].type =
+        theme->a_toggled_unfocused_pressed_desk->texture[0].type =
+        theme->a_focused_unpressed_desk->texture[0].type =
+        theme->a_focused_pressed_desk->texture[0].type =
+        theme->a_unfocused_unpressed_desk->texture[0].type =
+        theme->a_unfocused_pressed_desk->texture[0].type =
+        theme->a_disabled_focused_shade->texture[0].type =
+        theme->a_disabled_unfocused_shade->texture[0].type =
+        theme->a_hover_focused_shade->texture[0].type =
+        theme->a_hover_unfocused_shade->texture[0].type =
+        theme->a_toggled_hover_focused_shade->texture[0].type =
+        theme->a_toggled_hover_unfocused_shade->texture[0].type =
+        theme->a_toggled_focused_unpressed_shade->texture[0].type =
+        theme->a_toggled_unfocused_unpressed_shade->texture[0].type =
+        theme->a_toggled_focused_pressed_shade->texture[0].type =
+        theme->a_toggled_unfocused_pressed_shade->texture[0].type =
+        theme->a_focused_unpressed_shade->texture[0].type =
+        theme->a_focused_pressed_shade->texture[0].type =
+        theme->a_unfocused_unpressed_shade->texture[0].type =
+        theme->a_unfocused_pressed_shade->texture[0].type =
+        theme->a_disabled_focused_iconify->texture[0].type =
+        theme->a_disabled_unfocused_iconify->texture[0].type =
+        theme->a_hover_focused_iconify->texture[0].type =
+        theme->a_hover_unfocused_iconify->texture[0].type =
+        theme->a_focused_unpressed_iconify->texture[0].type =
+        theme->a_focused_pressed_iconify->texture[0].type =
+        theme->a_unfocused_unpressed_iconify->texture[0].type =
         theme->a_unfocused_pressed_iconify->texture[0].type =
         theme->a_menu_bullet_normal->texture[0].type =
         theme->a_menu_bullet_selected->texture[0].type = RR_TEXTURE_MASK;
-    
-    theme->a_disabled_focused_max->texture[0].data.mask.mask = 
-        theme->a_disabled_unfocused_max->texture[0].data.mask.mask = 
+
+    theme->a_disabled_focused_max->texture[0].data.mask.mask =
+        theme->a_disabled_unfocused_max->texture[0].data.mask.mask =
         theme->max_disabled_mask;
-    theme->a_hover_focused_max->texture[0].data.mask.mask = 
-        theme->a_hover_unfocused_max->texture[0].data.mask.mask = 
+    theme->a_hover_focused_max->texture[0].data.mask.mask =
+        theme->a_hover_unfocused_max->texture[0].data.mask.mask =
         theme->max_hover_mask;
-    theme->a_focused_pressed_max->texture[0].data.mask.mask = 
+    theme->a_focused_pressed_max->texture[0].data.mask.mask =
         theme->a_unfocused_pressed_max->texture[0].data.mask.mask =
         theme->max_pressed_mask;
-    theme->a_focused_unpressed_max->texture[0].data.mask.mask = 
-        theme->a_unfocused_unpressed_max->texture[0].data.mask.mask = 
+    theme->a_focused_unpressed_max->texture[0].data.mask.mask =
+        theme->a_unfocused_unpressed_max->texture[0].data.mask.mask =
         theme->max_mask;
-    theme->a_toggled_hover_focused_max->texture[0].data.mask.mask = 
+    theme->a_toggled_hover_focused_max->texture[0].data.mask.mask =
         theme->a_toggled_hover_unfocused_max->texture[0].data.mask.mask =
         theme->max_toggled_hover_mask;
-    theme->a_toggled_focused_unpressed_max->texture[0].data.mask.mask = 
+    theme->a_toggled_focused_unpressed_max->texture[0].data.mask.mask =
         theme->a_toggled_unfocused_unpressed_max->texture[0].data.mask.mask =
         theme->max_toggled_mask;
-    theme->a_toggled_focused_pressed_max->texture[0].data.mask.mask = 
+    theme->a_toggled_focused_pressed_max->texture[0].data.mask.mask =
         theme->a_toggled_unfocused_pressed_max->texture[0].data.mask.mask =
         theme->max_toggled_pressed_mask;
-    theme->a_disabled_focused_close->texture[0].data.mask.mask = 
-        theme->a_disabled_unfocused_close->texture[0].data.mask.mask = 
+    theme->a_disabled_focused_close->texture[0].data.mask.mask =
+        theme->a_disabled_unfocused_close->texture[0].data.mask.mask =
         theme->close_disabled_mask;
-    theme->a_hover_focused_close->texture[0].data.mask.mask = 
-        theme->a_hover_unfocused_close->texture[0].data.mask.mask = 
+    theme->a_hover_focused_close->texture[0].data.mask.mask =
+        theme->a_hover_unfocused_close->texture[0].data.mask.mask =
         theme->close_hover_mask;
-    theme->a_focused_pressed_close->texture[0].data.mask.mask = 
+    theme->a_focused_pressed_close->texture[0].data.mask.mask =
         theme->a_unfocused_pressed_close->texture[0].data.mask.mask =
         theme->close_pressed_mask;
-    theme->a_focused_unpressed_close->texture[0].data.mask.mask = 
+    theme->a_focused_unpressed_close->texture[0].data.mask.mask =
         theme->a_unfocused_unpressed_close->texture[0].data.mask.mask =
         theme->close_mask;
-    theme->a_disabled_focused_desk->texture[0].data.mask.mask = 
-        theme->a_disabled_unfocused_desk->texture[0].data.mask.mask = 
+    theme->a_disabled_focused_desk->texture[0].data.mask.mask =
+        theme->a_disabled_unfocused_desk->texture[0].data.mask.mask =
         theme->desk_disabled_mask;
-    theme->a_hover_focused_desk->texture[0].data.mask.mask = 
-        theme->a_hover_unfocused_desk->texture[0].data.mask.mask = 
+    theme->a_hover_focused_desk->texture[0].data.mask.mask =
+        theme->a_hover_unfocused_desk->texture[0].data.mask.mask =
         theme->desk_hover_mask;
-    theme->a_focused_pressed_desk->texture[0].data.mask.mask = 
+    theme->a_focused_pressed_desk->texture[0].data.mask.mask =
         theme->a_unfocused_pressed_desk->texture[0].data.mask.mask =
         theme->desk_pressed_mask;
-    theme->a_focused_unpressed_desk->texture[0].data.mask.mask = 
-        theme->a_unfocused_unpressed_desk->texture[0].data.mask.mask = 
+    theme->a_focused_unpressed_desk->texture[0].data.mask.mask =
+        theme->a_unfocused_unpressed_desk->texture[0].data.mask.mask =
         theme->desk_mask;
-    theme->a_toggled_hover_focused_desk->texture[0].data.mask.mask = 
+    theme->a_toggled_hover_focused_desk->texture[0].data.mask.mask =
         theme->a_toggled_hover_unfocused_desk->texture[0].data.mask.mask =
         theme->desk_toggled_hover_mask;
-    theme->a_toggled_focused_unpressed_desk->texture[0].data.mask.mask = 
+    theme->a_toggled_focused_unpressed_desk->texture[0].data.mask.mask =
         theme->a_toggled_unfocused_unpressed_desk->texture[0].data.mask.mask =
         theme->desk_toggled_mask;
-    theme->a_toggled_focused_pressed_desk->texture[0].data.mask.mask = 
+    theme->a_toggled_focused_pressed_desk->texture[0].data.mask.mask =
         theme->a_toggled_unfocused_pressed_desk->texture[0].data.mask.mask =
         theme->desk_toggled_pressed_mask;
-    theme->a_disabled_focused_shade->texture[0].data.mask.mask = 
-        theme->a_disabled_unfocused_shade->texture[0].data.mask.mask = 
+    theme->a_disabled_focused_shade->texture[0].data.mask.mask =
+        theme->a_disabled_unfocused_shade->texture[0].data.mask.mask =
         theme->shade_disabled_mask;
-    theme->a_hover_focused_shade->texture[0].data.mask.mask = 
-        theme->a_hover_unfocused_shade->texture[0].data.mask.mask = 
+    theme->a_hover_focused_shade->texture[0].data.mask.mask =
+        theme->a_hover_unfocused_shade->texture[0].data.mask.mask =
         theme->shade_hover_mask;
-    theme->a_focused_pressed_shade->texture[0].data.mask.mask = 
+    theme->a_focused_pressed_shade->texture[0].data.mask.mask =
         theme->a_unfocused_pressed_shade->texture[0].data.mask.mask =
         theme->shade_pressed_mask;
-    theme->a_focused_unpressed_shade->texture[0].data.mask.mask = 
-        theme->a_unfocused_unpressed_shade->texture[0].data.mask.mask = 
+    theme->a_focused_unpressed_shade->texture[0].data.mask.mask =
+        theme->a_unfocused_unpressed_shade->texture[0].data.mask.mask =
         theme->shade_mask;
-    theme->a_toggled_hover_focused_shade->texture[0].data.mask.mask = 
+    theme->a_toggled_hover_focused_shade->texture[0].data.mask.mask =
         theme->a_toggled_hover_unfocused_shade->texture[0].data.mask.mask =
         theme->shade_toggled_hover_mask;
-    theme->a_toggled_focused_unpressed_shade->texture[0].data.mask.mask = 
+    theme->a_toggled_focused_unpressed_shade->texture[0].data.mask.mask =
         theme->a_toggled_unfocused_unpressed_shade->texture[0].data.mask.mask =
         theme->shade_toggled_mask;
-    theme->a_toggled_focused_pressed_shade->texture[0].data.mask.mask = 
+    theme->a_toggled_focused_pressed_shade->texture[0].data.mask.mask =
         theme->a_toggled_unfocused_pressed_shade->texture[0].data.mask.mask =
         theme->shade_toggled_pressed_mask;
-    theme->a_disabled_focused_iconify->texture[0].data.mask.mask = 
-        theme->a_disabled_unfocused_iconify->texture[0].data.mask.mask = 
+    theme->a_disabled_focused_iconify->texture[0].data.mask.mask =
+        theme->a_disabled_unfocused_iconify->texture[0].data.mask.mask =
         theme->iconify_disabled_mask;
-    theme->a_hover_focused_iconify->texture[0].data.mask.mask = 
-        theme->a_hover_unfocused_iconify->texture[0].data.mask.mask = 
+    theme->a_hover_focused_iconify->texture[0].data.mask.mask =
+        theme->a_hover_unfocused_iconify->texture[0].data.mask.mask =
         theme->iconify_hover_mask;
-    theme->a_focused_pressed_iconify->texture[0].data.mask.mask = 
+    theme->a_focused_pressed_iconify->texture[0].data.mask.mask =
         theme->a_unfocused_pressed_iconify->texture[0].data.mask.mask =
         theme->iconify_pressed_mask;
-    theme->a_focused_unpressed_iconify->texture[0].data.mask.mask = 
-        theme->a_unfocused_unpressed_iconify->texture[0].data.mask.mask = 
+    theme->a_focused_unpressed_iconify->texture[0].data.mask.mask =
+        theme->a_unfocused_unpressed_iconify->texture[0].data.mask.mask =
         theme->iconify_mask;
-    theme->a_menu_bullet_normal->texture[0].data.mask.mask = 
-    theme->a_menu_bullet_selected->texture[0].data.mask.mask = 
+    theme->a_menu_bullet_normal->texture[0].data.mask.mask =
+    theme->a_menu_bullet_selected->texture[0].data.mask.mask =
         theme->menu_bullet_mask;
-    theme->a_disabled_focused_max->texture[0].data.mask.color = 
-        theme->a_disabled_focused_close->texture[0].data.mask.color = 
-        theme->a_disabled_focused_desk->texture[0].data.mask.color = 
-        theme->a_disabled_focused_shade->texture[0].data.mask.color = 
-        theme->a_disabled_focused_iconify->texture[0].data.mask.color = 
+    theme->a_disabled_focused_max->texture[0].data.mask.color =
+        theme->a_disabled_focused_close->texture[0].data.mask.color =
+        theme->a_disabled_focused_desk->texture[0].data.mask.color =
+        theme->a_disabled_focused_shade->texture[0].data.mask.color =
+        theme->a_disabled_focused_iconify->texture[0].data.mask.color =
         theme->titlebut_disabled_focused_color;
-    theme->a_disabled_unfocused_max->texture[0].data.mask.color = 
-        theme->a_disabled_unfocused_close->texture[0].data.mask.color = 
-        theme->a_disabled_unfocused_desk->texture[0].data.mask.color = 
-        theme->a_disabled_unfocused_shade->texture[0].data.mask.color = 
-        theme->a_disabled_unfocused_iconify->texture[0].data.mask.color = 
+    theme->a_disabled_unfocused_max->texture[0].data.mask.color =
+        theme->a_disabled_unfocused_close->texture[0].data.mask.color =
+        theme->a_disabled_unfocused_desk->texture[0].data.mask.color =
+        theme->a_disabled_unfocused_shade->texture[0].data.mask.color =
+        theme->a_disabled_unfocused_iconify->texture[0].data.mask.color =
         theme->titlebut_disabled_unfocused_color;
-    theme->a_hover_focused_max->texture[0].data.mask.color = 
-        theme->a_hover_focused_close->texture[0].data.mask.color = 
-        theme->a_hover_focused_desk->texture[0].data.mask.color = 
-        theme->a_hover_focused_shade->texture[0].data.mask.color = 
-        theme->a_hover_focused_iconify->texture[0].data.mask.color = 
+    theme->a_hover_focused_max->texture[0].data.mask.color =
+        theme->a_hover_focused_close->texture[0].data.mask.color =
+        theme->a_hover_focused_desk->texture[0].data.mask.color =
+        theme->a_hover_focused_shade->texture[0].data.mask.color =
+        theme->a_hover_focused_iconify->texture[0].data.mask.color =
         theme->titlebut_hover_focused_color;
-    theme->a_hover_unfocused_max->texture[0].data.mask.color = 
-        theme->a_hover_unfocused_close->texture[0].data.mask.color = 
-        theme->a_hover_unfocused_desk->texture[0].data.mask.color = 
-        theme->a_hover_unfocused_shade->texture[0].data.mask.color = 
-        theme->a_hover_unfocused_iconify->texture[0].data.mask.color = 
+    theme->a_hover_unfocused_max->texture[0].data.mask.color =
+        theme->a_hover_unfocused_close->texture[0].data.mask.color =
+        theme->a_hover_unfocused_desk->texture[0].data.mask.color =
+        theme->a_hover_unfocused_shade->texture[0].data.mask.color =
+        theme->a_hover_unfocused_iconify->texture[0].data.mask.color =
         theme->titlebut_hover_unfocused_color;
     theme->a_toggled_hover_focused_max->texture[0].data.mask.color =
         theme->a_toggled_hover_focused_desk->texture[0].data.mask.color =
@@ -1254,33 +1299,33 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
         theme->a_toggled_unfocused_pressed_desk->texture[0].data.mask.color =
         theme->a_toggled_unfocused_pressed_shade->texture[0].data.mask.color =
         theme->titlebut_toggled_unfocused_pressed_color;
-    theme->a_focused_unpressed_max->texture[0].data.mask.color = 
-        theme->a_focused_unpressed_close->texture[0].data.mask.color = 
-        theme->a_focused_unpressed_desk->texture[0].data.mask.color = 
-        theme->a_focused_unpressed_shade->texture[0].data.mask.color = 
-        theme->a_focused_unpressed_iconify->texture[0].data.mask.color = 
+    theme->a_focused_unpressed_max->texture[0].data.mask.color =
+        theme->a_focused_unpressed_close->texture[0].data.mask.color =
+        theme->a_focused_unpressed_desk->texture[0].data.mask.color =
+        theme->a_focused_unpressed_shade->texture[0].data.mask.color =
+        theme->a_focused_unpressed_iconify->texture[0].data.mask.color =
         theme->titlebut_focused_unpressed_color;
-    theme->a_focused_pressed_max->texture[0].data.mask.color = 
-        theme->a_focused_pressed_close->texture[0].data.mask.color = 
-        theme->a_focused_pressed_desk->texture[0].data.mask.color = 
-        theme->a_focused_pressed_shade->texture[0].data.mask.color = 
+    theme->a_focused_pressed_max->texture[0].data.mask.color =
+        theme->a_focused_pressed_close->texture[0].data.mask.color =
+        theme->a_focused_pressed_desk->texture[0].data.mask.color =
+        theme->a_focused_pressed_shade->texture[0].data.mask.color =
         theme->a_focused_pressed_iconify->texture[0].data.mask.color =
         theme->titlebut_focused_pressed_color;
-    theme->a_unfocused_unpressed_max->texture[0].data.mask.color = 
-        theme->a_unfocused_unpressed_close->texture[0].data.mask.color = 
-        theme->a_unfocused_unpressed_desk->texture[0].data.mask.color = 
-        theme->a_unfocused_unpressed_shade->texture[0].data.mask.color = 
-        theme->a_unfocused_unpressed_iconify->texture[0].data.mask.color = 
+    theme->a_unfocused_unpressed_max->texture[0].data.mask.color =
+        theme->a_unfocused_unpressed_close->texture[0].data.mask.color =
+        theme->a_unfocused_unpressed_desk->texture[0].data.mask.color =
+        theme->a_unfocused_unpressed_shade->texture[0].data.mask.color =
+        theme->a_unfocused_unpressed_iconify->texture[0].data.mask.color =
         theme->titlebut_unfocused_unpressed_color;
-    theme->a_unfocused_pressed_max->texture[0].data.mask.color = 
-        theme->a_unfocused_pressed_close->texture[0].data.mask.color = 
-        theme->a_unfocused_pressed_desk->texture[0].data.mask.color = 
-        theme->a_unfocused_pressed_shade->texture[0].data.mask.color = 
+    theme->a_unfocused_pressed_max->texture[0].data.mask.color =
+        theme->a_unfocused_pressed_close->texture[0].data.mask.color =
+        theme->a_unfocused_pressed_desk->texture[0].data.mask.color =
+        theme->a_unfocused_pressed_shade->texture[0].data.mask.color =
         theme->a_unfocused_pressed_iconify->texture[0].data.mask.color =
         theme->titlebut_unfocused_pressed_color;
-    theme->a_menu_bullet_normal->texture[0].data.mask.color = 
+    theme->a_menu_bullet_normal->texture[0].data.mask.color =
         theme->menu_color;
-    theme->a_menu_bullet_selected->texture[0].data.mask.color = 
+    theme->a_menu_bullet_selected->texture[0].data.mask.color =
         theme->menu_selected_color;
 
     g_free(path);
@@ -1411,11 +1456,14 @@ void RrThemeFree(RrTheme *theme)
         RrPixmapMaskFree(theme->close_hover_mask);
         RrPixmapMaskFree(theme->close_pressed_mask);
         RrPixmapMaskFree(theme->menu_bullet_mask);
+        RrPixmapMaskFree(theme->down_arrow_mask);
+        RrPixmapMaskFree(theme->up_arrow_mask);
 
-        RrFontClose(theme->win_font_focused); 
+        RrFontClose(theme->win_font_focused);
         RrFontClose(theme->win_font_unfocused);
         RrFontClose(theme->menu_title_font);
         RrFontClose(theme->menu_font);
+        RrFontClose(theme->osd_font);
 
         RrAppearanceFree(theme->a_disabled_focused_max);
         RrAppearanceFree(theme->a_disabled_unfocused_max);
@@ -1520,6 +1568,10 @@ static XrmDatabase loaddb(const gchar *name, gchar **path)
             *path = g_path_get_dirname(s);
         g_free(s);
     } else {
+        ObtPaths *p;
+
+        p = obt_paths_new();
+
         /* XXX backwards compatibility, remove me sometime later */
         s = g_build_filename(g_get_home_dir(), ".themes", name,
                              "openbox-3", "themerc", NULL);
@@ -1527,8 +1579,7 @@ static XrmDatabase loaddb(const gchar *name, gchar **path)
             *path = g_path_get_dirname(s);
         g_free(s);
 
-        for (it = parse_xdg_data_dir_paths(); !db && it;
-             it = g_slist_next(it))
+        for (it = obt_paths_data_dirs(p); !db && it; it = g_slist_next(it))
         {
             s = g_build_filename(it->data, "themes", name,
                                  "openbox-3", "themerc", NULL);
@@ -1536,6 +1587,8 @@ static XrmDatabase loaddb(const gchar *name, gchar **path)
                 *path = g_path_get_dirname(s);
             g_free(s);
         }
+
+        obt_paths_unref(p);
     }
 
     if (db == NULL) {
@@ -1569,7 +1622,7 @@ static gboolean read_int(XrmDatabase db, const gchar *rname, gint *value)
     gchar *rclass = create_class_name(rname);
     gchar *rettype, *end;
     XrmValue retvalue;
-  
+
     if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
         retvalue.addr != NULL) {
         *value = (gint)strtol(retvalue.addr, &end, 10);
@@ -1587,7 +1640,7 @@ static gboolean read_string(XrmDatabase db, const gchar *rname, gchar **value)
     gchar *rclass = create_class_name(rname);
     gchar *rettype;
     XrmValue retvalue;
-  
+
     if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
         retvalue.addr != NULL) {
         *value = retvalue.addr;
@@ -1605,7 +1658,7 @@ static gboolean read_color(XrmDatabase db, const RrInstance *inst,
     gchar *rclass = create_class_name(rname);
     gchar *rettype;
     XrmValue retvalue;
-  
+
     if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
         retvalue.addr != NULL) {
         RrColor *c = RrColorParse(inst, retvalue.addr);
@@ -1708,14 +1761,20 @@ static gboolean read_appearance(XrmDatabase db, const RrInstance *inst,
 {
     gboolean ret = FALSE;
     gchar *rclass = create_class_name(rname);
-    gchar *cname, *ctoname, *bcname, *icname;
+    gchar *cname, *ctoname, *bcname, *icname, *hname, *sname;
+    gchar *csplitname, *ctosplitname;
     gchar *rettype;
     XrmValue retvalue;
+    gint i;
 
     cname = g_strconcat(rname, ".color", NULL);
     ctoname = g_strconcat(rname, ".colorTo", NULL);
     bcname = g_strconcat(rname, ".border.color", NULL);
     icname = g_strconcat(rname, ".interlace.color", NULL);
+    hname = g_strconcat(rname, ".highlight", NULL);
+    sname = g_strconcat(rname, ".shadow", NULL);
+    csplitname = g_strconcat(rname, ".color.splitTo", NULL);
+    ctosplitname = g_strconcat(rname, ".colorTo.splitTo", NULL);
 
     if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
         retvalue.addr != NULL) {
@@ -1738,9 +1797,52 @@ static gboolean read_appearance(XrmDatabase db, const RrInstance *inst,
             if (!read_color(db, inst, icname,
                             &value->surface.interlace_color))
                 value->surface.interlace_color = RrColorNew(inst, 0, 0, 0);
+        if (read_int(db, hname, &i) && i >= 0)
+            value->surface.bevel_light_adjust = i;
+        if (read_int(db, sname, &i) && i >= 0 && i <= 256)
+            value->surface.bevel_dark_adjust = i;
+
+        if (value->surface.grad == RR_SURFACE_SPLIT_VERTICAL) {
+            gint r, g, b;
+
+            if (!read_color(db, inst, csplitname,
+                            &value->surface.split_primary))
+            {
+                r = value->surface.primary->r;
+                r += r >> 2;
+                g = value->surface.primary->g;
+                g += g >> 2;
+                b = value->surface.primary->b;
+                b += b >> 2;
+                if (r > 0xFF) r = 0xFF;
+                if (g > 0xFF) g = 0xFF;
+                if (b > 0xFF) b = 0xFF;
+                value->surface.split_primary = RrColorNew(inst, r, g, b);
+            }
+
+            if (!read_color(db, inst, ctosplitname,
+                            &value->surface.split_secondary))
+            {
+                r = value->surface.secondary->r;
+                r += r >> 4;
+                g = value->surface.secondary->g;
+                g += g >> 4;
+                b = value->surface.secondary->b;
+                b += b >> 4;
+                if (r > 0xFF) r = 0xFF;
+                if (g > 0xFF) g = 0xFF;
+                if (b > 0xFF) b = 0xFF;
+                value->surface.split_secondary = RrColorNew(inst, r, g, b);
+            }
+        }
+
         ret = TRUE;
     }
 
+    g_free(ctosplitname);
+    g_free(csplitname);
+    g_free(sname);
+    g_free(hname);
     g_free(icname);
     g_free(bcname);
     g_free(ctoname);