summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/theme-format.txt6
-rw-r--r--src/ui/theme-parser.c2
-rw-r--r--src/ui/theme-private.h6
-rw-r--r--src/ui/theme.c44
4 files changed, 51 insertions, 7 deletions
diff --git a/doc/theme-format.txt b/doc/theme-format.txt
index 0a07ce4b9..fbf5699c8 100644
--- a/doc/theme-format.txt
+++ b/doc/theme-format.txt
@@ -22,6 +22,12 @@ This document has separate sections for each format version. You may
want to read the document in reverse order, since the base features
are discussed under version 1.
+New Features in Theme Format Version 3.3
+========================================
+
+Add two additional button background functions - left_single_background and
+right_single_background - for button groups with just a single button.
+
New Features in Theme Format Version 3.2
========================================
diff --git a/src/ui/theme-parser.c b/src/ui/theme-parser.c
index 42ceeaca8..5456f1c63 100644
--- a/src/ui/theme-parser.c
+++ b/src/ui/theme-parser.c
@@ -38,7 +38,7 @@
* look out for.
*/
#define THEME_MAJOR_VERSION 3
-#define THEME_MINOR_VERSION 2
+#define THEME_MINOR_VERSION 3
#define THEME_VERSION (1000 * THEME_MAJOR_VERSION + THEME_MINOR_VERSION)
#define METACITY_THEME_FILENAME_FORMAT "metacity-theme-%d.xml"
diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h
index b7f05c963..775641a3f 100644
--- a/src/ui/theme-private.h
+++ b/src/ui/theme-private.h
@@ -234,7 +234,7 @@ struct _MetaFrameGeometry
/* used for a memset hack */
#define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
-#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, right_right_background) + sizeof (GdkRectangle) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
+#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, right_single_background) + sizeof (GdkRectangle) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
/* The button rects (if changed adjust memset hack) */
MetaButtonSpace close_rect;
@@ -252,9 +252,11 @@ struct _MetaFrameGeometry
GdkRectangle left_left_background;
GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
GdkRectangle left_right_background;
+ GdkRectangle left_single_background;
GdkRectangle right_left_background;
GdkRectangle right_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
GdkRectangle right_right_background;
+ GdkRectangle right_single_background;
/* End of button rects (if changed adjust memset hack) */
/* Saved button layout */
@@ -647,9 +649,11 @@ typedef enum
META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND,
META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND,
META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND,
+ META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND,
META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND,
META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND,
META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND,
+ META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND,
META_BUTTON_TYPE_CLOSE,
META_BUTTON_TYPE_MAXIMIZE,
META_BUTTON_TYPE_MINIMIZE,
diff --git a/src/ui/theme.c b/src/ui/theme.c
index f688b9589..87ebedecb 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -734,7 +734,9 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
for (i = 0; i < n_left; i++)
{
- if (i == 0) /* prefer left background if only one button */
+ if (n_left == 1)
+ left_bg_rects[i] = &fgeom->left_single_background;
+ else if (i == 0)
left_bg_rects[i] = &fgeom->left_left_background;
else if (i == (n_left - 1))
left_bg_rects[i] = &fgeom->left_right_background;
@@ -744,8 +746,9 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
for (i = 0; i < n_right; i++)
{
- /* prefer right background if only one button */
- if (i == (n_right - 1))
+ if (n_right == 1)
+ right_bg_rects[i] = &fgeom->right_single_background;
+ else if (i == (n_right - 1))
right_bg_rects[i] = &fgeom->right_right_background;
else if (i == 0)
right_bg_rects[i] = &fgeom->right_left_background;
@@ -4260,6 +4263,7 @@ map_button_state (MetaButtonType button_type,
/* Map position buttons to the corresponding function */
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
+ case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
if (fgeom->n_right_buttons > 0)
function = fgeom->button_layout.right_buttons[0];
break;
@@ -4272,6 +4276,7 @@ map_button_state (MetaButtonType button_type,
function = fgeom->button_layout.right_buttons[middle_bg_offset + 1];
break;
case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
+ case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
if (fgeom->n_left_buttons > 0)
function = fgeom->button_layout.left_buttons[0];
break;
@@ -4309,11 +4314,20 @@ get_button (MetaFrameStyle *style,
parent = parent->parent;
}
- /* We fall back to middle button backgrounds if we don't
- * have the ones on the sides
+ /* We fall back to the side buttons if we don't have
+ * single button backgrounds, and to middle button
+ * backgrounds if we don't have the ones on the sides
*/
if (op_list == NULL &&
+ type == META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND)
+ return get_button (style, META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND, state);
+
+ if (op_list == NULL &&
+ type == META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND)
+ return get_button (style, META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND, state);
+
+ if (op_list == NULL &&
(type == META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND ||
type == META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND))
return get_button (style, META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND,
@@ -4387,6 +4401,10 @@ button_rect (MetaButtonType type,
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
*rect = fgeom->left_right_background;
break;
+
+ case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
+ *rect = fgeom->left_single_background;
+ break;
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
*rect = fgeom->right_left_background;
@@ -4399,6 +4417,10 @@ button_rect (MetaButtonType type,
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
*rect = fgeom->right_right_background;
break;
+
+ case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
+ *rect = fgeom->right_single_background;
+ break;
case META_BUTTON_TYPE_CLOSE:
*rect = fgeom->close_rect.visible;
@@ -5873,12 +5895,16 @@ meta_button_type_from_string (const char *str, MetaTheme *theme)
return META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND;
else if (strcmp ("left_right_background", str) == 0)
return META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND;
+ else if (strcmp ("left_single_background", str) == 0)
+ return META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND;
else if (strcmp ("right_left_background", str) == 0)
return META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND;
else if (strcmp ("right_middle_background", str) == 0)
return META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND;
else if (strcmp ("right_right_background", str) == 0)
return META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND;
+ else if (strcmp ("right_single_background", str) == 0)
+ return META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND;
else
return META_BUTTON_TYPE_LAST;
}
@@ -5914,12 +5940,16 @@ meta_button_type_to_string (MetaButtonType type)
return "left_middle_background";
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
return "left_right_background";
+ case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
+ return "left_single_background";
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
return "right_left_background";
case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
return "right_middle_background";
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
return "right_right_background";
+ case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
+ return "right_single_background";
case META_BUTTON_TYPE_LAST:
break;
}
@@ -6793,6 +6823,10 @@ meta_theme_earliest_version_with_button (MetaButtonType type)
case META_BUTTON_TYPE_UNSTICK:
return 2000;
+ case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
+ case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
+ return 3003;
+
default:
meta_warning("Unknown button %d\n", type);
return 1000;