| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" | 5 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 ScopedDisableInternalMouseAndKeyboardX11() | 69 ScopedDisableInternalMouseAndKeyboardX11() |
| 70 : touchpad_device_id_(kDeviceIdNone), | 70 : touchpad_device_id_(kDeviceIdNone), |
| 71 keyboard_device_id_(kDeviceIdNone), | 71 keyboard_device_id_(kDeviceIdNone), |
| 72 core_keyboard_device_id_(kDeviceIdNone), | 72 core_keyboard_device_id_(kDeviceIdNone), |
| 73 last_mouse_location_(GetMouseLocationInScreen()) { | 73 last_mouse_location_(GetMouseLocationInScreen()) { |
| 74 | 74 |
| 75 ui::DeviceDataManagerX11* device_data_manager = | 75 ui::DeviceDataManagerX11* device_data_manager = |
| 76 static_cast<ui::DeviceDataManagerX11*>( | 76 static_cast<ui::DeviceDataManagerX11*>( |
| 77 ui::DeviceDataManager::GetInstance()); | 77 ui::DeviceDataManager::GetInstance()); |
| 78 if (device_data_manager->IsXInput2Available()) { | 78 if (device_data_manager->IsXInput2Available()) { |
| 79 XIDeviceList xi_dev_list = ui::DeviceListCacheX11::GetInstance()-> | 79 const XIDeviceList& xi_dev_list = |
| 80 GetXI2DeviceList(gfx::GetXDisplay()); | 80 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList( |
| 81 gfx::GetXDisplay()); |
| 81 for (int i = 0; i < xi_dev_list.count; ++i) { | 82 for (int i = 0; i < xi_dev_list.count; ++i) { |
| 82 std::string device_name(xi_dev_list[i].name); | 83 std::string device_name(xi_dev_list[i].name); |
| 83 base::TrimWhitespaceASCII(device_name, base::TRIM_TRAILING, &device_name); | 84 base::TrimWhitespaceASCII(device_name, base::TRIM_TRAILING, &device_name); |
| 84 if (device_name == kInternalTouchpadName) { | 85 if (device_name == kInternalTouchpadName) { |
| 85 touchpad_device_id_ = xi_dev_list[i].deviceid; | 86 touchpad_device_id_ = xi_dev_list[i].deviceid; |
| 86 device_data_manager->DisableDevice(touchpad_device_id_); | 87 device_data_manager->DisableDevice(touchpad_device_id_); |
| 87 aura::client::GetCursorClient( | 88 aura::client::GetCursorClient( |
| 88 Shell::GetInstance()->GetPrimaryRootWindow())->HideCursor(); | 89 Shell::GetInstance()->GetPrimaryRootWindow())->HideCursor(); |
| 89 } else if (device_name == kInternalKeyboardName) { | 90 } else if (device_name == kInternalKeyboardName) { |
| 90 keyboard_device_id_ = xi_dev_list[i].deviceid; | 91 keyboard_device_id_ = xi_dev_list[i].deviceid; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // blocked. Move the mouse cursor back to its last known location resulting | 147 // blocked. Move the mouse cursor back to its last known location resulting |
| 147 // from an external mouse to prevent the internal touchpad from moving it. | 148 // from an external mouse to prevent the internal touchpad from moving it. |
| 148 SetMouseLocationInScreen(last_mouse_location_); | 149 SetMouseLocationInScreen(last_mouse_location_); |
| 149 } else { | 150 } else { |
| 150 // Track the last location seen from an external mouse event. | 151 // Track the last location seen from an external mouse event. |
| 151 last_mouse_location_ = GetMouseLocationInScreen(); | 152 last_mouse_location_ = GetMouseLocationInScreen(); |
| 152 } | 153 } |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace ash | 156 } // namespace ash |
| OLD | NEW |