summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas James Alexander Thurman <tthurman@src.gnome.org>2006-05-26 18:10:02 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2006-05-26 18:10:02 +0000
commit3a8b54310e292efbbab1c2172b8d67755d432b25 (patch)
tree6b38f389f60bb0670d214108d98862105eb9b796
parentc62ed35d7552116451328b62a0cdf3a831070ce6 (diff)
downloadmetacity-3a8b54310e292efbbab1c2172b8d67755d432b25.tar.gz
#114304: New style for shaded, non-resizable windows
-rw-r--r--src/theme-parser.c55
-rw-r--r--src/theme.c81
-rw-r--r--src/theme.h3
-rw-r--r--src/ui.c3
4 files changed, 94 insertions, 48 deletions
diff --git a/src/theme-parser.c b/src/theme-parser.c
index aa299e71..ea45f9a2 100644
--- a/src/theme-parser.c
+++ b/src/theme-parser.c
@@ -3525,8 +3525,9 @@ parse_style_set_element (GMarkupParseContext *context,
return;
}
- if (frame_state == META_FRAME_STATE_NORMAL)
+ switch (frame_state)
{
+ case META_FRAME_STATE_NORMAL:
if (resize == NULL)
{
set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
@@ -3535,7 +3536,6 @@ parse_style_set_element (GMarkupParseContext *context,
return;
}
-
frame_resize = meta_frame_resize_from_string (resize);
if (frame_resize == META_FRAME_RESIZE_LAST)
{
@@ -3544,13 +3544,48 @@ parse_style_set_element (GMarkupParseContext *context,
focus);
return;
}
- }
- else
- {
+
+ break;
+
+ case META_FRAME_STATE_SHADED:
+ if (META_THEME_ALLOWS (info->theme, META_THEME_UNRESIZABLE_SHADED_STYLES))
+ {
+ if (resize == NULL)
+ {
+ set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
+ _("No \"resize\" attribute on <%s> element"),
+ element_name);
+ return;
+ }
+
+ frame_resize = meta_frame_resize_from_string (resize);
+ if (frame_resize == META_FRAME_RESIZE_LAST)
+ {
+ set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
+ _("\"%s\" is not a valid value for resize attribute"),
+ focus);
+ return;
+ }
+ }
+ else
+ {
+ if (resize != NULL)
+ {
+ set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
+ _("Should not have \"resize\" attribute on <%s> element for maximized/shaded states"),
+ element_name);
+ return;
+ }
+
+ frame_resize = META_FRAME_RESIZE_BOTH;
+ }
+ break;
+
+ default:
if (resize != NULL)
{
set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
- _("Should not have \"resize\" attribute on <%s> element for maximized/shaded states"),
+ _("Should not have \"resize\" attribute on <%s> element for maximized states"),
element_name);
return;
}
@@ -3583,15 +3618,15 @@ parse_style_set_element (GMarkupParseContext *context,
info->style_set->maximized_styles[frame_focus] = frame_style;
break;
case META_FRAME_STATE_SHADED:
- if (info->style_set->shaded_styles[frame_focus])
+ if (info->style_set->shaded_styles[frame_resize][frame_focus])
{
set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
- _("Style has already been specified for state %s focus %s"),
- state, focus);
+ _("Style has already been specified for state %s resize %s focus %s"),
+ state, resize, focus);
return;
}
meta_frame_style_ref (frame_style);
- info->style_set->shaded_styles[frame_focus] = frame_style;
+ info->style_set->shaded_styles[frame_resize][frame_focus] = frame_style;
break;
case META_FRAME_STATE_MAXIMIZED_AND_SHADED:
if (info->style_set->maximized_and_shaded_styles[frame_focus])
diff --git a/src/theme.c b/src/theme.c
index aa38bf96..0a679fde 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -4178,6 +4178,7 @@ meta_frame_style_draw (MetaFrameStyle *style,
if (op_list)
{
MetaRectangle m_rect;
+
m_rect = meta_rect (rect.x, rect.y,
rect.width, rect.height);
meta_draw_op_list_draw (op_list,
@@ -4255,10 +4256,12 @@ meta_frame_style_set_unref (MetaFrameStyleSet *style_set)
int i;
for (i = 0; i < META_FRAME_RESIZE_LAST; i++)
- free_focus_styles (style_set->normal_styles[i]);
+ {
+ free_focus_styles (style_set->normal_styles[i]);
+ free_focus_styles (style_set->shaded_styles[i]);
+ }
free_focus_styles (style_set->maximized_styles);
- free_focus_styles (style_set->shaded_styles);
free_focus_styles (style_set->maximized_and_shaded_styles);
if (style_set->parent)
@@ -4280,47 +4283,53 @@ get_style (MetaFrameStyleSet *style_set,
style = NULL;
- if (state == META_FRAME_STATE_NORMAL)
+ switch (state)
{
- style = style_set->normal_styles[resize][focus];
+ 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);
+ /* 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);
- }
- else
- {
- MetaFrameStyle **styles;
+ /* 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);
+ }
+ break;
+ default:
+ {
+ MetaFrameStyle **styles;
- styles = NULL;
+ styles = NULL;
- switch (state)
- {
- case META_FRAME_STATE_SHADED:
- styles = style_set->shaded_styles;
- break;
- case META_FRAME_STATE_MAXIMIZED:
- styles = style_set->maximized_styles;
- break;
- case META_FRAME_STATE_MAXIMIZED_AND_SHADED:
- styles = style_set->maximized_and_shaded_styles;
- break;
- case META_FRAME_STATE_NORMAL:
- case META_FRAME_STATE_LAST:
- g_assert_not_reached ();
- break;
- }
+ switch (state)
+ {
+ case META_FRAME_STATE_MAXIMIZED:
+ styles = style_set->maximized_styles;
+ break;
+ case META_FRAME_STATE_MAXIMIZED_AND_SHADED:
+ styles = style_set->maximized_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];
+ style = styles[focus];
- /* Try parent if we failed here */
- if (style == NULL && style_set->parent)
- style = get_style (style_set->parent, state, 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;
diff --git a/src/theme.h b/src/theme.h
index 32f31f0e..ab734688 100644
--- a/src/theme.h
+++ b/src/theme.h
@@ -550,7 +550,7 @@ struct _MetaFrameStyleSet
MetaFrameStyleSet *parent;
MetaFrameStyle *normal_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
MetaFrameStyle *maximized_styles[META_FRAME_FOCUS_LAST];
- MetaFrameStyle *shaded_styles[META_FRAME_FOCUS_LAST];
+ MetaFrameStyle *shaded_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
MetaFrameStyle *maximized_and_shaded_styles[META_FRAME_FOCUS_LAST];
};
@@ -862,5 +862,6 @@ guint meta_theme_earliest_version_with_button (MetaButtonType type);
#define META_THEME_UBIQUITOUS_CONSTANTS 2
#define META_THEME_VARIED_ROUND_CORNERS 2
#define META_THEME_IMAGES_FROM_ICON_THEMES 2
+#define META_THEME_UNRESIZABLE_SHADED_STYLES 2
#endif
diff --git a/src/ui.c b/src/ui.c
index 4f01ef52..5b5a5d6d 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -87,7 +87,8 @@ filter_func (GdkXEvent *xevent,
return GDK_FILTER_REMOVE;
else
{
- ef->last_event_serial = ((XEvent*)xevent)->xany.serial;
+ if (ef)
+ ef->last_event_serial = ((XEvent*)xevent)->xany.serial;
return GDK_FILTER_CONTINUE;
}
}