[gtk+] Stop using screen resolution



commit 31b7555b7b717d61725255c57878c311c84a0569
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 31 18:53:29 2017 -0400

    Stop using screen resolution
    
    This api is going away.

 gdk/x11/xsettings-client.c |   23 -----------------------
 gtk/gtkcssinitialvalue.c   |    9 +++++----
 gtk/gtksettings.c          |   29 -----------------------------
 3 files changed, 5 insertions(+), 56 deletions(-)
---
diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c
index cd7e335..f73e7e4 100644
--- a/gdk/x11/xsettings-client.c
+++ b/gdk/x11/xsettings-client.c
@@ -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));
diff --git a/gtk/gtkcssinitialvalue.c b/gtk/gtkcssinitialvalue.c
index c40f26d..af9430a 100644
--- a/gtk/gtkcssinitialvalue.c
+++ b/gtk/gtkcssinitialvalue.c
@@ -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;
 
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index a583d84..ce7de59 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -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.
@@ -2253,32 +2250,6 @@ settings_update_fontconfig (GtkSettings *settings)
 }
 
 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,
                           GtkCssProvider  *new)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]