summaryrefslogtreecommitdiff
path: root/libmetacity
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2017-04-02 12:55:43 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2017-04-02 12:55:43 +0300
commit7f92252114eb06529bc87a23d923d5c413896ecc (patch)
tree99a6fd2968554437769baf09a324d05569a1b916 /libmetacity
parentcc87afcd9aa0d98890cf1eb0571cb244b1189ad4 (diff)
downloadmetacity-7f92252114eb06529bc87a23d923d5c413896ecc.tar.gz
libmetacity: add meta_style_info_set_scale
Diffstat (limited to 'libmetacity')
-rw-r--r--libmetacity/meta-style-info-private.h6
-rw-r--r--libmetacity/meta-style-info.c37
2 files changed, 31 insertions, 12 deletions
diff --git a/libmetacity/meta-style-info-private.h b/libmetacity/meta-style-info-private.h
index 70d61fa3..82223531 100644
--- a/libmetacity/meta-style-info-private.h
+++ b/libmetacity/meta-style-info-private.h
@@ -41,7 +41,7 @@ G_GNUC_INTERNAL
MetaStyleInfo *meta_style_info_new (const gchar *gtk_theme_name,
const gchar *gtk_theme_variant,
gboolean composited,
- gint window_scale);
+ gint scale);
G_GNUC_INTERNAL
GtkStyleContext *meta_style_info_get_style (MetaStyleInfo *style_info,
@@ -52,6 +52,10 @@ void meta_style_info_set_composited (MetaStyleInfo *style_info,
gboolean composited);
G_GNUC_INTERNAL
+void meta_style_info_set_scale (MetaStyleInfo *style_info,
+ gint scale);
+
+G_GNUC_INTERNAL
void meta_style_info_set_flags (MetaStyleInfo *style_info,
MetaFrameFlags flags);
diff --git a/libmetacity/meta-style-info.c b/libmetacity/meta-style-info.c
index a6d90992..87d4cf29 100644
--- a/libmetacity/meta-style-info.c
+++ b/libmetacity/meta-style-info.c
@@ -28,7 +28,7 @@ struct _MetaStyleInfo
gchar *gtk_theme_name;
gchar *gtk_theme_variant;
gboolean composited;
- gint window_scale;
+ gint scale;
GtkCssProvider *theme_provider;
GtkCssProvider *user_provider;
@@ -43,7 +43,7 @@ enum
PROP_GTK_THEME_NAME,
PROP_GTK_THEME_VARIANT,
PROP_COMPOSITED,
- PROP_WINDOW_SCALE,
+ PROP_SCALE,
LAST_PROP
};
@@ -115,7 +115,7 @@ create_style_context (MetaStyleInfo *style_info,
context = gtk_style_context_new ();
gtk_style_context_set_path (context, path);
gtk_style_context_set_parent (context, parent);
- gtk_style_context_set_scale (context, style_info->window_scale);
+ gtk_style_context_set_scale (context, style_info->scale);
gtk_widget_path_unref (path);
provider = GTK_STYLE_PROVIDER (style_info->theme_provider);
@@ -257,8 +257,8 @@ meta_style_info_set_property (GObject *object,
style_info->composited = g_value_get_boolean (value);
break;
- case PROP_WINDOW_SCALE:
- style_info->window_scale = g_value_get_int (value);
+ case PROP_SCALE:
+ style_info->scale = g_value_get_int (value);
break;
default:
@@ -303,10 +303,10 @@ meta_style_info_class_init (MetaStyleInfoClass *style_info_class)
G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE |
G_PARAM_STATIC_STRINGS);
- properties[PROP_WINDOW_SCALE] =
- g_param_spec_int ("window-scale",
- "Window Scaling Factor",
- "Window Scaling Factor",
+ properties[PROP_SCALE] =
+ g_param_spec_int ("scale",
+ "Scale",
+ "Scale",
1, G_MAXINT, 1,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE |
G_PARAM_STATIC_STRINGS);
@@ -323,13 +323,13 @@ MetaStyleInfo *
meta_style_info_new (const gchar *gtk_theme_name,
const gchar *gtk_theme_variant,
gboolean composited,
- gint window_scale)
+ gint scale)
{
return g_object_new (META_TYPE_STYLE_INFO,
"gtk-theme-name", gtk_theme_name,
"gtk-theme-variant", gtk_theme_variant,
"composited", composited,
- "window-scale", window_scale,
+ "scale", scale,
NULL);
}
@@ -371,6 +371,21 @@ meta_style_info_set_composited (MetaStyleInfo *style_info,
}
void
+meta_style_info_set_scale (MetaStyleInfo *style_info,
+ gint scale)
+{
+ gint i;
+
+ if (style_info->scale == scale)
+ return;
+
+ style_info->scale = scale;
+
+ for (i = 0; i < META_STYLE_ELEMENT_LAST; i++)
+ gtk_style_context_set_scale (style_info->styles[i], scale);
+}
+
+void
meta_style_info_set_flags (MetaStyleInfo *style_info,
MetaFrameFlags flags)
{