| 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 27 matching lines...) Expand all Loading... |
| 38 public: | 38 public: |
| 39 TouchEventConverterEvdev(int fd, | 39 TouchEventConverterEvdev(int fd, |
| 40 base::FilePath path, | 40 base::FilePath path, |
| 41 int id, | 41 int id, |
| 42 const EventDeviceInfo& devinfo, | 42 const EventDeviceInfo& devinfo, |
| 43 DeviceEventDispatcherEvdev* dispatcher); | 43 DeviceEventDispatcherEvdev* dispatcher); |
| 44 ~TouchEventConverterEvdev() override; | 44 ~TouchEventConverterEvdev() override; |
| 45 | 45 |
| 46 // EventConverterEvdev: | 46 // EventConverterEvdev: |
| 47 bool HasTouchscreen() const override; | 47 bool HasTouchscreen() const override; |
| 48 bool HasPen() const override; |
| 48 gfx::Size GetTouchscreenSize() const override; | 49 gfx::Size GetTouchscreenSize() const override; |
| 49 int GetTouchPoints() const override; | 50 int GetTouchPoints() const override; |
| 50 void OnEnabled() override; | 51 void OnEnabled() override; |
| 51 void OnDisabled() override; | 52 void OnDisabled() override; |
| 52 | 53 |
| 53 void DumpTouchEventLog(const char* filename) override; | 54 void DumpTouchEventLog(const char* filename) override; |
| 54 | 55 |
| 55 // Update touch event logging state | 56 // Update touch event logging state |
| 56 void SetTouchEventLoggingEnabled(bool enabled) override; | 57 void SetTouchEventLoggingEnabled(bool enabled) override; |
| 57 | 58 |
| 59 // Sets callback to enable/disable palm suppression. |
| 60 void SetPalmSuppressionCallback( |
| 61 const base::Callback<void(bool)>& callback) override; |
| 62 |
| 58 // Unsafe part of initialization. | 63 // Unsafe part of initialization. |
| 59 virtual void Initialize(const EventDeviceInfo& info); | 64 virtual void Initialize(const EventDeviceInfo& info); |
| 60 | 65 |
| 61 private: | 66 private: |
| 62 friend class MockTouchEventConverterEvdev; | 67 friend class MockTouchEventConverterEvdev; |
| 63 | 68 |
| 64 // Overidden from base::MessagePumpLibevent::Watcher. | 69 // Overidden from base::MessagePumpLibevent::Watcher. |
| 65 void OnFileCanReadWithoutBlocking(int fd) override; | 70 void OnFileCanReadWithoutBlocking(int fd) override; |
| 66 | 71 |
| 67 virtual void Reinitialize(); | 72 virtual void Reinitialize(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 97 | 102 |
| 98 // Dispatcher for events. | 103 // Dispatcher for events. |
| 99 DeviceEventDispatcherEvdev* dispatcher_; | 104 DeviceEventDispatcherEvdev* dispatcher_; |
| 100 | 105 |
| 101 // Set if we drop events in kernel (SYN_DROPPED) or in process. | 106 // Set if we drop events in kernel (SYN_DROPPED) or in process. |
| 102 bool dropped_events_ = false; | 107 bool dropped_events_ = false; |
| 103 | 108 |
| 104 // Device has multitouch capability. | 109 // Device has multitouch capability. |
| 105 bool has_mt_ = false; | 110 bool has_mt_ = false; |
| 106 | 111 |
| 112 // Device supports pen input. |
| 113 bool has_pen_ = false; |
| 114 |
| 107 // Use BTN_LEFT instead of BT_TOUCH. | 115 // Use BTN_LEFT instead of BT_TOUCH. |
| 108 bool quirk_left_mouse_button_ = false; | 116 bool quirk_left_mouse_button_ = false; |
| 109 | 117 |
| 110 // Pressure values. | 118 // Pressure values. |
| 111 int pressure_min_; | 119 int pressure_min_; |
| 112 int pressure_max_; // Used to normalize pressure values. | 120 int pressure_max_; // Used to normalize pressure values. |
| 113 | 121 |
| 114 // Input range for x-axis. | 122 // Input range for x-axis. |
| 115 float x_min_tuxels_; | 123 float x_min_tuxels_; |
| 116 float x_num_tuxels_; | 124 float x_num_tuxels_; |
| 117 | 125 |
| 118 // Input range for y-axis. | 126 // Input range for y-axis. |
| 119 float y_min_tuxels_; | 127 float y_min_tuxels_; |
| 120 float y_num_tuxels_; | 128 float y_num_tuxels_; |
| 121 | 129 |
| 122 // Number of touch points reported by driver | 130 // Number of touch points reported by driver |
| 123 int touch_points_ = 0; | 131 int touch_points_ = 0; |
| 124 | 132 |
| 133 // Maximum value of touch major axis |
| 134 int major_max_ = 0; |
| 135 |
| 125 // Tracking id counter. | 136 // Tracking id counter. |
| 126 int next_tracking_id_ = 0; | 137 int next_tracking_id_ = 0; |
| 127 | 138 |
| 128 // Touch point currently being updated from the /dev/input/event* stream. | 139 // Touch point currently being updated from the /dev/input/event* stream. |
| 129 size_t current_slot_ = 0; | 140 size_t current_slot_ = 0; |
| 130 | 141 |
| 131 // Flag that indicates if the touch logging enabled or not. | 142 // Flag that indicates if the touch logging enabled or not. |
| 132 bool touch_logging_enabled_ = true; | 143 bool touch_logging_enabled_ = true; |
| 133 | 144 |
| 134 // In-progress touch points. | 145 // In-progress touch points. |
| 135 std::vector<InProgressTouchEvdev> events_; | 146 std::vector<InProgressTouchEvdev> events_; |
| 136 | 147 |
| 137 // Finds touch noise. | 148 // Finds touch noise. |
| 138 std::unique_ptr<TouchNoiseFinder> touch_noise_finder_; | 149 std::unique_ptr<TouchNoiseFinder> touch_noise_finder_; |
| 139 | 150 |
| 140 // Records the recent touch events. It is used to fill the feedback reports | 151 // Records the recent touch events. It is used to fill the feedback reports |
| 141 TouchEventLogEvdev touch_evdev_debug_buffer_; | 152 TouchEventLogEvdev touch_evdev_debug_buffer_; |
| 142 | 153 |
| 154 // Callback to enable/disable palm suppression. |
| 155 base::Callback<void(bool)> enable_palm_suppression_callback_; |
| 156 |
| 143 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); | 157 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); |
| 144 }; | 158 }; |
| 145 | 159 |
| 146 } // namespace ui | 160 } // namespace ui |
| 147 | 161 |
| 148 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ | 162 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ |
| OLD | NEW |