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/Xlib.h> |
| 8 #include <X11/extensions/XInput2.h> |
7 #include <set> | 9 #include <set> |
8 #include <X11/extensions/XInput2.h> | 10 #include <utility> |
9 #include <X11/Xlib.h> | |
10 | 11 |
11 #include "ash/display/window_tree_host_manager.h" | 12 #include "ash/display/window_tree_host_manager.h" |
12 #include "ash/screen_util.h" | 13 #include "ash/screen_util.h" |
13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 #include "ui/aura/client/cursor_client.h" | 17 #include "ui/aura/client/cursor_client.h" |
17 #include "ui/aura/client/screen_position_client.h" | 18 #include "ui/aura/client/screen_position_client.h" |
18 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
19 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 106 } |
106 } | 107 } |
107 } | 108 } |
108 // 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 |
109 // working. | 110 // working. |
110 scoped_ptr<std::set<ui::KeyboardCode> > excepted_keys( | 111 scoped_ptr<std::set<ui::KeyboardCode> > excepted_keys( |
111 new std::set<ui::KeyboardCode>); | 112 new std::set<ui::KeyboardCode>); |
112 excepted_keys->insert(ui::VKEY_VOLUME_DOWN); | 113 excepted_keys->insert(ui::VKEY_VOLUME_DOWN); |
113 excepted_keys->insert(ui::VKEY_VOLUME_UP); | 114 excepted_keys->insert(ui::VKEY_VOLUME_UP); |
114 excepted_keys->insert(ui::VKEY_POWER); | 115 excepted_keys->insert(ui::VKEY_POWER); |
115 device_data_manager->SetDisabledKeyboardAllowedKeys(excepted_keys.Pass()); | 116 device_data_manager->SetDisabledKeyboardAllowedKeys(std::move(excepted_keys)); |
116 ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this); | 117 ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this); |
117 } | 118 } |
118 | 119 |
119 ScopedDisableInternalMouseAndKeyboardX11:: | 120 ScopedDisableInternalMouseAndKeyboardX11:: |
120 ~ScopedDisableInternalMouseAndKeyboardX11() { | 121 ~ScopedDisableInternalMouseAndKeyboardX11() { |
121 ui::DeviceDataManagerX11* device_data_manager = | 122 ui::DeviceDataManagerX11* device_data_manager = |
122 static_cast<ui::DeviceDataManagerX11*>( | 123 static_cast<ui::DeviceDataManagerX11*>( |
123 ui::DeviceDataManager::GetInstance()); | 124 ui::DeviceDataManager::GetInstance()); |
124 if (touchpad_device_id_ != kDeviceIdNone) { | 125 if (touchpad_device_id_ != kDeviceIdNone) { |
125 device_data_manager->EnableDevice(touchpad_device_id_); | 126 device_data_manager->EnableDevice(touchpad_device_id_); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // 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 |
159 // 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. |
160 SetMouseLocationInScreen(last_mouse_location_); | 161 SetMouseLocationInScreen(last_mouse_location_); |
161 } else { | 162 } else { |
162 // Track the last location seen from an external mouse event. | 163 // Track the last location seen from an external mouse event. |
163 last_mouse_location_ = GetMouseLocationInScreen(); | 164 last_mouse_location_ = GetMouseLocationInScreen(); |
164 } | 165 } |
165 } | 166 } |
166 | 167 |
167 } // namespace ash | 168 } // namespace ash |
OLD | NEW |