Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.h

Issue 929733002: Fix Pango font rendering with HiDPi displays on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don’t scale fonts up twice when running with device_scale_factor > 1.0. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_ 5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_
6 #define CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_ 6 #define CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h" 15 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h"
16 #include "chrome/browser/ui/libgtk2ui/gtk2_signal_registrar.h" 16 #include "chrome/browser/ui/libgtk2ui/gtk2_signal_registrar.h"
17 #include "chrome/browser/ui/libgtk2ui/libgtk2ui_export.h" 17 #include "chrome/browser/ui/libgtk2ui/libgtk2ui_export.h"
18 #include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h" 18 #include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h"
19 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h" 19 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h"
20 #include "ui/gfx/color_utils.h" 20 #include "ui/gfx/color_utils.h"
21 #include "ui/views/linux_ui/linux_ui.h" 21 #include "ui/views/linux_ui/linux_ui.h"
22 #include "ui/views/window/frame_buttons.h" 22 #include "ui/views/window/frame_buttons.h"
23 23
24 typedef struct _GdkColor GdkColor; 24 typedef struct _GdkColor GdkColor;
25 typedef struct _GtkBorder GtkBorder; 25 typedef struct _GtkBorder GtkBorder;
26 typedef struct _GtkStyle GtkStyle; 26 typedef struct _GtkStyle GtkStyle;
27 typedef struct _GtkWidget GtkWidget; 27 typedef struct _GtkWidget GtkWidget;
28 typedef struct _PangoFontDescription PangoFontDescription;
Daniel Erat 2015/03/16 13:57:53 you might want to rebase or merge your change agai
stapelberg 2015/03/17 08:36:33 Done.
28 29
29 class SkBitmap; 30 class SkBitmap;
30 31
31 namespace gfx { 32 namespace gfx {
32 class Image; 33 class Image;
33 } 34 }
34 35
35 namespace libgtk2ui { 36 namespace libgtk2ui {
36 class Gtk2Border; 37 class Gtk2Border;
37 class Gtk2KeyBindingsHandler; 38 class Gtk2KeyBindingsHandler;
(...skipping 26 matching lines...) Expand all
64 // ui::LinuxInputMethodContextFactory: 65 // ui::LinuxInputMethodContextFactory:
65 scoped_ptr<ui::LinuxInputMethodContext> CreateInputMethodContext( 66 scoped_ptr<ui::LinuxInputMethodContext> CreateInputMethodContext(
66 ui::LinuxInputMethodContextDelegate* delegate) const override; 67 ui::LinuxInputMethodContextDelegate* delegate) const override;
67 68
68 // gfx::LinuxFontDelegate: 69 // gfx::LinuxFontDelegate:
69 gfx::FontRenderParams GetDefaultFontRenderParams() const override; 70 gfx::FontRenderParams GetDefaultFontRenderParams() const override;
70 void GetDefaultFontDescription( 71 void GetDefaultFontDescription(
71 std::string* family_out, 72 std::string* family_out,
72 int* size_pixels_out, 73 int* size_pixels_out,
73 int* style_out, 74 int* style_out,
74 gfx::FontRenderParams* params_out) const override; 75 gfx::FontRenderParams* params_out) override;
75 76
76 // ui::LinuxShellDialog: 77 // ui::LinuxShellDialog:
77 ui::SelectFileDialog* CreateSelectFileDialog( 78 ui::SelectFileDialog* CreateSelectFileDialog(
78 ui::SelectFileDialog::Listener* listener, 79 ui::SelectFileDialog::Listener* listener,
79 ui::SelectFilePolicy* policy) const override; 80 ui::SelectFilePolicy* policy) const override;
80 81
81 // ui::LinuxUI: 82 // ui::LinuxUI:
82 void Initialize() override; 83 void Initialize() override;
83 gfx::Image GetThemeImageNamed(int id) const override; 84 gfx::Image GetThemeImageNamed(int id) const override;
84 bool GetColor(int id, SkColor* color) const override; 85 bool GetColor(int id, SkColor* color) const override;
(...skipping 26 matching lines...) Expand all
111 void RemoveWindowButtonOrderObserver( 112 void RemoveWindowButtonOrderObserver(
112 views::WindowButtonOrderObserver* observer) override; 113 views::WindowButtonOrderObserver* observer) override;
113 bool UnityIsRunning() override; 114 bool UnityIsRunning() override;
114 NonClientMiddleClickAction GetNonClientMiddleClickAction() override; 115 NonClientMiddleClickAction GetNonClientMiddleClickAction() override;
115 void NotifyWindowManagerStartupComplete() override; 116 void NotifyWindowManagerStartupComplete() override;
116 117
117 // ui::TextEditKeybindingDelegate: 118 // ui::TextEditKeybindingDelegate:
118 bool MatchEvent(const ui::Event& event, 119 bool MatchEvent(const ui::Event& event,
119 std::vector<ui::TextEditCommandAuraLinux>* commands) override; 120 std::vector<ui::TextEditCommandAuraLinux>* commands) override;
120 121
122 // ui::Views::LinuxUI:
123 void UpdateDeviceScaleFactor(float device_scale_factor) override;
124
121 private: 125 private:
122 typedef std::map<int, SkColor> ColorMap; 126 typedef std::map<int, SkColor> ColorMap;
123 typedef std::map<int, color_utils::HSL> TintMap; 127 typedef std::map<int, color_utils::HSL> TintMap;
124 typedef std::map<int, gfx::Image> ImageCache; 128 typedef std::map<int, gfx::Image> ImageCache;
125 129
126 // This method returns the colors webkit will use for the scrollbars. When no 130 // This method returns the colors webkit will use for the scrollbars. When no
127 // colors are specified by the GTK+ theme, this function averages of the 131 // colors are specified by the GTK+ theme, this function averages of the
128 // thumb part and of the track colors. 132 // thumb part and of the track colors.
129 void GetScrollbarColors(GdkColor* thumb_active_color, 133 void GetScrollbarColors(GdkColor* thumb_active_color,
130 GdkColor* thumb_inactive_color, 134 GdkColor* thumb_inactive_color,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 NonClientMiddleClickAction middle_click_action_; 259 NonClientMiddleClickAction middle_click_action_;
256 260
257 // Image cache of lazily created images. 261 // Image cache of lazily created images.
258 mutable ImageCache gtk_images_; 262 mutable ImageCache gtk_images_;
259 263
260 // Used to override the native theme for a window. If no override is provided 264 // Used to override the native theme for a window. If no override is provided
261 // or the callback returns NULL, Gtk2UI will default to a NativeThemeGtk2 265 // or the callback returns NULL, Gtk2UI will default to a NativeThemeGtk2
262 // instance. 266 // instance.
263 NativeThemeGetter native_theme_overrider_; 267 NativeThemeGetter native_theme_overrider_;
264 268
269 float device_scale_factor_;
270
265 DISALLOW_COPY_AND_ASSIGN(Gtk2UI); 271 DISALLOW_COPY_AND_ASSIGN(Gtk2UI);
266 }; 272 };
267 273
268 } // namespace libgtk2ui 274 } // namespace libgtk2ui
269 275
270 // Access point to the GTK2 desktop system. This should be the only symbol that 276 // Access point to the GTK2 desktop system. This should be the only symbol that
271 // is exported in the library; everything else should be used through the 277 // is exported in the library; everything else should be used through the
272 // interface, because eventually this .so will be loaded through dlopen at 278 // interface, because eventually this .so will be loaded through dlopen at
273 // runtime so our main binary can conditionally load GTK2 or GTK3 or EFL or 279 // runtime so our main binary can conditionally load GTK2 or GTK3 or EFL or
274 // QT or whatever. 280 // QT or whatever.
275 LIBGTK2UI_EXPORT views::LinuxUI* BuildGtk2UI(); 281 LIBGTK2UI_EXPORT views::LinuxUI* BuildGtk2UI();
276 282
277 #endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_ 283 #endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698