diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-02-01 14:33:58 +0200 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-02-01 14:33:58 +0200 |
commit | 058c0ac5df562281900c4addf9f10011409dfd6f (patch) | |
tree | 70f5c4771fbaf90ed9e2f008b55a23aa501c6b63 /src | |
parent | efb9fe070f375910ed8b7a82a280875d3ecada70 (diff) | |
download | metacity-058c0ac5df562281900c4addf9f10011409dfd6f.tar.gz |
frames: move style variants to MetaTheme
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/frames.c | 69 | ||||
-rw-r--r-- | src/ui/frames.h | 3 |
2 files changed, 6 insertions, 66 deletions
diff --git a/src/ui/frames.c b/src/ui/frames.c index da546a56..ed219a26 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -174,48 +174,6 @@ prefs_changed_callback (MetaPreference pref, meta_frames_button_layout_changed (META_FRAMES (data)); } -static MetaStyleInfo * -meta_frames_get_theme_variant (MetaFrames *frames, - const gchar *variant) -{ - MetaStyleInfo *style_info; - - style_info = g_hash_table_lookup (frames->style_variants, variant); - if (style_info == NULL) - { - MetaTheme *theme = meta_theme_get_current (); - style_info = meta_style_info_new (variant, meta_theme_get_composited (theme)); - g_hash_table_insert (frames->style_variants, g_strdup (variant), style_info); - } - - return style_info; -} - -static void -update_style_contexts (MetaFrames *frames) -{ - MetaStyleInfo *style_info; - GList *variants, *variant; - MetaTheme *theme; - gboolean composited; - - theme = meta_theme_get_current (); - composited = meta_theme_get_composited (theme); - - if (frames->normal_style) - meta_style_info_unref (frames->normal_style); - frames->normal_style = meta_style_info_new (NULL, composited); - - variants = g_hash_table_get_keys (frames->style_variants); - for (variant = variants; variant; variant = variants->next) - { - style_info = meta_style_info_new ((char *)variant->data, composited); - g_hash_table_insert (frames->style_variants, - g_strdup (variant->data), style_info); - } - g_list_free (variants); -} - static void meta_frames_init (MetaFrames *frames) { @@ -231,10 +189,6 @@ meta_frames_init (MetaFrames *frames) frames->invalidate_frames = NULL; frames->cache = g_hash_table_new (g_direct_hash, g_direct_equal); - frames->style_variants = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, (GDestroyNotify)meta_style_info_unref); - update_style_contexts (frames); - meta_prefs_add_listener (prefs_changed_callback, frames); } @@ -272,18 +226,6 @@ meta_frames_destroy (GtkWidget *widget) } g_slist_free (winlist); - if (frames->normal_style) - { - meta_style_info_unref (frames->normal_style); - frames->normal_style = NULL; - } - - if (frames->style_variants) - { - g_hash_table_destroy (frames->style_variants); - frames->style_variants = NULL; - } - GTK_WIDGET_CLASS (meta_frames_parent_class)->destroy (widget); } @@ -471,11 +413,10 @@ meta_frames_style_updated (GtkWidget *widget) compositing_manager = meta_prefs_get_compositing_manager (); meta_theme_set_composited (theme, compositing_manager); + meta_theme_style_invalidate (theme); meta_frames_font_changed (frames); - update_style_contexts (frames); - g_hash_table_foreach (frames->frames, reattach_style_func, frames); @@ -667,6 +608,7 @@ meta_frames_attach_style (MetaFrames *frames, gboolean has_frame; char *variant = NULL; const char *variant_override; + MetaTheme *theme; if (frame->style_info != NULL) meta_style_info_unref (frame->style_info); @@ -682,11 +624,12 @@ meta_frames_attach_style (MetaFrames *frames, META_CORE_GET_THEME_VARIANT, &variant, META_CORE_GET_END); + theme = meta_theme_get_current (); + if (variant == NULL || strcmp(variant, "normal") == 0) - frame->style_info = meta_style_info_ref (frames->normal_style); + frame->style_info = meta_style_info_ref (meta_theme_get_style_info (theme, NULL)); else - frame->style_info = meta_style_info_ref (meta_frames_get_theme_variant (frames, - variant)); + frame->style_info = meta_style_info_ref (meta_theme_get_style_info (theme, variant)); if (variant_override) g_free (variant); diff --git a/src/ui/frames.h b/src/ui/frames.h index 5de23130..1109a8c1 100644 --- a/src/ui/frames.h +++ b/src/ui/frames.h @@ -97,9 +97,6 @@ struct _MetaFrames guint tooltip_timeout; MetaUIFrame *last_motion_frame; - MetaStyleInfo *normal_style; - GHashTable *style_variants; - int expose_delay_count; int invalidate_cache_timeout_id; |