Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "input" |
| 18 | #include <utils/Log.h> |
| 19 | |
| 20 | #include <android/input.h> |
Mathias Agopian | b93a03f8 | 2012-02-17 15:34:57 -0800 | [diff] [blame] | 21 | #include <androidfw/Input.h> |
| 22 | #include <androidfw/InputTransport.h> |
Jeff Brown | 4fe6c3e | 2010-09-13 23:17:30 -0700 | [diff] [blame] | 23 | #include <utils/Looper.h> |
Jeff Brown | 6d0fec2 | 2010-07-23 21:28:06 -0700 | [diff] [blame] | 24 | #include <utils/RefBase.h> |
| 25 | #include <utils/Vector.h> |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 26 | |
Dianne Hackborn | d76b67c | 2010-07-13 17:48:30 -0700 | [diff] [blame] | 27 | #include <android_runtime/android_app_NativeActivity.h> |
| 28 | |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 29 | #include <poll.h> |
Jeff Brown | 6d0fec2 | 2010-07-23 21:28:06 -0700 | [diff] [blame] | 30 | #include <errno.h> |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 31 | |
| 32 | using android::InputEvent; |
| 33 | using android::KeyEvent; |
| 34 | using android::MotionEvent; |
Jeff Brown | 6d0fec2 | 2010-07-23 21:28:06 -0700 | [diff] [blame] | 35 | using android::sp; |
| 36 | using android::Vector; |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 37 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 38 | int32_t AInputEvent_getType(const AInputEvent* event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 39 | return static_cast<const InputEvent*>(event)->getType(); |
| 40 | } |
| 41 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 42 | int32_t AInputEvent_getDeviceId(const AInputEvent* event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 43 | return static_cast<const InputEvent*>(event)->getDeviceId(); |
| 44 | } |
| 45 | |
Jeff Brown | c5ed591 | 2010-07-14 18:48:53 -0700 | [diff] [blame] | 46 | int32_t AInputEvent_getSource(const AInputEvent* event) { |
| 47 | return static_cast<const InputEvent*>(event)->getSource(); |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 48 | } |
| 49 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 50 | int32_t AKeyEvent_getAction(const AInputEvent* key_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 51 | return static_cast<const KeyEvent*>(key_event)->getAction(); |
| 52 | } |
| 53 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 54 | int32_t AKeyEvent_getFlags(const AInputEvent* key_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 55 | return static_cast<const KeyEvent*>(key_event)->getFlags(); |
| 56 | } |
| 57 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 58 | int32_t AKeyEvent_getKeyCode(const AInputEvent* key_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 59 | return static_cast<const KeyEvent*>(key_event)->getKeyCode(); |
| 60 | } |
| 61 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 62 | int32_t AKeyEvent_getScanCode(const AInputEvent* key_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 63 | return static_cast<const KeyEvent*>(key_event)->getScanCode(); |
| 64 | } |
| 65 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 66 | int32_t AKeyEvent_getMetaState(const AInputEvent* key_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 67 | return static_cast<const KeyEvent*>(key_event)->getMetaState(); |
| 68 | } |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 69 | int32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 70 | return static_cast<const KeyEvent*>(key_event)->getRepeatCount(); |
| 71 | } |
| 72 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 73 | int64_t AKeyEvent_getDownTime(const AInputEvent* key_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 74 | return static_cast<const KeyEvent*>(key_event)->getDownTime(); |
| 75 | } |
| 76 | |
Jeff Brown | c5ed591 | 2010-07-14 18:48:53 -0700 | [diff] [blame] | 77 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 78 | int64_t AKeyEvent_getEventTime(const AInputEvent* key_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 79 | return static_cast<const KeyEvent*>(key_event)->getEventTime(); |
| 80 | } |
| 81 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 82 | int32_t AMotionEvent_getAction(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 83 | return static_cast<const MotionEvent*>(motion_event)->getAction(); |
| 84 | } |
| 85 | |
Jeff Brown | 85a3176 | 2010-09-01 17:01:00 -0700 | [diff] [blame] | 86 | int32_t AMotionEvent_getFlags(const AInputEvent* motion_event) { |
| 87 | return static_cast<const MotionEvent*>(motion_event)->getFlags(); |
| 88 | } |
| 89 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 90 | int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 91 | return static_cast<const MotionEvent*>(motion_event)->getMetaState(); |
| 92 | } |
| 93 | |
Jeff Brown | fe9f8ab | 2011-05-06 18:20:01 -0700 | [diff] [blame] | 94 | int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event) { |
| 95 | return static_cast<const MotionEvent*>(motion_event)->getButtonState(); |
| 96 | } |
| 97 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 98 | int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 99 | return reinterpret_cast<const MotionEvent*>(motion_event)->getEdgeFlags(); |
| 100 | } |
| 101 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 102 | int64_t AMotionEvent_getDownTime(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 103 | return static_cast<const MotionEvent*>(motion_event)->getDownTime(); |
| 104 | } |
| 105 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 106 | int64_t AMotionEvent_getEventTime(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 107 | return static_cast<const MotionEvent*>(motion_event)->getEventTime(); |
| 108 | } |
| 109 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 110 | float AMotionEvent_getXOffset(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 111 | return static_cast<const MotionEvent*>(motion_event)->getXOffset(); |
| 112 | } |
| 113 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 114 | float AMotionEvent_getYOffset(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 115 | return static_cast<const MotionEvent*>(motion_event)->getYOffset(); |
| 116 | } |
| 117 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 118 | float AMotionEvent_getXPrecision(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 119 | return static_cast<const MotionEvent*>(motion_event)->getXPrecision(); |
| 120 | } |
| 121 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 122 | float AMotionEvent_getYPrecision(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 123 | return static_cast<const MotionEvent*>(motion_event)->getYPrecision(); |
| 124 | } |
| 125 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 126 | size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 127 | return static_cast<const MotionEvent*>(motion_event)->getPointerCount(); |
| 128 | } |
| 129 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 130 | int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 131 | return static_cast<const MotionEvent*>(motion_event)->getPointerId(pointer_index); |
| 132 | } |
| 133 | |
Jeff Brown | fe9f8ab | 2011-05-06 18:20:01 -0700 | [diff] [blame] | 134 | int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index) { |
| 135 | return static_cast<const MotionEvent*>(motion_event)->getToolType(pointer_index); |
| 136 | } |
| 137 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 138 | float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 139 | return static_cast<const MotionEvent*>(motion_event)->getRawX(pointer_index); |
| 140 | } |
| 141 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 142 | float AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 143 | return static_cast<const MotionEvent*>(motion_event)->getRawY(pointer_index); |
| 144 | } |
| 145 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 146 | float AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 147 | return static_cast<const MotionEvent*>(motion_event)->getX(pointer_index); |
| 148 | } |
| 149 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 150 | float AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 151 | return static_cast<const MotionEvent*>(motion_event)->getY(pointer_index); |
| 152 | } |
| 153 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 154 | float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 155 | return static_cast<const MotionEvent*>(motion_event)->getPressure(pointer_index); |
| 156 | } |
| 157 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 158 | float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 159 | return static_cast<const MotionEvent*>(motion_event)->getSize(pointer_index); |
| 160 | } |
| 161 | |
Jeff Brown | c5ed591 | 2010-07-14 18:48:53 -0700 | [diff] [blame] | 162 | float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index) { |
| 163 | return static_cast<const MotionEvent*>(motion_event)->getTouchMajor(pointer_index); |
| 164 | } |
| 165 | |
| 166 | float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index) { |
| 167 | return static_cast<const MotionEvent*>(motion_event)->getTouchMinor(pointer_index); |
| 168 | } |
| 169 | |
| 170 | float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index) { |
| 171 | return static_cast<const MotionEvent*>(motion_event)->getToolMajor(pointer_index); |
| 172 | } |
| 173 | |
| 174 | float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index) { |
| 175 | return static_cast<const MotionEvent*>(motion_event)->getToolMinor(pointer_index); |
| 176 | } |
| 177 | |
| 178 | float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index) { |
| 179 | return static_cast<const MotionEvent*>(motion_event)->getOrientation(pointer_index); |
| 180 | } |
| 181 | |
Jeff Brown | 91c69ab | 2011-02-14 17:03:18 -0800 | [diff] [blame] | 182 | float AMotionEvent_getAxisValue(const AInputEvent* motion_event, |
| 183 | int32_t axis, size_t pointer_index) { |
| 184 | return static_cast<const MotionEvent*>(motion_event)->getAxisValue(axis, pointer_index); |
| 185 | } |
| 186 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 187 | size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event) { |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 188 | return static_cast<const MotionEvent*>(motion_event)->getHistorySize(); |
| 189 | } |
| 190 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 191 | int64_t AMotionEvent_getHistoricalEventTime(const AInputEvent* motion_event, |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 192 | size_t history_index) { |
| 193 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalEventTime( |
| 194 | history_index); |
| 195 | } |
| 196 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 197 | float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index, |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 198 | size_t history_index) { |
| 199 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalRawX( |
| 200 | pointer_index, history_index); |
| 201 | } |
| 202 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 203 | float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index, |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 204 | size_t history_index) { |
| 205 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalRawY( |
| 206 | pointer_index, history_index); |
| 207 | } |
| 208 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 209 | float AMotionEvent_getHistoricalX(const AInputEvent* motion_event, size_t pointer_index, |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 210 | size_t history_index) { |
| 211 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalX( |
| 212 | pointer_index, history_index); |
| 213 | } |
| 214 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 215 | float AMotionEvent_getHistoricalY(const AInputEvent* motion_event, size_t pointer_index, |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 216 | size_t history_index) { |
| 217 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalY( |
| 218 | pointer_index, history_index); |
| 219 | } |
| 220 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 221 | float AMotionEvent_getHistoricalPressure(const AInputEvent* motion_event, size_t pointer_index, |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 222 | size_t history_index) { |
| 223 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalPressure( |
| 224 | pointer_index, history_index); |
| 225 | } |
| 226 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 227 | float AMotionEvent_getHistoricalSize(const AInputEvent* motion_event, size_t pointer_index, |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 228 | size_t history_index) { |
| 229 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalSize( |
| 230 | pointer_index, history_index); |
| 231 | } |
| 232 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 233 | float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index, |
Jeff Brown | c5ed591 | 2010-07-14 18:48:53 -0700 | [diff] [blame] | 234 | size_t history_index) { |
| 235 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalTouchMajor( |
| 236 | pointer_index, history_index); |
| 237 | } |
| 238 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 239 | float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index, |
Jeff Brown | c5ed591 | 2010-07-14 18:48:53 -0700 | [diff] [blame] | 240 | size_t history_index) { |
| 241 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalTouchMinor( |
| 242 | pointer_index, history_index); |
| 243 | } |
| 244 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 245 | float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index, |
Jeff Brown | c5ed591 | 2010-07-14 18:48:53 -0700 | [diff] [blame] | 246 | size_t history_index) { |
| 247 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalToolMajor( |
| 248 | pointer_index, history_index); |
| 249 | } |
| 250 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 251 | float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index, |
Jeff Brown | c5ed591 | 2010-07-14 18:48:53 -0700 | [diff] [blame] | 252 | size_t history_index) { |
| 253 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalToolMinor( |
| 254 | pointer_index, history_index); |
| 255 | } |
| 256 | |
Andrew Hsieh | c01e1ed | 2013-05-27 12:27:10 +0800 | [diff] [blame^] | 257 | float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index, |
Jeff Brown | c5ed591 | 2010-07-14 18:48:53 -0700 | [diff] [blame] | 258 | size_t history_index) { |
| 259 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalOrientation( |
| 260 | pointer_index, history_index); |
| 261 | } |
| 262 | |
Jeff Brown | 91c69ab | 2011-02-14 17:03:18 -0800 | [diff] [blame] | 263 | float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event, |
| 264 | int32_t axis, size_t pointer_index, size_t history_index) { |
| 265 | return static_cast<const MotionEvent*>(motion_event)->getHistoricalAxisValue( |
| 266 | axis, pointer_index, history_index); |
| 267 | } |
| 268 | |
Jeff Brown | c5ed591 | 2010-07-14 18:48:53 -0700 | [diff] [blame] | 269 | |
Dianne Hackborn | 6826741 | 2010-07-02 18:52:01 -0700 | [diff] [blame] | 270 | void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper, |
Jeff Brown | 4fe6c3e | 2010-09-13 23:17:30 -0700 | [diff] [blame] | 271 | int ident, ALooper_callbackFunc callback, void* data) { |
Dianne Hackborn | 42c03e5 | 2010-09-07 15:28:30 -0700 | [diff] [blame] | 272 | queue->attachLooper(looper, ident, callback, data); |
Dianne Hackborn | 6826741 | 2010-07-02 18:52:01 -0700 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | void AInputQueue_detachLooper(AInputQueue* queue) { |
Dianne Hackborn | d76b67c | 2010-07-13 17:48:30 -0700 | [diff] [blame] | 276 | queue->detachLooper(); |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 277 | } |
| 278 | |
Dianne Hackborn | 2c6081c | 2010-07-15 17:44:53 -0700 | [diff] [blame] | 279 | int32_t AInputQueue_hasEvents(AInputQueue* queue) { |
Dianne Hackborn | d76b67c | 2010-07-13 17:48:30 -0700 | [diff] [blame] | 280 | return queue->hasEvents(); |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 281 | } |
| 282 | |
Dianne Hackborn | 2e9f93e | 2010-06-28 15:27:30 -0700 | [diff] [blame] | 283 | int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent) { |
Dianne Hackborn | d76b67c | 2010-07-13 17:48:30 -0700 | [diff] [blame] | 284 | return queue->getEvent(outEvent); |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 285 | } |
| 286 | |
Dianne Hackborn | 2c6081c | 2010-07-15 17:44:53 -0700 | [diff] [blame] | 287 | int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event) { |
| 288 | return queue->preDispatchEvent(event) ? 1 : 0; |
| 289 | } |
| 290 | |
Dianne Hackborn | d76b67c | 2010-07-13 17:48:30 -0700 | [diff] [blame] | 291 | void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled) { |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 292 | queue->finishEvent(event, handled != 0, false); |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 293 | } |