]> Dogcows Code - chaz/openbox/blobdiff - src/Screen.cc
use drop shadow height in the font height.
[chaz/openbox] / src / Screen.cc
index 7e7ce5a4f5d68342e337ab958319431336d93095..70494cab38132a0b1916f96a258f1ad7726e5d6b 100644 (file)
@@ -1065,6 +1065,12 @@ void BScreen::LoadStyle(void) {
   resource.wstyle.b_pressed =
     readDatabaseTexture("window.button.pressed", "black", style);
 
+  //if neither of these can be found, we will use the previous resource
+  resource.wstyle.b_pressed_focus =
+    readDatabaseTexture("window.button.pressed.focus", "black", style, true);
+  resource.wstyle.b_pressed_unfocus =
+    readDatabaseTexture("window.button.pressed.unfocus", "black", style, true);
+
 #ifdef    BITMAPBUTTONS
   if (resource.wstyle.close_button.mask != None)
     XFreePixmap(blackbox->getXDisplay(), resource.wstyle.close_button.mask);
@@ -2671,12 +2677,15 @@ void BScreen::readDatabaseMask(const string &rname, PixmapMask &pixmapMask,
 
 BTexture BScreen::readDatabaseTexture(const string &rname,
                                       const string &default_color,
-                                      const Configuration &style) {
+                                      const Configuration &style, 
+                                      bool allowNoTexture) {
   BTexture texture;
   string s;
 
   if (style.getValue(rname, s))
     texture = BTexture(s);
+  else if (allowNoTexture) //no default
+    texture.setTexture(BTexture::NoTexture);
   else
     texture.setTexture(BTexture::Solid | BTexture::Flat);
 
@@ -2684,12 +2693,15 @@ BTexture BScreen::readDatabaseTexture(const string &rname,
   texture.setDisplay(getBaseDisplay(), getScreenNumber());
   texture.setImageControl(image_control);
 
-  texture.setColor(readDatabaseColor(rname + ".color", default_color, style));
-  texture.setColorTo(readDatabaseColor(rname + ".colorTo", default_color,
+  if (texture.texture() != BTexture::NoTexture) {
+    texture.setColor(readDatabaseColor(rname + ".color", default_color,
                                        style));
-  texture.setBorderColor(readDatabaseColor(rname + ".borderColor",
-                                           default_color, style));
-  
+    texture.setColorTo(readDatabaseColor(rname + ".colorTo", default_color,
+                                         style));
+    texture.setBorderColor(readDatabaseColor(rname + ".borderColor",
+                                             default_color, style));
+  }
+
   return texture;
 }
 
@@ -2720,15 +2732,33 @@ BFont *BScreen::readDatabaseFont(const string &rbasename,
     string family = s;
     bool bold = False;
     bool italic = False;
+    bool dropShadow = False;
+
     if (style.getValue(rbasename + "xft.flags", s)) {
       if (s.find("bold") != string::npos)
         bold = True;
       if (s.find("italic") != string::npos)
         italic = True;
+      if (s.find("shadow") != string::npos)
+        dropShadow = True;
     }
     
+    unsigned char offset = 1;
+    if (style.getValue(rbasename + "xft.shadow.offset", s)) {
+      offset = atoi(s.c_str()); //doesn't detect errors
+      if (offset > CHAR_MAX)
+        offset = 1;
+    }
+
+    unsigned char tint = 0x40;
+    if (style.getValue(rbasename + "xft.shadow.tint", s)) {
+      tint = atoi(s.c_str());
+    }
+
+    
     BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold,
-                         italic, resource.shadow_fonts, resource.aa_fonts);
+                         italic, dropShadow && resource.shadow_fonts, offset, 
+                         tint, resource.aa_fonts);
     if (b->valid())
       return b;
     else
This page took 0.025553 seconds and 4 git commands to generate.