]> Dogcows Code - chaz/openbox/blobdiff - src/Screen.cc
sync with bb-cvs
[chaz/openbox] / src / Screen.cc
index acde773640a5007749a35f17d1fe705ed6f9aa78..d92dec3502cb54a66c3e4050600fc6044ed124c8 100644 (file)
@@ -974,10 +974,19 @@ void BScreen::LoadStyle(void) {
     readDatabaseTexture("window.button.unfocus", "black", style);
   resource.wstyle.b_pressed =
     readDatabaseTexture("window.button.pressed", "black", style);
-  resource.wstyle.f_focus =
-    readDatabaseColor("window.frame.focusColor", "white", style);
-  resource.wstyle.f_unfocus =
-    readDatabaseColor("window.frame.unfocusColor", "black", style);
+
+  // we create the window.frame texture by hand because it exists only to
+  // make the code cleaner and is not actually used for display
+  BColor color = readDatabaseColor("window.frame.focusColor", "white", style);
+  resource.wstyle.f_focus = BTexture("solid flat", getBaseDisplay(),
+                                     getScreenNumber(), image_control);
+  resource.wstyle.f_focus.setColor(color);
+
+  color = readDatabaseColor("window.frame.unfocusColor", "white", style);
+  resource.wstyle.f_unfocus = BTexture("solid flat", getBaseDisplay(),
+                                       getScreenNumber(), image_control);
+  resource.wstyle.f_unfocus.setColor(color);
+
   resource.wstyle.l_text_focus =
     readDatabaseColor("window.label.focus.textColor", "black", style);
   resource.wstyle.l_text_unfocus =
@@ -995,7 +1004,17 @@ void BScreen::LoadStyle(void) {
       resource.wstyle.justify = CenterJustify;
   }
 
-  // load toolbar config
+  // sanity checks
+  if (resource.wstyle.t_focus.texture() == BTexture::Parent_Relative)
+    resource.wstyle.t_focus = resource.wstyle.f_focus;
+  if (resource.wstyle.t_unfocus.texture() == BTexture::Parent_Relative)
+    resource.wstyle.t_unfocus = resource.wstyle.f_unfocus;
+  if (resource.wstyle.h_focus.texture() == BTexture::Parent_Relative)
+    resource.wstyle.h_focus = resource.wstyle.f_focus;
+  if (resource.wstyle.h_unfocus.texture() == BTexture::Parent_Relative)
+    resource.wstyle.h_unfocus = resource.wstyle.f_unfocus;
+
+// load toolbar config
   resource.tstyle.toolbar =
     readDatabaseTexture("toolbar", "black", style);
   resource.tstyle.label =
@@ -1025,6 +1044,14 @@ void BScreen::LoadStyle(void) {
       resource.tstyle.justify = CenterJustify;
   }
 
+  // sanity checks
+  if (resource.tstyle.toolbar.texture() == BTexture::Parent_Relative) {
+    resource.tstyle.toolbar = BTexture("solid flat", getBaseDisplay(),
+                                       getScreenNumber(), image_control);
+    resource.tstyle.toolbar.setColor(BColor("black", getBaseDisplay(),
+                                            getScreenNumber()));
+  }
+
   // load menu config
   resource.mstyle.title =
     readDatabaseTexture("menu.title", "white", style);
@@ -1073,6 +1100,14 @@ void BScreen::LoadStyle(void) {
       resource.mstyle.bullet_pos = Basemenu::Right;
   }
 
+  // sanity checks
+  if (resource.mstyle.frame.texture() == BTexture::Parent_Relative) {
+    resource.mstyle.frame = BTexture("solid flat", getBaseDisplay(),
+                                     getScreenNumber(), image_control);
+    resource.mstyle.frame.setColor(BColor("black", getBaseDisplay(),
+                                          getScreenNumber()));
+  }
+
   resource.border_color =
     readDatabaseColor("borderColor", "black", style);
 
@@ -2422,18 +2457,10 @@ BTexture BScreen::readDatabaseTexture(const string &rname,
   texture.setDisplay(getBaseDisplay(), getScreenNumber());
   texture.setImageControl(image_control);
 
-  if (texture.texture() & BTexture::Solid) {
-    texture.setColor(readDatabaseColor(rname + ".color",
-                                       default_color, style));
-    texture.setColorTo(readDatabaseColor(rname + ".colorTo",
-                                         default_color, style));
-  } else if (texture.texture() & BTexture::Gradient) {
-    texture.setColor(readDatabaseColor(rname + ".color",
-                                       default_color, style));
-    texture.setColorTo(readDatabaseColor(rname + ".colorTo",
-                                         default_color, style));
-  }
-
+  texture.setColor(readDatabaseColor(rname + ".color", default_color, style));
+  texture.setColorTo(readDatabaseColor(rname + ".colorTo", default_color,
+                                       style));
+  
   return texture;
 }
 
This page took 0.021988 seconds and 4 git commands to generate.