only specify the middle backgrounds, let left/right fall back to middle

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
This commit is contained in:
Havoc Pennington 2002-10-04 02:59:07 +00:00 committed by Havoc Pennington
parent 7641c6f952
commit 7b0cd87838
3 changed files with 47 additions and 21 deletions

View File

@ -1,3 +1,14 @@
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

View File

@ -3722,6 +3722,22 @@ get_button (MetaFrameStyle *style,
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;
@ -4031,9 +4051,20 @@ meta_frame_style_draw (MetaFrameStyle *style,
rect.x, rect.y, rect.width, rect.height);
}
/* 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;
}
}
}
++i;
}

View File

@ -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"/>