From f6ff97cbebf143fcf8b82740eb47115e3d6a2740 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 21 Oct 2014 19:48:08 +0800 Subject: [PATCH] linux: Make scale factor default to 1 --- atom/browser/atom_browser_main_parts_linux.cc | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/atom/browser/atom_browser_main_parts_linux.cc b/atom/browser/atom_browser_main_parts_linux.cc index 23012d4c1ff0..d7a9c2d4eeb5 100644 --- a/atom/browser/atom_browser_main_parts_linux.cc +++ b/atom/browser/atom_browser_main_parts_linux.cc @@ -14,11 +14,9 @@ namespace atom { namespace { const char* kInterfaceSchema = "org.gnome.desktop.interface"; -const char* kScaleFactor = "scale-factor"; +const char* kScaleFactor = "scaling-factor"; -} // namespace - -void AtomBrowserMainParts::SetDPIFromGSettings() { +void GetDPIFromGSettings(guint* scale_factor) { LibGioLoader libgio_loader; // Try also without .0 at the end; on some systems this may be required. @@ -47,18 +45,23 @@ void AtomBrowserMainParts::SetDPIFromGSettings() { break; iter++; } - - if (*iter) { - guint scale_factor = libgio_loader.g_settings_get_uint( - client, kScaleFactor); - if (scale_factor >= 1) { - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( - switches::kForceDeviceScaleFactor, base::UintToString(scale_factor)); - } - } + if (*iter) + *scale_factor = libgio_loader.g_settings_get_uint(client, kScaleFactor); g_strfreev(keys); g_object_unref(client); } +} // namespace + +void AtomBrowserMainParts::SetDPIFromGSettings() { + guint scale_factor = 1; + GetDPIFromGSettings(&scale_factor); + if (scale_factor == 0) + scale_factor = 1; + + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( + switches::kForceDeviceScaleFactor, base::UintToString(scale_factor)); +} + } // namespace atom