[metacity] libmetacity: do not reload CSS changing composited status
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] libmetacity: do not reload CSS changing composited status
- Date: Sat, 4 Mar 2017 16:49:05 +0000 (UTC)
commit 518e7f2c426b7c13ba1062b43c284d7c45a5fde8
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Mar 4 15:27:54 2017 +0200
libmetacity: do not reload CSS changing composited status
libmetacity/meta-style-info-private.h | 20 ++++++++++++--------
libmetacity/meta-style-info.c | 30 ++++++++++++++++++++++++++++++
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 9b76472..70d61fa 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 f155890..a6d9099 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 5a6fded..2428f3f 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]