| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" | 
| 13 #include "ui/events/events_export.h" | 13 #include "ui/events/events_export.h" | 
|  | 14 #include "ui/events/ozone/evdev/event_converter.h" | 
|  | 15 #include "ui/events/ozone/evdev/event_modifiers.h" | 
| 14 #include "ui/events/ozone/event_converter_ozone.h" | 16 #include "ui/events/ozone/event_converter_ozone.h" | 
| 15 | 17 | 
| 16 namespace ui { | 18 namespace ui { | 
| 17 | 19 | 
| 18 class TouchEvent; | 20 class TouchEvent; | 
| 19 | 21 | 
| 20 class EVENTS_EXPORT TouchEventConverterEvdev : public EventConverterOzone { | 22 class EVENTS_EXPORT TouchEventConverterEvdev : public EventConverterEvdev { | 
| 21  public: | 23  public: | 
| 22   enum { | 24   enum { | 
| 23     MAX_FINGERS = 11 | 25     MAX_FINGERS = 11 | 
| 24   }; | 26   }; | 
| 25   TouchEventConverterEvdev(int fd, base::FilePath path); | 27   TouchEventConverterEvdev(int fd, | 
|  | 28                            base::FilePath path, | 
|  | 29                            EventModifiersEvdev* modifiers); | 
| 26   virtual ~TouchEventConverterEvdev(); | 30   virtual ~TouchEventConverterEvdev(); | 
| 27 | 31 | 
|  | 32  protected: | 
|  | 33   void ProcessEvents(const struct input_event* inputs, int count) OVERRIDE; | 
|  | 34 | 
| 28  private: | 35  private: | 
| 29   friend class MockTouchEventConverterEvdev; | 36   friend class MockTouchEventConverterEvdev; | 
| 30 | 37 | 
| 31   // Unsafe part of initialization. | 38   // Unsafe part of initialization. | 
| 32   void Init(); | 39   void Init(); | 
| 33 | 40 | 
| 34   // Overidden from base::MessagePumpLibevent::Watcher. |  | 
| 35   virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; |  | 
| 36   virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; |  | 
| 37 |  | 
| 38   // Pressure values. | 41   // Pressure values. | 
| 39   int pressure_min_; | 42   int pressure_min_; | 
| 40   int pressure_max_;  // Used to normalize pressure values. | 43   int pressure_max_;  // Used to normalize pressure values. | 
| 41 | 44 | 
| 42   // Touch scaling. | 45   // Touch scaling. | 
| 43   float x_scale_; | 46   float x_scale_; | 
| 44   float y_scale_; | 47   float y_scale_; | 
| 45 | 48 | 
| 46   // Maximum coordinate-values allowed for the events. | 49   // Maximum coordinate-values allowed for the events. | 
| 47   int x_max_; | 50   int x_max_; | 
| 48   int y_max_; | 51   int y_max_; | 
| 49 | 52 | 
| 50   // Touch point currently being updated from the /dev/input/event* stream. | 53   // Touch point currently being updated from the /dev/input/event* stream. | 
| 51   int current_slot_; | 54   int current_slot_; | 
| 52 | 55 | 
| 53   // File descriptor for the /dev/input/event* instance. |  | 
| 54   int fd_; |  | 
| 55 |  | 
| 56   // Path to input device. |  | 
| 57   base::FilePath path_; |  | 
| 58 |  | 
| 59   // Bit field tracking which in-progress touch points have been modified | 56   // Bit field tracking which in-progress touch points have been modified | 
| 60   // without a syn event. | 57   // without a syn event. | 
| 61   std::bitset<MAX_FINGERS> altered_slots_; | 58   std::bitset<MAX_FINGERS> altered_slots_; | 
| 62 | 59 | 
| 63   struct InProgressEvents { | 60   struct InProgressEvents { | 
| 64     int x_; | 61     int x_; | 
| 65     int y_; | 62     int y_; | 
| 66     int id_;  // Device reported "unique" touch point id; -1 means not active | 63     int id_;  // Device reported "unique" touch point id; -1 means not active | 
| 67     int finger_;  // "Finger" id starting from 0; -1 means not active | 64     int finger_;  // "Finger" id starting from 0; -1 means not active | 
| 68 | 65 | 
| 69     EventType type_; | 66     EventType type_; | 
| 70     int major_; | 67     int major_; | 
| 71     float pressure_; | 68     float pressure_; | 
| 72   }; | 69   }; | 
| 73 | 70 | 
| 74   // In-progress touch points. | 71   // In-progress touch points. | 
| 75   InProgressEvents events_[MAX_FINGERS]; | 72   InProgressEvents events_[MAX_FINGERS]; | 
| 76 | 73 | 
| 77   DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); | 74   DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); | 
| 78 }; | 75 }; | 
| 79 | 76 | 
| 80 }  // namespace ui | 77 }  // namespace ui | 
| 81 | 78 | 
| 82 #endif  // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ | 79 #endif  // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ | 
| 83 | 80 | 
| OLD | NEW | 
|---|