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

Side by Side Diff: ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.h

Issue 545063006: ozone: evdev: Add gesture property provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again. Move id generation logic to EventFactoryEvdev Created 6 years, 2 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
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_dispatch_callback.h" 14 #include "ui/events/ozone/evdev/event_dispatch_callback.h"
15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" 15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
16 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" 16 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h"
17 17
18 namespace ui { 18 namespace ui {
19 19
20 class EventDeviceInfo; 20 class EventDeviceInfo;
21 class EventModifiersEvdev; 21 class EventModifiersEvdev;
22 class CursorDelegateEvdev; 22 class CursorDelegateEvdev;
23 class GestureDeviceProperties;
24 class GesturePropertyProvider;
23 25
24 // Convert libevdev-cros events to ui::Events using libgestures. 26 // Convert libevdev-cros events to ui::Events using libgestures.
25 // 27 //
26 // This builds a GestureInterpreter for an input device (touchpad or 28 // This builds a GestureInterpreter for an input device (touchpad or
27 // mouse). 29 // mouse).
28 // 30 //
29 // Raw input events must be preprocessed into a form suitable for 31 // Raw input events must be preprocessed into a form suitable for
30 // libgestures. The kernel protocol only emits changes to the device state, 32 // libgestures. The kernel protocol only emits changes to the device state,
31 // so changes must be accumulated until a sync event. The full device state 33 // so changes must be accumulated until a sync event. The full device state
32 // at sync is then processed by libgestures. 34 // at sync is then processed by libgestures.
33 // 35 //
34 // Once we have the state at sync, we convert it to a HardwareState object 36 // Once we have the state at sync, we convert it to a HardwareState object
35 // and forward it to libgestures. If any gestures are produced, they are 37 // and forward it to libgestures. If any gestures are produced, they are
36 // converted to ui::Events and dispatched. 38 // converted to ui::Events and dispatched.
37 class EVENTS_OZONE_EVDEV_EXPORT GestureInterpreterLibevdevCros 39 class EVENTS_OZONE_EVDEV_EXPORT GestureInterpreterLibevdevCros
38 : public EventReaderLibevdevCros::Delegate { 40 : public EventReaderLibevdevCros::Delegate {
39 public: 41 public:
40 GestureInterpreterLibevdevCros(EventModifiersEvdev* modifiers, 42 GestureInterpreterLibevdevCros(int id, EventModifiersEvdev* modifiers,
41 CursorDelegateEvdev* cursor, 43 CursorDelegateEvdev* cursor,
44 GesturePropertyProvider* property_provider,
42 const EventDispatchCallback& callback); 45 const EventDispatchCallback& callback);
43 virtual ~GestureInterpreterLibevdevCros(); 46 virtual ~GestureInterpreterLibevdevCros();
44 47
45 // Overriden from ui::EventReaderLibevdevCros::Delegate 48 // Overriden from ui::EventReaderLibevdevCros::Delegate
46 virtual void OnLibEvdevCrosOpen(Evdev* evdev, 49 virtual void OnLibEvdevCrosOpen(Evdev* evdev,
47 EventStateRec* evstate) override; 50 EventStateRec* evstate) override;
48 virtual void OnLibEvdevCrosEvent(Evdev* evdev, 51 virtual void OnLibEvdevCrosEvent(Evdev* evdev,
49 EventStateRec* evstate, 52 EventStateRec* evstate,
50 const timeval& time) override; 53 const timeval& time) override;
51 54
52 // Handler for gesture events generated from libgestures. 55 // Handler for gesture events generated from libgestures.
53 void OnGestureReady(const Gesture* gesture); 56 void OnGestureReady(const Gesture* gesture);
54 57
58 // Accessors.
59 int id() { return id_; }
60 GesturePropertyProvider* property_provider() { return property_provider_; }
61 Evdev* evdev() { return evdev_; }
62
55 private: 63 private:
56 void OnGestureMove(const Gesture* gesture, const GestureMove* move); 64 void OnGestureMove(const Gesture* gesture, const GestureMove* move);
57 void OnGestureScroll(const Gesture* gesture, const GestureScroll* move); 65 void OnGestureScroll(const Gesture* gesture, const GestureScroll* move);
58 void OnGestureButtonsChange(const Gesture* gesture, 66 void OnGestureButtonsChange(const Gesture* gesture,
59 const GestureButtonsChange* move); 67 const GestureButtonsChange* move);
60 void OnGestureContactInitiated(const Gesture* gesture); 68 void OnGestureContactInitiated(const Gesture* gesture);
61 void OnGestureFling(const Gesture* gesture, const GestureFling* fling); 69 void OnGestureFling(const Gesture* gesture, const GestureFling* fling);
62 void OnGestureSwipe(const Gesture* gesture, const GestureSwipe* swipe); 70 void OnGestureSwipe(const Gesture* gesture, const GestureSwipe* swipe);
63 void OnGestureSwipeLift(const Gesture* gesture, 71 void OnGestureSwipeLift(const Gesture* gesture,
64 const GestureSwipeLift* swipelift); 72 const GestureSwipeLift* swipelift);
65 void OnGesturePinch(const Gesture* gesture, const GesturePinch* pinch); 73 void OnGesturePinch(const Gesture* gesture, const GesturePinch* pinch);
66 void OnGestureMetrics(const Gesture* gesture, const GestureMetrics* metrics); 74 void OnGestureMetrics(const Gesture* gesture, const GestureMetrics* metrics);
67 75
68 void Dispatch(Event* event); 76 void Dispatch(Event* event);
69 void DispatchMouseButton(unsigned int modifier, bool down); 77 void DispatchMouseButton(unsigned int modifier, bool down);
70 78
79 // The unique device id.
80 int id_;
81
71 // Shared modifier state. 82 // Shared modifier state.
72 EventModifiersEvdev* modifiers_; 83 EventModifiersEvdev* modifiers_;
73 84
74 // Shared cursor state. 85 // Shared cursor state.
75 CursorDelegateEvdev* cursor_; 86 CursorDelegateEvdev* cursor_;
76 87
88 // Shared gesture property provider.
89 GesturePropertyProvider* property_provider_;
90
77 // Callback for dispatching events. 91 // Callback for dispatching events.
78 EventDispatchCallback dispatch_callback_; 92 EventDispatchCallback dispatch_callback_;
79 93
80 // Gestures interpretation state. 94 // Gestures interpretation state.
81 gestures::GestureInterpreter* interpreter_; 95 gestures::GestureInterpreter* interpreter_;
82 96
97 // Device pointer.
98 Evdev* evdev_;
99
100 // Gesture lib device properties.
101 scoped_ptr<GestureDeviceProperties> device_properties_;
102
83 DISALLOW_COPY_AND_ASSIGN(GestureInterpreterLibevdevCros); 103 DISALLOW_COPY_AND_ASSIGN(GestureInterpreterLibevdevCros);
84 }; 104 };
85 105
86 } // namspace ui 106 } // namspace ui
87 107
88 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_C ROS_H_ 108 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_C ROS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698