summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-06-03 03:00:34 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-06-03 03:00:34 +0300
commit430f8f962efe2927df2afde5988f5745b278e95f (patch)
tree511dd92135d95fa103179ec0f50bb83ed8c16764
parent2c2aed8e1a66a875312432f82f8dcbdd71b865cd (diff)
downloadmetacity-430f8f962efe2927df2afde5988f5745b278e95f.tar.gz
libmetacity: add composited to MetaThemeImpl
-rw-r--r--libmetacity/meta-theme-gtk.c9
-rw-r--r--libmetacity/meta-theme-impl-private.h41
-rw-r--r--libmetacity/meta-theme-impl.c23
-rw-r--r--libmetacity/meta-theme-metacity.c7
-rw-r--r--libmetacity/meta-theme.c61
5 files changed, 72 insertions, 69 deletions
diff --git a/libmetacity/meta-theme-gtk.c b/libmetacity/meta-theme-gtk.c
index f4ff47ef..af951fea 100644
--- a/libmetacity/meta-theme-gtk.c
+++ b/libmetacity/meta-theme-gtk.c
@@ -208,16 +208,17 @@ static void
meta_theme_gtk_get_frame_borders (MetaThemeImpl *impl,
MetaFrameLayout *layout,
MetaStyleInfo *style_info,
- gboolean composited,
gint text_height,
MetaFrameFlags flags,
MetaFrameType type,
MetaFrameBorders *borders)
{
+ gboolean composited;
gint buttons_height;
gint content_height;
gint scale;
+ composited = meta_theme_impl_get_composited (impl);
frame_layout_sync_with_style (layout, style_info, composited, flags);
meta_frame_borders_clear (borders);
@@ -401,7 +402,6 @@ static void
meta_theme_gtk_calc_geometry (MetaThemeImpl *impl,
MetaFrameLayout *layout,
MetaStyleInfo *style_info,
- gboolean composited,
gint text_height,
MetaFrameFlags flags,
gint client_width,
@@ -430,9 +430,8 @@ meta_theme_gtk_calc_geometry (MetaThemeImpl *impl,
gboolean right_buttons_has_spacer[META_BUTTON_FUNCTION_LAST];
META_THEME_IMPL_GET_CLASS (impl)->get_frame_borders (impl, layout,
- style_info, composited,
- text_height, flags,
- type, &borders);
+ style_info, text_height,
+ flags, type, &borders);
fgeom->borders = borders;
diff --git a/libmetacity/meta-theme-impl-private.h b/libmetacity/meta-theme-impl-private.h
index 1ec87b4c..0ee88f3c 100644
--- a/libmetacity/meta-theme-impl-private.h
+++ b/libmetacity/meta-theme-impl-private.h
@@ -43,7 +43,6 @@ struct _MetaThemeImplClass
void (* get_frame_borders) (MetaThemeImpl *impl,
MetaFrameLayout *layout,
MetaStyleInfo *style_info,
- gboolean composited,
gint text_height,
MetaFrameFlags flags,
MetaFrameType type,
@@ -52,7 +51,6 @@ struct _MetaThemeImplClass
void (* calc_geometry) (MetaThemeImpl *impl,
MetaFrameLayout *layout,
MetaStyleInfo *style_info,
- gboolean composited,
gint text_height,
MetaFrameFlags flags,
gint client_width,
@@ -74,32 +72,39 @@ struct _MetaThemeImplClass
};
G_GNUC_INTERNAL
-void meta_theme_impl_add_style_set (MetaThemeImpl *impl,
- MetaFrameType type,
- MetaFrameStyleSet *style_set);
+void meta_theme_impl_set_composited (MetaThemeImpl *impl,
+ gboolean composited);
G_GNUC_INTERNAL
-MetaFrameStyleSet *meta_theme_impl_get_style_set (MetaThemeImpl *impl,
- MetaFrameType type);
+gboolean meta_theme_impl_get_composited (MetaThemeImpl *impl);
G_GNUC_INTERNAL
-void get_button_rect (MetaButtonType type,
- const MetaFrameGeometry *fgeom,
- gint middle_background_offset,
- GdkRectangle *rect);
+void meta_theme_impl_add_style_set (MetaThemeImpl *impl,
+ MetaFrameType type,
+ MetaFrameStyleSet *style_set);
G_GNUC_INTERNAL
-MetaButtonState map_button_state (MetaButtonType button_type,
- const MetaFrameGeometry *fgeom,
- gint middle_bg_offset,
- MetaButtonState button_states[META_BUTTON_TYPE_LAST]);
+MetaFrameStyleSet *meta_theme_impl_get_style_set (MetaThemeImpl *impl,
+ MetaFrameType type);
G_GNUC_INTERNAL
-void scale_border (GtkBorder *border,
- double factor);
+void get_button_rect (MetaButtonType type,
+ const MetaFrameGeometry *fgeom,
+ gint middle_background_offset,
+ GdkRectangle *rect);
G_GNUC_INTERNAL
-int get_window_scaling_factor (void);
+MetaButtonState map_button_state (MetaButtonType button_type,
+ const MetaFrameGeometry *fgeom,
+ gint middle_bg_offset,
+ MetaButtonState button_states[META_BUTTON_TYPE_LAST]);
+
+G_GNUC_INTERNAL
+void scale_border (GtkBorder *border,
+ double factor);
+
+G_GNUC_INTERNAL
+int get_window_scaling_factor (void);
G_END_DECLS
diff --git a/libmetacity/meta-theme-impl.c b/libmetacity/meta-theme-impl.c
index 1002adfc..64a8f796 100644
--- a/libmetacity/meta-theme-impl.c
+++ b/libmetacity/meta-theme-impl.c
@@ -25,6 +25,8 @@
typedef struct
{
+ gboolean composited;
+
MetaFrameStyleSet *style_sets_by_type[META_FRAME_TYPE_LAST];
} MetaThemeImplPrivate;
@@ -120,6 +122,27 @@ meta_theme_impl_init (MetaThemeImpl *impl)
}
void
+meta_theme_impl_set_composited (MetaThemeImpl *impl,
+ gboolean composited)
+{
+ MetaThemeImplPrivate *priv;
+
+ priv = meta_theme_impl_get_instance_private (impl);
+
+ priv->composited = composited;
+}
+
+gboolean
+meta_theme_impl_get_composited (MetaThemeImpl *impl)
+{
+ MetaThemeImplPrivate *priv;
+
+ priv = meta_theme_impl_get_instance_private (impl);
+
+ return priv->composited;
+}
+
+void
meta_theme_impl_add_style_set (MetaThemeImpl *impl,
MetaFrameType type,
MetaFrameStyleSet *style_set)
diff --git a/libmetacity/meta-theme-metacity.c b/libmetacity/meta-theme-metacity.c
index 35c3791f..533bd371 100644
--- a/libmetacity/meta-theme-metacity.c
+++ b/libmetacity/meta-theme-metacity.c
@@ -4603,7 +4603,6 @@ static void
meta_theme_metacity_get_frame_borders (MetaThemeImpl *impl,
MetaFrameLayout *layout,
MetaStyleInfo *style_info,
- gboolean composited,
gint text_height,
MetaFrameFlags flags,
MetaFrameType type,
@@ -4815,7 +4814,6 @@ static void
meta_theme_metacity_calc_geometry (MetaThemeImpl *impl,
MetaFrameLayout *layout,
MetaStyleInfo *style_info,
- gboolean composited,
gint text_height,
MetaFrameFlags flags,
gint client_width,
@@ -4846,9 +4844,8 @@ meta_theme_metacity_calc_geometry (MetaThemeImpl *impl,
gboolean right_buttons_has_spacer[META_BUTTON_FUNCTION_LAST];
META_THEME_IMPL_GET_CLASS (impl)->get_frame_borders (impl, layout,
- style_info, composited,
- text_height, flags,
- type, &borders);
+ style_info, text_height,
+ flags, type, &borders);
fgeom->borders = borders;
diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c
index 61f3c3e7..2be6fb48 100644
--- a/libmetacity/meta-theme.c
+++ b/libmetacity/meta-theme.c
@@ -98,6 +98,8 @@ meta_theme_constructed (GObject *object)
theme->impl = g_object_new (META_TYPE_THEME_METACITY, NULL);
else
g_assert_not_reached ();
+
+ meta_theme_impl_set_composited (theme->impl, theme->composited);
}
static void
@@ -252,6 +254,7 @@ meta_theme_set_composited (MetaTheme *theme,
theme->composited = composited;
+ meta_theme_impl_set_composited (theme->impl, composited);
meta_theme_invalidate (theme);
}
@@ -436,6 +439,7 @@ meta_theme_get_frame_borders (MetaTheme *theme,
{
MetaFrameStyle *style;
MetaStyleInfo *style_info;
+ MetaThemeImplClass *impl_class;
g_return_if_fail (type < META_FRAME_TYPE_LAST);
@@ -448,15 +452,10 @@ meta_theme_get_frame_borders (MetaTheme *theme,
return;
style_info = meta_theme_get_style_info (theme, theme_variant);
+ impl_class = META_THEME_IMPL_GET_CLASS (theme->impl);
- META_THEME_IMPL_GET_CLASS (theme->impl)->get_frame_borders (theme->impl,
- style->layout,
- style_info,
- theme->composited,
- text_height,
- flags,
- type,
- borders);
+ impl_class->get_frame_borders (theme->impl, style->layout, style_info,
+ text_height, flags, type, borders);
}
void
@@ -472,6 +471,7 @@ meta_theme_calc_geometry (MetaTheme *theme,
{
MetaFrameStyle *style;
MetaStyleInfo *style_info;
+ MetaThemeImplClass *impl_class;
g_return_if_fail (type < META_FRAME_TYPE_LAST);
@@ -482,18 +482,11 @@ meta_theme_calc_geometry (MetaTheme *theme,
return;
style_info = meta_theme_get_style_info (theme, theme_variant);
+ impl_class = META_THEME_IMPL_GET_CLASS (theme->impl);
- META_THEME_IMPL_GET_CLASS (theme->impl)->calc_geometry (theme->impl,
- style->layout,
- style_info,
- theme->composited,
- text_height,
- flags,
- client_width,
- client_height,
- button_layout,
- type,
- fgeom);
+ impl_class->calc_geometry (theme->impl, style->layout, style_info,
+ text_height, flags, client_width, client_height,
+ button_layout, type, fgeom);
}
void
@@ -513,6 +506,7 @@ meta_theme_draw_frame (MetaTheme *theme,
{
MetaFrameStyle *style;
MetaStyleInfo *style_info;
+ MetaThemeImplClass *impl_class;
MetaFrameGeometry fgeom;
g_return_if_fail (type < META_FRAME_TYPE_LAST);
@@ -524,27 +518,12 @@ meta_theme_draw_frame (MetaTheme *theme,
return;
style_info = meta_theme_get_style_info (theme, theme_variant);
+ impl_class = META_THEME_IMPL_GET_CLASS (theme->impl);
+
+ impl_class->calc_geometry (theme->impl, style->layout, style_info,
+ text_height, flags, client_width, client_height,
+ button_layout, type, &fgeom);
- META_THEME_IMPL_GET_CLASS (theme->impl)->calc_geometry (theme->impl,
- style->layout,
- style_info,
- theme->composited,
- text_height,
- flags,
- client_width,
- client_height,
- button_layout,
- type,
- &fgeom);
-
- META_THEME_IMPL_GET_CLASS (theme->impl)->draw_frame (theme->impl,
- style,
- style_info,
- cr,
- &fgeom,
- title_layout,
- flags,
- button_states,
- mini_icon,
- icon);
+ impl_class->draw_frame (theme->impl, style, style_info, cr, &fgeom,
+ title_layout, flags, button_states, mini_icon, icon);
}