]> Dogcows Code - chaz/openbox/commitdiff
add a config option hideDisabled in the theme section that hides disabled buttons...
authorMikael Magnusson <mikachu@comhem.se>
Thu, 14 Jul 2005 13:44:33 +0000 (13:44 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Thu, 14 Jul 2005 13:44:33 +0000 (13:44 +0000)
data/rc.xsd
openbox/config.c
openbox/config.h
openbox/frame.c

index 7cdc5900693733dae7c828853b270d431002d403..3c6c47b77fc649c2fc0f61dbf99eb92e31bee6e9 100644 (file)
             <xs:element name="name" type="xs:string"/>
             <xs:element name="titlelayout" type="xs:string"/>
             <xs:element name="keepBorder" type="ob:yesorno"/>
+            <xs:element name="hideDisabled" type="ob:yesorno"/>
         </xs:sequence>
     </xs:complexType>
     <xs:complexType name="desktops">
index 8c86b973fbcf3bb703a6354d17fb2e506b7bbe8d..c43db9354b59a2a3b4ce3a14e5379080787a328b 100644 (file)
@@ -35,6 +35,7 @@ ObPlacePolicy config_place_policy;
 
 gchar   *config_theme;
 gboolean config_theme_keepborder;
+gboolean config_theme_hidedisabled;
 
 gchar *config_title_layout;
 
@@ -256,6 +257,8 @@ static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
     }
     if ((n = parse_find_node("keepBorder", node)))
         config_theme_keepborder = parse_bool(doc, n);
+    if ((n = parse_find_node("hideDisabled", node)))
+        config_theme_hidedisabled = parse_bool(doc, n);
 }
 
 static void parse_desktops(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
@@ -556,6 +559,7 @@ void config_startup(ObParseInst *i)
 
     config_title_layout = g_strdup("NLIMC");
     config_theme_keepborder = TRUE;
+    config_theme_hidedisabled = FALSE;
 
     parse_register(i, "theme", parse_theme, NULL);
 
index b04d06af9ea0f83e3b317b37ff4177195814464a..5be26ef4cab01c28857f0266c2fa0967038e7dc9 100644 (file)
@@ -84,6 +84,8 @@ extern gchar *config_theme;
 
 /* Show the onepixel border after toggleDecor */
 extern gboolean config_theme_keepborder;
+/* Hide window frame buttons that the window doesn't allow */
+extern gboolean config_theme_hidedisabled;
 /* Titlebar button layout */
 extern gchar *config_title_layout;
 
index fcad427b49d17023efb3b5350a892fecfd7b48ae..f390887ae8908fd27226abbf2fbd9ca4c57785a3 100644 (file)
@@ -579,18 +579,24 @@ static void layout_title(ObFrame *self)
             break;
         case 'D':
             if (d) { *lc = ' '; break; }
+            if (!(self->decorations & OB_FRAME_DECOR_ALLDESKTOPS) && config_theme_hidedisabled)
+                break;
             d = TRUE;
             self->label_width -= (ob_rr_theme->button_size +
                                   ob_rr_theme->padding + 1);
             break;
         case 'S':
             if (s) { *lc = ' '; break; }
+            if (!(self->decorations & OB_FRAME_DECOR_SHADE) && config_theme_hidedisabled)
+                break;
             s = TRUE;
             self->label_width -= (ob_rr_theme->button_size +
                                   ob_rr_theme->padding + 1);
             break;
         case 'I':
             if (i) { *lc = ' '; break; }
+            if (!(self->decorations & OB_FRAME_DECOR_ICONIFY) && config_theme_hidedisabled)
+                break;
             i = TRUE;
             self->label_width -= (ob_rr_theme->button_size +
                                   ob_rr_theme->padding + 1);
@@ -601,12 +607,16 @@ static void layout_title(ObFrame *self)
             break;
         case 'M':
             if (m) { *lc = ' '; break; }
+            if (!(self->decorations & OB_FRAME_DECOR_MAXIMIZE) && config_theme_hidedisabled)
+                break;
             m = TRUE;
             self->label_width -= (ob_rr_theme->button_size +
                                   ob_rr_theme->padding + 1);
             break;
         case 'C':
             if (c) { *lc = ' '; break; }
+            if (!(self->decorations & OB_FRAME_DECOR_CLOSE) && config_theme_hidedisabled)
+                break;
             c = TRUE;
             self->label_width -= (ob_rr_theme->button_size +
                                   ob_rr_theme->padding + 1);
This page took 0.031162 seconds and 4 git commands to generate.