| 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 <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "ash/display/window_tree_host_manager.h" | 14 #include "ash/display/window_tree_host_manager.h" |
| 15 #include "ash/screen_util.h" | 15 #include "ash/screen_util.h" |
| 16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "ui/aura/client/cursor_client.h" | 18 #include "ui/aura/client/cursor_client.h" |
| 19 #include "ui/aura/client/screen_position_client.h" | 19 #include "ui/aura/client/screen_position_client.h" |
| 20 #include "ui/aura/env.h" | 20 #include "ui/aura/env.h" |
| 21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 22 #include "ui/aura/window_event_dispatcher.h" | 22 #include "ui/aura/window_event_dispatcher.h" |
| 23 #include "ui/aura/window_tree_host.h" | 23 #include "ui/aura/window_tree_host.h" |
| 24 #include "ui/events/devices/input_device.h" | 24 #include "ui/events/devices/input_device.h" |
| 25 #include "ui/events/devices/keyboard_device.h" | |
| 26 #include "ui/events/devices/x11/device_data_manager_x11.h" | 25 #include "ui/events/devices/x11/device_data_manager_x11.h" |
| 27 #include "ui/events/devices/x11/device_list_cache_x11.h" | 26 #include "ui/events/devices/x11/device_list_cache_x11.h" |
| 28 #include "ui/events/event.h" | 27 #include "ui/events/event.h" |
| 29 #include "ui/events/event_utils.h" | 28 #include "ui/events/event_utils.h" |
| 30 #include "ui/events/keycodes/keyboard_codes_posix.h" | 29 #include "ui/events/keycodes/keyboard_codes_posix.h" |
| 31 #include "ui/events/platform/platform_event_source.h" | 30 #include "ui/events/platform/platform_event_source.h" |
| 32 #include "ui/gfx/x/x11_types.h" | 31 #include "ui/gfx/x/x11_types.h" |
| 33 | 32 |
| 34 namespace ash { | 33 namespace ash { |
| 35 | 34 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 touchpad_device_id_ = xi_dev_list[i].deviceid; | 90 touchpad_device_id_ = xi_dev_list[i].deviceid; |
| 92 device_data_manager->DisableDevice(touchpad_device_id_); | 91 device_data_manager->DisableDevice(touchpad_device_id_); |
| 93 Shell::GetInstance()->cursor_manager()->HideCursor(); | 92 Shell::GetInstance()->cursor_manager()->HideCursor(); |
| 94 } | 93 } |
| 95 } else if (device_name == kCoreKeyboardName) { | 94 } else if (device_name == kCoreKeyboardName) { |
| 96 core_keyboard_device_id_ = xi_dev_list[i].deviceid; | 95 core_keyboard_device_id_ = xi_dev_list[i].deviceid; |
| 97 device_data_manager->DisableDevice(core_keyboard_device_id_); | 96 device_data_manager->DisableDevice(core_keyboard_device_id_); |
| 98 } | 97 } |
| 99 } | 98 } |
| 100 | 99 |
| 101 for (const ui::KeyboardDevice& device : | 100 for (const ui::InputDevice& device : |
| 102 device_data_manager->keyboard_devices()) { | 101 device_data_manager->keyboard_devices()) { |
| 103 if (device.type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL) { | 102 if (device.type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL) { |
| 104 keyboard_device_id_ = device.id; | 103 keyboard_device_id_ = device.id; |
| 105 device_data_manager->DisableDevice(keyboard_device_id_); | 104 device_data_manager->DisableDevice(keyboard_device_id_); |
| 106 break; | 105 break; |
| 107 } | 106 } |
| 108 } | 107 } |
| 109 } | 108 } |
| 110 // Allow the accessible keys present on the side of some devices to continue | 109 // Allow the accessible keys present on the side of some devices to continue |
| 111 // working. | 110 // working. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // blocked. Move the mouse cursor back to its last known location resulting | 159 // blocked. Move the mouse cursor back to its last known location resulting |
| 161 // from an external mouse to prevent the internal touchpad from moving it. | 160 // from an external mouse to prevent the internal touchpad from moving it. |
| 162 SetMouseLocationInScreen(last_mouse_location_); | 161 SetMouseLocationInScreen(last_mouse_location_); |
| 163 } else { | 162 } else { |
| 164 // Track the last location seen from an external mouse event. | 163 // Track the last location seen from an external mouse event. |
| 165 last_mouse_location_ = GetMouseLocationInScreen(); | 164 last_mouse_location_ = GetMouseLocationInScreen(); |
| 166 } | 165 } |
| 167 } | 166 } |
| 168 | 167 |
| 169 } // namespace ash | 168 } // namespace ash |
| OLD | NEW |