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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_screen_x11.cc

Issue 1870873003: Remove screen dependency from font_render_params_linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 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 "ui/views/widget/desktop_aura/desktop_screen_x11.h" 5 #include "ui/views/widget/desktop_aura/desktop_screen_x11.h"
6 6
7 #include <X11/extensions/Xrandr.h> 7 #include <X11/extensions/Xrandr.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 // It clashes with out RootWindow. 10 // It clashes with out RootWindow.
11 #undef RootWindow 11 #undef RootWindow
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
16 #include "ui/aura/window_event_dispatcher.h" 16 #include "ui/aura/window_event_dispatcher.h"
17 #include "ui/aura/window_tree_host.h" 17 #include "ui/aura/window_tree_host.h"
18 #include "ui/base/layout.h" 18 #include "ui/base/layout.h"
19 #include "ui/display/util/display_util.h" 19 #include "ui/display/util/display_util.h"
20 #include "ui/display/util/x11/edid_parser_x11.h" 20 #include "ui/display/util/x11/edid_parser_x11.h"
21 #include "ui/events/platform/platform_event_source.h" 21 #include "ui/events/platform/platform_event_source.h"
22 #include "ui/gfx/display.h" 22 #include "ui/gfx/display.h"
23 #include "ui/gfx/font_render_params.h"
23 #include "ui/gfx/geometry/point_conversions.h" 24 #include "ui/gfx/geometry/point_conversions.h"
24 #include "ui/gfx/geometry/size_conversions.h" 25 #include "ui/gfx/geometry/size_conversions.h"
25 #include "ui/gfx/native_widget_types.h" 26 #include "ui/gfx/native_widget_types.h"
26 #include "ui/gfx/screen.h" 27 #include "ui/gfx/screen.h"
27 #include "ui/gfx/x/x11_types.h" 28 #include "ui/gfx/x/x11_types.h"
28 #include "ui/views/linux_ui/linux_ui.h" 29 #include "ui/views/linux_ui/linux_ui.h"
29 #include "ui/views/widget/desktop_aura/desktop_screen.h" 30 #include "ui/views/widget/desktop_aura/desktop_screen.h"
30 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" 31 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
31 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" 32 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
32 33
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 XRRQueryExtension(xdisplay_, &xrandr_event_base_, &error_base_ignored); 101 XRRQueryExtension(xdisplay_, &xrandr_event_base_, &error_base_ignored);
101 102
102 if (ui::PlatformEventSource::GetInstance()) 103 if (ui::PlatformEventSource::GetInstance())
103 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); 104 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
104 XRRSelectInput(xdisplay_, 105 XRRSelectInput(xdisplay_,
105 x_root_window_, 106 x_root_window_,
106 RRScreenChangeNotifyMask | 107 RRScreenChangeNotifyMask |
107 RROutputChangeNotifyMask | 108 RROutputChangeNotifyMask |
108 RRCrtcChangeNotifyMask); 109 RRCrtcChangeNotifyMask);
109 110
110 displays_ = BuildDisplaysFromXRandRInfo(); 111 SetDisplaysInternal(BuildDisplaysFromXRandRInfo());
111 } else { 112 } else {
112 displays_ = GetFallbackDisplayList(); 113 SetDisplaysInternal(GetFallbackDisplayList());
113 } 114 }
114 } 115 }
115 116
116 DesktopScreenX11::~DesktopScreenX11() { 117 DesktopScreenX11::~DesktopScreenX11() {
117 if (has_xrandr_ && ui::PlatformEventSource::GetInstance()) 118 if (has_xrandr_ && ui::PlatformEventSource::GetInstance())
118 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); 119 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
119 } 120 }
120 121
121 //////////////////////////////////////////////////////////////////////////////// 122 ////////////////////////////////////////////////////////////////////////////////
122 // DesktopScreenX11, gfx::Screen implementation: 123 // DesktopScreenX11, gfx::Screen implementation:
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 360 }
360 361
361 if (displays.empty()) 362 if (displays.empty())
362 return GetFallbackDisplayList(); 363 return GetFallbackDisplayList();
363 364
364 return displays; 365 return displays;
365 } 366 }
366 367
367 void DesktopScreenX11::ConfigureTimerFired() { 368 void DesktopScreenX11::ConfigureTimerFired() {
368 std::vector<gfx::Display> old_displays = displays_; 369 std::vector<gfx::Display> old_displays = displays_;
369 displays_ = BuildDisplaysFromXRandRInfo(); 370 SetDisplaysInternal(BuildDisplaysFromXRandRInfo());
371 change_notifier_.NotifyDisplaysChanged(old_displays, displays_);
372 }
370 373
371 change_notifier_.NotifyDisplaysChanged(old_displays, displays_); 374 void DesktopScreenX11::SetDisplaysInternal(
375 const std::vector<gfx::Display>& displays) {
376 displays_ = displays;
377 gfx::SetFontRenderParamsDeviceScaleFactor(
378 GetPrimaryDisplay().device_scale_factor());
372 } 379 }
373 380
374 //////////////////////////////////////////////////////////////////////////////// 381 ////////////////////////////////////////////////////////////////////////////////
375 382
376 gfx::Screen* CreateDesktopScreen() { 383 gfx::Screen* CreateDesktopScreen() {
377 return new DesktopScreenX11; 384 return new DesktopScreenX11;
378 } 385 }
379 386
380 } // namespace views 387 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698