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

Side by Side Diff: ui/events/ozone/evdev/event_device_info.h

Issue 672633002: Revert of [Ozone] Properly initialize multitouch slot values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | ui/events/ozone/evdev/event_device_info.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 #include <linux/input.h> 9 #include <linux/input.h>
10 10
11 #include <vector>
12
13 #include "base/basictypes.h" 11 #include "base/basictypes.h"
14 #include "ui/events/ozone/evdev/event_device_util.h" 12 #include "ui/events/ozone/evdev/event_device_util.h"
15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" 13 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
16 14
17 // ABS_MT_SLOT isn't valid options for EVIOCGMTSLOTS ioctl.
18 #define EVDEV_ABS_MT_COUNT (ABS_MAX - ABS_MT_SLOT - 1)
19
20 namespace ui { 15 namespace ui {
21 16
22 // Device information for Linux input devices 17 // Device information for Linux input devices
23 // 18 //
24 // This stores and queries information about input devices; in 19 // This stores and queries information about input devices; in
25 // particular it knows which events the device can generate. 20 // particular it knows which events the device can generate.
26 class EVENTS_OZONE_EVDEV_EXPORT EventDeviceInfo { 21 class EVENTS_OZONE_EVDEV_EXPORT EventDeviceInfo {
27 public: 22 public:
28 EventDeviceInfo(); 23 EventDeviceInfo();
29 ~EventDeviceInfo(); 24 ~EventDeviceInfo();
30 25
31 // Initialize device information from an open device. 26 // Initialize device information from an open device.
32 bool Initialize(int fd); 27 bool Initialize(int fd);
33 28
34 // Check events this device can generate. 29 // Check events this device can generate.
35 bool HasEventType(unsigned int type) const; 30 bool HasEventType(unsigned int type) const;
36 bool HasKeyEvent(unsigned int code) const; 31 bool HasKeyEvent(unsigned int code) const;
37 bool HasRelEvent(unsigned int code) const; 32 bool HasRelEvent(unsigned int code) const;
38 bool HasAbsEvent(unsigned int code) const; 33 bool HasAbsEvent(unsigned int code) const;
39 bool HasMscEvent(unsigned int code) const; 34 bool HasMscEvent(unsigned int code) const;
40 bool HasSwEvent(unsigned int code) const; 35 bool HasSwEvent(unsigned int code) const;
41 bool HasLedEvent(unsigned int code) const; 36 bool HasLedEvent(unsigned int code) const;
42 37
43 // Properties of absolute axes. 38 // Properties of absolute axes.
44 int32 GetAbsMinimum(unsigned int code) const; 39 int32 GetAbsMinimum(unsigned int code) const;
45 int32 GetAbsMaximum(unsigned int code) const; 40 int32 GetAbsMaximum(unsigned int code) const;
46 int32 GetSlotValue(unsigned int code, unsigned int slot) const;
47 41
48 // Check input device properties. 42 // Check input device properties.
49 bool HasProp(unsigned int code) const; 43 bool HasProp(unsigned int code) const;
50 44
51 // Has absolute X & Y axes. 45 // Has absolute X & Y axes.
52 bool HasAbsXY() const; 46 bool HasAbsXY() const;
53 47
54 // Has relativeX & Y axes. 48 // Has relativeX & Y axes.
55 bool HasRelXY() const; 49 bool HasRelXY() const;
56 50
57 // Determine whether absolute device X/Y coordinates are mapped onto the 51 // Determine whether absolute device X/Y coordinates are mapped onto the
58 // screen. This is the case for touchscreens and tablets but not touchpads. 52 // screen. This is the case for touchscreens and tablets but not touchpads.
59 bool IsMappedToScreen() const; 53 bool IsMappedToScreen() const;
60 54
61 private: 55 private:
62 // Return the slot vector in |slot_values_| for |code|.
63 const std::vector<int32_t>& GetMtSlotsForCode(int code) const;
64
65 unsigned long ev_bits_[EVDEV_BITS_TO_LONGS(EV_CNT)]; 56 unsigned long ev_bits_[EVDEV_BITS_TO_LONGS(EV_CNT)];
66 unsigned long key_bits_[EVDEV_BITS_TO_LONGS(KEY_CNT)]; 57 unsigned long key_bits_[EVDEV_BITS_TO_LONGS(KEY_CNT)];
67 unsigned long rel_bits_[EVDEV_BITS_TO_LONGS(REL_CNT)]; 58 unsigned long rel_bits_[EVDEV_BITS_TO_LONGS(REL_CNT)];
68 unsigned long abs_bits_[EVDEV_BITS_TO_LONGS(ABS_CNT)]; 59 unsigned long abs_bits_[EVDEV_BITS_TO_LONGS(ABS_CNT)];
69 unsigned long msc_bits_[EVDEV_BITS_TO_LONGS(MSC_CNT)]; 60 unsigned long msc_bits_[EVDEV_BITS_TO_LONGS(MSC_CNT)];
70 unsigned long sw_bits_[EVDEV_BITS_TO_LONGS(SW_CNT)]; 61 unsigned long sw_bits_[EVDEV_BITS_TO_LONGS(SW_CNT)];
71 unsigned long led_bits_[EVDEV_BITS_TO_LONGS(LED_CNT)]; 62 unsigned long led_bits_[EVDEV_BITS_TO_LONGS(LED_CNT)];
72 unsigned long prop_bits_[EVDEV_BITS_TO_LONGS(INPUT_PROP_CNT)]; 63 unsigned long prop_bits_[EVDEV_BITS_TO_LONGS(INPUT_PROP_CNT)];
73 64
74 struct input_absinfo abs_info_[ABS_CNT]; 65 struct input_absinfo abs_info_[ABS_CNT];
75 66
76 // Store the values for the multi-touch properties for each slot.
77 std::vector<int32_t> slot_values_[EVDEV_ABS_MT_COUNT];
78
79 DISALLOW_COPY_AND_ASSIGN(EventDeviceInfo); 67 DISALLOW_COPY_AND_ASSIGN(EventDeviceInfo);
80 }; 68 };
81 69
82 } // namspace ui 70 } // namspace ui
83 71
84 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ 72 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_
OLDNEW
« no previous file with comments | « no previous file | ui/events/ozone/evdev/event_device_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698