| 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 <bitset> | 8 #include <bitset> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/message_loop/message_pump_libevent.h" | 12 #include "base/message_loop/message_pump_libevent.h" |
| 13 #include "ui/events/event_constants.h" | 13 #include "ui/events/event_constants.h" |
| 14 #include "ui/events/ozone/evdev/event_converter_evdev.h" | 14 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
| 15 #include "ui/events/ozone/evdev/event_device_info.h" | 15 #include "ui/events/ozone/evdev/event_device_info.h" |
| 16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 | 19 |
| 20 class TouchEvent; | 20 class TouchEvent; |
| 21 | 21 |
| 22 class DeviceEventDispatcherEvdev; | 22 class DeviceEventDispatcherEvdev; |
| 23 | 23 |
| 24 class EVENTS_OZONE_EVDEV_EXPORT TouchEventConverterEvdev | 24 class EVENTS_OZONE_EVDEV_EXPORT TouchEventConverterEvdev |
| 25 : public EventConverterEvdev { | 25 : public EventConverterEvdev { |
| 26 public: | 26 public: |
| 27 enum { | 27 enum { MAX_FINGERS = 20 }; |
| 28 MAX_FINGERS = 11 | |
| 29 }; | |
| 30 TouchEventConverterEvdev(int fd, | 28 TouchEventConverterEvdev(int fd, |
| 31 base::FilePath path, | 29 base::FilePath path, |
| 32 int id, | 30 int id, |
| 33 InputDeviceType type, | 31 InputDeviceType type, |
| 34 DeviceEventDispatcherEvdev* dispatcher); | 32 DeviceEventDispatcherEvdev* dispatcher); |
| 35 ~TouchEventConverterEvdev() override; | 33 ~TouchEventConverterEvdev() override; |
| 36 | 34 |
| 37 // EventConverterEvdev: | 35 // EventConverterEvdev: |
| 38 bool HasTouchscreen() const override; | 36 bool HasTouchscreen() const override; |
| 39 gfx::Size GetTouchscreenSize() const override; | 37 gfx::Size GetTouchscreenSize() const override; |
| 40 | 38 |
| 41 // Unsafe part of initialization. | 39 // Unsafe part of initialization. |
| 42 virtual void Initialize(const EventDeviceInfo& info); | 40 virtual void Initialize(const EventDeviceInfo& info); |
| 43 | 41 |
| 44 private: | 42 private: |
| 45 friend class MockTouchEventConverterEvdev; | 43 friend class MockTouchEventConverterEvdev; |
| 46 | 44 |
| 47 struct InProgressEvents { | 45 struct InProgressEvents { |
| 48 InProgressEvents(); | 46 InProgressEvents(); |
| 49 | 47 |
| 48 bool altered_; |
| 50 float x_; | 49 float x_; |
| 51 float y_; | 50 float y_; |
| 52 int id_; // Device reported "unique" touch point id; -1 means not active | 51 int id_; // Device reported "unique" touch point id; -1 means not active |
| 53 int finger_; // "Finger" id starting from 0; -1 means not active | 52 int finger_; // "Finger" id starting from 0; -1 means not active |
| 54 | 53 |
| 55 EventType type_; | 54 EventType type_; |
| 56 float radius_x_; | 55 float radius_x_; |
| 57 float radius_y_; | 56 float radius_y_; |
| 58 float pressure_; | 57 float pressure_; |
| 59 }; | 58 }; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 89 float x_num_tuxels_; | 88 float x_num_tuxels_; |
| 90 | 89 |
| 91 // Input range for y-axis. | 90 // Input range for y-axis. |
| 92 float y_min_tuxels_; | 91 float y_min_tuxels_; |
| 93 float y_num_tuxels_; | 92 float y_num_tuxels_; |
| 94 | 93 |
| 95 // Size of the touchscreen as reported by the driver. | 94 // Size of the touchscreen as reported by the driver. |
| 96 gfx::Size native_size_; | 95 gfx::Size native_size_; |
| 97 | 96 |
| 98 // Touch point currently being updated from the /dev/input/event* stream. | 97 // Touch point currently being updated from the /dev/input/event* stream. |
| 99 int current_slot_; | 98 size_t current_slot_; |
| 100 | |
| 101 // Bit field tracking which in-progress touch points have been modified | |
| 102 // without a syn event. | |
| 103 std::bitset<MAX_FINGERS> altered_slots_; | |
| 104 | 99 |
| 105 // In-progress touch points. | 100 // In-progress touch points. |
| 106 InProgressEvents events_[MAX_FINGERS]; | 101 std::vector<InProgressEvents> events_; |
| 107 | 102 |
| 108 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); | 103 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); |
| 109 }; | 104 }; |
| 110 | 105 |
| 111 } // namespace ui | 106 } // namespace ui |
| 112 | 107 |
| 113 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ | 108 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ |
| OLD | NEW |