Add GDK_DPI_SCALE env var
This is very useful for hidpi where the dpi is scaled to make non-dpi aware apps larger. In that case a dpi aware gtk+ using GDK_SCALE will be getting huge fonts. You can the set GDK_DPI_SCALE to compensate for this.
This commit is contained in:
		@ -2810,6 +2810,8 @@ settings_update_resolution (GtkSettings *settings)
 | 
			
		||||
  GtkSettingsPrivate *priv = settings->priv;
 | 
			
		||||
  gint dpi_int;
 | 
			
		||||
  gdouble dpi;
 | 
			
		||||
  const char *scale_env;
 | 
			
		||||
  double scale;
 | 
			
		||||
 | 
			
		||||
  g_object_get (settings,
 | 
			
		||||
                "gtk-xft-dpi", &dpi_int,
 | 
			
		||||
@ -2820,6 +2822,14 @@ settings_update_resolution (GtkSettings *settings)
 | 
			
		||||
  else
 | 
			
		||||
    dpi = -1.;
 | 
			
		||||
 | 
			
		||||
  scale_env = g_getenv ("GDK_DPI_SCALE");
 | 
			
		||||
  if (scale_env)
 | 
			
		||||
    {
 | 
			
		||||
      scale = g_ascii_strtod (scale_env, NULL);
 | 
			
		||||
      if (scale != 0 && dpi > 0)
 | 
			
		||||
	dpi *= scale;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  gdk_screen_set_resolution (priv->screen, dpi);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user