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

Side by Side Diff: ui/events/x/device_data_manager_x11.h

Issue 313913004: Block internal PlatformEvents before they are dispatched in touchview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix updating cursor on enter notify. Created 6 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « ui/events/device_data_manager.cc ('k') | ui/events/x/device_data_manager_x11.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 #ifndef UI_EVENTS_X_DEVICE_DATA_MANAGER_X11_H_ 5 #ifndef UI_EVENTS_X_DEVICE_DATA_MANAGER_X11_H_
6 #define UI_EVENTS_X_DEVICE_DATA_MANAGER_X11_H_ 6 #define UI_EVENTS_X_DEVICE_DATA_MANAGER_X11_H_
7 7
8 // Generically-named #defines from Xlib is conflicting with symbols in GTest. 8 // Generically-named #defines from Xlib is conflicting with symbols in GTest.
9 // So many tests .cc file #undef Bool before including device_data_manager.h, 9 // So many tests .cc file #undef Bool before including device_data_manager.h,
10 // which makes Bool unrecognized in XInput2.h. 10 // which makes Bool unrecognized in XInput2.h.
11 #ifndef Bool 11 #ifndef Bool
12 #define Bool int 12 #define Bool int
13 #endif 13 #endif
14 14
15 #include <X11/extensions/XInput2.h> 15 #include <X11/extensions/XInput2.h>
16 16
17 #include <bitset> 17 #include <bitset>
18 #include <map> 18 #include <map>
19 #include <set>
19 #include <vector> 20 #include <vector>
20 21
21 #include "base/basictypes.h" 22 #include "base/basictypes.h"
22 #include "base/event_types.h" 23 #include "base/event_types.h"
23 #include "base/memory/scoped_ptr.h" 24 #include "base/memory/scoped_ptr.h"
24 #include "ui/events/device_data_manager.h" 25 #include "ui/events/device_data_manager.h"
25 #include "ui/events/event.h" 26 #include "ui/events/event.h"
26 #include "ui/events/event_constants.h" 27 #include "ui/events/event_constants.h"
27 #include "ui/events/events_base_export.h" 28 #include "ui/events/events_base_export.h"
28 #include "ui/gfx/geometry/rect.h" 29 #include "ui/gfx/geometry/rect.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // to have safe default values for testing. 217 // to have safe default values for testing.
217 void SetDeviceListForTest(const std::vector<unsigned int>& touchscreen, 218 void SetDeviceListForTest(const std::vector<unsigned int>& touchscreen,
218 const std::vector<unsigned int>& cmt_devices); 219 const std::vector<unsigned int>& cmt_devices);
219 220
220 void SetValuatorDataForTest(XIDeviceEvent* xievent, 221 void SetValuatorDataForTest(XIDeviceEvent* xievent,
221 DataType type, 222 DataType type,
222 double value); 223 double value);
223 224
224 bool TouchEventNeedsCalibrate(int touch_device_id) const; 225 bool TouchEventNeedsCalibrate(int touch_device_id) const;
225 226
227 // Disables the physical keyboard except for the |excepted_keys| provided.
228 void DisableKeyboard(scoped_ptr<std::set<KeyboardCode> > excepted_keys);
229 // Re-enables the keyboard after a previous call to DisableKeyboard.
230 void EnableKeyboard();
231
232 // Disables and enables events from devices by device id.
233 void DisableDevice(unsigned int deviceid);
234 void EnableDevice(unsigned int deviceid);
235
236 // Returns true if |native_event| should be blocked.
237 bool IsEventBlocked(const base::NativeEvent& native_event);
238
226 private: 239 private:
227 DeviceDataManagerX11(); 240 DeviceDataManagerX11();
228 virtual ~DeviceDataManagerX11(); 241 virtual ~DeviceDataManagerX11();
229 242
230 // Initialize the XInput related system information. 243 // Initialize the XInput related system information.
231 bool InitializeXInputInternal(); 244 bool InitializeXInputInternal();
232 245
233 // Check if an XI event contains data of the specified type. 246 // Check if an XI event contains data of the specified type.
234 bool HasEventData(const XIDeviceEvent* xiev, const DataType type) const; 247 bool HasEventData(const XIDeviceEvent* xiev, const DataType type) const;
235 248
(...skipping 10 matching lines...) Expand all
246 int xi_opcode_; 259 int xi_opcode_;
247 260
248 // A quick lookup table for determining if the XI event is an XIDeviceEvent. 261 // A quick lookup table for determining if the XI event is an XIDeviceEvent.
249 std::bitset<kMaxXIEventType> xi_device_event_types_; 262 std::bitset<kMaxXIEventType> xi_device_event_types_;
250 263
251 // A quick lookup table for determining if events from the pointer device 264 // A quick lookup table for determining if events from the pointer device
252 // should be processed. 265 // should be processed.
253 std::bitset<kMaxDeviceNum> cmt_devices_; 266 std::bitset<kMaxDeviceNum> cmt_devices_;
254 std::bitset<kMaxDeviceNum> touchpads_; 267 std::bitset<kMaxDeviceNum> touchpads_;
255 268
269 // A quick lookup table for determining if events from the XI device
270 // should be blocked.
271 std::bitset<kMaxDeviceNum> blocked_devices_;
272
273 // When true, keyboard events will be blocked.
274 // TODO(flackr): Only block the internal keyboard when XI2 is used for key
275 // events. http://crbug.com/362881.
276 bool blocked_keyboard_;
277
278 // The set of keys allowed while the keyboard is blocked.
279 scoped_ptr<std::set<KeyboardCode> > blocked_keyboard_allowed_keys_;
280
256 // Number of valuators on the specific device. 281 // Number of valuators on the specific device.
257 int valuator_count_[kMaxDeviceNum]; 282 int valuator_count_[kMaxDeviceNum];
258 283
259 // Index table to find the valuator for DataType on the specific device 284 // Index table to find the valuator for DataType on the specific device
260 // by valuator_lookup_[device_id][data_type]. 285 // by valuator_lookup_[device_id][data_type].
261 std::vector<int> valuator_lookup_[kMaxDeviceNum]; 286 std::vector<int> valuator_lookup_[kMaxDeviceNum];
262 287
263 // Index table to find the DataType for valuator on the specific device 288 // Index table to find the DataType for valuator on the specific device
264 // by data_type_lookup_[device_id][valuator]. 289 // by data_type_lookup_[device_id][valuator].
265 std::vector<int> data_type_lookup_[kMaxDeviceNum]; 290 std::vector<int> data_type_lookup_[kMaxDeviceNum];
(...skipping 17 matching lines...) Expand all
283 308
284 unsigned char button_map_[256]; 309 unsigned char button_map_[256];
285 int button_map_count_; 310 int button_map_count_;
286 311
287 DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11); 312 DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11);
288 }; 313 };
289 314
290 } // namespace ui 315 } // namespace ui
291 316
292 #endif // UI_EVENTS_X_DEVICE_DATA_MANAGER_X11_H_ 317 #endif // UI_EVENTS_X_DEVICE_DATA_MANAGER_X11_H_
OLDNEW
« no previous file with comments | « ui/events/device_data_manager.cc ('k') | ui/events/x/device_data_manager_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698