| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/libgtkui/gtk_ui.h" | 5 #include "chrome/browser/ui/libgtkui/gtk_ui.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <pango/pango.h> | 8 #include <pango/pango.h> |
| 9 #include <X11/Xcursor/Xcursor.h> | 9 #include <X11/Xcursor/Xcursor.h> |
| 10 | 10 |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 void Gtk2UI::ResetStyle() { | 1047 void Gtk2UI::ResetStyle() { |
| 1048 LoadGtkValues(); | 1048 LoadGtkValues(); |
| 1049 NativeThemeGtk2::instance()->NotifyObservers(); | 1049 NativeThemeGtk2::instance()->NotifyObservers(); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 void Gtk2UI::UpdateDeviceScaleFactor() { | 1052 void Gtk2UI::UpdateDeviceScaleFactor() { |
| 1053 // Note: Linux chrome currently does not support dynamic DPI | 1053 // Note: Linux chrome currently does not support dynamic DPI |
| 1054 // changes. This is to allow flags to override the DPI settings | 1054 // changes. This is to allow flags to override the DPI settings |
| 1055 // during startup. | 1055 // during startup. |
| 1056 float scale = GetRawDeviceScaleFactor(); | 1056 float scale = GetRawDeviceScaleFactor(); |
| 1057 | 1057 // Blacklist scaling factors <120% (crbug.com/484400) and round |
| 1058 // Blacklist scaling factors <130% (crbug.com/484400) and round | |
| 1059 // to 1 decimal to prevent rendering problems (crbug.com/485183). | 1058 // to 1 decimal to prevent rendering problems (crbug.com/485183). |
| 1060 device_scale_factor_ = scale < 1.3f ? 1.0f : roundf(scale * 10) / 10; | 1059 device_scale_factor_ = scale < 1.2f ? 1.0f : roundf(scale * 10) / 10; |
| 1061 UpdateDefaultFont(); | 1060 UpdateDefaultFont(); |
| 1062 } | 1061 } |
| 1063 | 1062 |
| 1064 float Gtk2UI::GetDeviceScaleFactor() const { | 1063 float Gtk2UI::GetDeviceScaleFactor() const { |
| 1065 return device_scale_factor_; | 1064 return device_scale_factor_; |
| 1066 } | 1065 } |
| 1067 | 1066 |
| 1068 } // namespace libgtkui | 1067 } // namespace libgtkui |
| 1069 | 1068 |
| 1070 views::LinuxUI* BuildGtk2UI() { | 1069 views::LinuxUI* BuildGtk2UI() { |
| 1071 return new libgtkui::Gtk2UI; | 1070 return new libgtkui::Gtk2UI; |
| 1072 } | 1071 } |
| OLD | NEW |