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> 2002-10-03 Havoc Pennington <hp@pobox.com>
Button-reordering patch. Has all the code except actually Button-reordering patch. Has all the code except actually

View File

@ -3721,6 +3721,22 @@ get_button (MetaFrameStyle *style,
if (op_list == NULL && if (op_list == NULL &&
state == META_BUTTON_STATE_PRELIGHT) state == META_BUTTON_STATE_PRELIGHT)
return get_button (style, type, META_BUTTON_STATE_NORMAL); 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; return op_list;
} }
@ -3766,6 +3782,7 @@ meta_frame_style_validate (MetaFrameStyle *style,
static void static void
button_rect (MetaButtonType type, button_rect (MetaButtonType type,
const MetaFrameGeometry *fgeom, const MetaFrameGeometry *fgeom,
int middle_background_offset,
GdkRectangle *rect) GdkRectangle *rect)
{ {
switch (type) switch (type)
@ -3775,7 +3792,7 @@ button_rect (MetaButtonType type,
break; break;
case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND: case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
/* FIXME */ *rect = fgeom->left_middle_backgrounds[middle_background_offset];
break; break;
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND: case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
@ -3787,7 +3804,7 @@ button_rect (MetaButtonType type,
break; break;
case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND: case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
/* FIXME */ *rect = fgeom->right_middle_backgrounds[middle_background_offset];
break; break;
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND: case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
@ -4001,10 +4018,13 @@ meta_frame_style_draw (MetaFrameStyle *style,
/* Draw buttons just before overlay */ /* Draw buttons just before overlay */
if ((i + 1) == META_FRAME_PIECE_OVERLAY) if ((i + 1) == META_FRAME_PIECE_OVERLAY)
{ {
int middle_bg_offset;
middle_bg_offset = 0;
j = 0; j = 0;
while (j < META_BUTTON_TYPE_LAST) while (j < META_BUTTON_TYPE_LAST)
{ {
button_rect (j, fgeom, &rect); button_rect (j, fgeom, middle_bg_offset, &rect);
rect.x += x_offset; rect.x += x_offset;
rect.y += y_offset; rect.y += y_offset;
@ -4030,8 +4050,19 @@ meta_frame_style_draw (MetaFrameStyle *style,
&draw_info, &draw_info,
rect.x, rect.y, rect.width, rect.height); 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;
}
} }
} }

View File

@ -467,18 +467,10 @@
<!-- we don't specify for normal or prelight, so nothing is used for <!-- we don't specify for normal or prelight, so nothing is used for
those --> those -->
<button function="left_left_background" state="pressed"
draw_ops="button_pressed_bg"/>
<button function="left_middle_background" state="pressed" <button function="left_middle_background" state="pressed"
draw_ops="button_pressed_bg"/> 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" <button function="right_middle_background" state="pressed"
draw_ops="button_pressed_bg"/> draw_ops="button_pressed_bg"/>
<button function="right_right_background" state="pressed"
draw_ops="button_pressed_bg"/>
<button function="menu" state="normal" <button function="menu" state="normal"
draw_ops="menu_button"/> draw_ops="menu_button"/>
@ -506,18 +498,10 @@
<piece position="title" draw_ops="title_focused"/> <piece position="title" draw_ops="title_focused"/>
<!-- we don't specify for prelight, so normal is used --> <!-- 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" <button function="left_middle_background" state="normal"
draw_ops="button_normal_bg"/> 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" <button function="right_middle_background" state="normal"
draw_ops="button_normal_bg"/> 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="close" state="normal" draw_ops="close_button_focused"/>
<button function="menu" state="normal" draw_ops="menu_button_focused"/> <button function="menu" state="normal" draw_ops="menu_button_focused"/>