Stop using screen resolution

This api is going away.
This commit is contained in:
Matthias Clasen 2017-10-31 18:53:29 -04:00
parent a27bfaa0a3
commit 31b7555b7b
3 changed files with 5 additions and 56 deletions

View File

@ -465,29 +465,6 @@ read_settings (GdkX11Screen *x11_screen,
g_value_init (&value, G_TYPE_INT);
if (!screen->resolution_set)
{
/* This code is duplicated with gtksettings.c:settings_update_resolution().
* The update of the screen resolution needs to happen immediately when
* gdk_x11_display_set_window_scale() is called, and not wait for events
* to be processed, so we can't always handling it in gtksettings.c.
* But we can't always handle it here because the DPI can be set through
* GtkSettings, which we don't have access to.
*/
int dpi_int = 0;
double dpi;
if (gdk_display_get_setting (display, "gtk-xft-dpi", &value))
dpi_int = g_value_get_int (&value);
if (dpi_int > 0)
dpi = dpi_int / 1024.;
else
dpi = -1.;
_gdk_screen_set_resolution (screen, dpi);
}
if (!x11_screen->fixed_window_scale &&
gdk_display_get_setting (display, "gdk-window-scaling-factor", &value))
_gdk_x11_screen_set_window_scale (x11_screen, g_value_get_int (&value));

View File

@ -52,11 +52,12 @@ gtk_css_value_initial_compute (GtkCssValue *value,
settings = gtk_style_provider_get_settings (provider);
if (settings)
{
GdkScreen *screen = gdk_display_get_default_screen (_gtk_settings_get_display (settings));
double resolution = gdk_screen_get_resolution (screen);
int dpi_int;
if (resolution > 0.0)
return _gtk_css_number_value_new (resolution, GTK_CSS_NUMBER);
g_object_get (settings, "gtk-xft-dpi", &dpi_int, NULL);
if (dpi_int > 0.0)
return _gtk_css_number_value_new (dpi_int / 1024., GTK_CSS_NUMBER);
}
break;

View File

@ -214,7 +214,6 @@ static void settings_update_double_click (GtkSettings *setting
static void settings_update_modules (GtkSettings *settings);
static void settings_update_cursor_theme (GtkSettings *settings);
static void settings_update_resolution (GtkSettings *settings);
static void settings_update_font_options (GtkSettings *settings);
static void settings_update_font_values (GtkSettings *settings);
static gboolean settings_update_fontconfig (GtkSettings *settings);
@ -1230,7 +1229,6 @@ gtk_settings_create_for_display (GdkDisplay *display)
settings_update_modules (settings);
settings_update_double_click (settings);
settings_update_cursor_theme (settings);
settings_update_resolution (settings);
settings_update_font_options (settings);
settings_update_font_values (settings);
@ -1379,7 +1377,6 @@ gtk_settings_notify (GObject *object,
settings_update_theme (settings);
break;
case PROP_XFT_DPI:
settings_update_resolution (settings);
/* This is a hack because with gtk_rc_reset_styles() doesn't get
* widgets with gtk_widget_style_set(), and also causes more
* recomputation than necessary.
@ -2252,32 +2249,6 @@ settings_update_fontconfig (GtkSettings *settings)
#endif /* GDK_WINDOWING_X11 || GDK_WINDOWING_WAYLAND */
}
static void
settings_update_resolution (GtkSettings *settings)
{
GtkSettingsPrivate *priv = settings->priv;
gint dpi_int;
gdouble dpi;
/* We handle this here in the case that the dpi was set on the GtkSettings
* object by the application. Other cases are handled in
* xsettings-client.c:read-settings(). See comment there for the rationale.
*/
if (priv->property_values[PROP_XFT_DPI - 1].source == GTK_SETTINGS_SOURCE_APPLICATION)
{
g_object_get (settings,
"gtk-xft-dpi", &dpi_int,
NULL);
if (dpi_int > 0)
dpi = dpi_int / 1024.;
else
dpi = -1.;
gdk_screen_set_resolution (gdk_display_get_default_screen (priv->display), dpi);
}
}
static void
settings_update_provider (GdkDisplay *display,
GtkCssProvider **old,