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 #ifndef UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 21 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
22 #include "ui/events/ozone/evdev/touch_evdev_debug_buffer.h" | 22 #include "ui/events/ozone/evdev/touch_evdev_debug_buffer.h" |
23 | 23 |
24 namespace gfx { | 24 namespace gfx { |
25 class PointF; | 25 class PointF; |
26 } | 26 } |
27 | 27 |
28 namespace ui { | 28 namespace ui { |
29 | 29 |
30 class DeviceEventDispatcherEvdev; | 30 class DeviceEventDispatcherEvdev; |
| 31 class PalmSuppressionFilter; |
31 class TouchEvent; | 32 class TouchEvent; |
32 class TouchNoiseFinder; | 33 class TouchNoiseFinder; |
33 struct InProgressTouchEvdev; | 34 struct InProgressTouchEvdev; |
34 struct PointerDetails; | 35 struct PointerDetails; |
35 | 36 |
36 class EVENTS_OZONE_EVDEV_EXPORT TouchEventConverterEvdev | 37 class EVENTS_OZONE_EVDEV_EXPORT TouchEventConverterEvdev |
37 : public EventConverterEvdev { | 38 : public EventConverterEvdev { |
38 public: | 39 public: |
39 TouchEventConverterEvdev(int fd, | 40 TouchEventConverterEvdev(int fd, |
40 base::FilePath path, | 41 base::FilePath path, |
41 int id, | 42 int id, |
42 const EventDeviceInfo& devinfo, | 43 const EventDeviceInfo& devinfo, |
43 DeviceEventDispatcherEvdev* dispatcher); | 44 DeviceEventDispatcherEvdev* dispatcher); |
44 ~TouchEventConverterEvdev() override; | 45 ~TouchEventConverterEvdev() override; |
45 | 46 |
46 // EventConverterEvdev: | 47 // EventConverterEvdev: |
47 bool HasTouchscreen() const override; | 48 bool HasTouchscreen() const override; |
| 49 bool HasPen() const override; |
48 gfx::Size GetTouchscreenSize() const override; | 50 gfx::Size GetTouchscreenSize() const override; |
49 int GetTouchPoints() const override; | 51 int GetTouchPoints() const override; |
50 void OnEnabled() override; | 52 void OnEnabled() override; |
51 void OnDisabled() override; | 53 void OnDisabled() override; |
| 54 void SetPalmSuppressionFilter(PalmSuppressionFilter* palm_filter) override; |
52 | 55 |
53 void DumpTouchEventLog(const char* filename) override; | 56 void DumpTouchEventLog(const char* filename) override; |
54 | 57 |
55 // Update touch event logging state | 58 // Update touch event logging state |
56 void SetTouchEventLoggingEnabled(bool enabled) override; | 59 void SetTouchEventLoggingEnabled(bool enabled) override; |
57 | 60 |
58 // Unsafe part of initialization. | 61 // Unsafe part of initialization. |
59 virtual void Initialize(const EventDeviceInfo& info); | 62 virtual void Initialize(const EventDeviceInfo& info); |
60 | 63 |
61 private: | 64 private: |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 100 |
98 // Dispatcher for events. | 101 // Dispatcher for events. |
99 DeviceEventDispatcherEvdev* dispatcher_; | 102 DeviceEventDispatcherEvdev* dispatcher_; |
100 | 103 |
101 // Set if we drop events in kernel (SYN_DROPPED) or in process. | 104 // Set if we drop events in kernel (SYN_DROPPED) or in process. |
102 bool dropped_events_ = false; | 105 bool dropped_events_ = false; |
103 | 106 |
104 // Device has multitouch capability. | 107 // Device has multitouch capability. |
105 bool has_mt_ = false; | 108 bool has_mt_ = false; |
106 | 109 |
| 110 // Device has pen capability. |
| 111 bool has_pen_ = false; |
| 112 |
107 // Use BTN_LEFT instead of BT_TOUCH. | 113 // Use BTN_LEFT instead of BT_TOUCH. |
108 bool quirk_left_mouse_button_ = false; | 114 bool quirk_left_mouse_button_ = false; |
109 | 115 |
110 // Pressure values. | 116 // Pressure values. |
111 int pressure_min_; | 117 int pressure_min_; |
112 int pressure_max_; // Used to normalize pressure values. | 118 int pressure_max_; // Used to normalize pressure values. |
113 | 119 |
114 // Input range for x-axis. | 120 // Input range for x-axis. |
115 float x_min_tuxels_; | 121 float x_min_tuxels_; |
116 float x_num_tuxels_; | 122 float x_num_tuxels_; |
117 | 123 |
118 // Input range for y-axis. | 124 // Input range for y-axis. |
119 float y_min_tuxels_; | 125 float y_min_tuxels_; |
120 float y_num_tuxels_; | 126 float y_num_tuxels_; |
121 | 127 |
122 // Number of touch points reported by driver | 128 // Number of touch points reported by driver |
123 int touch_points_ = 0; | 129 int touch_points_ = 0; |
124 | 130 |
| 131 // Maximum value of touch major axis |
| 132 int major_max_ = 0; |
| 133 |
125 // Tracking id counter. | 134 // Tracking id counter. |
126 int next_tracking_id_ = 0; | 135 int next_tracking_id_ = 0; |
127 | 136 |
128 // Touch point currently being updated from the /dev/input/event* stream. | 137 // Touch point currently being updated from the /dev/input/event* stream. |
129 size_t current_slot_ = 0; | 138 size_t current_slot_ = 0; |
130 | 139 |
131 // Flag that indicates if the touch logging enabled or not. | 140 // Flag that indicates if the touch logging enabled or not. |
132 bool touch_logging_enabled_ = true; | 141 bool touch_logging_enabled_ = true; |
133 | 142 |
134 // In-progress touch points. | 143 // In-progress touch points. |
135 std::vector<InProgressTouchEvdev> events_; | 144 std::vector<InProgressTouchEvdev> events_; |
136 | 145 |
137 // Finds touch noise. | 146 // Finds touch noise. |
138 std::unique_ptr<TouchNoiseFinder> touch_noise_finder_; | 147 std::unique_ptr<TouchNoiseFinder> touch_noise_finder_; |
139 | 148 |
140 // Records the recent touch events. It is used to fill the feedback reports | 149 // Records the recent touch events. It is used to fill the feedback reports |
141 TouchEventLogEvdev touch_evdev_debug_buffer_; | 150 TouchEventLogEvdev touch_evdev_debug_buffer_; |
142 | 151 |
| 152 // Decides whether events should be dropped for palm suppression. |
| 153 PalmSuppressionFilter* palm_filter_; |
| 154 |
143 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); | 155 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); |
144 }; | 156 }; |
145 | 157 |
146 } // namespace ui | 158 } // namespace ui |
147 | 159 |
148 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ | 160 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ |
OLD | NEW |