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; |
| 23 |
22 class EVENTS_OZONE_EVDEV_EXPORT TouchEventConverterEvdev | 24 class EVENTS_OZONE_EVDEV_EXPORT TouchEventConverterEvdev |
23 : public EventConverterEvdev { | 25 : public EventConverterEvdev { |
24 public: | 26 public: |
25 enum { | 27 enum { |
26 MAX_FINGERS = 11 | 28 MAX_FINGERS = 11 |
27 }; | 29 }; |
28 TouchEventConverterEvdev(int fd, | 30 TouchEventConverterEvdev(int fd, |
29 base::FilePath path, | 31 base::FilePath path, |
30 int id, | 32 int id, |
31 InputDeviceType type, | 33 InputDeviceType type, |
32 const TouchEventDispatchCallback& touch_callback); | 34 DeviceEventDispatcherEvdev* dispatcher); |
33 ~TouchEventConverterEvdev() override; | 35 ~TouchEventConverterEvdev() override; |
34 | 36 |
35 // EventConverterEvdev: | 37 // EventConverterEvdev: |
36 bool HasTouchscreen() const override; | 38 bool HasTouchscreen() const override; |
37 gfx::Size GetTouchscreenSize() const override; | 39 gfx::Size GetTouchscreenSize() const override; |
38 | 40 |
39 // Unsafe part of initialization. | 41 // Unsafe part of initialization. |
40 virtual void Initialize(const EventDeviceInfo& info); | 42 virtual void Initialize(const EventDeviceInfo& info); |
41 | 43 |
42 private: | 44 private: |
(...skipping 19 matching lines...) Expand all Loading... |
62 virtual bool Reinitialize(); | 64 virtual bool Reinitialize(); |
63 | 65 |
64 void ProcessInputEvent(const input_event& input); | 66 void ProcessInputEvent(const input_event& input); |
65 void ProcessAbs(const input_event& input); | 67 void ProcessAbs(const input_event& input); |
66 void ProcessSyn(const input_event& input); | 68 void ProcessSyn(const input_event& input); |
67 | 69 |
68 void ReportEvent(int touch_id, | 70 void ReportEvent(int touch_id, |
69 const InProgressEvents& event, const base::TimeDelta& delta); | 71 const InProgressEvents& event, const base::TimeDelta& delta); |
70 void ReportEvents(base::TimeDelta delta); | 72 void ReportEvents(base::TimeDelta delta); |
71 | 73 |
72 // Callback for dispatching events. | 74 // Dispatcher for events. |
73 TouchEventDispatchCallback touch_callback_; | 75 DeviceEventDispatcherEvdev* dispatcher_; |
74 | 76 |
75 // Set if we have seen a SYN_DROPPED and not yet re-synced with the device. | 77 // Set if we have seen a SYN_DROPPED and not yet re-synced with the device. |
76 bool syn_dropped_; | 78 bool syn_dropped_; |
77 | 79 |
78 // Set if this is a type A device (uses SYN_MT_REPORT). | 80 // Set if this is a type A device (uses SYN_MT_REPORT). |
79 bool is_type_a_; | 81 bool is_type_a_; |
80 | 82 |
81 // Pressure values. | 83 // Pressure values. |
82 int pressure_min_; | 84 int pressure_min_; |
83 int pressure_max_; // Used to normalize pressure values. | 85 int pressure_max_; // Used to normalize pressure values. |
(...skipping 18 matching lines...) Expand all Loading... |
102 | 104 |
103 // In-progress touch points. | 105 // In-progress touch points. |
104 InProgressEvents events_[MAX_FINGERS]; | 106 InProgressEvents events_[MAX_FINGERS]; |
105 | 107 |
106 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); | 108 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); |
107 }; | 109 }; |
108 | 110 |
109 } // namespace ui | 111 } // namespace ui |
110 | 112 |
111 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ | 113 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ |
OLD | NEW |