| 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 <bitset> |
| 8 #include <gestures/gestures.h> | 9 #include <gestures/gestures.h> |
| 9 #include <libevdev/libevdev.h> | 10 #include <libevdev/libevdev.h> |
| 10 | 11 |
| 11 #include "base/callback.h" | 12 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 14 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 14 #include "ui/events/ozone/evdev/event_device_util.h" | 15 #include "ui/events/ozone/evdev/event_device_util.h" |
| 15 #include "ui/events/ozone/evdev/event_dispatch_callback.h" | 16 #include "ui/events/ozone/evdev/event_dispatch_callback.h" |
| 16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 17 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
| 17 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" | 18 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void OnGestureSwipe(const Gesture* gesture, const GestureSwipe* swipe); | 75 void OnGestureSwipe(const Gesture* gesture, const GestureSwipe* swipe); |
| 75 void OnGestureSwipeLift(const Gesture* gesture, | 76 void OnGestureSwipeLift(const Gesture* gesture, |
| 76 const GestureSwipeLift* swipelift); | 77 const GestureSwipeLift* swipelift); |
| 77 void OnGesturePinch(const Gesture* gesture, const GesturePinch* pinch); | 78 void OnGesturePinch(const Gesture* gesture, const GesturePinch* pinch); |
| 78 void OnGestureMetrics(const Gesture* gesture, const GestureMetrics* metrics); | 79 void OnGestureMetrics(const Gesture* gesture, const GestureMetrics* metrics); |
| 79 | 80 |
| 80 void DispatchMouseButton(unsigned int modifier, | 81 void DispatchMouseButton(unsigned int modifier, |
| 81 bool down, | 82 bool down, |
| 82 stime_t time); | 83 stime_t time); |
| 83 void DispatchChangedKeys(unsigned long* changed_keys, stime_t timestamp); | 84 void DispatchChangedKeys(unsigned long* changed_keys, stime_t timestamp); |
| 84 void ReleaseKeys(); | 85 void ReleaseKeys(stime_t timestamp); |
| 86 bool SetMouseButtonState(unsigned int button, bool down); |
| 87 void ReleaseMouseButtons(stime_t timestamp); |
| 85 | 88 |
| 86 // The unique device id. | 89 // The unique device id. |
| 87 int id_; | 90 int id_; |
| 88 | 91 |
| 89 // 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 |
| 90 // and multi-touch mice. | 93 // and multi-touch mice. |
| 91 bool is_mouse_; | 94 bool is_mouse_; |
| 92 | 95 |
| 93 // The evdev codes of the keys which should be processed. nullptr if all keys | 96 // The evdev codes of the keys which should be processed. nullptr if all keys |
| 94 // should be processed. | 97 // should be processed. |
| 95 scoped_ptr<std::set<int>> allowed_keys_; | 98 scoped_ptr<std::set<int>> allowed_keys_; |
| 96 | 99 |
| 97 // Shared cursor state. | 100 // Shared cursor state. |
| 98 CursorDelegateEvdev* cursor_; | 101 CursorDelegateEvdev* cursor_; |
| 99 | 102 |
| 100 // Shared gesture property provider. | 103 // Shared gesture property provider. |
| 101 GesturePropertyProvider* property_provider_; | 104 GesturePropertyProvider* property_provider_; |
| 102 | 105 |
| 103 // Dispatcher for events. | 106 // Dispatcher for events. |
| 104 DeviceEventDispatcherEvdev* dispatcher_; | 107 DeviceEventDispatcherEvdev* dispatcher_; |
| 105 | 108 |
| 106 // Gestures interpretation state. | 109 // Gestures interpretation state. |
| 107 gestures::GestureInterpreter* interpreter_; | 110 gestures::GestureInterpreter* interpreter_; |
| 108 | 111 |
| 109 // Last key state from libevdev. | 112 // Last key state from libevdev. |
| 110 unsigned long prev_key_state_[EVDEV_BITS_TO_LONGS(KEY_CNT)]; | 113 unsigned long prev_key_state_[EVDEV_BITS_TO_LONGS(KEY_CNT)]; |
| 111 | 114 |
| 115 // Last mouse button state. |
| 116 static const int kMouseButtonCount = BTN_JOYSTICK - BTN_MOUSE; |
| 117 std::bitset<kMouseButtonCount> mouse_button_state_; |
| 118 |
| 112 // Device pointer. | 119 // Device pointer. |
| 113 Evdev* evdev_; | 120 Evdev* evdev_; |
| 114 | 121 |
| 115 // Gesture lib device properties. | 122 // Gesture lib device properties. |
| 116 scoped_ptr<GestureDeviceProperties> device_properties_; | 123 scoped_ptr<GestureDeviceProperties> device_properties_; |
| 117 | 124 |
| 118 DISALLOW_COPY_AND_ASSIGN(GestureInterpreterLibevdevCros); | 125 DISALLOW_COPY_AND_ASSIGN(GestureInterpreterLibevdevCros); |
| 119 }; | 126 }; |
| 120 | 127 |
| 121 } // namspace ui | 128 } // namspace ui |
| 122 | 129 |
| 123 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_C
ROS_H_ | 130 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_INTERPRETER_LIBEVDEV_C
ROS_H_ |
| OLD | NEW |