| 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. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "ui/gfx/x/x11_types.h" | 27 #include "ui/gfx/x/x11_types.h" |
| 28 #include "ui/views/linux_ui/linux_ui.h" | 28 #include "ui/views/linux_ui/linux_ui.h" |
| 29 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 29 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| 30 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" | 30 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| 31 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" | 31 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 // The delay to perform configuration after RRNotify. See the comment | 35 // The delay to perform configuration after RRNotify. See the comment |
| 36 // in |Dispatch()|. | 36 // in |Dispatch()|. |
| 37 const int64 kConfigureDelayMs = 500; | 37 const int64_t kConfigureDelayMs = 500; |
| 38 | 38 |
| 39 double GetDeviceScaleFactor() { | 39 double GetDeviceScaleFactor() { |
| 40 float device_scale_factor = 1.0f; | 40 float device_scale_factor = 1.0f; |
| 41 if (views::LinuxUI::instance()) | 41 if (views::LinuxUI::instance()) |
| 42 device_scale_factor = | 42 device_scale_factor = |
| 43 views::LinuxUI::instance()->GetDeviceScaleFactor(); | 43 views::LinuxUI::instance()->GetDeviceScaleFactor(); |
| 44 return device_scale_factor; | 44 return device_scale_factor; |
| 45 } | 45 } |
| 46 | 46 |
| 47 gfx::Point PixelToDIPPoint(const gfx::Point& pixel_point) { | 47 gfx::Point PixelToDIPPoint(const gfx::Point& pixel_point) { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 302 |
| 303 bool is_connected = (output_info->connection == RR_Connected); | 303 bool is_connected = (output_info->connection == RR_Connected); |
| 304 if (!is_connected) | 304 if (!is_connected) |
| 305 continue; | 305 continue; |
| 306 | 306 |
| 307 if (output_info->crtc) { | 307 if (output_info->crtc) { |
| 308 gfx::XScopedPtr<XRRCrtcInfo, | 308 gfx::XScopedPtr<XRRCrtcInfo, |
| 309 gfx::XObjectDeleter<XRRCrtcInfo, void, XRRFreeCrtcInfo>> | 309 gfx::XObjectDeleter<XRRCrtcInfo, void, XRRFreeCrtcInfo>> |
| 310 crtc(XRRGetCrtcInfo(xdisplay_, resources.get(), output_info->crtc)); | 310 crtc(XRRGetCrtcInfo(xdisplay_, resources.get(), output_info->crtc)); |
| 311 | 311 |
| 312 int64 display_id = -1; | 312 int64_t display_id = -1; |
| 313 if (!ui::GetDisplayId(output_id, static_cast<uint8>(i), &display_id)) { | 313 if (!ui::GetDisplayId(output_id, static_cast<uint8_t>(i), &display_id)) { |
| 314 // It isn't ideal, but if we can't parse the EDID data, fallback on the | 314 // It isn't ideal, but if we can't parse the EDID data, fallback on the |
| 315 // display number. | 315 // display number. |
| 316 display_id = i; | 316 display_id = i; |
| 317 } | 317 } |
| 318 | 318 |
| 319 gfx::Rect crtc_bounds(crtc->x, crtc->y, crtc->width, crtc->height); | 319 gfx::Rect crtc_bounds(crtc->x, crtc->y, crtc->width, crtc->height); |
| 320 gfx::Display display(display_id, crtc_bounds); | 320 gfx::Display display(display_id, crtc_bounds); |
| 321 | 321 |
| 322 if (!gfx::Display::HasForceDeviceScaleFactor()) { | 322 if (!gfx::Display::HasForceDeviceScaleFactor()) { |
| 323 display.SetScaleAndBounds(device_scale_factor, crtc_bounds); | 323 display.SetScaleAndBounds(device_scale_factor, crtc_bounds); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 change_notifier_.NotifyDisplaysChanged(old_displays, displays_); | 367 change_notifier_.NotifyDisplaysChanged(old_displays, displays_); |
| 368 } | 368 } |
| 369 | 369 |
| 370 //////////////////////////////////////////////////////////////////////////////// | 370 //////////////////////////////////////////////////////////////////////////////// |
| 371 | 371 |
| 372 gfx::Screen* CreateDesktopScreen() { | 372 gfx::Screen* CreateDesktopScreen() { |
| 373 return new DesktopScreenX11; | 373 return new DesktopScreenX11; |
| 374 } | 374 } |
| 375 | 375 |
| 376 } // namespace views | 376 } // namespace views |
| OLD | NEW |