146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Copyright (C) 2010 The Android Open Source Project 346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Licensed under the Apache License, Version 2.0 (the "License"); 546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * you may not use this file except in compliance with the License. 646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * You may obtain a copy of the License at 746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * http://www.apache.org/licenses/LICENSE-2.0 946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 1046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Unless required by applicable law or agreed to in writing, software 1146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * distributed under the License is distributed on an "AS IS" BASIS, 1246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * See the License for the specific language governing permissions and 1446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * limitations under the License. 1546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 1646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 1746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown#ifndef _ANDROID_INPUT_H 1846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown#define _ANDROID_INPUT_H 1946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 2046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/****************************************************************** 2146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 2246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * IMPORTANT NOTICE: 2346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 2446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * This file is part of Android's set of stable system headers 2546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * exposed by the Android NDK (Native Development Kit). 2646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 2746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Third-party source AND binary code relies on the definitions 2846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. 2946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 3046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) 3146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS 3246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY 3346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES 3446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 3546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 3646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 3746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Structures and functions to receive and process input events in 3846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * native code. 3946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 4046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * NOTE: These functions MUST be implemented by /system/lib/libui.so 4146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 4246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 43e30de4e6a312aa921633d119f2518f4b07a7effaKenny Root#include <stdint.h> 4446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown#include <sys/types.h> 4546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown#include <android/keycodes.h> 46682674154e3fe88f6061245145f934f25f1a2eb8Dianne Hackborn#include <android/looper.h> 4746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 4846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown#ifdef __cplusplus 4946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brownextern "C" { 5046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown#endif 5146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 5246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 5346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Key states (may be returned by queries about the current state of a 5446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * particular key code, scan code or switch). 5546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 5646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brownenum { 5746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* The key state is unknown or the requested key itself is not supported. */ 58c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_STATE_UNKNOWN = -1, 5946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 6046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* The key is up. */ 61c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_STATE_UP = 0, 6246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 6346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* The key is down. */ 64c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_STATE_DOWN = 1, 6546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 6646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* The key is down but is a virtual key press that is being emulated by the system. */ 67c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_STATE_VIRTUAL = 2 6846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown}; 6946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 7046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 7146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Meta key / modifer state. 7246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 7346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brownenum { 7446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* No meta keys are pressed. */ 75c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMETA_NONE = 0, 7646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 7746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is used to check whether one of the ALT meta keys is pressed. */ 78c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMETA_ALT_ON = 0x02, 7946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 8046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is used to check whether the left ALT meta key is pressed. */ 81c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMETA_ALT_LEFT_ON = 0x10, 8246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 8346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is used to check whether the right ALT meta key is pressed. */ 84c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMETA_ALT_RIGHT_ON = 0x20, 8546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 8646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is used to check whether one of the SHIFT meta keys is pressed. */ 87c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMETA_SHIFT_ON = 0x01, 8846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 8946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is used to check whether the left SHIFT meta key is pressed. */ 90c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMETA_SHIFT_LEFT_ON = 0x40, 9146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 9246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is used to check whether the right SHIFT meta key is pressed. */ 93c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMETA_SHIFT_RIGHT_ON = 0x80, 9446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 9546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is used to check whether the SYM meta key is pressed. */ 96497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown AMETA_SYM_ON = 0x04, 97497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown 98497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown /* This mask is used to check whether the FUNCTION meta key is pressed. */ 99497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown AMETA_FUNCTION_ON = 0x08, 100497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown 101497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown /* This mask is used to check whether one of the CTRL meta keys is pressed. */ 102497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown AMETA_CTRL_ON = 0x1000, 103497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown 104497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown /* This mask is used to check whether the left CTRL meta key is pressed. */ 105497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown AMETA_CTRL_LEFT_ON = 0x2000, 106497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown 107497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown /* This mask is used to check whether the right CTRL meta key is pressed. */ 108497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown AMETA_CTRL_RIGHT_ON = 0x4000, 109497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown 110497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown /* This mask is used to check whether one of the META meta keys is pressed. */ 111497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown AMETA_META_ON = 0x10000, 112497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown 113497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown /* This mask is used to check whether the left META meta key is pressed. */ 114497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown AMETA_META_LEFT_ON = 0x20000, 115497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown 116497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown /* This mask is used to check whether the right META meta key is pressed. */ 117497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown AMETA_META_RIGHT_ON = 0x40000, 118497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown 11951e7fe7545e3509ebb5c31c10440acd31cec89a2Jeff Brown /* This mask is used to check whether the CAPS LOCK meta key is on. */ 12051e7fe7545e3509ebb5c31c10440acd31cec89a2Jeff Brown AMETA_CAPS_LOCK_ON = 0x100000, 121497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown 12251e7fe7545e3509ebb5c31c10440acd31cec89a2Jeff Brown /* This mask is used to check whether the NUM LOCK meta key is on. */ 12351e7fe7545e3509ebb5c31c10440acd31cec89a2Jeff Brown AMETA_NUM_LOCK_ON = 0x200000, 124497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown 12551e7fe7545e3509ebb5c31c10440acd31cec89a2Jeff Brown /* This mask is used to check whether the SCROLL LOCK meta key is on. */ 12651e7fe7545e3509ebb5c31c10440acd31cec89a2Jeff Brown AMETA_SCROLL_LOCK_ON = 0x400000, 12746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown}; 12846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 12946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 13046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Input events. 13146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 13246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Input events are opaque structures. Use the provided accessors functions to 13346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * read their properties. 13446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 1352e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornstruct AInputEvent; 1362e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackborntypedef struct AInputEvent AInputEvent; 13746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 13846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 13946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Input event types. 14046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 14146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brownenum { 14246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* Indicates that the input event is a key event. */ 143c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_EVENT_TYPE_KEY = 1, 14446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 14546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* Indicates that the input event is a motion event. */ 146c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_EVENT_TYPE_MOTION = 2 14746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown}; 14846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 14946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 15046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Key event actions. 15146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 15246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brownenum { 15346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* The key has been pressed down. */ 154c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_ACTION_DOWN = 0, 15546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 15646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* The key has been released. */ 157c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_ACTION_UP = 1, 15846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 15946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* Multiple duplicate key events have occurred in a row, or a complex string is 16046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * being delivered. The repeat_count property of the key event contains the number 16146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * of times the given key code should be executed. 16246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 163c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_ACTION_MULTIPLE = 2 16446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown}; 16546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 16646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 16746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Key event flags. 16846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 16946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brownenum { 17046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is set if the device woke because of this key event. */ 171c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_FLAG_WOKE_HERE = 0x1, 17246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 17346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is set if the key event was generated by a software keyboard. */ 174c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2, 17546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 17646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is set if we don't want the key event to cause us to leave touch mode. */ 177c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4, 17846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 17946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is set if an event was known to come from a trusted part 18046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * of the system. That is, the event is known to come from the user, 18146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * and could not have been spoofed by a third party component. */ 182c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8, 18346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 18446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This mask is used for compatibility, to identify enter keys that are 18546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * coming from an IME whose enter key has been auto-labelled "next" or 18646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * "done". This allows TextView to dispatch these as normal enter keys 18746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * for old applications, but still do the appropriate action when 18846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * receiving them. */ 189c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10, 19046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 19146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* When associated with up key events, this indicates that the key press 19246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * has been canceled. Typically this is used with virtual touch screen 19346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * keys, where the user can slide from the virtual key area on to the 19446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * display: in that case, the application will receive a canceled up 19546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * event and should not perform the action normally associated with the 19646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * key. Note that for this to work, the application can not perform an 19746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * action for a key until it receives an up or the long press timeout has 19846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * expired. */ 199c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_FLAG_CANCELED = 0x20, 20046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 20146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This key event was generated by a virtual (on-screen) hard key area. 20246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Typically this is an area of the touchscreen, outside of the regular 20346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * display, dedicated to "hardware" buttons. */ 204c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40, 20546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 20646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* This flag is set for the first key repeat that occurs after the 20746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * long press timeout. */ 208c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_FLAG_LONG_PRESS = 0x80, 20946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 210c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown /* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long 21146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * press action was executed while it was down. */ 212c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100, 21346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 214c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown /* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being 21546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * tracked from its initial down. That is, somebody requested that tracking 21646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * started on the key down and a long press has not caused 21746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * the tracking to be canceled. */ 21849ed71db425c5054e3ad9526496a7e116c89556bJeff Brown AKEY_EVENT_FLAG_TRACKING = 0x200, 21949ed71db425c5054e3ad9526496a7e116c89556bJeff Brown 22049ed71db425c5054e3ad9526496a7e116c89556bJeff Brown /* Set when a key event has been synthesized to implement default behavior 22149ed71db425c5054e3ad9526496a7e116c89556bJeff Brown * for an event that the application did not handle. 22249ed71db425c5054e3ad9526496a7e116c89556bJeff Brown * Fallback key events are generated by unhandled trackball motions 22349ed71db425c5054e3ad9526496a7e116c89556bJeff Brown * (to emulate a directional keypad) and by certain unhandled key presses 22449ed71db425c5054e3ad9526496a7e116c89556bJeff Brown * that are declared in the key map (such as special function numeric keypad 22549ed71db425c5054e3ad9526496a7e116c89556bJeff Brown * keys when numlock is off). */ 22649ed71db425c5054e3ad9526496a7e116c89556bJeff Brown AKEY_EVENT_FLAG_FALLBACK = 0x400, 22746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown}; 22846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 22946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 23046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Motion event actions. 23146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 23246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 23346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Bit shift for the action bits holding the pointer index as 234c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK. 23546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 236c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown#define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8 23746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 23846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brownenum { 23946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* Bit mask of the parts of the action code that are the action itself. 24046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 241c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_ACTION_MASK = 0xff, 24246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 24346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* Bits in the action code that represent a pointer index, used with 244c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting 245c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer 24646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * index where the data for the pointer going up or down can be found. 24746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 248c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00, 24946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 25046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* A pressed gesture has started, the motion contains the initial starting location. 25146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 252c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_ACTION_DOWN = 0, 25346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 25446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* A pressed gesture has finished, the motion contains the final release location 25546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * as well as any intermediate points since the last down or move event. 25646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 257c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_ACTION_UP = 1, 25846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 259c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown /* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and 260c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as 26146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * any intermediate points since the last down or move event. 26246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 263c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_ACTION_MOVE = 2, 26446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 26546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* The current gesture has been aborted. 26646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * You will not receive any more points in it. You should treat this as 26746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * an up event, but not perform any action that you normally would. 26846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 269c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_ACTION_CANCEL = 3, 27046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 27146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* A movement has happened outside of the normal bounds of the UI element. 27246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * This does not provide a full gesture, but only the initial location of the movement/touch. 27346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 274c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_ACTION_OUTSIDE = 4, 27546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 27646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* A non-primary pointer has gone down. 277c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. 27846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 279c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_ACTION_POINTER_DOWN = 5, 28046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 28146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* A non-primary pointer has gone up. 282c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. 28346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 284cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown AMOTION_EVENT_ACTION_POINTER_UP = 6, 285cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown 286cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown /* A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE). 287cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown * The motion contains the most recent point, as well as any intermediate points since 288cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown * the last hover move event. 289cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown */ 290cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown AMOTION_EVENT_ACTION_HOVER_MOVE = 7, 29133bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown 29233bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown /* The motion event contains relative vertical and/or horizontal scroll offsets. 29333bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL 29433bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * and AMOTION_EVENT_AXIS_HSCROLL. 29533bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * The pointer may or may not be down when this event is dispatched. 29633bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * This action is always delivered to the winder under the pointer, which 29733bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * may not be the window currently touched. 29833bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown */ 29933bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown AMOTION_EVENT_ACTION_SCROLL = 8, 300a032cc008618b83ecbbede537517d1e7998e3264Jeff Brown 301a032cc008618b83ecbbede537517d1e7998e3264Jeff Brown /* The pointer is not down but has entered the boundaries of a window or view. 302a032cc008618b83ecbbede537517d1e7998e3264Jeff Brown */ 303a032cc008618b83ecbbede537517d1e7998e3264Jeff Brown AMOTION_EVENT_ACTION_HOVER_ENTER = 9, 304a032cc008618b83ecbbede537517d1e7998e3264Jeff Brown 305a032cc008618b83ecbbede537517d1e7998e3264Jeff Brown /* The pointer is not down but has exited the boundaries of a window or view. 306a032cc008618b83ecbbede537517d1e7998e3264Jeff Brown */ 307a032cc008618b83ecbbede537517d1e7998e3264Jeff Brown AMOTION_EVENT_ACTION_HOVER_EXIT = 10, 30846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown}; 30946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 31046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 31185a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown * Motion event flags. 31285a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown */ 31385a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brownenum { 31485a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown /* This flag indicates that the window that received this motion event is partly 31585a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown * or wholly obscured by another visible window above it. This flag is set to true 31685a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown * even if the event did not directly pass through the obscured area. 31785a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown * A security sensitive application can check this flag to identify situations in which 31885a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown * a malicious application may have covered up part of its content for the purpose 31985a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown * of misleading the user or hijacking touches. An appropriate response might be 32085a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown * to drop the suspect touches or to take additional precautions to confirm the user's 32185a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown * actual intent. 32285a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown */ 32385a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1, 32485a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown}; 32585a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown 32685a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown/* 32746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Motion event edge touch flags. 32846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 32946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brownenum { 33046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* No edges intersected */ 331c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_EDGE_FLAG_NONE = 0, 33246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 33346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* Flag indicating the motion event intersected the top edge of the screen. */ 334c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_EDGE_FLAG_TOP = 0x01, 33546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 33646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* Flag indicating the motion event intersected the bottom edge of the screen. */ 337c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02, 33846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 33946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* Flag indicating the motion event intersected the left edge of the screen. */ 340c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04, 34146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 34246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown /* Flag indicating the motion event intersected the right edge of the screen. */ 343c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08 34446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown}; 34546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 34646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 347ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown * Constants that identify each individual axis of a motion event. 3486f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown * Refer to the documentation on the MotionEvent class for descriptions of each axis. 349ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown */ 350ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brownenum { 351ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AMOTION_EVENT_AXIS_X = 0, 352ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AMOTION_EVENT_AXIS_Y = 1, 353ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AMOTION_EVENT_AXIS_PRESSURE = 2, 354ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AMOTION_EVENT_AXIS_SIZE = 3, 355ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4, 356ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AMOTION_EVENT_AXIS_TOUCH_MINOR = 5, 357ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AMOTION_EVENT_AXIS_TOOL_MAJOR = 6, 358ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AMOTION_EVENT_AXIS_TOOL_MINOR = 7, 359ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AMOTION_EVENT_AXIS_ORIENTATION = 8, 3606f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_VSCROLL = 9, 3616f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_HSCROLL = 10, 3626f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_Z = 11, 3636f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_RX = 12, 3646f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_RY = 13, 3656f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_RZ = 14, 3666f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_HAT_X = 15, 3676f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_HAT_Y = 16, 3686f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_LTRIGGER = 17, 3696f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_RTRIGGER = 18, 3703a22fa057091cd6614f58ebc57a7ce4fe29462bbJeff Brown AMOTION_EVENT_AXIS_THROTTLE = 19, 3713a22fa057091cd6614f58ebc57a7ce4fe29462bbJeff Brown AMOTION_EVENT_AXIS_RUDDER = 20, 3723a22fa057091cd6614f58ebc57a7ce4fe29462bbJeff Brown AMOTION_EVENT_AXIS_WHEEL = 21, 3733a22fa057091cd6614f58ebc57a7ce4fe29462bbJeff Brown AMOTION_EVENT_AXIS_GAS = 22, 3743a22fa057091cd6614f58ebc57a7ce4fe29462bbJeff Brown AMOTION_EVENT_AXIS_BRAKE = 23, 375fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AMOTION_EVENT_AXIS_DISTANCE = 24, 37665fd251c3913fc921468a3dad190810db19eb9dfJeff Brown AMOTION_EVENT_AXIS_TILT = 25, 3776f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_1 = 32, 3786f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_2 = 33, 3796f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_3 = 34, 3806f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_4 = 35, 3816f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_5 = 36, 3826f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_6 = 37, 3836f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_7 = 38, 3846f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_8 = 39, 3856f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_9 = 40, 3866f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_10 = 41, 3876f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_11 = 42, 3886f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_12 = 43, 3896f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_13 = 44, 3906f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_14 = 45, 3916f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_15 = 46, 3926f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown AMOTION_EVENT_AXIS_GENERIC_16 = 47, 3936f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown 3946f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown // NOTE: If you add a new axis here you must also add it to several other files. 3956f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown // Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list. 396ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown}; 397ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown 398ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown/* 399fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown * Constants that identify buttons that are associated with motion events. 400fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown * Refer to the documentation on the MotionEvent class for descriptions of each button. 401fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown */ 402fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brownenum { 403fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0, 404fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1, 405fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2, 406fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AMOTION_EVENT_BUTTON_BACK = 1 << 3, 407fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AMOTION_EVENT_BUTTON_FORWARD = 1 << 4, 408fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown}; 409fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown 410fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown/* 411fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown * Constants that identify tool types. 412fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown * Refer to the documentation on the MotionEvent class for descriptions of each tool type. 413fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown */ 414fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brownenum { 415fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0, 416fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AMOTION_EVENT_TOOL_TYPE_FINGER = 1, 417fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AMOTION_EVENT_TOOL_TYPE_STYLUS = 2, 418fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AMOTION_EVENT_TOOL_TYPE_MOUSE = 3, 41949754db5a304d995c1cc108ff6f19e4ba4265572Jeff Brown AMOTION_EVENT_TOOL_TYPE_ERASER = 4, 420fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown}; 421fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown 422fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown/* 423c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * Input sources. 42446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 425c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * Refer to the documentation on android.view.InputDevice for more details about input sources 426c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * and their correct interpretation. 42746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 42846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brownenum { 429c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_CLASS_MASK = 0x000000ff, 430c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 431c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_CLASS_BUTTON = 0x00000001, 432c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_CLASS_POINTER = 0x00000002, 433c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004, 434c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_CLASS_POSITION = 0x00000008, 435cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010, 436c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown}; 437c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 438c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownenum { 439c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_UNKNOWN = 0x00000000, 440c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 441c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON, 442c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON, 443cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON, 444c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER, 445c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER, 446fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER, 447c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION, 448c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION, 449cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK, 450c3db858de9fa152480b9cf53c8c0cb793a280722Jeff Brown 451c3db858de9fa152480b9cf53c8c0cb793a280722Jeff Brown AINPUT_SOURCE_ANY = 0xffffff00, 45246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown}; 45346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 45446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* 4556d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown * Keyboard types. 4566d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown * 4576d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown * Refer to the documentation on android.view.InputDevice for more details. 4586d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown */ 4596d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brownenum { 4606d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown AINPUT_KEYBOARD_TYPE_NONE = 0, 4616d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1, 4626d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2, 4636d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown}; 4646d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown 4656d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown/* 4666d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown * Constants used to retrieve information about the range of motion for a particular 4676d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown * coordinate of a motion event. 4686d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown * 4696d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown * Refer to the documentation on android.view.InputDevice for more details about input sources 4706d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown * and their correct interpretation. 47191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown * 472ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown * DEPRECATION NOTICE: These constants are deprecated. Use AMOTION_EVENT_AXIS_* constants instead. 4736d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown */ 4746d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brownenum { 475ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AINPUT_MOTION_RANGE_X = AMOTION_EVENT_AXIS_X, 476ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AINPUT_MOTION_RANGE_Y = AMOTION_EVENT_AXIS_Y, 477ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AINPUT_MOTION_RANGE_PRESSURE = AMOTION_EVENT_AXIS_PRESSURE, 478ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AINPUT_MOTION_RANGE_SIZE = AMOTION_EVENT_AXIS_SIZE, 479ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AINPUT_MOTION_RANGE_TOUCH_MAJOR = AMOTION_EVENT_AXIS_TOUCH_MAJOR, 480ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AINPUT_MOTION_RANGE_TOUCH_MINOR = AMOTION_EVENT_AXIS_TOUCH_MINOR, 481ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AINPUT_MOTION_RANGE_TOOL_MAJOR = AMOTION_EVENT_AXIS_TOOL_MAJOR, 482ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AINPUT_MOTION_RANGE_TOOL_MINOR = AMOTION_EVENT_AXIS_TOOL_MINOR, 483ebbd5d14ad3b1e762d9fcfa026e19413cc857e05Jeff Brown AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION, 48491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown} __attribute__ ((deprecated)); 4856d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown 4866d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown 4876d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown/* 48846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Input event accessors. 48946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 49046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Note that most functions can only be used on input events that are of a given type. 49146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Calling these functions on input events of other types will yield undefined behavior. 49246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 49346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 49446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/*** Accessors for all input events. ***/ 49546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 49646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the input event type. */ 4972e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AInputEvent_getType(const AInputEvent* event); 49846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 49946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the id for the device that an input event came from. 50046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 50146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Input events can be generated by multiple different input devices. 50246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Use the input device id to obtain information about the input 50346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * device that was responsible for generating a particular event. 50446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * 50546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * An input device id of 0 indicates that the event didn't come from a physical device; 50646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * other numbers are arbitrary and you shouldn't depend on the values. 50746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Use the provided input device query API to obtain information about input devices. 50846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown */ 5092e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AInputEvent_getDeviceId(const AInputEvent* event); 51046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 511c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the input event source. */ 512c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownint32_t AInputEvent_getSource(const AInputEvent* event); 51346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 51446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/*** Accessors for key events only. ***/ 51546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 51646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the key event action. */ 5172e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AKeyEvent_getAction(const AInputEvent* key_event); 51846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 51946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the key event flags. */ 5202e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AKeyEvent_getFlags(const AInputEvent* key_event); 52146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 52246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the key code of the key event. 52346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * This is the physical key that was pressed, not the Unicode character. */ 5242e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AKeyEvent_getKeyCode(const AInputEvent* key_event); 52546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 52646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the hardware key id of this key event. 52746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * These values are not reliable and vary from device to device. */ 5282e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AKeyEvent_getScanCode(const AInputEvent* key_event); 52946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 53046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the meta key state. */ 5312e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AKeyEvent_getMetaState(const AInputEvent* key_event); 53246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 53346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the repeat count of the event. 53446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * For both key up an key down events, this is the number of times the key has 53546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * repeated with the first down starting at 0 and counting up from there. For 53646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * multiple key events, this is the number of down/up pairs that have occurred. */ 5372e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event); 53846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 53946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the time of the most recent key down event, in the 54046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * java.lang.System.nanoTime() time base. If this is a down event, 54146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * this will be the same as eventTime. 54246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Note that when chording keys, this value is the down time of the most recently 54346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * pressed key, which may not be the same physical key of this event. */ 5442e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint64_t AKeyEvent_getDownTime(const AInputEvent* key_event); 54546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 54646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the time this event occurred, in the 54746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * java.lang.System.nanoTime() time base. */ 5482e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint64_t AKeyEvent_getEventTime(const AInputEvent* key_event); 54946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 55046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/*** Accessors for motion events only. ***/ 55146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 55246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the combined motion event action code and pointer index. */ 5532e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AMotionEvent_getAction(const AInputEvent* motion_event); 55446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 55585a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown/* Get the motion event flags. */ 55685a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brownint32_t AMotionEvent_getFlags(const AInputEvent* motion_event); 55785a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown 55846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the state of any meta / modifier keys that were in effect when the 55946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * event was generated. */ 5602e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AMotionEvent_getMetaState(const AInputEvent* motion_event); 56146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 562fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown/* Get the button state of all buttons that are pressed. */ 563fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brownint32_t AMotionEvent_getButtonState(const AInputEvent* motion_event); 564fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown 56546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get a bitfield indicating which edges, if any, were touched by this motion event. 56646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * For touch events, clients can use this to determine if the user's finger was 56746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * touching the edge of the display. */ 5682e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event); 56946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 57046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the time when the user originally pressed down to start a stream of 57146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * position events, in the java.lang.System.nanoTime() time base. */ 5722e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint64_t AMotionEvent_getDownTime(const AInputEvent* motion_event); 57346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 57446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the time when this specific event was generated, 57546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * in the java.lang.System.nanoTime() time base. */ 5762e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint64_t AMotionEvent_getEventTime(const AInputEvent* motion_event); 57746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 5785c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown/* Get the X coordinate offset. 5795c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * For touch events on the screen, this is the delta that was added to the raw 5805c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * screen coordinates to adjust for the absolute position of the containing windows 5815c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * and views. */ 5822e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getXOffset(const AInputEvent* motion_event); 5835c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown 5845c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown/* Get the precision of the Y coordinates being reported. 5855c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * For touch events on the screen, this is the delta that was added to the raw 5865c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * screen coordinates to adjust for the absolute position of the containing windows 5875c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * and views. */ 5882e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getYOffset(const AInputEvent* motion_event); 5895c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown 59046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the precision of the X coordinates being reported. 59146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * You can multiply this number with an X coordinate sample to find the 59246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * actual hardware value of the X coordinate. */ 5932e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getXPrecision(const AInputEvent* motion_event); 59446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 59546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the precision of the Y coordinates being reported. 59646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * You can multiply this number with a Y coordinate sample to find the 59746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * actual hardware value of the Y coordinate. */ 5982e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getYPrecision(const AInputEvent* motion_event); 59946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 60046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the number of pointers of data contained in this event. 60146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Always >= 1. */ 6022e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornsize_t AMotionEvent_getPointerCount(const AInputEvent* motion_event); 60346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 60446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the pointer identifier associated with a particular pointer 605fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown * data index in this event. The identifier tells you the actual pointer 60646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * number associated with the data, accounting for individual pointers 60746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * going up and down since the start of the current gesture. */ 6082e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index); 60946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 610fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown/* Get the tool type of a pointer for the given pointer index. 611fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown * The tool type indicates the type of tool used to make contact such as a 612fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown * finger or stylus, if known. */ 613fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brownint32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index); 614fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown 6155c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown/* Get the original raw X coordinate of this event. 6165c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * For touch events on the screen, this is the original location of the event 61746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * on the screen, before it had been adjusted for the containing window 61846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * and views. */ 6192e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index); 62046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 6215c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown/* Get the original raw X coordinate of this event. 6225c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * For touch events on the screen, this is the original location of the event 62346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * on the screen, before it had been adjusted for the containing window 62446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * and views. */ 6252e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index); 62646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 62746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the current X coordinate of this event for the given pointer index. 62846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Whole numbers are pixels; the value may have a fraction for input devices 62946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * that are sub-pixel precise. */ 6302e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index); 63146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 63246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the current Y coordinate of this event for the given pointer index. 63346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Whole numbers are pixels; the value may have a fraction for input devices 63446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * that are sub-pixel precise. */ 6352e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index); 63646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 63746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the current pressure of this event for the given pointer index. 63846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), 63991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown * although values higher than 1 may be generated depending on the calibration of 64046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * the input device. */ 6412e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index); 64246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 64346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the current scaled value of the approximate size for the given pointer index. 64446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * This represents some approximation of the area of the screen being 64546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * pressed; the actual value in pixels corresponding to the 64646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * touch is normalized with the device specific range of values 64746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * and scaled to a value between 0 and 1. The value of size can be used to 64846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * determine fat touch events. */ 6492e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index); 65046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 651c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the current length of the major axis of an ellipse that describes the touch area 652c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * at the point of contact for the given pointer index. */ 653c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownfloat AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index); 654c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 655c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the current length of the minor axis of an ellipse that describes the touch area 656c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * at the point of contact for the given pointer index. */ 657c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownfloat AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index); 658c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 659c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the current length of the major axis of an ellipse that describes the size 660c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * of the approaching tool for the given pointer index. 661c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * The tool area represents the estimated size of the finger or pen that is 662c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * touching the device independent of its actual touch area at the point of contact. */ 663c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownfloat AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index); 664c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 665c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the current length of the minor axis of an ellipse that describes the size 666c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * of the approaching tool for the given pointer index. 667c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * The tool area represents the estimated size of the finger or pen that is 668c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * touching the device independent of its actual touch area at the point of contact. */ 669c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownfloat AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index); 670c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 671c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the current orientation of the touch area and tool area in radians clockwise from 672c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * vertical for the given pointer index. 673c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * An angle of 0 degrees indicates that the major axis of contact is oriented 674c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * upwards, is perfectly circular or is of unknown orientation. A positive angle 675c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * indicates that the major axis of contact is oriented to the right. A negative angle 676c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * indicates that the major axis of contact is oriented to the left. 6776d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians 678c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * (finger pointing fully right). */ 679c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownfloat AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index); 680c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 68191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown/* Get the value of the request axis for the given pointer index. */ 68291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brownfloat AMotionEvent_getAxisValue(const AInputEvent* motion_event, 68391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown int32_t axis, size_t pointer_index); 68491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown 68546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the number of historical points in this event. These are movements that 68646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * have occurred between this event and the previous event. This only applies 687c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0. 68846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Historical samples are indexed from oldest to newest. */ 689c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownsize_t AMotionEvent_getHistorySize(const AInputEvent* motion_event); 69046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 69146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the time that a historical movement occurred between this event and 69246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * the previous event, in the java.lang.System.nanoTime() time base. */ 6932e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint64_t AMotionEvent_getHistoricalEventTime(AInputEvent* motion_event, 69446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown size_t history_index); 69546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 6965c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown/* Get the historical raw X coordinate of this event for the given pointer index that 6975c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * occurred between this event and the previous motion event. 6985c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * For touch events on the screen, this is the original location of the event 6995c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * on the screen, before it had been adjusted for the containing window 7005c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * and views. 7015c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * Whole numbers are pixels; the value may have a fraction for input devices 7025c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * that are sub-pixel precise. */ 703e325e9ada7be366468199157234a16d7606a0abeJeff Brownfloat AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index, 704e325e9ada7be366468199157234a16d7606a0abeJeff Brown size_t history_index); 7055c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown 7065c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown/* Get the historical raw Y coordinate of this event for the given pointer index that 7075c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * occurred between this event and the previous motion event. 7085c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * For touch events on the screen, this is the original location of the event 7095c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * on the screen, before it had been adjusted for the containing window 7105c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * and views. 7115c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * Whole numbers are pixels; the value may have a fraction for input devices 7125c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown * that are sub-pixel precise. */ 713e325e9ada7be366468199157234a16d7606a0abeJeff Brownfloat AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index, 714e325e9ada7be366468199157234a16d7606a0abeJeff Brown size_t history_index); 7155c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown 71646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the historical X coordinate of this event for the given pointer index that 71746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * occurred between this event and the previous motion event. 71846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Whole numbers are pixels; the value may have a fraction for input devices 71946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * that are sub-pixel precise. */ 7202e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getHistoricalX(AInputEvent* motion_event, size_t pointer_index, 72146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown size_t history_index); 72246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 72346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the historical Y coordinate of this event for the given pointer index that 72446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * occurred between this event and the previous motion event. 72546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * Whole numbers are pixels; the value may have a fraction for input devices 72646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * that are sub-pixel precise. */ 7272e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getHistoricalY(AInputEvent* motion_event, size_t pointer_index, 72846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown size_t history_index); 72946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 73046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the historical pressure of this event for the given pointer index that 73146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * occurred between this event and the previous motion event. 73246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), 73391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown * although values higher than 1 may be generated depending on the calibration of 73446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * the input device. */ 7352e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getHistoricalPressure(AInputEvent* motion_event, size_t pointer_index, 73646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown size_t history_index); 73746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 73846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown/* Get the current scaled value of the approximate size for the given pointer index that 73946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * occurred between this event and the previous motion event. 74046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * This represents some approximation of the area of the screen being 74146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * pressed; the actual value in pixels corresponding to the 74246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * touch is normalized with the device specific range of values 74346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * and scaled to a value between 0 and 1. The value of size can be used to 74446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown * determine fat touch events. */ 7452e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornfloat AMotionEvent_getHistoricalSize(AInputEvent* motion_event, size_t pointer_index, 74646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown size_t history_index); 74746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 748c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the historical length of the major axis of an ellipse that describes the touch area 749c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * at the point of contact for the given pointer index that 750c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * occurred between this event and the previous motion event. */ 751c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownfloat AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index, 752c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown size_t history_index); 753c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 754c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the historical length of the minor axis of an ellipse that describes the touch area 755c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * at the point of contact for the given pointer index that 756c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * occurred between this event and the previous motion event. */ 757c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownfloat AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index, 758c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown size_t history_index); 759c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 760c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the historical length of the major axis of an ellipse that describes the size 761c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * of the approaching tool for the given pointer index that 762c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * occurred between this event and the previous motion event. 763c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * The tool area represents the estimated size of the finger or pen that is 764c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * touching the device independent of its actual touch area at the point of contact. */ 765c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownfloat AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index, 766c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown size_t history_index); 767c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 768c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the historical length of the minor axis of an ellipse that describes the size 769c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * of the approaching tool for the given pointer index that 770c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * occurred between this event and the previous motion event. 771c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * The tool area represents the estimated size of the finger or pen that is 772c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * touching the device independent of its actual touch area at the point of contact. */ 773c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownfloat AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index, 774c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown size_t history_index); 775c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 776c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown/* Get the historical orientation of the touch area and tool area in radians clockwise from 777c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * vertical for the given pointer index that 778c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * occurred between this event and the previous motion event. 779c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * An angle of 0 degrees indicates that the major axis of contact is oriented 780c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * upwards, is perfectly circular or is of unknown orientation. A positive angle 781c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * indicates that the major axis of contact is oriented to the right. A negative angle 782c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * indicates that the major axis of contact is oriented to the left. 7836d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians 784c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * (finger pointing fully right). */ 785c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownfloat AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index, 786c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown size_t history_index); 787c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 78891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown/* Get the historical value of the request axis for the given pointer index 78991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown * that occurred between this event and the previous motion event. */ 79091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brownfloat AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event, 79191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown int32_t axis, size_t pointer_index, size_t history_index); 79291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown 793c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown 794a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn/* 795a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn * Input queue 796a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn * 797a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn * An input queue is the facility through which you retrieve input 798a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn * events. 799a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn */ 8002e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornstruct AInputQueue; 8012e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackborntypedef struct AInputQueue AInputQueue; 802a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn 803a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn/* 80485448bbecd4e0909eecfab15b7c3605f114d0427Dianne Hackborn * Add this input queue to a looper for processing. See 80542c03e579aade011b451e2a13ea3f44a2ef0056aDianne Hackborn * ALooper_addFd() for information on the ident, callback, and data params. 806a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn */ 807682674154e3fe88f6061245145f934f25f1a2eb8Dianne Hackbornvoid AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper, 8084fe6c3e51be77e35f40872cdbca6c80f8f8b7ecbJeff Brown int ident, ALooper_callbackFunc callback, void* data); 809682674154e3fe88f6061245145f934f25f1a2eb8Dianne Hackborn 810682674154e3fe88f6061245145f934f25f1a2eb8Dianne Hackborn/* 811682674154e3fe88f6061245145f934f25f1a2eb8Dianne Hackborn * Remove the input queue from the looper it is currently attached to. 812682674154e3fe88f6061245145f934f25f1a2eb8Dianne Hackborn */ 813682674154e3fe88f6061245145f934f25f1a2eb8Dianne Hackbornvoid AInputQueue_detachLooper(AInputQueue* queue); 814a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn 815a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn/* 816a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn * Returns true if there are one or more events available in the 817a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn * input queue. Returns 1 if the queue has events; 0 if 818a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn * it does not have events; and a negative value if there is an error. 819a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn */ 8202c6081ce3593712f30dacd990a97209c791d6cedDianne Hackbornint32_t AInputQueue_hasEvents(AInputQueue* queue); 821a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn 822a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn/* 823a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn * Returns the next available event from the queue. Returns a negative 824a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn * value if no events are available or an error has occurred. 825a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn */ 8262e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornint32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent); 827a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn 828a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn/* 8292c6081ce3593712f30dacd990a97209c791d6cedDianne Hackborn * Sends the key for standard pre-dispatching -- that is, possibly deliver 8302c6081ce3593712f30dacd990a97209c791d6cedDianne Hackborn * it to the current IME to be consumed before the app. Returns 0 if it 8312c6081ce3593712f30dacd990a97209c791d6cedDianne Hackborn * was not pre-dispatched, meaning you can process it right now. If non-zero 8322c6081ce3593712f30dacd990a97209c791d6cedDianne Hackborn * is returned, you must abandon the current event processing and allow the 8332c6081ce3593712f30dacd990a97209c791d6cedDianne Hackborn * event to appear again in the event queue (if it does not get consumed during 8342c6081ce3593712f30dacd990a97209c791d6cedDianne Hackborn * pre-dispatching). 8352c6081ce3593712f30dacd990a97209c791d6cedDianne Hackborn */ 8362c6081ce3593712f30dacd990a97209c791d6cedDianne Hackbornint32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event); 8372c6081ce3593712f30dacd990a97209c791d6cedDianne Hackborn 8382c6081ce3593712f30dacd990a97209c791d6cedDianne Hackborn/* 839a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn * Report that dispatching has finished with the given event. 8402e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackborn * This must be called after receiving an event with AInputQueue_get_event(). 841a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn */ 8422e9f93e8db509d5236229dc8540e0904c5dbb9f5Dianne Hackbornvoid AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled); 843a95e4cb62f3642cb190d032dbf7dc40d9ecc6973Dianne Hackborn 84446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown#ifdef __cplusplus 84546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown} 84646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown#endif 84746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown 84846b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown#endif // _ANDROID_INPUT_H 849