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

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

Issue 872683006: [PATCH 3/11] ozone: evdev: Move MouseButtonMap usage during dispatch to EventFactoryEvdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update per comments on previous patches Created 5 years, 10 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_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;
24 class CursorDelegateEvdev; 23 class CursorDelegateEvdev;
25 struct GestureDeviceProperties; 24 struct GestureDeviceProperties;
26 class GesturePropertyProvider; 25 class GesturePropertyProvider;
27 26
28 // Convert libevdev-cros events to ui::Events using libgestures. 27 // Convert libevdev-cros events to ui::Events using libgestures.
29 // 28 //
30 // This builds a GestureInterpreter for an input device (touchpad or 29 // This builds a GestureInterpreter for an input device (touchpad or
31 // mouse). 30 // mouse).
32 // 31 //
33 // Raw input events must be preprocessed into a form suitable for 32 // Raw input events must be preprocessed into a form suitable for
34 // libgestures. The kernel protocol only emits changes to the device state, 33 // libgestures. The kernel protocol only emits changes to the device state,
35 // so changes must be accumulated until a sync event. The full device state 34 // so changes must be accumulated until a sync event. The full device state
36 // at sync is then processed by libgestures. 35 // at sync is then processed by libgestures.
37 // 36 //
38 // Once we have the state at sync, we convert it to a HardwareState object 37 // Once we have the state at sync, we convert it to a HardwareState object
39 // and forward it to libgestures. If any gestures are produced, they are 38 // and forward it to libgestures. If any gestures are produced, they are
40 // converted to ui::Events and dispatched. 39 // converted to ui::Events and dispatched.
41 class EVENTS_OZONE_EVDEV_EXPORT GestureInterpreterLibevdevCros 40 class EVENTS_OZONE_EVDEV_EXPORT GestureInterpreterLibevdevCros
42 : public EventReaderLibevdevCros::Delegate { 41 : public EventReaderLibevdevCros::Delegate {
43 public: 42 public:
44 GestureInterpreterLibevdevCros(int id, 43 GestureInterpreterLibevdevCros(
45 EventModifiersEvdev* modifiers, 44 int id,
46 MouseButtonMapEvdev* button_map, 45 EventModifiersEvdev* modifiers,
47 CursorDelegateEvdev* cursor, 46 CursorDelegateEvdev* cursor,
48 GesturePropertyProvider* property_provider, 47 GesturePropertyProvider* property_provider,
49 const KeyEventDispatchCallback& key_callback, 48 const KeyEventDispatchCallback& key_callback,
50 const EventDispatchCallback& callback); 49 const MouseMoveEventDispatchCallback& mouse_move_callback,
50 const MouseButtonEventDispatchCallback& mouse_button_callback,
51 const EventDispatchCallback& callback);
51 ~GestureInterpreterLibevdevCros() override; 52 ~GestureInterpreterLibevdevCros() override;
52 53
53 // Overriden from ui::EventReaderLibevdevCros::Delegate 54 // Overriden from ui::EventReaderLibevdevCros::Delegate
54 void OnLibEvdevCrosOpen(Evdev* evdev, EventStateRec* evstate) override; 55 void OnLibEvdevCrosOpen(Evdev* evdev, EventStateRec* evstate) override;
55 void OnLibEvdevCrosEvent(Evdev* evdev, 56 void OnLibEvdevCrosEvent(Evdev* evdev,
56 EventStateRec* evstate, 57 EventStateRec* evstate,
57 const timeval& time) override; 58 const timeval& time) override;
58 void SetAllowedKeys( 59 void SetAllowedKeys(
59 scoped_ptr<std::set<DomCode>> allowed_keys) override; 60 scoped_ptr<std::set<DomCode>> allowed_keys) override;
60 void AllowAllKeys() override; 61 void AllowAllKeys() override;
(...skipping 30 matching lines...) Expand all
91 // and multi-touch mice. 92 // and multi-touch mice.
92 bool is_mouse_; 93 bool is_mouse_;
93 94
94 // The evdev codes of the keys which should be processed. nullptr if all keys 95 // The evdev codes of the keys which should be processed. nullptr if all keys
95 // should be processed. 96 // should be processed.
96 scoped_ptr<std::set<int>> allowed_keys_; 97 scoped_ptr<std::set<int>> allowed_keys_;
97 98
98 // Shared modifier state. 99 // Shared modifier state.
99 EventModifiersEvdev* modifiers_; 100 EventModifiersEvdev* modifiers_;
100 101
101 // Shared mouse button map.
102 MouseButtonMapEvdev* button_map_;
103
104 // Shared cursor state. 102 // Shared cursor state.
105 CursorDelegateEvdev* cursor_; 103 CursorDelegateEvdev* cursor_;
106 104
107 // Shared gesture property provider. 105 // Shared gesture property provider.
108 GesturePropertyProvider* property_provider_; 106 GesturePropertyProvider* property_provider_;
109 107
110 // Callbacks for dispatching events. 108 // Callbacks for dispatching events.
111 KeyEventDispatchCallback key_callback_; 109 KeyEventDispatchCallback key_callback_;
110 MouseMoveEventDispatchCallback mouse_move_callback_;
111 MouseButtonEventDispatchCallback mouse_button_callback_;
112 EventDispatchCallback dispatch_callback_; 112 EventDispatchCallback dispatch_callback_;
113 113
114 // Gestures interpretation state. 114 // Gestures interpretation state.
115 gestures::GestureInterpreter* interpreter_; 115 gestures::GestureInterpreter* interpreter_;
116 116
117 // Last key state from libevdev. 117 // Last key state from libevdev.
118 unsigned long prev_key_state_[EVDEV_BITS_TO_LONGS(KEY_CNT)]; 118 unsigned long prev_key_state_[EVDEV_BITS_TO_LONGS(KEY_CNT)];
119 119
120 // Device pointer. 120 // Device pointer.
121 Evdev* evdev_; 121 Evdev* evdev_;
122 122
123 // Gesture lib device properties. 123 // Gesture lib device properties.
124 scoped_ptr<GestureDeviceProperties> device_properties_; 124 scoped_ptr<GestureDeviceProperties> device_properties_;
125 125
126 DISALLOW_COPY_AND_ASSIGN(GestureInterpreterLibevdevCros); 126 DISALLOW_COPY_AND_ASSIGN(GestureInterpreterLibevdevCros);
127 }; 127 };
128 128
129 } // namspace ui 129 } // namspace ui
130 130
131 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_C ROS_H_ 131 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_C ROS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698