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

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

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
7
8 #include <bitset>
9
10 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h"
12 #include "base/message_loop/message_pump_libevent.h"
13 #include "ui/events/event_constants.h"
14 #include "ui/events/ozone/evdev/event_converter_evdev.h"
15 #include "ui/events/ozone/evdev/event_device_info.h"
16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
17
18 namespace ui {
19
20 class TouchEvent;
21
22 class EVENTS_OZONE_EVDEV_EXPORT TouchEventConverterEvdev
23 : public EventConverterEvdev {
24 public:
25 enum {
26 MAX_FINGERS = 11
27 };
28 TouchEventConverterEvdev(int fd,
29 base::FilePath path,
30 int id,
31 const EventDeviceInfo& info,
32 const EventDispatchCallback& dispatch);
33 virtual ~TouchEventConverterEvdev();
34
35 // EventConverterEvdev:
36 virtual bool HasTouchscreen() const override;
37 virtual gfx::Size GetTouchscreenSize() const override;
38
39 private:
40 friend class MockTouchEventConverterEvdev;
41
42 // Unsafe part of initialization.
43 void Init(const EventDeviceInfo& info);
44
45 // Overidden from base::MessagePumpLibevent::Watcher.
46 virtual void OnFileCanReadWithoutBlocking(int fd) override;
47
48 virtual bool Reinitialize();
49
50 void ProcessInputEvent(const input_event& input);
51 void ProcessAbs(const input_event& input);
52 void ProcessSyn(const input_event& input);
53
54 void ReportEvents(base::TimeDelta delta);
55
56 // Callback for dispatching events.
57 EventDispatchCallback callback_;
58
59 // Set if we have seen a SYN_DROPPED and not yet re-synced with the device.
60 bool syn_dropped_;
61
62 // Set if this is a type A device (uses SYN_MT_REPORT).
63 bool is_type_a_;
64
65 // Pressure values.
66 int pressure_min_;
67 int pressure_max_; // Used to normalize pressure values.
68
69 // Input range for x-axis.
70 float x_min_tuxels_;
71 float x_num_tuxels_;
72
73 // Input range for y-axis.
74 float y_min_tuxels_;
75 float y_num_tuxels_;
76
77 // Output range for x-axis.
78 float x_min_pixels_;
79 float x_num_pixels_;
80
81 // Output range for y-axis.
82 float y_min_pixels_;
83 float y_num_pixels_;
84
85 // Size of the touchscreen as reported by the driver.
86 gfx::Size native_size_;
87
88 // Touch point currently being updated from the /dev/input/event* stream.
89 int current_slot_;
90
91 // Bit field tracking which in-progress touch points have been modified
92 // without a syn event.
93 std::bitset<MAX_FINGERS> altered_slots_;
94
95 struct InProgressEvents {
96 float x_;
97 float y_;
98 int id_; // Device reported "unique" touch point id; -1 means not active
99 int finger_; // "Finger" id starting from 0; -1 means not active
100
101 EventType type_;
102 float radius_x_;
103 float radius_y_;
104 float pressure_;
105 };
106
107 // In-progress touch points.
108 InProgressEvents events_[MAX_FINGERS];
109
110 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev);
111 };
112
113 } // namespace ui
114
115 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/libgestures_glue/gesture_timer_provider.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