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/libgtk2ui/gtk2_ui.h" | 5 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
652 g_free(gtk_rgba); | 652 g_free(gtk_rgba); |
653 } | 653 } |
654 | 654 |
655 return subpixel_rendering; | 655 return subpixel_rendering; |
656 } | 656 } |
657 | 657 |
658 std::string Gtk2UI::GetDefaultFontDescription() const { | 658 std::string Gtk2UI::GetDefaultFontDescription() const { |
659 return default_font_description_; | 659 return default_font_description_; |
660 } | 660 } |
661 | 661 |
662 double Gtk2UI::GetFontDPI() const { | |
663 GtkSettings* gtk_settings = gtk_settings_get_default(); | |
664 CHECK(gtk_settings); | |
665 gint dpi = 0.0; | |
msw
2014/07/18 03:39:33
nit: should this be -1 if for some reason g_object
Daniel Erat
2014/07/18 04:20:25
yep, and certainly not a double. thanks
| |
666 g_object_get(gtk_settings, "gtk-xft-dpi", &dpi, NULL); | |
667 | |
668 // GTK multiplies the DPI by 1024 before storing it. | |
669 return (dpi > 0) ? dpi / 1024.0 : dpi; | |
670 } | |
671 | |
662 ui::SelectFileDialog* Gtk2UI::CreateSelectFileDialog( | 672 ui::SelectFileDialog* Gtk2UI::CreateSelectFileDialog( |
663 ui::SelectFileDialog::Listener* listener, | 673 ui::SelectFileDialog::Listener* listener, |
664 ui::SelectFilePolicy* policy) const { | 674 ui::SelectFilePolicy* policy) const { |
665 return SelectFileDialogImpl::Create(listener, policy); | 675 return SelectFileDialogImpl::Create(listener, policy); |
666 } | 676 } |
667 | 677 |
668 bool Gtk2UI::UnityIsRunning() { | 678 bool Gtk2UI::UnityIsRunning() { |
669 return unity::IsRunning(); | 679 return unity::IsRunning(); |
670 } | 680 } |
671 | 681 |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1348 ClearAllThemeData(); | 1358 ClearAllThemeData(); |
1349 LoadGtkValues(); | 1359 LoadGtkValues(); |
1350 NativeThemeGtk2::instance()->NotifyObservers(); | 1360 NativeThemeGtk2::instance()->NotifyObservers(); |
1351 } | 1361 } |
1352 | 1362 |
1353 } // namespace libgtk2ui | 1363 } // namespace libgtk2ui |
1354 | 1364 |
1355 views::LinuxUI* BuildGtk2UI() { | 1365 views::LinuxUI* BuildGtk2UI() { |
1356 return new libgtk2ui::Gtk2UI; | 1366 return new libgtk2ui::Gtk2UI; |
1357 } | 1367 } |
OLD | NEW |