add a config option hideDisabled in the theme section that hides disabled buttons instead of showing them as disabled, based on patch in bug #2310

This commit is contained in:
Mikael Magnusson 2005-07-14 13:44:33 +00:00
parent 6ec1881579
commit 1cfb65bc40
4 changed files with 17 additions and 0 deletions

View file

@ -100,6 +100,7 @@
<xs:element name="name" type="xs:string"/> <xs:element name="name" type="xs:string"/>
<xs:element name="titlelayout" type="xs:string"/> <xs:element name="titlelayout" type="xs:string"/>
<xs:element name="keepBorder" type="ob:yesorno"/> <xs:element name="keepBorder" type="ob:yesorno"/>
<xs:element name="hideDisabled" type="ob:yesorno"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="desktops"> <xs:complexType name="desktops">

View file

@ -35,6 +35,7 @@ ObPlacePolicy config_place_policy;
gchar *config_theme; gchar *config_theme;
gboolean config_theme_keepborder; gboolean config_theme_keepborder;
gboolean config_theme_hidedisabled;
gchar *config_title_layout; 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))) if ((n = parse_find_node("keepBorder", node)))
config_theme_keepborder = parse_bool(doc, n); 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, 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_title_layout = g_strdup("NLIMC");
config_theme_keepborder = TRUE; config_theme_keepborder = TRUE;
config_theme_hidedisabled = FALSE;
parse_register(i, "theme", parse_theme, NULL); parse_register(i, "theme", parse_theme, NULL);

View file

@ -84,6 +84,8 @@ extern gchar *config_theme;
/* Show the onepixel border after toggleDecor */ /* Show the onepixel border after toggleDecor */
extern gboolean config_theme_keepborder; extern gboolean config_theme_keepborder;
/* Hide window frame buttons that the window doesn't allow */
extern gboolean config_theme_hidedisabled;
/* Titlebar button layout */ /* Titlebar button layout */
extern gchar *config_title_layout; extern gchar *config_title_layout;

View file

@ -579,18 +579,24 @@ static void layout_title(ObFrame *self)
break; break;
case 'D': case 'D':
if (d) { *lc = ' '; break; } if (d) { *lc = ' '; break; }
if (!(self->decorations & OB_FRAME_DECOR_ALLDESKTOPS) && config_theme_hidedisabled)
break;
d = TRUE; d = TRUE;
self->label_width -= (ob_rr_theme->button_size + self->label_width -= (ob_rr_theme->button_size +
ob_rr_theme->padding + 1); ob_rr_theme->padding + 1);
break; break;
case 'S': case 'S':
if (s) { *lc = ' '; break; } if (s) { *lc = ' '; break; }
if (!(self->decorations & OB_FRAME_DECOR_SHADE) && config_theme_hidedisabled)
break;
s = TRUE; s = TRUE;
self->label_width -= (ob_rr_theme->button_size + self->label_width -= (ob_rr_theme->button_size +
ob_rr_theme->padding + 1); ob_rr_theme->padding + 1);
break; break;
case 'I': case 'I':
if (i) { *lc = ' '; break; } if (i) { *lc = ' '; break; }
if (!(self->decorations & OB_FRAME_DECOR_ICONIFY) && config_theme_hidedisabled)
break;
i = TRUE; i = TRUE;
self->label_width -= (ob_rr_theme->button_size + self->label_width -= (ob_rr_theme->button_size +
ob_rr_theme->padding + 1); ob_rr_theme->padding + 1);
@ -601,12 +607,16 @@ static void layout_title(ObFrame *self)
break; break;
case 'M': case 'M':
if (m) { *lc = ' '; break; } if (m) { *lc = ' '; break; }
if (!(self->decorations & OB_FRAME_DECOR_MAXIMIZE) && config_theme_hidedisabled)
break;
m = TRUE; m = TRUE;
self->label_width -= (ob_rr_theme->button_size + self->label_width -= (ob_rr_theme->button_size +
ob_rr_theme->padding + 1); ob_rr_theme->padding + 1);
break; break;
case 'C': case 'C':
if (c) { *lc = ' '; break; } if (c) { *lc = ' '; break; }
if (!(self->decorations & OB_FRAME_DECOR_CLOSE) && config_theme_hidedisabled)
break;
c = TRUE; c = TRUE;
self->label_width -= (ob_rr_theme->button_size + self->label_width -= (ob_rr_theme->button_size +
ob_rr_theme->padding + 1); ob_rr_theme->padding + 1);