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

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

Issue 1033933004: Revert of Port Chromium OS touch noise filtering to Chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
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/memory/scoped_ptr.h"
13 #include "base/message_loop/message_pump_libevent.h" 12 #include "base/message_loop/message_pump_libevent.h"
14 #include "ui/events/event_constants.h" 13 #include "ui/events/event_constants.h"
15 #include "ui/events/ozone/evdev/event_converter_evdev.h" 14 #include "ui/events/ozone/evdev/event_converter_evdev.h"
16 #include "ui/events/ozone/evdev/event_device_info.h" 15 #include "ui/events/ozone/evdev/event_device_info.h"
17 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" 16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
18 17
19 namespace ui { 18 namespace ui {
20 19
20 class TouchEvent;
21
21 class DeviceEventDispatcherEvdev; 22 class DeviceEventDispatcherEvdev;
22 class TouchEvent;
23 class TouchNoiseFinder;
24 struct InProgressTouchEvdev;
25 23
26 class EVENTS_OZONE_EVDEV_EXPORT TouchEventConverterEvdev 24 class EVENTS_OZONE_EVDEV_EXPORT TouchEventConverterEvdev
27 : public EventConverterEvdev { 25 : public EventConverterEvdev {
28 public: 26 public:
27 enum { MAX_FINGERS = 20 };
29 TouchEventConverterEvdev(int fd, 28 TouchEventConverterEvdev(int fd,
30 base::FilePath path, 29 base::FilePath path,
31 int id, 30 int id,
32 InputDeviceType type, 31 InputDeviceType type,
33 DeviceEventDispatcherEvdev* dispatcher); 32 DeviceEventDispatcherEvdev* dispatcher);
34 ~TouchEventConverterEvdev() override; 33 ~TouchEventConverterEvdev() override;
35 34
36 // EventConverterEvdev: 35 // EventConverterEvdev:
37 bool HasTouchscreen() const override; 36 bool HasTouchscreen() const override;
38 gfx::Size GetTouchscreenSize() const override; 37 gfx::Size GetTouchscreenSize() const override;
39 int GetTouchPoints() const override; 38 int GetTouchPoints() const override;
40 39
41 // Unsafe part of initialization. 40 // Unsafe part of initialization.
42 virtual void Initialize(const EventDeviceInfo& info); 41 virtual void Initialize(const EventDeviceInfo& info);
43 42
44 private: 43 private:
45 friend class MockTouchEventConverterEvdev; 44 friend class MockTouchEventConverterEvdev;
46 45
46 struct InProgressEvents {
47 InProgressEvents();
48
49 bool altered_;
50 float x_;
51 float y_;
52 int id_; // Device reported "unique" touch point id; -1 means not active
53 int finger_; // "Finger" id starting from 0; -1 means not active
54
55 EventType type_;
56 float radius_x_;
57 float radius_y_;
58 float pressure_;
59 };
60
47 // Overidden from base::MessagePumpLibevent::Watcher. 61 // Overidden from base::MessagePumpLibevent::Watcher.
48 void OnFileCanReadWithoutBlocking(int fd) override; 62 void OnFileCanReadWithoutBlocking(int fd) override;
49 63
50 virtual bool Reinitialize(); 64 virtual bool Reinitialize();
51 65
52 void ProcessInputEvent(const input_event& input); 66 void ProcessInputEvent(const input_event& input);
53 void ProcessAbs(const input_event& input); 67 void ProcessAbs(const input_event& input);
54 void ProcessSyn(const input_event& input); 68 void ProcessSyn(const input_event& input);
55 69
56 // Returns an EventType to dispatch for |touch|. Returns ET_UNKNOWN if an 70 void ReportEvent(int touch_id,
57 // event should not be dispatched. 71 const InProgressEvents& event, const base::TimeDelta& delta);
58 EventType GetEventTypeForTouch(const InProgressTouchEvdev& touch);
59
60 void ReportEvent(const InProgressTouchEvdev& event,
61 EventType event_type,
62 const base::TimeDelta& delta);
63 void ReportEvents(base::TimeDelta delta); 72 void ReportEvents(base::TimeDelta delta);
64 73
65 // Dispatcher for events. 74 // Dispatcher for events.
66 DeviceEventDispatcherEvdev* dispatcher_; 75 DeviceEventDispatcherEvdev* dispatcher_;
67 76
68 // 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.
69 bool syn_dropped_; 78 bool syn_dropped_;
70 79
80 // Set if this is a type A device (uses SYN_MT_REPORT).
81 bool is_type_a_;
82
71 // Pressure values. 83 // Pressure values.
72 int pressure_min_; 84 int pressure_min_;
73 int pressure_max_; // Used to normalize pressure values. 85 int pressure_max_; // Used to normalize pressure values.
74 86
75 // Input range for x-axis. 87 // Input range for x-axis.
76 float x_min_tuxels_; 88 float x_min_tuxels_;
77 float x_num_tuxels_; 89 float x_num_tuxels_;
78 90
79 // Input range for y-axis. 91 // Input range for y-axis.
80 float y_min_tuxels_; 92 float y_min_tuxels_;
81 float y_num_tuxels_; 93 float y_num_tuxels_;
82 94
83 // Size of the touchscreen as reported by the driver. 95 // Size of the touchscreen as reported by the driver.
84 gfx::Size native_size_; 96 gfx::Size native_size_;
85 97
86 // Number of touch points reported by driver 98 // Number of touch points reported by driver
87 int touch_points_; 99 int touch_points_;
88 100
89 // Touch point currently being updated from the /dev/input/event* stream. 101 // Touch point currently being updated from the /dev/input/event* stream.
90 size_t current_slot_; 102 size_t current_slot_;
91 103
92 // In-progress touch points. 104 // In-progress touch points.
93 std::vector<InProgressTouchEvdev> events_; 105 std::vector<InProgressEvents> events_;
94
95 // Finds touch noise.
96 scoped_ptr<TouchNoiseFinder> touch_noise_finder_;
97 106
98 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); 107 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev);
99 }; 108 };
100 109
101 } // namespace ui 110 } // namespace ui
102 111
103 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ 112 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/touch_evdev_types.cc ('k') | ui/events/ozone/evdev/touch_event_converter_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698