| OLD | NEW |
| 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_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_CROS
_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_CROS
_H_ |
| 6 #define UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_CROS
_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_CROS
_H_ |
| 7 | 7 |
| 8 #include <gestures/gestures.h> | 8 #include <gestures/gestures.h> |
| 9 #include <libevdev/libevdev.h> | 9 #include <libevdev/libevdev.h> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 13 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 14 #include "ui/events/ozone/evdev/event_device_util.h" | 14 #include "ui/events/ozone/evdev/event_device_util.h" |
| 15 #include "ui/events/ozone/evdev/event_dispatch_callback.h" | 15 #include "ui/events/ozone/evdev/event_dispatch_callback.h" |
| 16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
| 17 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" | 17 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 | 20 |
| 21 class EventDeviceInfo; | 21 class EventDeviceInfo; |
| 22 class EventModifiersEvdev; | 22 class EventModifiersEvdev; |
| 23 class MouseButtonMapEvdev; | 23 class MouseButtonMapEvdev; |
| 24 class CursorDelegateEvdev; | 24 class CursorDelegateEvdev; |
| 25 class KeyboardEvdev; | 25 class KeyboardEvdev; |
| 26 struct GestureDeviceProperties; | 26 struct GestureDeviceProperties; |
| 27 class GesturePropertyProvider; | 27 class GesturePropertyProvider; |
| 28 enum class DomCode; |
| 28 | 29 |
| 29 // Convert libevdev-cros events to ui::Events using libgestures. | 30 // Convert libevdev-cros events to ui::Events using libgestures. |
| 30 // | 31 // |
| 31 // This builds a GestureInterpreter for an input device (touchpad or | 32 // This builds a GestureInterpreter for an input device (touchpad or |
| 32 // mouse). | 33 // mouse). |
| 33 // | 34 // |
| 34 // Raw input events must be preprocessed into a form suitable for | 35 // Raw input events must be preprocessed into a form suitable for |
| 35 // libgestures. The kernel protocol only emits changes to the device state, | 36 // libgestures. The kernel protocol only emits changes to the device state, |
| 36 // so changes must be accumulated until a sync event. The full device state | 37 // so changes must be accumulated until a sync event. The full device state |
| 37 // at sync is then processed by libgestures. | 38 // at sync is then processed by libgestures. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 49 KeyboardEvdev* keyboard, | 50 KeyboardEvdev* keyboard, |
| 50 GesturePropertyProvider* property_provider, | 51 GesturePropertyProvider* property_provider, |
| 51 const EventDispatchCallback& callback); | 52 const EventDispatchCallback& callback); |
| 52 ~GestureInterpreterLibevdevCros() override; | 53 ~GestureInterpreterLibevdevCros() override; |
| 53 | 54 |
| 54 // Overriden from ui::EventReaderLibevdevCros::Delegate | 55 // Overriden from ui::EventReaderLibevdevCros::Delegate |
| 55 void OnLibEvdevCrosOpen(Evdev* evdev, EventStateRec* evstate) override; | 56 void OnLibEvdevCrosOpen(Evdev* evdev, EventStateRec* evstate) override; |
| 56 void OnLibEvdevCrosEvent(Evdev* evdev, | 57 void OnLibEvdevCrosEvent(Evdev* evdev, |
| 57 EventStateRec* evstate, | 58 EventStateRec* evstate, |
| 58 const timeval& time) override; | 59 const timeval& time) override; |
| 60 void SetAllowedKeys( |
| 61 scoped_ptr<std::set<DomCode>> allowed_keys) override; |
| 62 void AllowAllKeys() override; |
| 59 | 63 |
| 60 // Handler for gesture events generated from libgestures. | 64 // Handler for gesture events generated from libgestures. |
| 61 void OnGestureReady(const Gesture* gesture); | 65 void OnGestureReady(const Gesture* gesture); |
| 62 | 66 |
| 63 // Accessors. | 67 // Accessors. |
| 64 int id() { return id_; } | 68 int id() { return id_; } |
| 65 GesturePropertyProvider* property_provider() { return property_provider_; } | 69 GesturePropertyProvider* property_provider() { return property_provider_; } |
| 66 Evdev* evdev() { return evdev_; } | 70 Evdev* evdev() { return evdev_; } |
| 67 | 71 |
| 68 private: | 72 private: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 82 void DispatchMouseButton(unsigned int modifier, bool down); | 86 void DispatchMouseButton(unsigned int modifier, bool down); |
| 83 void DispatchChangedKeys(Evdev* evdev, const timeval& time); | 87 void DispatchChangedKeys(Evdev* evdev, const timeval& time); |
| 84 | 88 |
| 85 // The unique device id. | 89 // The unique device id. |
| 86 int id_; | 90 int id_; |
| 87 | 91 |
| 88 // True if the device may be regarded as a mouse. This includes normal mice | 92 // True if the device may be regarded as a mouse. This includes normal mice |
| 89 // and multi-touch mice. | 93 // and multi-touch mice. |
| 90 bool is_mouse_; | 94 bool is_mouse_; |
| 91 | 95 |
| 96 // The keys which should be processed. nullptr if all keys should be |
| 97 // processed. |
| 98 scoped_ptr<std::set<DomCode>> allowed_keys_; |
| 99 |
| 92 // Shared modifier state. | 100 // Shared modifier state. |
| 93 EventModifiersEvdev* modifiers_; | 101 EventModifiersEvdev* modifiers_; |
| 94 | 102 |
| 95 // Shared mouse button map. | 103 // Shared mouse button map. |
| 96 MouseButtonMapEvdev* button_map_; | 104 MouseButtonMapEvdev* button_map_; |
| 97 | 105 |
| 98 // Shared cursor state. | 106 // Shared cursor state. |
| 99 CursorDelegateEvdev* cursor_; | 107 CursorDelegateEvdev* cursor_; |
| 100 | 108 |
| 101 // Shared keyboard state. | 109 // Shared keyboard state. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 118 | 126 |
| 119 // Gesture lib device properties. | 127 // Gesture lib device properties. |
| 120 scoped_ptr<GestureDeviceProperties> device_properties_; | 128 scoped_ptr<GestureDeviceProperties> device_properties_; |
| 121 | 129 |
| 122 DISALLOW_COPY_AND_ASSIGN(GestureInterpreterLibevdevCros); | 130 DISALLOW_COPY_AND_ASSIGN(GestureInterpreterLibevdevCros); |
| 123 }; | 131 }; |
| 124 | 132 |
| 125 } // namspace ui | 133 } // namspace ui |
| 126 | 134 |
| 127 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_C
ROS_H_ | 135 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_C
ROS_H_ |
| OLD | NEW |