| 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 "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/display.h" |
| 20 #include "ui/display/screen.h" |
| 19 #include "ui/display/util/display_util.h" | 21 #include "ui/display/util/display_util.h" |
| 20 #include "ui/display/util/x11/edid_parser_x11.h" | 22 #include "ui/display/util/x11/edid_parser_x11.h" |
| 21 #include "ui/events/platform/platform_event_source.h" | 23 #include "ui/events/platform/platform_event_source.h" |
| 22 #include "ui/gfx/display.h" | |
| 23 #include "ui/gfx/font_render_params.h" | 24 #include "ui/gfx/font_render_params.h" |
| 24 #include "ui/gfx/geometry/point_conversions.h" | 25 #include "ui/gfx/geometry/point_conversions.h" |
| 25 #include "ui/gfx/geometry/size_conversions.h" | 26 #include "ui/gfx/geometry/size_conversions.h" |
| 26 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.h" |
| 27 #include "ui/gfx/screen.h" | |
| 28 #include "ui/gfx/x/x11_types.h" | 28 #include "ui/gfx/x/x11_types.h" |
| 29 #include "ui/views/linux_ui/linux_ui.h" | 29 #include "ui/views/linux_ui/linux_ui.h" |
| 30 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 30 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| 31 #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" |
| 32 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" | 32 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 const char* const kAtomsToCache[] = { | 36 const char* const kAtomsToCache[] = { |
| 37 "_NET_WORKAREA", | 37 "_NET_WORKAREA", |
| 38 nullptr | 38 nullptr |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // The delay to perform configuration after RRNotify. See the comment | 41 // The delay to perform configuration after RRNotify. See the comment |
| 42 // in |Dispatch()|. | 42 // in |Dispatch()|. |
| 43 const int64_t kConfigureDelayMs = 500; | 43 const int64_t kConfigureDelayMs = 500; |
| 44 | 44 |
| 45 double GetDeviceScaleFactor() { | 45 double GetDeviceScaleFactor() { |
| 46 float device_scale_factor = 1.0f; | 46 float device_scale_factor = 1.0f; |
| 47 if (views::LinuxUI::instance()) { | 47 if (views::LinuxUI::instance()) { |
| 48 device_scale_factor = | 48 device_scale_factor = |
| 49 views::LinuxUI::instance()->GetDeviceScaleFactor(); | 49 views::LinuxUI::instance()->GetDeviceScaleFactor(); |
| 50 } else if (gfx::Display::HasForceDeviceScaleFactor()) { | 50 } else if (display::Display::HasForceDeviceScaleFactor()) { |
| 51 device_scale_factor = gfx::Display::GetForcedDeviceScaleFactor(); | 51 device_scale_factor = display::Display::GetForcedDeviceScaleFactor(); |
| 52 } | 52 } |
| 53 return device_scale_factor; | 53 return device_scale_factor; |
| 54 } | 54 } |
| 55 | 55 |
| 56 gfx::Point PixelToDIPPoint(const gfx::Point& pixel_point) { | 56 gfx::Point PixelToDIPPoint(const gfx::Point& pixel_point) { |
| 57 return gfx::ScaleToFlooredPoint(pixel_point, 1.0f / GetDeviceScaleFactor()); | 57 return gfx::ScaleToFlooredPoint(pixel_point, 1.0f / GetDeviceScaleFactor()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) { | 60 gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) { |
| 61 return gfx::ScaleToFlooredPoint(dip_point, GetDeviceScaleFactor()); | 61 return gfx::ScaleToFlooredPoint(dip_point, GetDeviceScaleFactor()); |
| 62 } | 62 } |
| 63 | 63 |
| 64 std::vector<gfx::Display> GetFallbackDisplayList() { | 64 std::vector<display::Display> GetFallbackDisplayList() { |
| 65 ::XDisplay* display = gfx::GetXDisplay(); | 65 ::XDisplay* display = gfx::GetXDisplay(); |
| 66 ::Screen* screen = DefaultScreenOfDisplay(display); | 66 ::Screen* screen = DefaultScreenOfDisplay(display); |
| 67 int width = WidthOfScreen(screen); | 67 int width = WidthOfScreen(screen); |
| 68 int height = HeightOfScreen(screen); | 68 int height = HeightOfScreen(screen); |
| 69 gfx::Size physical_size(WidthMMOfScreen(screen), HeightMMOfScreen(screen)); | 69 gfx::Size physical_size(WidthMMOfScreen(screen), HeightMMOfScreen(screen)); |
| 70 | 70 |
| 71 gfx::Rect bounds_in_pixels(0, 0, width, height); | 71 gfx::Rect bounds_in_pixels(0, 0, width, height); |
| 72 gfx::Display gfx_display(0, bounds_in_pixels); | 72 display::Display gfx_display(0, bounds_in_pixels); |
| 73 if (!gfx::Display::HasForceDeviceScaleFactor() && | 73 if (!display::Display::HasForceDeviceScaleFactor() && |
| 74 !ui::IsDisplaySizeBlackListed(physical_size)) { | 74 !ui::IsDisplaySizeBlackListed(physical_size)) { |
| 75 const float device_scale_factor = GetDeviceScaleFactor(); | 75 const float device_scale_factor = GetDeviceScaleFactor(); |
| 76 DCHECK_LE(1.0f, device_scale_factor); | 76 DCHECK_LE(1.0f, device_scale_factor); |
| 77 gfx_display.SetScaleAndBounds(device_scale_factor, bounds_in_pixels); | 77 gfx_display.SetScaleAndBounds(device_scale_factor, bounds_in_pixels); |
| 78 } | 78 } |
| 79 | 79 |
| 80 return std::vector<gfx::Display>(1, gfx_display); | 80 return std::vector<display::Display>(1, gfx_display); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace | 83 } // namespace |
| 84 | 84 |
| 85 namespace views { | 85 namespace views { |
| 86 | 86 |
| 87 //////////////////////////////////////////////////////////////////////////////// | 87 //////////////////////////////////////////////////////////////////////////////// |
| 88 // DesktopScreenX11, public: | 88 // DesktopScreenX11, public: |
| 89 | 89 |
| 90 DesktopScreenX11::DesktopScreenX11() | 90 DesktopScreenX11::DesktopScreenX11() |
| (...skipping 28 matching lines...) Expand all Loading... |
| 119 SetDisplaysInternal(GetFallbackDisplayList()); | 119 SetDisplaysInternal(GetFallbackDisplayList()); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 DesktopScreenX11::~DesktopScreenX11() { | 123 DesktopScreenX11::~DesktopScreenX11() { |
| 124 if (has_xrandr_ && ui::PlatformEventSource::GetInstance()) | 124 if (has_xrandr_ && ui::PlatformEventSource::GetInstance()) |
| 125 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 125 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
| 126 } | 126 } |
| 127 | 127 |
| 128 //////////////////////////////////////////////////////////////////////////////// | 128 //////////////////////////////////////////////////////////////////////////////// |
| 129 // DesktopScreenX11, gfx::Screen implementation: | 129 // DesktopScreenX11, display::Screen implementation: |
| 130 | 130 |
| 131 gfx::Point DesktopScreenX11::GetCursorScreenPoint() { | 131 gfx::Point DesktopScreenX11::GetCursorScreenPoint() { |
| 132 TRACE_EVENT0("views", "DesktopScreenX11::GetCursorScreenPoint()"); | 132 TRACE_EVENT0("views", "DesktopScreenX11::GetCursorScreenPoint()"); |
| 133 | 133 |
| 134 XDisplay* display = gfx::GetXDisplay(); | 134 XDisplay* display = gfx::GetXDisplay(); |
| 135 | 135 |
| 136 ::Window root, child; | 136 ::Window root, child; |
| 137 int root_x, root_y, win_x, win_y; | 137 int root_x, root_y, win_x, win_y; |
| 138 unsigned int mask; | 138 unsigned int mask; |
| 139 XQueryPointer(display, | 139 XQueryPointer(display, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 157 const gfx::Point& point) { | 157 const gfx::Point& point) { |
| 158 X11TopmostWindowFinder finder; | 158 X11TopmostWindowFinder finder; |
| 159 return finder.FindLocalProcessWindowAt( | 159 return finder.FindLocalProcessWindowAt( |
| 160 DIPToPixelPoint(point), std::set<aura::Window*>()); | 160 DIPToPixelPoint(point), std::set<aura::Window*>()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 int DesktopScreenX11::GetNumDisplays() const { | 163 int DesktopScreenX11::GetNumDisplays() const { |
| 164 return displays_.size(); | 164 return displays_.size(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 std::vector<gfx::Display> DesktopScreenX11::GetAllDisplays() const { | 167 std::vector<display::Display> DesktopScreenX11::GetAllDisplays() const { |
| 168 return displays_; | 168 return displays_; |
| 169 } | 169 } |
| 170 | 170 |
| 171 gfx::Display DesktopScreenX11::GetDisplayNearestWindow( | 171 display::Display DesktopScreenX11::GetDisplayNearestWindow( |
| 172 gfx::NativeView window) const { | 172 gfx::NativeView window) const { |
| 173 if (!window) | 173 if (!window) |
| 174 return GetPrimaryDisplay(); | 174 return GetPrimaryDisplay(); |
| 175 | 175 |
| 176 // Getting screen bounds here safely is hard. | 176 // Getting screen bounds here safely is hard. |
| 177 // | 177 // |
| 178 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we | 178 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we |
| 179 // can't because |window| (and the associated WindowEventDispatcher*) can be | 179 // can't because |window| (and the associated WindowEventDispatcher*) can be |
| 180 // partially initialized at this point; WindowEventDispatcher initializations | 180 // partially initialized at this point; WindowEventDispatcher initializations |
| 181 // call through into GetDisplayNearestWindow(). But the X11 resources are | 181 // call through into GetDisplayNearestWindow(). But the X11 resources are |
| 182 // created before we create the aura::WindowEventDispatcher. So we ask what | 182 // created before we create the aura::WindowEventDispatcher. So we ask what |
| 183 // the DRWHX11 believes the window bounds are instead of going through the | 183 // the DRWHX11 believes the window bounds are instead of going through the |
| 184 // aura::Window's screen bounds. | 184 // aura::Window's screen bounds. |
| 185 aura::WindowTreeHost* host = window->GetHost(); | 185 aura::WindowTreeHost* host = window->GetHost(); |
| 186 if (host) { | 186 if (host) { |
| 187 DesktopWindowTreeHostX11* rwh = DesktopWindowTreeHostX11::GetHostForXID( | 187 DesktopWindowTreeHostX11* rwh = DesktopWindowTreeHostX11::GetHostForXID( |
| 188 host->GetAcceleratedWidget()); | 188 host->GetAcceleratedWidget()); |
| 189 if (rwh) | 189 if (rwh) |
| 190 return GetDisplayMatching(rwh->GetX11RootWindowBounds()); | 190 return GetDisplayMatching(rwh->GetX11RootWindowBounds()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 return GetPrimaryDisplay(); | 193 return GetPrimaryDisplay(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 gfx::Display DesktopScreenX11::GetDisplayNearestPoint( | 196 display::Display DesktopScreenX11::GetDisplayNearestPoint( |
| 197 const gfx::Point& point) const { | 197 const gfx::Point& point) const { |
| 198 for (std::vector<gfx::Display>::const_iterator it = displays_.begin(); | 198 for (std::vector<display::Display>::const_iterator it = displays_.begin(); |
| 199 it != displays_.end(); ++it) { | 199 it != displays_.end(); ++it) { |
| 200 if (it->bounds().Contains(point)) | 200 if (it->bounds().Contains(point)) |
| 201 return *it; | 201 return *it; |
| 202 } | 202 } |
| 203 | 203 |
| 204 return GetPrimaryDisplay(); | 204 return GetPrimaryDisplay(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 gfx::Display DesktopScreenX11::GetDisplayMatching( | 207 display::Display DesktopScreenX11::GetDisplayMatching( |
| 208 const gfx::Rect& match_rect) const { | 208 const gfx::Rect& match_rect) const { |
| 209 int max_area = 0; | 209 int max_area = 0; |
| 210 const gfx::Display* matching = NULL; | 210 const display::Display* matching = NULL; |
| 211 for (std::vector<gfx::Display>::const_iterator it = displays_.begin(); | 211 for (std::vector<display::Display>::const_iterator it = displays_.begin(); |
| 212 it != displays_.end(); ++it) { | 212 it != displays_.end(); ++it) { |
| 213 gfx::Rect intersect = gfx::IntersectRects(it->bounds(), match_rect); | 213 gfx::Rect intersect = gfx::IntersectRects(it->bounds(), match_rect); |
| 214 int area = intersect.width() * intersect.height(); | 214 int area = intersect.width() * intersect.height(); |
| 215 if (area > max_area) { | 215 if (area > max_area) { |
| 216 max_area = area; | 216 max_area = area; |
| 217 matching = &*it; | 217 matching = &*it; |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 // Fallback to the primary display if there is no matching display. | 220 // Fallback to the primary display if there is no matching display. |
| 221 return matching ? *matching : GetPrimaryDisplay(); | 221 return matching ? *matching : GetPrimaryDisplay(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 gfx::Display DesktopScreenX11::GetPrimaryDisplay() const { | 224 display::Display DesktopScreenX11::GetPrimaryDisplay() const { |
| 225 return displays_.front(); | 225 return displays_.front(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void DesktopScreenX11::AddObserver(gfx::DisplayObserver* observer) { | 228 void DesktopScreenX11::AddObserver(display::DisplayObserver* observer) { |
| 229 change_notifier_.AddObserver(observer); | 229 change_notifier_.AddObserver(observer); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void DesktopScreenX11::RemoveObserver(gfx::DisplayObserver* observer) { | 232 void DesktopScreenX11::RemoveObserver(display::DisplayObserver* observer) { |
| 233 change_notifier_.RemoveObserver(observer); | 233 change_notifier_.RemoveObserver(observer); |
| 234 } | 234 } |
| 235 | 235 |
| 236 bool DesktopScreenX11::CanDispatchEvent(const ui::PlatformEvent& event) { | 236 bool DesktopScreenX11::CanDispatchEvent(const ui::PlatformEvent& event) { |
| 237 return event->type - xrandr_event_base_ == RRScreenChangeNotify || | 237 return event->type - xrandr_event_base_ == RRScreenChangeNotify || |
| 238 event->type - xrandr_event_base_ == RRNotify || | 238 event->type - xrandr_event_base_ == RRNotify || |
| 239 (event->type == PropertyNotify && | 239 (event->type == PropertyNotify && |
| 240 event->xproperty.window == x_root_window_ && | 240 event->xproperty.window == x_root_window_ && |
| 241 event->xproperty.atom == atom_cache_.GetAtom("_NET_WORKAREA")); | 241 event->xproperty.atom == atom_cache_.GetAtom("_NET_WORKAREA")); |
| 242 } | 242 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 263 } else { | 263 } else { |
| 264 NOTREACHED(); | 264 NOTREACHED(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 return ui::POST_DISPATCH_NONE; | 267 return ui::POST_DISPATCH_NONE; |
| 268 } | 268 } |
| 269 | 269 |
| 270 // static | 270 // static |
| 271 void DesktopScreenX11::UpdateDeviceScaleFactorForTest() { | 271 void DesktopScreenX11::UpdateDeviceScaleFactorForTest() { |
| 272 DesktopScreenX11* screen = | 272 DesktopScreenX11* screen = |
| 273 static_cast<DesktopScreenX11*>(gfx::Screen::GetScreen()); | 273 static_cast<DesktopScreenX11*>(display::Screen::GetScreen()); |
| 274 screen->ConfigureTimerFired(); | 274 screen->ConfigureTimerFired(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 //////////////////////////////////////////////////////////////////////////////// | 277 //////////////////////////////////////////////////////////////////////////////// |
| 278 // DesktopScreenX11, private: | 278 // DesktopScreenX11, private: |
| 279 | 279 |
| 280 DesktopScreenX11::DesktopScreenX11( | 280 DesktopScreenX11::DesktopScreenX11( |
| 281 const std::vector<gfx::Display>& test_displays) | 281 const std::vector<display::Display>& test_displays) |
| 282 : xdisplay_(gfx::GetXDisplay()), | 282 : xdisplay_(gfx::GetXDisplay()), |
| 283 x_root_window_(DefaultRootWindow(xdisplay_)), | 283 x_root_window_(DefaultRootWindow(xdisplay_)), |
| 284 has_xrandr_(false), | 284 has_xrandr_(false), |
| 285 xrandr_event_base_(0), | 285 xrandr_event_base_(0), |
| 286 displays_(test_displays), | 286 displays_(test_displays), |
| 287 atom_cache_(xdisplay_, kAtomsToCache) { | 287 atom_cache_(xdisplay_, kAtomsToCache) {} |
| 288 } | |
| 289 | 288 |
| 290 std::vector<gfx::Display> DesktopScreenX11::BuildDisplaysFromXRandRInfo() { | 289 std::vector<display::Display> DesktopScreenX11::BuildDisplaysFromXRandRInfo() { |
| 291 std::vector<gfx::Display> displays; | 290 std::vector<display::Display> displays; |
| 292 gfx::XScopedPtr< | 291 gfx::XScopedPtr< |
| 293 XRRScreenResources, | 292 XRRScreenResources, |
| 294 gfx::XObjectDeleter<XRRScreenResources, void, XRRFreeScreenResources>> | 293 gfx::XObjectDeleter<XRRScreenResources, void, XRRFreeScreenResources>> |
| 295 resources(XRRGetScreenResourcesCurrent(xdisplay_, x_root_window_)); | 294 resources(XRRGetScreenResourcesCurrent(xdisplay_, x_root_window_)); |
| 296 if (!resources) { | 295 if (!resources) { |
| 297 LOG(ERROR) << "XRandR returned no displays. Falling back to Root Window."; | 296 LOG(ERROR) << "XRandR returned no displays. Falling back to Root Window."; |
| 298 return GetFallbackDisplayList(); | 297 return GetFallbackDisplayList(); |
| 299 } | 298 } |
| 300 | 299 |
| 301 bool has_work_area = false; | 300 bool has_work_area = false; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 327 | 326 |
| 328 int64_t display_id = -1; | 327 int64_t display_id = -1; |
| 329 if (!ui::EDIDParserX11(output_id).GetDisplayId(static_cast<uint8_t>(i), | 328 if (!ui::EDIDParserX11(output_id).GetDisplayId(static_cast<uint8_t>(i), |
| 330 &display_id)) { | 329 &display_id)) { |
| 331 // It isn't ideal, but if we can't parse the EDID data, fallback on the | 330 // It isn't ideal, but if we can't parse the EDID data, fallback on the |
| 332 // display number. | 331 // display number. |
| 333 display_id = i; | 332 display_id = i; |
| 334 } | 333 } |
| 335 | 334 |
| 336 gfx::Rect crtc_bounds(crtc->x, crtc->y, crtc->width, crtc->height); | 335 gfx::Rect crtc_bounds(crtc->x, crtc->y, crtc->width, crtc->height); |
| 337 gfx::Display display(display_id, crtc_bounds); | 336 display::Display display(display_id, crtc_bounds); |
| 338 | 337 |
| 339 if (!gfx::Display::HasForceDeviceScaleFactor()) { | 338 if (!display::Display::HasForceDeviceScaleFactor()) { |
| 340 display.SetScaleAndBounds(device_scale_factor, crtc_bounds); | 339 display.SetScaleAndBounds(device_scale_factor, crtc_bounds); |
| 341 } | 340 } |
| 342 | 341 |
| 343 if (has_work_area) { | 342 if (has_work_area) { |
| 344 gfx::Rect intersection_in_pixels = crtc_bounds; | 343 gfx::Rect intersection_in_pixels = crtc_bounds; |
| 345 intersection_in_pixels.Intersect(work_area_in_pixels); | 344 intersection_in_pixels.Intersect(work_area_in_pixels); |
| 346 // SetScaleAndBounds() above does the conversion from pixels to DIP for | 345 // SetScaleAndBounds() above does the conversion from pixels to DIP for |
| 347 // us, but set_work_area does not, so we need to do it here. | 346 // us, but set_work_area does not, so we need to do it here. |
| 348 display.set_work_area(gfx::Rect( | 347 display.set_work_area(gfx::Rect( |
| 349 gfx::ScaleToFlooredPoint(intersection_in_pixels.origin(), | 348 gfx::ScaleToFlooredPoint(intersection_in_pixels.origin(), |
| 350 1.0f / display.device_scale_factor()), | 349 1.0f / display.device_scale_factor()), |
| 351 gfx::ScaleToFlooredSize(intersection_in_pixels.size(), | 350 gfx::ScaleToFlooredSize(intersection_in_pixels.size(), |
| 352 1.0f / display.device_scale_factor()))); | 351 1.0f / display.device_scale_factor()))); |
| 353 } | 352 } |
| 354 | 353 |
| 355 switch (crtc->rotation) { | 354 switch (crtc->rotation) { |
| 356 case RR_Rotate_0: | 355 case RR_Rotate_0: |
| 357 display.set_rotation(gfx::Display::ROTATE_0); | 356 display.set_rotation(display::Display::ROTATE_0); |
| 358 break; | 357 break; |
| 359 case RR_Rotate_90: | 358 case RR_Rotate_90: |
| 360 display.set_rotation(gfx::Display::ROTATE_90); | 359 display.set_rotation(display::Display::ROTATE_90); |
| 361 break; | 360 break; |
| 362 case RR_Rotate_180: | 361 case RR_Rotate_180: |
| 363 display.set_rotation(gfx::Display::ROTATE_180); | 362 display.set_rotation(display::Display::ROTATE_180); |
| 364 break; | 363 break; |
| 365 case RR_Rotate_270: | 364 case RR_Rotate_270: |
| 366 display.set_rotation(gfx::Display::ROTATE_270); | 365 display.set_rotation(display::Display::ROTATE_270); |
| 367 break; | 366 break; |
| 368 } | 367 } |
| 369 | 368 |
| 370 displays.push_back(display); | 369 displays.push_back(display); |
| 371 } | 370 } |
| 372 } | 371 } |
| 373 | 372 |
| 374 if (displays.empty()) | 373 if (displays.empty()) |
| 375 return GetFallbackDisplayList(); | 374 return GetFallbackDisplayList(); |
| 376 | 375 |
| 377 return displays; | 376 return displays; |
| 378 } | 377 } |
| 379 | 378 |
| 380 void DesktopScreenX11::ConfigureTimerFired() { | 379 void DesktopScreenX11::ConfigureTimerFired() { |
| 381 std::vector<gfx::Display> old_displays = displays_; | 380 std::vector<display::Display> old_displays = displays_; |
| 382 SetDisplaysInternal(BuildDisplaysFromXRandRInfo()); | 381 SetDisplaysInternal(BuildDisplaysFromXRandRInfo()); |
| 383 change_notifier_.NotifyDisplaysChanged(old_displays, displays_); | 382 change_notifier_.NotifyDisplaysChanged(old_displays, displays_); |
| 384 } | 383 } |
| 385 | 384 |
| 386 void DesktopScreenX11::SetDisplaysInternal( | 385 void DesktopScreenX11::SetDisplaysInternal( |
| 387 const std::vector<gfx::Display>& displays) { | 386 const std::vector<display::Display>& displays) { |
| 388 displays_ = displays; | 387 displays_ = displays; |
| 389 gfx::SetFontRenderParamsDeviceScaleFactor( | 388 gfx::SetFontRenderParamsDeviceScaleFactor( |
| 390 GetPrimaryDisplay().device_scale_factor()); | 389 GetPrimaryDisplay().device_scale_factor()); |
| 391 } | 390 } |
| 392 | 391 |
| 393 //////////////////////////////////////////////////////////////////////////////// | 392 //////////////////////////////////////////////////////////////////////////////// |
| 394 | 393 |
| 395 gfx::Screen* CreateDesktopScreen() { | 394 display::Screen* CreateDesktopScreen() { |
| 396 return new DesktopScreenX11; | 395 return new DesktopScreenX11; |
| 397 } | 396 } |
| 398 | 397 |
| 399 } // namespace views | 398 } // namespace views |
| OLD | NEW |