Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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. | |
| 4 | |
| 5 #ifndef UI_BASE_OZONE_TOUCH_EVENT_CONVERTER_OZONE_H_ | |
| 6 #define UI_BASE_OZONE_TOUCH_EVENT_CONVERTER_OZONE_H_ | |
| 7 | |
| 8 #include <bitset> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "ui/base/events/event_constants.h" | |
| 12 #include "ui/base/ozone/event_converter_ozone.h" | |
| 13 #include "ui/base/ui_export.h" | |
| 14 | |
| 15 namespace ui { | |
| 16 | |
| 17 class TouchEvent; | |
| 18 | |
| 19 class UI_EXPORT TouchEventConverterOzone : public EventConverterOzone { | |
| 20 public: | |
| 21 enum { | |
| 22 MAX_FINGERS = 11 | |
| 23 }; | |
| 24 TouchEventConverterOzone(int fd, int id); | |
| 25 virtual ~TouchEventConverterOzone(); | |
| 26 | |
| 27 private: | |
| 28 friend class MockTouchEventConverterOzone; | |
| 29 | |
| 30 // Unsafe part of initialization. | |
| 31 void Init(); | |
| 32 | |
| 33 // Overidden from base::MessagePumpLibevent::Watcher. | |
| 34 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; | |
| 35 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; | |
| 36 | |
| 37 // Pressure values. | |
| 38 int pressure_min_; | |
| 39 int pressure_max_; // Used to normalize pressure values. | |
| 40 | |
| 41 // Touch scaling. | |
| 42 float x_scale_; | |
| 43 float y_scale_; | |
| 44 | |
| 45 // Touch point currently being updated from the /dev/input/event* stream. | |
| 46 int current_slot_; | |
| 47 | |
| 48 // File descriptor for the /dev/input/event* instance. | |
| 49 int fd_; | |
| 50 | |
| 51 // Number corresponding to * in the source evdev device: /dev/input/event* | |
| 52 int id_; | |
| 53 | |
| 54 // Bit field tracking which in-progress touch points have been modified | |
| 55 // without a syn event. | |
| 56 std::bitset<MAX_FINGERS> altered_slots_; | |
| 57 | |
| 58 struct InProgressEvents { | |
| 59 int x_; | |
| 60 int y_; | |
| 61 int id_; // Device reported "unique" touch point id; -1 means not active | |
| 62 int finger_; // "Finger" id starting from 0; -1 means not active | |
| 63 | |
| 64 EventType type_; | |
| 65 int major_; | |
| 66 float pressure_; | |
| 67 }; | |
| 68 | |
| 69 // In-progress touch points. | |
| 70 InProgressEvents events_[MAX_FINGERS]; | |
|
sadrul
2013/06/06 16:54:30
DISALLOW_COPY_AND_ASSIGN
rjkroege
2013/06/06 23:05:05
Done.
| |
| 71 }; | |
| 72 | |
| 73 } // namespace ui | |
| 74 | |
| 75 #endif // UI_BASE_OZONE_TOUCH_EVENT_CONVERTER_OZONE_H_ | |
| OLD | NEW |