diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h index 141e0a792..bc49bd0e4 100644 --- a/src/ui/theme-private.h +++ b/src/ui/theme-private.h @@ -247,16 +247,14 @@ struct _MetaFrameStyle /* Kinds of frame... * - * normal -> noresize / vert only / horz only / both - * focused / unfocused + * normal -> focused / unfocused * max -> focused / unfocused * shaded -> focused / unfocused * max/shaded -> focused / unfocused * - * so 4 states with 8 sub-states in one, 2 sub-states in the other 3, - * meaning 14 total + * so 4 states with 2 sub-states each, meaning 8 total * - * 14 window states times 7 or 8 window types. Except some + * 8 window states times 7 or 8 window types. Except some * window types never get a frame so that narrows it down a bit. * */ @@ -273,15 +271,6 @@ typedef enum META_FRAME_STATE_LAST } MetaFrameState; -typedef enum -{ - META_FRAME_RESIZE_NONE, - META_FRAME_RESIZE_VERTICAL, - META_FRAME_RESIZE_HORIZONTAL, - META_FRAME_RESIZE_BOTH, - META_FRAME_RESIZE_LAST -} MetaFrameResize; - typedef enum { META_FRAME_FOCUS_NO, @@ -291,8 +280,7 @@ typedef enum /** * How to draw frames at different times: when it's maximised or not, shaded - * or not, when it's focussed or not, and (for non-maximised windows), when - * it can be horizontally or vertically resized, both, or neither. + * or not, tiled or not, and when it's focussed or not. * Not all window types actually get a frame. * * A theme contains one of these objects for each type of window (each @@ -304,11 +292,11 @@ struct _MetaFrameStyleSet { int refcount; MetaFrameStyleSet *parent; - MetaFrameStyle *normal_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST]; + MetaFrameStyle *normal_styles[META_FRAME_FOCUS_LAST]; MetaFrameStyle *maximized_styles[META_FRAME_FOCUS_LAST]; MetaFrameStyle *tiled_left_styles[META_FRAME_FOCUS_LAST]; MetaFrameStyle *tiled_right_styles[META_FRAME_FOCUS_LAST]; - MetaFrameStyle *shaded_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST]; + MetaFrameStyle *shaded_styles[META_FRAME_FOCUS_LAST]; MetaFrameStyle *maximized_and_shaded_styles[META_FRAME_FOCUS_LAST]; MetaFrameStyle *tiled_left_and_shaded_styles[META_FRAME_FOCUS_LAST]; MetaFrameStyle *tiled_right_and_shaded_styles[META_FRAME_FOCUS_LAST]; diff --git a/src/ui/theme.c b/src/ui/theme.c index 74203b4bc..934e90975 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -995,14 +995,8 @@ meta_frame_style_set_unref (MetaFrameStyleSet *style_set) if (style_set->refcount == 0) { - int i; - - for (i = 0; i < META_FRAME_RESIZE_LAST; i++) - { - free_focus_styles (style_set->normal_styles[i]); - free_focus_styles (style_set->shaded_styles[i]); - } - + free_focus_styles (style_set->normal_styles); + free_focus_styles (style_set->shaded_styles); free_focus_styles (style_set->maximized_styles); free_focus_styles (style_set->tiled_left_styles); free_focus_styles (style_set->tiled_right_styles); @@ -1022,88 +1016,44 @@ meta_frame_style_set_unref (MetaFrameStyleSet *style_set) static MetaFrameStyle* get_style (MetaFrameStyleSet *style_set, MetaFrameState state, - MetaFrameResize resize, MetaFrameFocus focus) { - MetaFrameStyle *style; + MetaFrameStyle **styles; - style = NULL; + styles = NULL; switch (state) { case META_FRAME_STATE_NORMAL: - case META_FRAME_STATE_SHADED: - { - if (state == META_FRAME_STATE_SHADED) - style = style_set->shaded_styles[resize][focus]; - else - style = style_set->normal_styles[resize][focus]; - - /* Try parent if we failed here */ - if (style == NULL && style_set->parent) - style = get_style (style_set->parent, state, resize, focus); - - /* Allow people to omit the vert/horz/none resize modes */ - if (style == NULL && - resize != META_FRAME_RESIZE_BOTH) - style = get_style (style_set, state, META_FRAME_RESIZE_BOTH, focus); - } + styles = style_set->normal_styles; + break; + case META_FRAME_STATE_MAXIMIZED: + styles = style_set->maximized_styles; + break; + case META_FRAME_STATE_TILED_LEFT: + styles = style_set->tiled_left_styles; + break; + case META_FRAME_STATE_TILED_RIGHT: + styles = style_set->tiled_right_styles; + break; + case META_FRAME_STATE_SHADED: + styles = style_set->shaded_styles; + break; + case META_FRAME_STATE_MAXIMIZED_AND_SHADED: + styles = style_set->maximized_and_shaded_styles; + break; + case META_FRAME_STATE_TILED_LEFT_AND_SHADED: + styles = style_set->tiled_left_and_shaded_styles; + break; + case META_FRAME_STATE_TILED_RIGHT_AND_SHADED: + styles = style_set->tiled_right_and_shaded_styles; + break; + case META_FRAME_STATE_LAST: + g_assert_not_reached (); break; - default: - { - MetaFrameStyle **styles; - - styles = NULL; - - switch (state) - { - case META_FRAME_STATE_MAXIMIZED: - styles = style_set->maximized_styles; - break; - case META_FRAME_STATE_TILED_LEFT: - styles = style_set->tiled_left_styles; - break; - case META_FRAME_STATE_TILED_RIGHT: - styles = style_set->tiled_right_styles; - break; - case META_FRAME_STATE_MAXIMIZED_AND_SHADED: - styles = style_set->maximized_and_shaded_styles; - break; - case META_FRAME_STATE_TILED_LEFT_AND_SHADED: - styles = style_set->tiled_left_and_shaded_styles; - break; - case META_FRAME_STATE_TILED_RIGHT_AND_SHADED: - styles = style_set->tiled_right_and_shaded_styles; - break; - case META_FRAME_STATE_NORMAL: - case META_FRAME_STATE_SHADED: - case META_FRAME_STATE_LAST: - g_assert_not_reached (); - break; - } - - style = styles[focus]; - - /* Tiled states are optional, try falling back to non-tiled states */ - if (style == NULL) - { - if (state == META_FRAME_STATE_TILED_LEFT || - state == META_FRAME_STATE_TILED_RIGHT) - style = get_style (style_set, META_FRAME_STATE_NORMAL, - resize, focus); - else if (state == META_FRAME_STATE_TILED_LEFT_AND_SHADED || - state == META_FRAME_STATE_TILED_RIGHT_AND_SHADED) - style = get_style (style_set, META_FRAME_STATE_SHADED, - resize, focus); - } - - /* Try parent if we failed here */ - if (style == NULL && style_set->parent) - style = get_style (style_set->parent, state, resize, focus); - } } - return style; + return styles[focus]; } /** @@ -1114,7 +1064,7 @@ MetaTheme* meta_theme_get_default (void) { static MetaTheme *theme = NULL; - int i, j, frame_type; + int i, frame_type; if (theme) return theme; @@ -1151,14 +1101,11 @@ meta_theme_get_default (void) for (i = 0; i < META_FRAME_FOCUS_LAST; i++) { - for (j = 0; j < META_FRAME_RESIZE_LAST; j++) - { - meta_frame_style_ref (style); - style_set->normal_styles[j][i] = style; + meta_frame_style_ref (style); + style_set->normal_styles[i] = style; - meta_frame_style_ref (style); - style_set->shaded_styles[j][i] = style; - } + meta_frame_style_ref (style); + style_set->shaded_styles[i] = style; meta_frame_style_ref (style); style_set->maximized_styles[i] = style; @@ -1217,9 +1164,7 @@ theme_get_style (MetaTheme *theme, MetaFrameFlags flags) { MetaFrameState state; - MetaFrameResize resize; MetaFrameFocus focus; - MetaFrameStyle *style; MetaFrameStyleSet *style_set; style_set = theme->style_sets_by_type[type]; @@ -1257,26 +1202,6 @@ theme_get_style (MetaTheme *theme, break; } - switch (flags & (META_FRAME_ALLOWS_VERTICAL_RESIZE | META_FRAME_ALLOWS_HORIZONTAL_RESIZE)) - { - case 0: - resize = META_FRAME_RESIZE_NONE; - break; - case META_FRAME_ALLOWS_VERTICAL_RESIZE: - resize = META_FRAME_RESIZE_VERTICAL; - break; - case META_FRAME_ALLOWS_HORIZONTAL_RESIZE: - resize = META_FRAME_RESIZE_HORIZONTAL; - break; - case (META_FRAME_ALLOWS_VERTICAL_RESIZE | META_FRAME_ALLOWS_HORIZONTAL_RESIZE): - resize = META_FRAME_RESIZE_BOTH; - break; - default: - g_assert_not_reached (); - resize = META_FRAME_RESIZE_LAST; /* compiler */ - break; - } - /* re invert the styles used for focus/unfocussed while flashing a frame */ if (((flags & META_FRAME_HAS_FOCUS) && !(flags & META_FRAME_IS_FLASHING)) || (!(flags & META_FRAME_HAS_FOCUS) && (flags & META_FRAME_IS_FLASHING))) @@ -1284,9 +1209,7 @@ theme_get_style (MetaTheme *theme, else focus = META_FRAME_FOCUS_NO; - style = get_style (style_set, state, resize, focus); - - return style; + return get_style (style_set, state, focus); } MetaFrameStyle*