111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Copyright (C) 2010 The Android Open Source Project
311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Licensed under the Apache License, Version 2.0 (the "License");
511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * you may not use this file except in compliance with the License.
611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * You may obtain a copy of the License at
711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *      http://www.apache.org/licenses/LICENSE-2.0
911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
1011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Unless required by applicable law or agreed to in writing, software
1111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * distributed under the License is distributed on an "AS IS" BASIS,
1211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * See the License for the specific language governing permissions and
1411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * limitations under the License.
1511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
1611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
1711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#ifndef _ANDROID_INPUT_H
1811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#define _ANDROID_INPUT_H
1911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
2011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/******************************************************************
2111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
2211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * IMPORTANT NOTICE:
2311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
2411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *   This file is part of Android's set of stable system headers
2511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *   exposed by the Android NDK (Native Development Kit).
2611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
2711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *   Third-party source AND binary code relies on the definitions
2811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *   here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
2911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
3011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *   - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
3111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *   - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
3211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *   - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
3311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *   - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
3411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
3511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
3611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
3711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Structures and functions to receive and process input events in
3811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * native code.
3911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
4011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * NOTE: These functions MUST be implemented by /system/lib/libui.so
4111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
4211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
4311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#include <stdint.h>
4411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#include <sys/types.h>
4511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#include <android/keycodes.h>
4611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#include <android/looper.h>
4711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
4811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#ifdef __cplusplus
4911cd02dfb91661c65134cac258cf5924270e9d2Dan Albertextern "C" {
5011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#endif
5111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
5211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
5311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Key states (may be returned by queries about the current state of a
5411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * particular key code, scan code or switch).
5511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
5611cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
5711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* The key state is unknown or the requested key itself is not supported. */
5811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_STATE_UNKNOWN = -1,
5911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
6011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* The key is up. */
6111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_STATE_UP = 0,
6211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
6311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* The key is down. */
6411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_STATE_DOWN = 1,
6511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
6611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* The key is down but is a virtual key press that is being emulated by the system. */
6711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_STATE_VIRTUAL = 2
6811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
6911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
7011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
7111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Meta key / modifer state.
7211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
7311cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
7411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* No meta keys are pressed. */
7511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMETA_NONE = 0,
7611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
7711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is used to check whether one of the ALT meta keys is pressed. */
7811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMETA_ALT_ON = 0x02,
7911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
8011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is used to check whether the left ALT meta key is pressed. */
8111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMETA_ALT_LEFT_ON = 0x10,
8211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
8311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is used to check whether the right ALT meta key is pressed. */
8411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMETA_ALT_RIGHT_ON = 0x20,
8511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
8611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is used to check whether one of the SHIFT meta keys is pressed. */
8711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMETA_SHIFT_ON = 0x01,
8811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
8911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is used to check whether the left SHIFT meta key is pressed. */
9011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMETA_SHIFT_LEFT_ON = 0x40,
9111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
9211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is used to check whether the right SHIFT meta key is pressed. */
9311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMETA_SHIFT_RIGHT_ON = 0x80,
9411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
9511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is used to check whether the SYM meta key is pressed. */
9611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMETA_SYM_ON = 0x04
9711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
9811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
9911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
10011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Input events.
10111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
10211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Input events are opaque structures.  Use the provided accessors functions to
10311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * read their properties.
10411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
10511cd02dfb91661c65134cac258cf5924270e9d2Dan Albertstruct AInputEvent;
10611cd02dfb91661c65134cac258cf5924270e9d2Dan Alberttypedef struct AInputEvent AInputEvent;
10711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
10811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
10911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Input event types.
11011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
11111cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
11211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Indicates that the input event is a key event. */
11311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_EVENT_TYPE_KEY = 1,
11411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
11511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Indicates that the input event is a motion event. */
11611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_EVENT_TYPE_MOTION = 2
11711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
11811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
11911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
12011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Key event actions.
12111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
12211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
12311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* The key has been pressed down. */
12411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_ACTION_DOWN = 0,
12511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
12611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* The key has been released. */
12711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_ACTION_UP = 1,
12811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
12911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Multiple duplicate key events have occurred in a row, or a complex string is
13011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * being delivered.  The repeat_count property of the key event contains the number
13111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * of times the given key code should be executed.
13211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
13311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_ACTION_MULTIPLE = 2
13411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
13511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
13611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
13711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Key event flags.
13811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
13911cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
14011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is set if the device woke because of this key event. */
14111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_FLAG_WOKE_HERE = 0x1,
14211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
14311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is set if the key event was generated by a software keyboard. */
14411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2,
14511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
14611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is set if we don't want the key event to cause us to leave touch mode. */
14711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4,
14811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
14911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is set if an event was known to come from a trusted part
15011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * of the system.  That is, the event is known to come from the user,
15111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * and could not have been spoofed by a third party component. */
15211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8,
15311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
15411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This mask is used for compatibility, to identify enter keys that are
15511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * coming from an IME whose enter key has been auto-labelled "next" or
15611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * "done".  This allows TextView to dispatch these as normal enter keys
15711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * for old applications, but still do the appropriate action when
15811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * receiving them. */
15911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10,
16011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
16111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* When associated with up key events, this indicates that the key press
16211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * has been canceled.  Typically this is used with virtual touch screen
16311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * keys, where the user can slide from the virtual key area on to the
16411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * display: in that case, the application will receive a canceled up
16511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * event and should not perform the action normally associated with the
16611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * key.  Note that for this to work, the application can not perform an
16711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * action for a key until it receives an up or the long press timeout has
16811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * expired. */
16911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_FLAG_CANCELED = 0x20,
17011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
17111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This key event was generated by a virtual (on-screen) hard key area.
17211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * Typically this is an area of the touchscreen, outside of the regular
17311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * display, dedicated to "hardware" buttons. */
17411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40,
17511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
17611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This flag is set for the first key repeat that occurs after the
17711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * long press timeout. */
17811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_FLAG_LONG_PRESS = 0x80,
17911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
18011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long
18111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * press action was executed while it was down. */
18211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100,
18311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
18411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being
18511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * tracked from its initial down.  That is, somebody requested that tracking
18611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * started on the key down and a long press has not caused
18711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * the tracking to be canceled. */
18811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AKEY_EVENT_FLAG_TRACKING = 0x200
18911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
19011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
19111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
19211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Motion event actions.
19311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
19411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
19511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Bit shift for the action bits holding the pointer index as
19611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
19711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
19811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8
19911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
20011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
20111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Bit mask of the parts of the action code that are the action itself.
20211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
20311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_ACTION_MASK = 0xff,
20411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
20511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Bits in the action code that represent a pointer index, used with
20611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP.  Shifting
20711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
20811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * index where the data for the pointer going up or down can be found.
20911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
21011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_ACTION_POINTER_INDEX_MASK  = 0xff00,
21111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
21211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* A pressed gesture has started, the motion contains the initial starting location.
21311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
21411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_ACTION_DOWN = 0,
21511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
21611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* A pressed gesture has finished, the motion contains the final release location
21711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * as well as any intermediate points since the last down or move event.
21811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
21911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_ACTION_UP = 1,
22011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
22111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
22211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * AMOTION_EVENT_ACTION_UP).  The motion contains the most recent point, as well as
22311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * any intermediate points since the last down or move event.
22411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
22511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_ACTION_MOVE = 2,
22611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
22711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* The current gesture has been aborted.
22811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * You will not receive any more points in it.  You should treat this as
22911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * an up event, but not perform any action that you normally would.
23011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
23111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_ACTION_CANCEL = 3,
23211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
23311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* A movement has happened outside of the normal bounds of the UI element.
23411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * This does not provide a full gesture, but only the initial location of the movement/touch.
23511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
23611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_ACTION_OUTSIDE = 4,
23711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
23811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* A non-primary pointer has gone down.
23911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
24011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
24111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_ACTION_POINTER_DOWN = 5,
24211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
24311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* A non-primary pointer has gone up.
24411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
24511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
24611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_ACTION_POINTER_UP = 6
24711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
24811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
24911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
25011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Motion event flags.
25111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
25211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
25311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* This flag indicates that the window that received this motion event is partly
25411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * or wholly obscured by another visible window above it.  This flag is set to true
25511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * even if the event did not directly pass through the obscured area.
25611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * A security sensitive application can check this flag to identify situations in which
25711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * a malicious application may have covered up part of its content for the purpose
25811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * of misleading the user or hijacking touches.  An appropriate response might be
25911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * to drop the suspect touches or to take additional precautions to confirm the user's
26011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     * actual intent.
26111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert     */
26211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1,
26311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
26411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
26511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
26611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Motion event edge touch flags.
26711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
26811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
26911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* No edges intersected */
27011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_EDGE_FLAG_NONE = 0,
27111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
27211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Flag indicating the motion event intersected the top edge of the screen. */
27311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_EDGE_FLAG_TOP = 0x01,
27411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
27511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Flag indicating the motion event intersected the bottom edge of the screen. */
27611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02,
27711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
27811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Flag indicating the motion event intersected the left edge of the screen. */
27911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04,
28011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
28111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    /* Flag indicating the motion event intersected the right edge of the screen. */
28211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08
28311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
28411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
28511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
28611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Input sources.
28711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
28811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Refer to the documentation on android.view.InputDevice for more details about input sources
28911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * and their correct interpretation.
29011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
29111cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
29211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_CLASS_MASK = 0x000000ff,
29311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
29411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_CLASS_BUTTON = 0x00000001,
29511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_CLASS_POINTER = 0x00000002,
29611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004,
29711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_CLASS_POSITION = 0x00000008,
29811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
29911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
30011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
30111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_UNKNOWN = 0x00000000,
30211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
30311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON,
30411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON,
30511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER,
30611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER,
30711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION,
30811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION,
30911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
31011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_SOURCE_ANY = 0xffffff00,
31111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
31211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
31311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
31411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Keyboard types.
31511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
31611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Refer to the documentation on android.view.InputDevice for more details.
31711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
31811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
31911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_KEYBOARD_TYPE_NONE = 0,
32011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1,
32111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2,
32211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
32311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
32411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
32511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Constants used to retrieve information about the range of motion for a particular
32611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * coordinate of a motion event.
32711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
32811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Refer to the documentation on android.view.InputDevice for more details about input sources
32911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * and their correct interpretation.
33011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
33111cd02dfb91661c65134cac258cf5924270e9d2Dan Albertenum {
33211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_MOTION_RANGE_X = 0,
33311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_MOTION_RANGE_Y = 1,
33411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_MOTION_RANGE_PRESSURE = 2,
33511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_MOTION_RANGE_SIZE = 3,
33611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_MOTION_RANGE_TOUCH_MAJOR = 4,
33711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_MOTION_RANGE_TOUCH_MINOR = 5,
33811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_MOTION_RANGE_TOOL_MAJOR = 6,
33911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_MOTION_RANGE_TOOL_MINOR = 7,
34011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert    AINPUT_MOTION_RANGE_ORIENTATION = 8,
34111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert};
34211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
34311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
34411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
34511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Input event accessors.
34611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
34711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Note that most functions can only be used on input events that are of a given type.
34811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Calling these functions on input events of other types will yield undefined behavior.
34911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
35011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
35111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*** Accessors for all input events. ***/
35211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
35311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the input event type. */
35411cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AInputEvent_getType(const AInputEvent* event);
35511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
35611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the id for the device that an input event came from.
35711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
35811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Input events can be generated by multiple different input devices.
35911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Use the input device id to obtain information about the input
36011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * device that was responsible for generating a particular event.
36111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
36211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * An input device id of 0 indicates that the event didn't come from a physical device;
36311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * other numbers are arbitrary and you shouldn't depend on the values.
36411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Use the provided input device query API to obtain information about input devices.
36511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
36611cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AInputEvent_getDeviceId(const AInputEvent* event);
36711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
36811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the input event source. */
36911cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AInputEvent_getSource(const AInputEvent* event);
37011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
37111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*** Accessors for key events only. ***/
37211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
37311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the key event action. */
37411cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AKeyEvent_getAction(const AInputEvent* key_event);
37511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
37611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the key event flags. */
37711cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AKeyEvent_getFlags(const AInputEvent* key_event);
37811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
37911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the key code of the key event.
38011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * This is the physical key that was pressed, not the Unicode character. */
38111cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AKeyEvent_getKeyCode(const AInputEvent* key_event);
38211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
38311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the hardware key id of this key event.
38411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * These values are not reliable and vary from device to device. */
38511cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AKeyEvent_getScanCode(const AInputEvent* key_event);
38611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
38711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the meta key state. */
38811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AKeyEvent_getMetaState(const AInputEvent* key_event);
38911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
39011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the repeat count of the event.
39111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * For both key up an key down events, this is the number of times the key has
39211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * repeated with the first down starting at 0 and counting up from there.  For
39311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * multiple key events, this is the number of down/up pairs that have occurred. */
39411cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event);
39511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
39611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the time of the most recent key down event, in the
39711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * java.lang.System.nanoTime() time base.  If this is a down event,
39811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * this will be the same as eventTime.
39911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Note that when chording keys, this value is the down time of the most recently
40011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * pressed key, which may not be the same physical key of this event. */
40111cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint64_t AKeyEvent_getDownTime(const AInputEvent* key_event);
40211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
40311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the time this event occurred, in the
40411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * java.lang.System.nanoTime() time base. */
40511cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint64_t AKeyEvent_getEventTime(const AInputEvent* key_event);
40611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
40711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*** Accessors for motion events only. ***/
40811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
40911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the combined motion event action code and pointer index. */
41011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AMotionEvent_getAction(const AInputEvent* motion_event);
41111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
41211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the motion event flags. */
41311cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AMotionEvent_getFlags(const AInputEvent* motion_event);
41411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
41511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the state of any meta / modifier keys that were in effect when the
41611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * event was generated. */
41711cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AMotionEvent_getMetaState(const AInputEvent* motion_event);
41811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
41911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get a bitfield indicating which edges, if any, were touched by this motion event.
42011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * For touch events, clients can use this to determine if the user's finger was
42111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * touching the edge of the display. */
42211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event);
42311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
42411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the time when the user originally pressed down to start a stream of
42511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * position events, in the java.lang.System.nanoTime() time base. */
42611cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint64_t AMotionEvent_getDownTime(const AInputEvent* motion_event);
42711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
42811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the time when this specific event was generated,
42911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * in the java.lang.System.nanoTime() time base. */
43011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint64_t AMotionEvent_getEventTime(const AInputEvent* motion_event);
43111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
43211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the X coordinate offset.
43311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * For touch events on the screen, this is the delta that was added to the raw
43411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * screen coordinates to adjust for the absolute position of the containing windows
43511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * and views. */
43611cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getXOffset(const AInputEvent* motion_event) __NDK_FPABI__;
43711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
43811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the Y coordinate offset.
43911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * For touch events on the screen, this is the delta that was added to the raw
44011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * screen coordinates to adjust for the absolute position of the containing windows
44111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * and views. */
44211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getYOffset(const AInputEvent* motion_event) __NDK_FPABI__;
44311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
44411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the precision of the X coordinates being reported.
44511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * You can multiply this number with an X coordinate sample to find the
44611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * actual hardware value of the X coordinate. */
44711cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getXPrecision(const AInputEvent* motion_event) __NDK_FPABI__;
44811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
44911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the precision of the Y coordinates being reported.
45011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * You can multiply this number with a Y coordinate sample to find the
45111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * actual hardware value of the Y coordinate. */
45211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getYPrecision(const AInputEvent* motion_event) __NDK_FPABI__;
45311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
45411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the number of pointers of data contained in this event.
45511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Always >= 1. */
45611cd02dfb91661c65134cac258cf5924270e9d2Dan Albertsize_t AMotionEvent_getPointerCount(const AInputEvent* motion_event);
45711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
45811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the pointer identifier associated with a particular pointer
45911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * data index is this event.  The identifier tells you the actual pointer
46011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * number associated with the data, accounting for individual pointers
46111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * going up and down since the start of the current gesture. */
46211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index);
46311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
46411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the original raw X coordinate of this event.
46511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * For touch events on the screen, this is the original location of the event
46611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * on the screen, before it had been adjusted for the containing window
46711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * and views. */
46811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
46911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
47011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the original raw X coordinate of this event.
47111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * For touch events on the screen, this is the original location of the event
47211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * on the screen, before it had been adjusted for the containing window
47311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * and views. */
47411cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
47511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
47611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the current X coordinate of this event for the given pointer index.
47711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Whole numbers are pixels; the value may have a fraction for input devices
47811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * that are sub-pixel precise. */
47911cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
48011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
48111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the current Y coordinate of this event for the given pointer index.
48211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Whole numbers are pixels; the value may have a fraction for input devices
48311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * that are sub-pixel precise. */
48411cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
48511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
48611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the current pressure of this event for the given pointer index.
48711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
48811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * although values higher than 1 may be generated depending on the calibration of
48911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * the input device. */
49011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
49111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
49211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the current scaled value of the approximate size for the given pointer index.
49311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * This represents some approximation of the area of the screen being
49411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * pressed; the actual value in pixels corresponding to the
49511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * touch is normalized with the device specific range of values
49611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * and scaled to a value between 0 and 1.  The value of size can be used to
49711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * determine fat touch events. */
49811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
49911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
50011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the current length of the major axis of an ellipse that describes the touch area
50111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * at the point of contact for the given pointer index. */
50211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
50311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
50411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the current length of the minor axis of an ellipse that describes the touch area
50511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * at the point of contact for the given pointer index. */
50611cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
50711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
50811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the current length of the major axis of an ellipse that describes the size
50911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * of the approaching tool for the given pointer index.
51011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * The tool area represents the estimated size of the finger or pen that is
51111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * touching the device independent of its actual touch area at the point of contact. */
51211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
51311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
51411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the current length of the minor axis of an ellipse that describes the size
51511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * of the approaching tool for the given pointer index.
51611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * The tool area represents the estimated size of the finger or pen that is
51711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * touching the device independent of its actual touch area at the point of contact. */
51811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
51911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
52011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the current orientation of the touch area and tool area in radians clockwise from
52111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * vertical for the given pointer index.
52211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * An angle of 0 degrees indicates that the major axis of contact is oriented
52311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * upwards, is perfectly circular or is of unknown orientation.  A positive angle
52411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * indicates that the major axis of contact is oriented to the right.  A negative angle
52511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * indicates that the major axis of contact is oriented to the left.
52611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
52711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * (finger pointing fully right). */
52811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__;
52911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
53011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the number of historical points in this event.  These are movements that
53111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * have occurred between this event and the previous event.  This only applies
53211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0.
53311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Historical samples are indexed from oldest to newest. */
53411cd02dfb91661c65134cac258cf5924270e9d2Dan Albertsize_t AMotionEvent_getHistorySize(const AInputEvent* motion_event);
53511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
53611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the time that a historical movement occurred between this event and
53711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * the previous event, in the java.lang.System.nanoTime() time base. */
53811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint64_t AMotionEvent_getHistoricalEventTime(const AInputEvent* motion_event,
53911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index);
54011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
54111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the historical raw X coordinate of this event for the given pointer index that
54211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event.
54311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * For touch events on the screen, this is the original location of the event
54411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * on the screen, before it had been adjusted for the containing window
54511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * and views.
54611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Whole numbers are pixels; the value may have a fraction for input devices
54711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * that are sub-pixel precise. */
54811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index,
54911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
55011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
55111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the historical raw Y coordinate of this event for the given pointer index that
55211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event.
55311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * For touch events on the screen, this is the original location of the event
55411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * on the screen, before it had been adjusted for the containing window
55511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * and views.
55611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Whole numbers are pixels; the value may have a fraction for input devices
55711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * that are sub-pixel precise. */
55811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index,
55911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
56011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
56111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the historical X coordinate of this event for the given pointer index that
56211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event.
56311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Whole numbers are pixels; the value may have a fraction for input devices
56411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * that are sub-pixel precise. */
56511cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalX(const AInputEvent* motion_event, size_t pointer_index,
56611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
56711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
56811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the historical Y coordinate of this event for the given pointer index that
56911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event.
57011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Whole numbers are pixels; the value may have a fraction for input devices
57111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * that are sub-pixel precise. */
57211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalY(const AInputEvent* motion_event, size_t pointer_index,
57311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
57411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
57511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the historical pressure of this event for the given pointer index that
57611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event.
57711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
57811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * although values higher than 1 may be generated depending on the calibration of
57911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * the input device. */
58011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalPressure(const AInputEvent* motion_event, size_t pointer_index,
58111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
58211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
58311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the current scaled value of the approximate size for the given pointer index that
58411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event.
58511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * This represents some approximation of the area of the screen being
58611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * pressed; the actual value in pixels corresponding to the
58711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * touch is normalized with the device specific range of values
58811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * and scaled to a value between 0 and 1.  The value of size can be used to
58911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * determine fat touch events. */
59011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalSize(const AInputEvent* motion_event, size_t pointer_index,
59111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
59211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
59311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the historical length of the major axis of an ellipse that describes the touch area
59411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * at the point of contact for the given pointer index that
59511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event. */
59611cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index,
59711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
59811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
59911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the historical length of the minor axis of an ellipse that describes the touch area
60011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * at the point of contact for the given pointer index that
60111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event. */
60211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index,
60311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
60411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
60511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the historical length of the major axis of an ellipse that describes the size
60611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * of the approaching tool for the given pointer index that
60711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event.
60811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * The tool area represents the estimated size of the finger or pen that is
60911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * touching the device independent of its actual touch area at the point of contact. */
61011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index,
61111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
61211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
61311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the historical length of the minor axis of an ellipse that describes the size
61411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * of the approaching tool for the given pointer index that
61511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event.
61611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * The tool area represents the estimated size of the finger or pen that is
61711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * touching the device independent of its actual touch area at the point of contact. */
61811cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index,
61911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
62011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
62111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/* Get the historical orientation of the touch area and tool area in radians clockwise from
62211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * vertical for the given pointer index that
62311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * occurred between this event and the previous motion event.
62411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * An angle of 0 degrees indicates that the major axis of contact is oriented
62511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * upwards, is perfectly circular or is of unknown orientation.  A positive angle
62611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * indicates that the major axis of contact is oriented to the right.  A negative angle
62711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * indicates that the major axis of contact is oriented to the left.
62811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
62911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * (finger pointing fully right). */
63011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertfloat AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index,
63111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        size_t history_index) __NDK_FPABI__;
63211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
63311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
63411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
63511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Input queue
63611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert *
63711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * An input queue is the facility through which you retrieve input
63811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * events.
63911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
64011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertstruct AInputQueue;
64111cd02dfb91661c65134cac258cf5924270e9d2Dan Alberttypedef struct AInputQueue AInputQueue;
64211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
64311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
64411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Add this input queue to a looper for processing.  See
64511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * ALooper_addFd() for information on the ident, callback, and data params.
64611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
64711cd02dfb91661c65134cac258cf5924270e9d2Dan Albertvoid AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
64811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert        int ident, ALooper_callbackFunc callback, void* data);
64911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
65011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
65111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Remove the input queue from the looper it is currently attached to.
65211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
65311cd02dfb91661c65134cac258cf5924270e9d2Dan Albertvoid AInputQueue_detachLooper(AInputQueue* queue);
65411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
65511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
65611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Returns true if there are one or more events available in the
65711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * input queue.  Returns 1 if the queue has events; 0 if
65811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * it does not have events; and a negative value if there is an error.
65911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
66011cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AInputQueue_hasEvents(AInputQueue* queue);
66111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
66211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
66311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Returns the next available event from the queue.  Returns a negative
66411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * value if no events are available or an error has occurred.
66511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
66611cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent);
66711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
66811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
66911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Sends the key for standard pre-dispatching -- that is, possibly deliver
67011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * it to the current IME to be consumed before the app.  Returns 0 if it
67111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * was not pre-dispatched, meaning you can process it right now.  If non-zero
67211cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * is returned, you must abandon the current event processing and allow the
67311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * event to appear again in the event queue (if it does not get consumed during
67411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * pre-dispatching).
67511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
67611cd02dfb91661c65134cac258cf5924270e9d2Dan Albertint32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event);
67711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
67811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert/*
67911cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * Report that dispatching has finished with the given event.
68011cd02dfb91661c65134cac258cf5924270e9d2Dan Albert * This must be called after receiving an event with AInputQueue_get_event().
68111cd02dfb91661c65134cac258cf5924270e9d2Dan Albert */
68211cd02dfb91661c65134cac258cf5924270e9d2Dan Albertvoid AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled);
68311cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
68411cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#ifdef __cplusplus
68511cd02dfb91661c65134cac258cf5924270e9d2Dan Albert}
68611cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#endif
68711cd02dfb91661c65134cac258cf5924270e9d2Dan Albert
68811cd02dfb91661c65134cac258cf5924270e9d2Dan Albert#endif // _ANDROID_INPUT_H
689