diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2017-03-04 15:27:54 +0200 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2017-03-04 15:27:54 +0200 |
commit | 518e7f2c426b7c13ba1062b43c284d7c45a5fde8 (patch) | |
tree | 138af0b286c5903064fb7c82f9ad73c55a54811b /libmetacity | |
parent | 77348e85b96b78ef330223309fdfbab94de9cf4c (diff) | |
download | metacity-518e7f2c426b7c13ba1062b43c284d7c45a5fde8.tar.gz |
libmetacity: do not reload CSS changing composited status
Diffstat (limited to 'libmetacity')
-rw-r--r-- | libmetacity/meta-style-info-private.h | 20 | ||||
-rw-r--r-- | libmetacity/meta-style-info.c | 30 | ||||
-rw-r--r-- | libmetacity/meta-theme.c | 19 |
3 files changed, 60 insertions, 9 deletions
diff --git a/libmetacity/meta-style-info-private.h b/libmetacity/meta-style-info-private.h index 9b764720..70d61fa3 100644 --- a/libmetacity/meta-style-info-private.h +++ b/libmetacity/meta-style-info-private.h @@ -38,18 +38,22 @@ G_GNUC_INTERNAL G_DECLARE_FINAL_TYPE (MetaStyleInfo, meta_style_info, META, STYLE_INFO, GObject) G_GNUC_INTERNAL -MetaStyleInfo *meta_style_info_new (const gchar *gtk_theme_name, - const gchar *gtk_theme_variant, - gboolean composited, - gint window_scale); +MetaStyleInfo *meta_style_info_new (const gchar *gtk_theme_name, + const gchar *gtk_theme_variant, + gboolean composited, + gint window_scale); G_GNUC_INTERNAL -GtkStyleContext *meta_style_info_get_style (MetaStyleInfo *style_info, - MetaStyleElement element); +GtkStyleContext *meta_style_info_get_style (MetaStyleInfo *style_info, + MetaStyleElement element); G_GNUC_INTERNAL -void meta_style_info_set_flags (MetaStyleInfo *style_info, - MetaFrameFlags flags); +void meta_style_info_set_composited (MetaStyleInfo *style_info, + gboolean composited); + +G_GNUC_INTERNAL +void meta_style_info_set_flags (MetaStyleInfo *style_info, + MetaFrameFlags flags); G_END_DECLS diff --git a/libmetacity/meta-style-info.c b/libmetacity/meta-style-info.c index f1558907..a6d90992 100644 --- a/libmetacity/meta-style-info.c +++ b/libmetacity/meta-style-info.c @@ -341,6 +341,36 @@ meta_style_info_get_style (MetaStyleInfo *style_info, } void +meta_style_info_set_composited (MetaStyleInfo *style_info, + gboolean composited) +{ + gint i; + + if (style_info->composited == composited) + return; + + style_info->composited = composited; + + for (i = 0; i < META_STYLE_ELEMENT_LAST; i++) + { + GtkStyleContext *style; + + style = style_info->styles[i]; + + if (composited) + { + remove_toplevel_class (style, "solid-csd"); + add_toplevel_class (style, "csd"); + } + else + { + remove_toplevel_class (style, "csd"); + add_toplevel_class (style, "solid-csd"); + } + } +} + +void meta_style_info_set_flags (MetaStyleInfo *style_info, MetaFrameFlags flags) { diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c index 5a6fded7..2428f3f8 100644 --- a/libmetacity/meta-theme.c +++ b/libmetacity/meta-theme.c @@ -64,6 +64,20 @@ static GParamSpec *properties[LAST_PROP] = { NULL }; G_DEFINE_TYPE (MetaTheme, meta_theme, G_TYPE_OBJECT) +static void +update_composited_func (gpointer key, + gpointer value, + gpointer user_data) +{ + MetaTheme *theme; + MetaStyleInfo *style_info; + + theme = META_THEME (user_data); + style_info = META_STYLE_INFO (value); + + meta_style_info_set_composited (style_info, theme->composited); +} + static MetaStyleInfo * get_style_info (MetaTheme *theme, const gchar *variant) @@ -693,7 +707,10 @@ meta_theme_set_composited (MetaTheme *theme, theme->composited = composited; meta_theme_impl_set_composited (theme->impl, composited); - meta_theme_invalidate (theme); + g_hash_table_foreach (theme->variants, update_composited_func, theme); + + g_hash_table_remove_all (theme->font_descs); + g_hash_table_remove_all (theme->title_heights); } void |