summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--src/theme.c41
-rw-r--r--src/themes/Esco/metacity-theme-1.xml16
3 files changed, 47 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 0fef9bba..8230dbbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2002-10-03 Havoc Pennington <hp@pobox.com>
+ * src/themes/Esco/metacity-theme-1.xml: only specify the
+ middle backgrounds, let left/right fall back to middle
+
+ * src/theme.c (get_button): fall back to middle_background draw
+ routines when missing the left/right button backgrounds.
+ (button_rect): fix to handle drawing middle button backgrounds
+ (meta_frame_style_draw): draw middle background once per middle
+ button
+
+2002-10-03 Havoc Pennington <hp@pobox.com>
+
Button-reordering patch. Has all the code except actually
installing a gconf schema and reading the gconf key in prefs.c.
metacity-theme-viewer displays the button layouts for testing
diff --git a/src/theme.c b/src/theme.c
index dc060735..5ad91368 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -3721,6 +3721,22 @@ get_button (MetaFrameStyle *style,
if (op_list == NULL &&
state == META_BUTTON_STATE_PRELIGHT)
return get_button (style, type, META_BUTTON_STATE_NORMAL);
+
+ /* We fall back to middle button backgrounds if we don't
+ * have the ones on the sides
+ */
+
+ 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,
+ state);
+
+ if (op_list == NULL &&
+ (type == META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND ||
+ type == META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND))
+ return get_button (style, META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND,
+ state);
return op_list;
}
@@ -3766,6 +3782,7 @@ meta_frame_style_validate (MetaFrameStyle *style,
static void
button_rect (MetaButtonType type,
const MetaFrameGeometry *fgeom,
+ int middle_background_offset,
GdkRectangle *rect)
{
switch (type)
@@ -3775,7 +3792,7 @@ button_rect (MetaButtonType type,
break;
case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
- /* FIXME */
+ *rect = fgeom->left_middle_backgrounds[middle_background_offset];
break;
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
@@ -3787,7 +3804,7 @@ button_rect (MetaButtonType type,
break;
case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
- /* FIXME */
+ *rect = fgeom->right_middle_backgrounds[middle_background_offset];
break;
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
@@ -4001,10 +4018,13 @@ meta_frame_style_draw (MetaFrameStyle *style,
/* Draw buttons just before overlay */
if ((i + 1) == META_FRAME_PIECE_OVERLAY)
{
+ int middle_bg_offset;
+
+ middle_bg_offset = 0;
j = 0;
while (j < META_BUTTON_TYPE_LAST)
{
- button_rect (j, fgeom, &rect);
+ button_rect (j, fgeom, middle_bg_offset, &rect);
rect.x += x_offset;
rect.y += y_offset;
@@ -4030,8 +4050,19 @@ meta_frame_style_draw (MetaFrameStyle *style,
&draw_info,
rect.x, rect.y, rect.width, rect.height);
}
-
- ++j;
+
+ /* MIDDLE_BACKGROUND type may get drawn more than once */
+ if ((j == META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND ||
+ j == META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND) &&
+ middle_bg_offset < MAX_MIDDLE_BACKGROUNDS)
+ {
+ ++middle_bg_offset;
+ }
+ else
+ {
+ middle_bg_offset = 0;
+ ++j;
+ }
}
}
diff --git a/src/themes/Esco/metacity-theme-1.xml b/src/themes/Esco/metacity-theme-1.xml
index 87ff8a70..11047df1 100644
--- a/src/themes/Esco/metacity-theme-1.xml
+++ b/src/themes/Esco/metacity-theme-1.xml
@@ -467,18 +467,10 @@
<!-- we don't specify for normal or prelight, so nothing is used for
those -->
- <button function="left_left_background" state="pressed"
- draw_ops="button_pressed_bg"/>
<button function="left_middle_background" state="pressed"
draw_ops="button_pressed_bg"/>
- <button function="left_right_background" state="pressed"
- draw_ops="button_pressed_bg"/>
- <button function="right_left_background" state="pressed"
- draw_ops="button_pressed_bg"/>
<button function="right_middle_background" state="pressed"
draw_ops="button_pressed_bg"/>
- <button function="right_right_background" state="pressed"
- draw_ops="button_pressed_bg"/>
<button function="menu" state="normal"
draw_ops="menu_button"/>
@@ -506,18 +498,10 @@
<piece position="title" draw_ops="title_focused"/>
<!-- we don't specify for prelight, so normal is used -->
- <button function="left_left_background" state="normal"
- draw_ops="button_normal_bg"/>
<button function="left_middle_background" state="normal"
draw_ops="button_normal_bg"/>
- <button function="left_right_background" state="normal"
- draw_ops="button_normal_bg"/>
- <button function="right_left_background" state="normal"
- draw_ops="button_normal_bg"/>
<button function="right_middle_background" state="normal"
draw_ops="button_normal_bg"/>
- <button function="right_right_background" state="normal"
- draw_ops="button_normal_bg"/>
<button function="close" state="normal" draw_ops="close_button_focused"/>
<button function="menu" state="normal" draw_ops="menu_button_focused"/>