aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium/chromium-61.0.3163.79-gtk2fix.patch
blob: 4847d51a52f0aca460c5183564260663ada05424 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff -up chromium-61.0.3163.79/chrome/browser/ui/libgtkui/gtk_ui.cc.gtk2fix chromium-61.0.3163.79/chrome/browser/ui/libgtkui/gtk_ui.cc
--- chromium-61.0.3163.79/chrome/browser/ui/libgtkui/gtk_ui.cc.gtk2fix	2017-09-07 15:40:40.904966476 -0400
+++ chrome/browser/ui/libgtkui/gtk_ui.cc	2017-09-07 15:42:23.829987464 -0400
@@ -1052,11 +1052,19 @@ float GtkUi::GetRawDeviceScaleFactor() {
   if (display::Display::HasForceDeviceScaleFactor())
     return display::Display::GetForcedDeviceScaleFactor();
 
+#if GTK_MAJOR_VERSION == 2
+  GtkSettings* gtk_settings = gtk_settings_get_default();
+  gint gtk_dpi = -1;
+  g_object_get(gtk_settings, "gtk-xft-dpi", &gtk_dpi, nullptr);
+  const float scale_factor = gtk_dpi / (1024 * kDefaultDPI);
+#else
   GdkScreen* screen = gdk_screen_get_default();
   gint scale = gtk_widget_get_scale_factor(fake_window_);
   gdouble resolution = gdk_screen_get_resolution(screen);
   const float scale_factor =
       resolution <= 0 ? scale : resolution * scale / kDefaultDPI;
+#endif
+
   // Blacklist scaling factors <120% (crbug.com/484400) and round
   // to 1 decimal to prevent rendering problems (crbug.com/485183).
   return scale_factor < 1.2f ? 1.0f : roundf(scale_factor * 10) / 10;