mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 20:12:06 +00:00
settings: Add CLUTTER_DPI_SCALE
Like we do for the windowing surfaces, we should have a run time knob (in the form of an environment variable) to allow changing the scaling factor of the font resolution.
This commit is contained in:
parent
30d1e47c4e
commit
696a536b26
@ -205,6 +205,8 @@ settings_update_font_name (ClutterSettings *self)
|
|||||||
static void
|
static void
|
||||||
settings_update_resolution (ClutterSettings *self)
|
settings_update_resolution (ClutterSettings *self)
|
||||||
{
|
{
|
||||||
|
const char *scale_env = NULL;
|
||||||
|
|
||||||
if (self->unscaled_font_dpi > 0)
|
if (self->unscaled_font_dpi > 0)
|
||||||
self->resolution = (gdouble) self->unscaled_font_dpi / 1024.0;
|
self->resolution = (gdouble) self->unscaled_font_dpi / 1024.0;
|
||||||
else if (self->font_dpi > 0)
|
else if (self->font_dpi > 0)
|
||||||
@ -212,6 +214,14 @@ settings_update_resolution (ClutterSettings *self)
|
|||||||
else
|
else
|
||||||
self->resolution = 96.0;
|
self->resolution = 96.0;
|
||||||
|
|
||||||
|
scale_env = g_getenv ("GDK_DPI_SCALE");
|
||||||
|
if (scale_env != NULL)
|
||||||
|
{
|
||||||
|
double scale = g_ascii_strtod (scale_env, NULL);
|
||||||
|
if (scale != 0 && self->resolution > 0)
|
||||||
|
self->resolution *= scale;
|
||||||
|
}
|
||||||
|
|
||||||
CLUTTER_NOTE (BACKEND, "New resolution: %.2f (%s)",
|
CLUTTER_NOTE (BACKEND, "New resolution: %.2f (%s)",
|
||||||
self->resolution,
|
self->resolution,
|
||||||
self->unscaled_font_dpi > 0 ? "unscaled" : "scaled");
|
self->unscaled_font_dpi > 0 ? "unscaled" : "scaled");
|
||||||
@ -706,6 +716,9 @@ clutter_settings_init (ClutterSettings *self)
|
|||||||
|
|
||||||
self->resolution = -1.0;
|
self->resolution = -1.0;
|
||||||
|
|
||||||
|
self->font_dpi = -1;
|
||||||
|
self->unscaled_font_dpi = -1;
|
||||||
|
|
||||||
self->double_click_time = 250;
|
self->double_click_time = 250;
|
||||||
self->double_click_distance = 5;
|
self->double_click_distance = 5;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user