backend: Return the correct default resolution

If ClutterSettings:font-dpi is set to -1 then the default resolution
should be returned by ClutterBackend — i.e. 96.0.
This commit is contained in:
Emmanuele Bassi 2011-12-05 11:42:49 +00:00
parent 8d234d270a
commit 943a65b476

View File

@ -200,14 +200,20 @@ clutter_backend_real_resolution_changed (ClutterBackend *backend)
ClutterBackendPrivate *priv = backend->priv; ClutterBackendPrivate *priv = backend->priv;
ClutterMainContext *context; ClutterMainContext *context;
ClutterSettings *settings; ClutterSettings *settings;
gdouble resolution;
gint dpi; gint dpi;
settings = clutter_settings_get_default (); settings = clutter_settings_get_default ();
g_object_get (settings, "font-dpi", &dpi, NULL); g_object_get (settings, "font-dpi", &dpi, NULL);
if (dpi < 0)
resolution = 96.0;
else
resolution = dpi / 1024.0;
context = _clutter_context_get_default (); context = _clutter_context_get_default ();
if (context->font_map != NULL) if (context->font_map != NULL)
cogl_pango_font_map_set_resolution (context->font_map, dpi / 1024.0); cogl_pango_font_map_set_resolution (context->font_map, resolution);
priv->units_per_em = get_units_per_em (backend, NULL); priv->units_per_em = get_units_per_em (backend, NULL);
priv->units_serial += 1; priv->units_serial += 1;
@ -1084,6 +1090,9 @@ clutter_backend_get_resolution (ClutterBackend *backend)
settings = clutter_settings_get_default (); settings = clutter_settings_get_default ();
g_object_get (settings, "font-dpi", &resolution, NULL); g_object_get (settings, "font-dpi", &resolution, NULL);
if (resolution < 0)
return 96.0;
return resolution / 1024.0; return resolution / 1024.0;
} }