mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
settings: Handle window scaling factor internally
We want the settings object to handle setting and getting the window scaling factor value, both through backend-specific settings and through the CLUTTER_SCALE environment variable. This means turning the ClutterSettings:window-scaling-factor property into a readwrite one, instead of write-only, so that ClutterStage implementations will be able to query the window scaling factor on construction. https://bugzilla.gnome.org/show_bug.cgi?id=705915
This commit is contained in:
parent
b7b09bd0ce
commit
afd87abb70
@ -77,6 +77,7 @@ struct _ClutterSettings
|
||||
|
||||
gint window_scaling_factor;
|
||||
gint unscaled_font_dpi;
|
||||
guint fixed_scaling_factor : 1;
|
||||
};
|
||||
|
||||
struct _ClutterSettingsClass
|
||||
@ -361,8 +362,11 @@ clutter_settings_set_property (GObject *gobject,
|
||||
break;
|
||||
|
||||
case PROP_WINDOW_SCALING_FACTOR:
|
||||
if (!self->fixed_scaling_factor)
|
||||
{
|
||||
self->window_scaling_factor = g_value_get_int (value);
|
||||
settings_update_window_scale (self);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_UNSCALED_FONT_DPI:
|
||||
@ -430,6 +434,10 @@ clutter_settings_get_property (GObject *gobject,
|
||||
g_value_set_uint (value, self->password_hint_time);
|
||||
break;
|
||||
|
||||
case PROP_WINDOW_SCALING_FACTOR:
|
||||
g_value_set_int (value, self->window_scaling_factor);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@ -674,7 +682,7 @@ clutter_settings_class_init (ClutterSettingsClass *klass)
|
||||
P_("The scaling factor to be applied to windows"),
|
||||
1, G_MAXINT,
|
||||
1,
|
||||
CLUTTER_PARAM_WRITABLE);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
obj_props[PROP_FONTCONFIG_TIMESTAMP] =
|
||||
g_param_spec_uint ("fontconfig-timestamp",
|
||||
@ -713,6 +721,8 @@ clutter_settings_class_init (ClutterSettingsClass *klass)
|
||||
static void
|
||||
clutter_settings_init (ClutterSettings *self)
|
||||
{
|
||||
const char *scale_str;
|
||||
|
||||
self->resolution = -1.0;
|
||||
|
||||
self->double_click_time = 250;
|
||||
@ -728,6 +738,18 @@ clutter_settings_init (ClutterSettings *self)
|
||||
self->xft_rgba = NULL;
|
||||
|
||||
self->long_press_duration = 500;
|
||||
|
||||
/* if the scaling factor was set by the environment we ignore
|
||||
* any explicit setting
|
||||
*/
|
||||
scale_str = g_getenv ("CLUTTER_SCALE");
|
||||
if (scale_str != NULL)
|
||||
{
|
||||
self->window_scaling_factor = atol (scale_str);
|
||||
self->fixed_scaling_factor = TRUE;
|
||||
}
|
||||
else
|
||||
self->window_scaling_factor = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user