| OLD | NEW |
| 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 #include "chromeos/display/real_output_configurator_delegate.h" | 5 #include "chromeos/display/real_output_configurator_delegate.h" |
| 6 | 6 |
| 7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/extensions/dpms.h> | 9 #include <X11/extensions/dpms.h> |
| 10 #include <X11/extensions/XInput.h> | 10 #include <X11/extensions/XInput.h> |
| 11 #include <X11/extensions/XInput2.h> | 11 #include <X11/extensions/XInput2.h> |
| 12 #include <X11/extensions/Xrandr.h> | 12 #include <X11/extensions/Xrandr.h> |
| 13 | 13 |
| 14 #include <cmath> | 14 #include <cmath> |
| 15 #include <set> | 15 #include <set> |
| 16 #include <utility> | 16 #include <utility> |
| 17 | 17 |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/message_loop/message_pump_aurax11.h" | 19 #include "base/message_loop/message_pump_x11.h" |
| 20 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
| 21 #include "chromeos/dbus/power_manager_client.h" | 21 #include "chromeos/dbus/power_manager_client.h" |
| 22 #include "chromeos/display/output_util.h" | 22 #include "chromeos/display/output_util.h" |
| 23 | 23 |
| 24 namespace chromeos { | 24 namespace chromeos { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // DPI measurements. | 28 // DPI measurements. |
| 29 const float kMmInInch = 25.4; | 29 const float kMmInInch = 25.4; |
| 30 const float kDpi96 = 96.0; | 30 const float kDpi96 = 96.0; |
| 31 const float kPixelsToMmScale = kMmInInch / kDpi96; | 31 const float kPixelsToMmScale = kMmInInch / kDpi96; |
| 32 | 32 |
| 33 bool IsInternalOutput(const XRROutputInfo* output_info) { | 33 bool IsInternalOutput(const XRROutputInfo* output_info) { |
| 34 return IsInternalOutputName(std::string(output_info->name)); | 34 return IsInternalOutputName(std::string(output_info->name)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 RRMode GetOutputNativeMode(const XRROutputInfo* output_info) { | 37 RRMode GetOutputNativeMode(const XRROutputInfo* output_info) { |
| 38 return output_info->nmode > 0 ? output_info->modes[0] : None; | 38 return output_info->nmode > 0 ? output_info->modes[0] : None; |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 RealOutputConfiguratorDelegate::RealOutputConfiguratorDelegate() | 43 RealOutputConfiguratorDelegate::RealOutputConfiguratorDelegate() |
| 44 : display_(base::MessagePumpAuraX11::GetDefaultXDisplay()), | 44 : display_(base::MessagePumpX11::GetDefaultXDisplay()), |
| 45 window_(DefaultRootWindow(display_)), | 45 window_(DefaultRootWindow(display_)), |
| 46 screen_(NULL), | 46 screen_(NULL), |
| 47 is_panel_fitting_enabled_(false) { | 47 is_panel_fitting_enabled_(false) { |
| 48 } | 48 } |
| 49 | 49 |
| 50 RealOutputConfiguratorDelegate::~RealOutputConfiguratorDelegate() { | 50 RealOutputConfiguratorDelegate::~RealOutputConfiguratorDelegate() { |
| 51 } | 51 } |
| 52 | 52 |
| 53 void RealOutputConfiguratorDelegate::SetPanelFittingEnabled(bool enabled) { | 53 void RealOutputConfiguratorDelegate::SetPanelFittingEnabled(bool enabled) { |
| 54 is_panel_fitting_enabled_ = enabled; | 54 is_panel_fitting_enabled_ = enabled; |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 << (*outputs)[i].touch_device_id << " to output #" << i; | 638 << (*outputs)[i].touch_device_id << " to output #" << i; |
| 639 break; | 639 break; |
| 640 } | 640 } |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 | 643 |
| 644 XIFreeDeviceInfo(info); | 644 XIFreeDeviceInfo(info); |
| 645 } | 645 } |
| 646 | 646 |
| 647 } // namespace chromeos | 647 } // namespace chromeos |
| OLD | NEW |