Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc

Issue 685793002: Move all event related devices from ui/events/ to ui/events/devices/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@internal-touchscreens
Patch Set: fix ozone Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/virtual_keyboard_controller_unittest.cc ('k') | ash/wm/system_gesture_event_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "ash/display/display_controller.h" 11 #include "ash/display/display_controller.h"
12 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "ui/aura/client/screen_position_client.h" 16 #include "ui/aura/client/screen_position_client.h"
17 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
18 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
19 #include "ui/aura/window_event_dispatcher.h" 19 #include "ui/aura/window_event_dispatcher.h"
20 #include "ui/aura/window_tree_host.h" 20 #include "ui/aura/window_tree_host.h"
21 #include "ui/events/devices/x11/device_data_manager_x11.h"
22 #include "ui/events/devices/x11/device_list_cache_x11.h"
21 #include "ui/events/event.h" 23 #include "ui/events/event.h"
22 #include "ui/events/event_utils.h" 24 #include "ui/events/event_utils.h"
23 #include "ui/events/keycodes/keyboard_codes_posix.h" 25 #include "ui/events/keycodes/keyboard_codes_posix.h"
24 #include "ui/events/platform/platform_event_source.h" 26 #include "ui/events/platform/platform_event_source.h"
25 #include "ui/events/x/device_data_manager_x11.h"
26 #include "ui/events/x/device_list_cache_x.h"
27 #include "ui/gfx/x/x11_types.h" 27 #include "ui/gfx/x/x11_types.h"
28 28
29 namespace ash { 29 namespace ash {
30 30
31 namespace { 31 namespace {
32 32
33 // The name of the xinput device corresponding to the internal touchpad. 33 // The name of the xinput device corresponding to the internal touchpad.
34 const char kInternalTouchpadName[] = "Elan Touchpad"; 34 const char kInternalTouchpadName[] = "Elan Touchpad";
35 35
36 // The name of the xinput device corresponding to the internal keyboard. 36 // The name of the xinput device corresponding to the internal keyboard.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 ScopedDisableInternalMouseAndKeyboardX11() 68 ScopedDisableInternalMouseAndKeyboardX11()
69 : touchpad_device_id_(kDeviceIdNone), 69 : touchpad_device_id_(kDeviceIdNone),
70 keyboard_device_id_(kDeviceIdNone), 70 keyboard_device_id_(kDeviceIdNone),
71 core_keyboard_device_id_(kDeviceIdNone), 71 core_keyboard_device_id_(kDeviceIdNone),
72 last_mouse_location_(GetMouseLocationInScreen()) { 72 last_mouse_location_(GetMouseLocationInScreen()) {
73 73
74 ui::DeviceDataManagerX11* device_data_manager = 74 ui::DeviceDataManagerX11* device_data_manager =
75 static_cast<ui::DeviceDataManagerX11*>( 75 static_cast<ui::DeviceDataManagerX11*>(
76 ui::DeviceDataManager::GetInstance()); 76 ui::DeviceDataManager::GetInstance());
77 if (device_data_manager->IsXInput2Available()) { 77 if (device_data_manager->IsXInput2Available()) {
78 XIDeviceList xi_dev_list = ui::DeviceListCacheX::GetInstance()-> 78 XIDeviceList xi_dev_list = ui::DeviceListCacheX11::GetInstance()->
79 GetXI2DeviceList(gfx::GetXDisplay()); 79 GetXI2DeviceList(gfx::GetXDisplay());
80 for (int i = 0; i < xi_dev_list.count; ++i) { 80 for (int i = 0; i < xi_dev_list.count; ++i) {
81 std::string device_name(xi_dev_list[i].name); 81 std::string device_name(xi_dev_list[i].name);
82 base::TrimWhitespaceASCII(device_name, base::TRIM_TRAILING, &device_name); 82 base::TrimWhitespaceASCII(device_name, base::TRIM_TRAILING, &device_name);
83 if (device_name == kInternalTouchpadName) { 83 if (device_name == kInternalTouchpadName) {
84 touchpad_device_id_ = xi_dev_list[i].deviceid; 84 touchpad_device_id_ = xi_dev_list[i].deviceid;
85 device_data_manager->DisableDevice(touchpad_device_id_); 85 device_data_manager->DisableDevice(touchpad_device_id_);
86 } else if (device_name == kInternalKeyboardName) { 86 } else if (device_name == kInternalKeyboardName) {
87 keyboard_device_id_ = xi_dev_list[i].deviceid; 87 keyboard_device_id_ = xi_dev_list[i].deviceid;
88 device_data_manager->DisableDevice(keyboard_device_id_); 88 device_data_manager->DisableDevice(keyboard_device_id_);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // blocked. Move the mouse cursor back to its last known location resulting 143 // blocked. Move the mouse cursor back to its last known location resulting
144 // from an external mouse to prevent the internal touchpad from moving it. 144 // from an external mouse to prevent the internal touchpad from moving it.
145 SetMouseLocationInScreen(last_mouse_location_); 145 SetMouseLocationInScreen(last_mouse_location_);
146 } else { 146 } else {
147 // Track the last location seen from an external mouse event. 147 // Track the last location seen from an external mouse event.
148 last_mouse_location_ = GetMouseLocationInScreen(); 148 last_mouse_location_ = GetMouseLocationInScreen();
149 } 149 }
150 } 150 }
151 151
152 } // namespace ash 152 } // namespace ash
OLDNEW
« no previous file with comments | « ash/virtual_keyboard_controller_unittest.cc ('k') | ash/wm/system_gesture_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698