1 // Copyright 2013 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.
5 #ifndef UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
10 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h"
12 #include "ui/events/event_constants.h"
13 #include "ui/events/events_export.h"
14 #include "ui/events/ozone/event_converter_ozone.h"
20 class EVENTS_EXPORT TouchEventConverterEvdev : public EventConverterOzone {
25 TouchEventConverterEvdev(int fd, base::FilePath path);
26 virtual ~TouchEventConverterEvdev();
29 friend class MockTouchEventConverterEvdev;
31 // Unsafe part of initialization.
34 // Overidden from base::MessagePumpLibevent::Watcher.
35 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
36 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
40 int pressure_max_; // Used to normalize pressure values.
46 // Maximum coordinate-values allowed for the events.
50 // Touch point currently being updated from the /dev/input/event* stream.
53 // File descriptor for the /dev/input/event* instance.
56 // Path to input device.
59 // Bit field tracking which in-progress touch points have been modified
60 // without a syn event.
61 std::bitset<MAX_FINGERS> altered_slots_;
63 struct InProgressEvents {
66 int id_; // Device reported "unique" touch point id; -1 means not active
67 int finger_; // "Finger" id starting from 0; -1 means not active
74 // In-progress touch points.
75 InProgressEvents events_[MAX_FINGERS];
77 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev);
82 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_