summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas James Alexander Thurman <tthurman@src.gnome.org>2006-06-10 02:07:50 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2006-06-10 02:07:50 +0000
commit12b960f372141d52985b3115e00e4b7906b32ac2 (patch)
tree2b68c55a0a67fc518fa9fbef7eab8ef40b02e9d6
parent4eec46f589f271f3b427011cfb075aa0b7730a19 (diff)
downloadmetacity-12b960f372141d52985b3115e00e4b7906b32ac2.tar.gz
#121639: hide buttons on some windows
-rw-r--r--src/theme-parser.c18
-rw-r--r--src/theme.c6
-rw-r--r--src/theme.h4
3 files changed, 21 insertions, 7 deletions
diff --git a/src/theme-parser.c b/src/theme-parser.c
index ea7c831d..d632ac74 100644
--- a/src/theme-parser.c
+++ b/src/theme-parser.c
@@ -833,11 +833,13 @@ parse_toplevel_element (GMarkupParseContext *context,
const char *rounded_top_right = NULL;
const char *rounded_bottom_left = NULL;
const char *rounded_bottom_right = NULL;
+ const char *hide_buttons = NULL;
gboolean has_title_val;
guint rounded_top_left_val;
guint rounded_top_right_val;
guint rounded_bottom_left_val;
guint rounded_bottom_right_val;
+ gboolean hide_buttons_val;
double title_scale_val;
MetaFrameLayout *parent_layout;
@@ -849,6 +851,7 @@ parse_toplevel_element (GMarkupParseContext *context,
"rounded_top_right", &rounded_top_right,
"rounded_bottom_left", &rounded_bottom_left,
"rounded_bottom_right", &rounded_bottom_right,
+ "hide_buttons", &hide_buttons,
NULL))
return;
@@ -864,10 +867,14 @@ parse_toplevel_element (GMarkupParseContext *context,
if (has_title && !parse_boolean (has_title, &has_title_val, context, error))
return;
- rounded_top_left_val = FALSE;
- rounded_top_right_val = FALSE;
- rounded_bottom_left_val = FALSE;
- rounded_bottom_right_val = FALSE;
+ hide_buttons_val = FALSE;
+ if (hide_buttons && !parse_boolean (hide_buttons, &hide_buttons_val, context, error))
+ return;
+
+ rounded_top_left_val = 0;
+ rounded_top_right_val = 0;
+ rounded_bottom_left_val = 0;
+ rounded_bottom_right_val = 0;
if (rounded_top_left && !parse_rounding (rounded_top_left, &rounded_top_left_val, context, info->theme, error))
return;
@@ -913,6 +920,9 @@ parse_toplevel_element (GMarkupParseContext *context,
if (has_title) /* only if explicit, otherwise inherit */
info->layout->has_title = has_title_val;
+ if (META_THEME_ALLOWS (info->theme, META_THEME_HIDDEN_BUTTONS) && hide_buttons_val)
+ info->layout->hide_buttons = hide_buttons_val;
+
if (title_scale)
info->layout->title_scale = title_scale_val;
diff --git a/src/theme.c b/src/theme.c
index 02ad3ef9..69fb5686 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -560,7 +560,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
/* Init all button rects to 0, lame hack */
memset (ADDRESS_OF_BUTTON_RECTS (fgeom), '\0',
LENGTH_OF_BUTTON_RECTS);
-
+
n_left = 0;
n_right = 0;
for (i = 0; i < MAX_BUTTONS_PER_CORNER; i++)
@@ -570,7 +570,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
right_func_rects[i] = NULL;
/* Try to fill in rects */
- if (button_layout->left_buttons[i] != META_BUTTON_FUNCTION_LAST)
+ if (button_layout->left_buttons[i] != META_BUTTON_FUNCTION_LAST && !layout->hide_buttons)
{
left_func_rects[n_left] = rect_for_function (fgeom, flags,
button_layout->left_buttons[i]);
@@ -578,7 +578,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
++n_left;
}
- if (button_layout->right_buttons[i] != META_BUTTON_FUNCTION_LAST)
+ if (button_layout->right_buttons[i] != META_BUTTON_FUNCTION_LAST && !layout->hide_buttons)
{
right_func_rects[n_right] = rect_for_function (fgeom, flags,
button_layout->right_buttons[i]);
diff --git a/src/theme.h b/src/theme.h
index 52986c1b..8371de9f 100644
--- a/src/theme.h
+++ b/src/theme.h
@@ -97,6 +97,9 @@ struct _MetaFrameLayout
/* Whether title text will be displayed */
guint has_title : 1;
+ /* Whether we should hide the buttons */
+ guint hide_buttons : 1;
+
/* Round corners */
guint top_left_corner_rounded_radius;
guint top_right_corner_rounded_radius;
@@ -854,5 +857,6 @@ guint meta_theme_earliest_version_with_button (MetaButtonType type);
#define META_THEME_IMAGES_FROM_ICON_THEMES 2
#define META_THEME_UNRESIZABLE_SHADED_STYLES 2
#define META_THEME_DEGREES_IN_ARCS 2
+#define META_THEME_HIDDEN_BUTTONS 2
#endif