1 /*
2                                     __
3                                    / _|
4   __ _ _   _ _ __ ___  _ __ __ _  | |_ ___  ___ ___
5  / _` | | | | '__/ _ \| '__/ _` | |  _/ _ \/ __/ __|
6 | (_| | |_| | | | (_) | | | (_| | | || (_) \__ \__ \
7  \__,_|\__,_|_|  \___/|_|  \__,_| |_| \___/|___/___/
8 
9 Copyright (C) 2010 The Android Open Source Project.
10 Copyright (C) 2018-2019 Aurora Free Open Source Software.
11 
12 This file is part of the Aurora Free Open Source Software. This
13 organization promote free and open source software that you can
14 redistribute and/or modify under the terms of the GNU Lesser General
15 Public License Version 3 as published by the Free Software Foundation or
16 (at your option) any later version approved by the Aurora Free Open Source
17 Software Organization. The license is available in the package root path
18 as 'LICENSE' file. Please review the following information to ensure the
19 GNU Lesser General Public License version 3 requirements will be met:
20 https://www.gnu.org/licenses/lgpl.html .
21 
22 Alternatively, this file may be used under the terms of the GNU General
23 Public License version 3 or later as published by the Free Software
24 Foundation. Please review the following information to ensure the GNU
25 General Public License requirements will be met:
26 https://www.gnu.org/licenses/gpl-3.0.html.
27 
28 NOTE: All products, services or anything associated to trademarks and
29 service marks used or referenced on this file are the property of their
30 respective companies/owners or its subsidiaries. Other names and brands
31 may be claimed as the property of others.
32 
33 For more info about intellectual property visit: aurorafoss.org or
34 directly send an email to: contact (at) aurorafoss.org .
35 
36 This file has bindings for an existing code, part of The Android Open Source
37 Project implementation. Check it out at android.googlesource.com .
38 */
39 
40 module aurorafw.android.platform.input;
41 
42 /**
43  * @addtogroup Input
44  * @{
45  */
46 
47 /**
48  * @file aurorafw/android/platform/input.d
49  */
50 
51 version (Android):
52 extern (C):
53 @system:
54 nothrow:
55 @nogc:
56 
57 /******************************************************************
58  *
59  * IMPORTANT NOTICE:
60  *
61  *   This file is part of Android's set of stable system headers
62  *   exposed by the Android NDK (Native Development Kit).
63  *
64  *   Third-party source AND binary code relies on the definitions
65  *   here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
66  *
67  *   - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
68  *   - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
69  *   - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
70  *   - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
71  */
72 
73 /*
74  * Structures and functions to receive and process input events in
75  * native code.
76  *
77  * NOTE: These functions MUST be implemented by /system/lib/libui.so
78  */
79 
80 /* nothing */
81 
82 /**
83  * Key states (may be returned by queries about the current state of a
84  * particular key code, scan code or switch).
85  */
86 enum
87 {
88     /** The key state is unknown or the requested key itself is not supported. */
89     AKEY_STATE_UNKNOWN = -1,
90 
91     /** The key is up. */
92     AKEY_STATE_UP = 0,
93 
94     /** The key is down. */
95     AKEY_STATE_DOWN = 1,
96 
97     /** The key is down but is a virtual key press that is being emulated by the system. */
98     AKEY_STATE_VIRTUAL = 2
99 }
100 
101 /**
102  * Meta key / modifer state.
103  */
104 enum
105 {
106     /** No meta keys are pressed. */
107     AMETA_NONE = 0,
108 
109     /** This mask is used to check whether one of the ALT meta keys is pressed. */
110     AMETA_ALT_ON = 2,
111 
112     /** This mask is used to check whether the left ALT meta key is pressed. */
113     AMETA_ALT_LEFT_ON = 16,
114 
115     /** This mask is used to check whether the right ALT meta key is pressed. */
116     AMETA_ALT_RIGHT_ON = 32,
117 
118     /** This mask is used to check whether one of the SHIFT meta keys is pressed. */
119     AMETA_SHIFT_ON = 1,
120 
121     /** This mask is used to check whether the left SHIFT meta key is pressed. */
122     AMETA_SHIFT_LEFT_ON = 64,
123 
124     /** This mask is used to check whether the right SHIFT meta key is pressed. */
125     AMETA_SHIFT_RIGHT_ON = 128,
126 
127     /** This mask is used to check whether the SYM meta key is pressed. */
128     AMETA_SYM_ON = 4,
129 
130     /** This mask is used to check whether the FUNCTION meta key is pressed. */
131     AMETA_FUNCTION_ON = 8,
132 
133     /** This mask is used to check whether one of the CTRL meta keys is pressed. */
134     AMETA_CTRL_ON = 4096,
135 
136     /** This mask is used to check whether the left CTRL meta key is pressed. */
137     AMETA_CTRL_LEFT_ON = 8192,
138 
139     /** This mask is used to check whether the right CTRL meta key is pressed. */
140     AMETA_CTRL_RIGHT_ON = 16384,
141 
142     /** This mask is used to check whether one of the META meta keys is pressed. */
143     AMETA_META_ON = 65536,
144 
145     /** This mask is used to check whether the left META meta key is pressed. */
146     AMETA_META_LEFT_ON = 131072,
147 
148     /** This mask is used to check whether the right META meta key is pressed. */
149     AMETA_META_RIGHT_ON = 262144,
150 
151     /** This mask is used to check whether the CAPS LOCK meta key is on. */
152     AMETA_CAPS_LOCK_ON = 1048576,
153 
154     /** This mask is used to check whether the NUM LOCK meta key is on. */
155     AMETA_NUM_LOCK_ON = 2097152,
156 
157     /** This mask is used to check whether the SCROLL LOCK meta key is on. */
158     AMETA_SCROLL_LOCK_ON = 4194304
159 }
160 
161 struct AInputEvent;
162 /**
163  * Input events.
164  *
165  * Input events are opaque structures.  Use the provided accessors functions to
166  * read their properties.
167  */
168 
169 /**
170  * Input event types.
171  */
172 enum
173 {
174     /** Indicates that the input event is a key event. */
175     AINPUT_EVENT_TYPE_KEY = 1,
176 
177     /** Indicates that the input event is a motion event. */
178     AINPUT_EVENT_TYPE_MOTION = 2
179 }
180 
181 /**
182  * Key event actions.
183  */
184 enum
185 {
186     /** The key has been pressed down. */
187     AKEY_EVENT_ACTION_DOWN = 0,
188 
189     /** The key has been released. */
190     AKEY_EVENT_ACTION_UP = 1,
191 
192     /**
193      * Multiple duplicate key events have occurred in a row, or a
194      * complex string is being delivered.  The repeat_count property
195      * of the key event contains the number of times the given key
196      * code should be executed.
197      */
198     AKEY_EVENT_ACTION_MULTIPLE = 2
199 }
200 
201 /**
202  * Key event flags.
203  */
204 enum
205 {
206     /** This mask is set if the device woke because of this key event. */
207     AKEY_EVENT_FLAG_WOKE_HERE = 1,
208 
209     /** This mask is set if the key event was generated by a software keyboard. */
210     AKEY_EVENT_FLAG_SOFT_KEYBOARD = 2,
211 
212     /** This mask is set if we don't want the key event to cause us to leave touch mode. */
213     AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 4,
214 
215     /**
216      * This mask is set if an event was known to come from a trusted
217      * part of the system.  That is, the event is known to come from
218      * the user, and could not have been spoofed by a third party
219      * component.
220      */
221     AKEY_EVENT_FLAG_FROM_SYSTEM = 8,
222 
223     /**
224      * This mask is used for compatibility, to identify enter keys that are
225      * coming from an IME whose enter key has been auto-labelled "next" or
226      * "done".  This allows TextView to dispatch these as normal enter keys
227      * for old applications, but still do the appropriate action when
228      * receiving them.
229      */
230     AKEY_EVENT_FLAG_EDITOR_ACTION = 16,
231 
232     /**
233      * When associated with up key events, this indicates that the key press
234      * has been canceled.  Typically this is used with virtual touch screen
235      * keys, where the user can slide from the virtual key area on to the
236      * display: in that case, the application will receive a canceled up
237      * event and should not perform the action normally associated with the
238      * key.  Note that for this to work, the application can not perform an
239      * action for a key until it receives an up or the long press timeout has
240      * expired.
241      */
242     AKEY_EVENT_FLAG_CANCELED = 32,
243 
244     /**
245      * This key event was generated by a virtual (on-screen) hard key area.
246      * Typically this is an area of the touchscreen, outside of the regular
247      * display, dedicated to "hardware" buttons.
248      */
249     AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 64,
250 
251     /**
252      * This flag is set for the first key repeat that occurs after the
253      * long press timeout.
254      */
255     AKEY_EVENT_FLAG_LONG_PRESS = 128,
256 
257     /**
258      * Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long
259      * press action was executed while it was down.
260      */
261     AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 256,
262 
263     /**
264      * Set for AKEY_EVENT_ACTION_UP when this event's key code is still being
265      * tracked from its initial down.  That is, somebody requested that tracking
266      * started on the key down and a long press has not caused
267      * the tracking to be canceled.
268      */
269     AKEY_EVENT_FLAG_TRACKING = 512,
270 
271     /**
272      * Set when a key event has been synthesized to implement default behavior
273      * for an event that the application did not handle.
274      * Fallback key events are generated by unhandled trackball motions
275      * (to emulate a directional keypad) and by certain unhandled key presses
276      * that are declared in the key map (such as special function numeric keypad
277      * keys when numlock is off).
278      */
279     AKEY_EVENT_FLAG_FALLBACK = 1024
280 }
281 
282 /**
283  * Bit shift for the action bits holding the pointer index as
284  * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
285  */
286 enum AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT = 8;
287 
288 /** Motion event actions */
289 enum
290 {
291     /** Bit mask of the parts of the action code that are the action itself. */
292     AMOTION_EVENT_ACTION_MASK = 255,
293 
294     /**
295      * Bits in the action code that represent a pointer index, used with
296      * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP.  Shifting
297      * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
298      * index where the data for the pointer going up or down can be found.
299      */
300     AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 65280,
301 
302     /** A pressed gesture has started, the motion contains the initial starting location. */
303     AMOTION_EVENT_ACTION_DOWN = 0,
304 
305     /**
306      * A pressed gesture has finished, the motion contains the final release location
307      * as well as any intermediate points since the last down or move event.
308      */
309     AMOTION_EVENT_ACTION_UP = 1,
310 
311     /**
312      * A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
313      * AMOTION_EVENT_ACTION_UP).  The motion contains the most recent point, as well as
314      * any intermediate points since the last down or move event.
315      */
316     AMOTION_EVENT_ACTION_MOVE = 2,
317 
318     /**
319      * The current gesture has been aborted.
320      * You will not receive any more points in it.  You should treat this as
321      * an up event, but not perform any action that you normally would.
322      */
323     AMOTION_EVENT_ACTION_CANCEL = 3,
324 
325     /**
326      * A movement has happened outside of the normal bounds of the UI element.
327      * This does not provide a full gesture, but only the initial location of the movement/touch.
328      */
329     AMOTION_EVENT_ACTION_OUTSIDE = 4,
330 
331     /**
332      * A non-primary pointer has gone down.
333      * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
334      */
335     AMOTION_EVENT_ACTION_POINTER_DOWN = 5,
336 
337     /**
338      * A non-primary pointer has gone up.
339      * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
340      */
341     AMOTION_EVENT_ACTION_POINTER_UP = 6,
342 
343     /**
344      * A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE).
345      * The motion contains the most recent point, as well as any intermediate points since
346      * the last hover move event.
347      */
348     AMOTION_EVENT_ACTION_HOVER_MOVE = 7,
349 
350     /**
351      * The motion event contains relative vertical and/or horizontal scroll offsets.
352      * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL
353      * and AMOTION_EVENT_AXIS_HSCROLL.
354      * The pointer may or may not be down when this event is dispatched.
355      * This action is always delivered to the winder under the pointer, which
356      * may not be the window currently touched.
357      */
358     AMOTION_EVENT_ACTION_SCROLL = 8,
359 
360     /** The pointer is not down but has entered the boundaries of a window or view. */
361     AMOTION_EVENT_ACTION_HOVER_ENTER = 9,
362 
363     /** The pointer is not down but has exited the boundaries of a window or view. */
364     AMOTION_EVENT_ACTION_HOVER_EXIT = 10,
365 
366     /* One or more buttons have been pressed. */
367     AMOTION_EVENT_ACTION_BUTTON_PRESS = 11,
368 
369     /* One or more buttons have been released. */
370     AMOTION_EVENT_ACTION_BUTTON_RELEASE = 12
371 }
372 
373 /**
374  * Motion event flags.
375  */
376 enum
377 {
378     /**
379      * This flag indicates that the window that received this motion event is partly
380      * or wholly obscured by another visible window above it.  This flag is set to true
381      * even if the event did not directly pass through the obscured area.
382      * A security sensitive application can check this flag to identify situations in which
383      * a malicious application may have covered up part of its content for the purpose
384      * of misleading the user or hijacking touches.  An appropriate response might be
385      * to drop the suspect touches or to take additional precautions to confirm the user's
386      * actual intent.
387      */
388     AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 1
389 }
390 
391 /**
392  * Motion event edge touch flags.
393  */
394 enum
395 {
396     /** No edges intersected. */
397     AMOTION_EVENT_EDGE_FLAG_NONE = 0,
398 
399     /** Flag indicating the motion event intersected the top edge of the screen. */
400     AMOTION_EVENT_EDGE_FLAG_TOP = 1,
401 
402     /** Flag indicating the motion event intersected the bottom edge of the screen. */
403     AMOTION_EVENT_EDGE_FLAG_BOTTOM = 2,
404 
405     /** Flag indicating the motion event intersected the left edge of the screen. */
406     AMOTION_EVENT_EDGE_FLAG_LEFT = 4,
407 
408     /** Flag indicating the motion event intersected the right edge of the screen. */
409     AMOTION_EVENT_EDGE_FLAG_RIGHT = 8
410 }
411 
412 /**
413  * Constants that identify each individual axis of a motion event.
414  * @anchor AMOTION_EVENT_AXIS
415  */
416 enum
417 {
418     /**
419      * Axis constant: X axis of a motion event.
420      *
421      * - For a touch screen, reports the absolute X screen position of the center of
422      * the touch contact area.  The units are display pixels.
423      * - For a touch pad, reports the absolute X surface position of the center of the touch
424      * contact area. The units are device-dependent.
425      * - For a mouse, reports the absolute X screen position of the mouse pointer.
426      * The units are display pixels.
427      * - For a trackball, reports the relative horizontal displacement of the trackball.
428      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
429      * - For a joystick, reports the absolute X position of the joystick.
430      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
431      */
432     AMOTION_EVENT_AXIS_X = 0,
433     /**
434      * Axis constant: Y axis of a motion event.
435      *
436      * - For a touch screen, reports the absolute Y screen position of the center of
437      * the touch contact area.  The units are display pixels.
438      * - For a touch pad, reports the absolute Y surface position of the center of the touch
439      * contact area. The units are device-dependent.
440      * - For a mouse, reports the absolute Y screen position of the mouse pointer.
441      * The units are display pixels.
442      * - For a trackball, reports the relative vertical displacement of the trackball.
443      * The value is normalized to a range from -1.0 (up) to 1.0 (down).
444      * - For a joystick, reports the absolute Y position of the joystick.
445      * The value is normalized to a range from -1.0 (up or far) to 1.0 (down or near).
446      */
447     AMOTION_EVENT_AXIS_Y = 1,
448     /**
449      * Axis constant: Pressure axis of a motion event.
450      *
451      * - For a touch screen or touch pad, reports the approximate pressure applied to the surface
452      * by a finger or other tool.  The value is normalized to a range from
453      * 0 (no pressure at all) to 1 (normal pressure), although values higher than 1
454      * may be generated depending on the calibration of the input device.
455      * - For a trackball, the value is set to 1 if the trackball button is pressed
456      * or 0 otherwise.
457      * - For a mouse, the value is set to 1 if the primary mouse button is pressed
458      * or 0 otherwise.
459      */
460     AMOTION_EVENT_AXIS_PRESSURE = 2,
461     /**
462      * Axis constant: Size axis of a motion event.
463      *
464      * - For a touch screen or touch pad, reports the approximate size of the contact area in
465      * relation to the maximum detectable size for the device.  The value is normalized
466      * to a range from 0 (smallest detectable size) to 1 (largest detectable size),
467      * although it is not a linear scale. This value is of limited use.
468      * To obtain calibrated size information, see
469      * {@link AMOTION_EVENT_AXIS_TOUCH_MAJOR} or {@link AMOTION_EVENT_AXIS_TOOL_MAJOR}.
470      */
471     AMOTION_EVENT_AXIS_SIZE = 3,
472     /**
473      * Axis constant: TouchMajor axis of a motion event.
474      *
475      * - For a touch screen, reports the length of the major axis of an ellipse that
476      * represents the touch area at the point of contact.
477      * The units are display pixels.
478      * - For a touch pad, reports the length of the major axis of an ellipse that
479      * represents the touch area at the point of contact.
480      * The units are device-dependent.
481      */
482     AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4,
483     /**
484      * Axis constant: TouchMinor axis of a motion event.
485      *
486      * - For a touch screen, reports the length of the minor axis of an ellipse that
487      * represents the touch area at the point of contact.
488      * The units are display pixels.
489      * - For a touch pad, reports the length of the minor axis of an ellipse that
490      * represents the touch area at the point of contact.
491      * The units are device-dependent.
492      *
493      * When the touch is circular, the major and minor axis lengths will be equal to one another.
494      */
495     AMOTION_EVENT_AXIS_TOUCH_MINOR = 5,
496     /**
497      * Axis constant: ToolMajor axis of a motion event.
498      *
499      * - For a touch screen, reports the length of the major axis of an ellipse that
500      * represents the size of the approaching finger or tool used to make contact.
501      * - For a touch pad, reports the length of the major axis of an ellipse that
502      * represents the size of the approaching finger or tool used to make contact.
503      * The units are device-dependent.
504      *
505      * When the touch is circular, the major and minor axis lengths will be equal to one another.
506      *
507      * The tool size may be larger than the touch size since the tool may not be fully
508      * in contact with the touch sensor.
509      */
510     AMOTION_EVENT_AXIS_TOOL_MAJOR = 6,
511     /**
512      * Axis constant: ToolMinor axis of a motion event.
513      *
514      * - For a touch screen, reports the length of the minor axis of an ellipse that
515      * represents the size of the approaching finger or tool used to make contact.
516      * - For a touch pad, reports the length of the minor axis of an ellipse that
517      * represents the size of the approaching finger or tool used to make contact.
518      * The units are device-dependent.
519      *
520      * When the touch is circular, the major and minor axis lengths will be equal to one another.
521      *
522      * The tool size may be larger than the touch size since the tool may not be fully
523      * in contact with the touch sensor.
524      */
525     AMOTION_EVENT_AXIS_TOOL_MINOR = 7,
526     /**
527      * Axis constant: Orientation axis of a motion event.
528      *
529      * - For a touch screen or touch pad, reports the orientation of the finger
530      * or tool in radians relative to the vertical plane of the device.
531      * An angle of 0 radians indicates that the major axis of contact is oriented
532      * upwards, is perfectly circular or is of unknown orientation.  A positive angle
533      * indicates that the major axis of contact is oriented to the right.  A negative angle
534      * indicates that the major axis of contact is oriented to the left.
535      * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
536      * (finger pointing fully right).
537      * - For a stylus, the orientation indicates the direction in which the stylus
538      * is pointing in relation to the vertical axis of the current orientation of the screen.
539      * The range is from -PI radians to PI radians, where 0 is pointing up,
540      * -PI/2 radians is pointing left, -PI or PI radians is pointing down, and PI/2 radians
541      * is pointing right.  See also {@link AMOTION_EVENT_AXIS_TILT}.
542      */
543     AMOTION_EVENT_AXIS_ORIENTATION = 8,
544     /**
545      * Axis constant: Vertical Scroll axis of a motion event.
546      *
547      * - For a mouse, reports the relative movement of the vertical scroll wheel.
548      * The value is normalized to a range from -1.0 (down) to 1.0 (up).
549      *
550      * This axis should be used to scroll views vertically.
551      */
552     AMOTION_EVENT_AXIS_VSCROLL = 9,
553     /**
554      * Axis constant: Horizontal Scroll axis of a motion event.
555      *
556      * - For a mouse, reports the relative movement of the horizontal scroll wheel.
557      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
558      *
559      * This axis should be used to scroll views horizontally.
560      */
561     AMOTION_EVENT_AXIS_HSCROLL = 10,
562     /**
563      * Axis constant: Z axis of a motion event.
564      *
565      * - For a joystick, reports the absolute Z position of the joystick.
566      * The value is normalized to a range from -1.0 (high) to 1.0 (low).
567      * <em>On game pads with two analog joysticks, this axis is often reinterpreted
568      * to report the absolute X position of the second joystick instead.</em>
569      */
570     AMOTION_EVENT_AXIS_Z = 11,
571     /**
572      * Axis constant: X Rotation axis of a motion event.
573      *
574      * - For a joystick, reports the absolute rotation angle about the X axis.
575      * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
576      */
577     AMOTION_EVENT_AXIS_RX = 12,
578     /**
579      * Axis constant: Y Rotation axis of a motion event.
580      *
581      * - For a joystick, reports the absolute rotation angle about the Y axis.
582      * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
583      */
584     AMOTION_EVENT_AXIS_RY = 13,
585     /**
586      * Axis constant: Z Rotation axis of a motion event.
587      *
588      * - For a joystick, reports the absolute rotation angle about the Z axis.
589      * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
590      * On game pads with two analog joysticks, this axis is often reinterpreted
591      * to report the absolute Y position of the second joystick instead.
592      */
593     AMOTION_EVENT_AXIS_RZ = 14,
594     /**
595      * Axis constant: Hat X axis of a motion event.
596      *
597      * - For a joystick, reports the absolute X position of the directional hat control.
598      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
599      */
600     AMOTION_EVENT_AXIS_HAT_X = 15,
601     /**
602      * Axis constant: Hat Y axis of a motion event.
603      *
604      * - For a joystick, reports the absolute Y position of the directional hat control.
605      * The value is normalized to a range from -1.0 (up) to 1.0 (down).
606      */
607     AMOTION_EVENT_AXIS_HAT_Y = 16,
608     /**
609      * Axis constant: Left Trigger axis of a motion event.
610      *
611      * - For a joystick, reports the absolute position of the left trigger control.
612      * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
613      */
614     AMOTION_EVENT_AXIS_LTRIGGER = 17,
615     /**
616      * Axis constant: Right Trigger axis of a motion event.
617      *
618      * - For a joystick, reports the absolute position of the right trigger control.
619      * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
620      */
621     AMOTION_EVENT_AXIS_RTRIGGER = 18,
622     /**
623      * Axis constant: Throttle axis of a motion event.
624      *
625      * - For a joystick, reports the absolute position of the throttle control.
626      * The value is normalized to a range from 0.0 (fully open) to 1.0 (fully closed).
627      */
628     AMOTION_EVENT_AXIS_THROTTLE = 19,
629     /**
630      * Axis constant: Rudder axis of a motion event.
631      *
632      * - For a joystick, reports the absolute position of the rudder control.
633      * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
634      */
635     AMOTION_EVENT_AXIS_RUDDER = 20,
636     /**
637      * Axis constant: Wheel axis of a motion event.
638      *
639      * - For a joystick, reports the absolute position of the steering wheel control.
640      * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
641      */
642     AMOTION_EVENT_AXIS_WHEEL = 21,
643     /**
644      * Axis constant: Gas axis of a motion event.
645      *
646      * - For a joystick, reports the absolute position of the gas (accelerator) control.
647      * The value is normalized to a range from 0.0 (no acceleration)
648      * to 1.0 (maximum acceleration).
649      */
650     AMOTION_EVENT_AXIS_GAS = 22,
651     /**
652      * Axis constant: Brake axis of a motion event.
653      *
654      * - For a joystick, reports the absolute position of the brake control.
655      * The value is normalized to a range from 0.0 (no braking) to 1.0 (maximum braking).
656      */
657     AMOTION_EVENT_AXIS_BRAKE = 23,
658     /**
659      * Axis constant: Distance axis of a motion event.
660      *
661      * - For a stylus, reports the distance of the stylus from the screen.
662      * A value of 0.0 indicates direct contact and larger values indicate increasing
663      * distance from the surface.
664      */
665     AMOTION_EVENT_AXIS_DISTANCE = 24,
666     /**
667      * Axis constant: Tilt axis of a motion event.
668      *
669      * - For a stylus, reports the tilt angle of the stylus in radians where
670      * 0 radians indicates that the stylus is being held perpendicular to the
671      * surface, and PI/2 radians indicates that the stylus is being held flat
672      * against the surface.
673      */
674     AMOTION_EVENT_AXIS_TILT = 25,
675     /**
676      * Axis constant:  Generic scroll axis of a motion event.
677      *
678      * - This is used for scroll axis motion events that can't be classified as strictly
679      *   vertical or horizontal. The movement of a rotating scroller is an example of this.
680      */
681     AMOTION_EVENT_AXIS_SCROLL = 26,
682     /**
683      * Axis constant: The movement of x position of a motion event.
684      *
685      * - For a mouse, reports a difference of x position between the previous position.
686      * This is useful when pointer is captured, in that case the mouse pointer doesn't
687      * change the location but this axis reports the difference which allows the app
688      * to see how the mouse is moved.
689      */
690     AMOTION_EVENT_AXIS_RELATIVE_X = 27,
691     /**
692      * Axis constant: The movement of y position of a motion event.
693      *
694      * Same as {@link RELATIVE_X}, but for y position.
695      */
696     AMOTION_EVENT_AXIS_RELATIVE_Y = 28,
697     /**
698      * Axis constant: Generic 1 axis of a motion event.
699      * The interpretation of a generic axis is device-specific.
700      */
701     AMOTION_EVENT_AXIS_GENERIC_1 = 32,
702     /**
703      * Axis constant: Generic 2 axis of a motion event.
704      * The interpretation of a generic axis is device-specific.
705      */
706     AMOTION_EVENT_AXIS_GENERIC_2 = 33,
707     /**
708      * Axis constant: Generic 3 axis of a motion event.
709      * The interpretation of a generic axis is device-specific.
710      */
711     AMOTION_EVENT_AXIS_GENERIC_3 = 34,
712     /**
713      * Axis constant: Generic 4 axis of a motion event.
714      * The interpretation of a generic axis is device-specific.
715      */
716     AMOTION_EVENT_AXIS_GENERIC_4 = 35,
717     /**
718      * Axis constant: Generic 5 axis of a motion event.
719      * The interpretation of a generic axis is device-specific.
720      */
721     AMOTION_EVENT_AXIS_GENERIC_5 = 36,
722     /**
723      * Axis constant: Generic 6 axis of a motion event.
724      * The interpretation of a generic axis is device-specific.
725      */
726     AMOTION_EVENT_AXIS_GENERIC_6 = 37,
727     /**
728      * Axis constant: Generic 7 axis of a motion event.
729      * The interpretation of a generic axis is device-specific.
730      */
731     AMOTION_EVENT_AXIS_GENERIC_7 = 38,
732     /**
733      * Axis constant: Generic 8 axis of a motion event.
734      * The interpretation of a generic axis is device-specific.
735      */
736     AMOTION_EVENT_AXIS_GENERIC_8 = 39,
737     /**
738      * Axis constant: Generic 9 axis of a motion event.
739      * The interpretation of a generic axis is device-specific.
740      */
741     AMOTION_EVENT_AXIS_GENERIC_9 = 40,
742     /**
743      * Axis constant: Generic 10 axis of a motion event.
744      * The interpretation of a generic axis is device-specific.
745      */
746     AMOTION_EVENT_AXIS_GENERIC_10 = 41,
747     /**
748      * Axis constant: Generic 11 axis of a motion event.
749      * The interpretation of a generic axis is device-specific.
750      */
751     AMOTION_EVENT_AXIS_GENERIC_11 = 42,
752     /**
753      * Axis constant: Generic 12 axis of a motion event.
754      * The interpretation of a generic axis is device-specific.
755      */
756     AMOTION_EVENT_AXIS_GENERIC_12 = 43,
757     /**
758      * Axis constant: Generic 13 axis of a motion event.
759      * The interpretation of a generic axis is device-specific.
760      */
761     AMOTION_EVENT_AXIS_GENERIC_13 = 44,
762     /**
763      * Axis constant: Generic 14 axis of a motion event.
764      * The interpretation of a generic axis is device-specific.
765      */
766     AMOTION_EVENT_AXIS_GENERIC_14 = 45,
767     /**
768      * Axis constant: Generic 15 axis of a motion event.
769      * The interpretation of a generic axis is device-specific.
770      */
771     AMOTION_EVENT_AXIS_GENERIC_15 = 46,
772     /**
773      * Axis constant: Generic 16 axis of a motion event.
774      * The interpretation of a generic axis is device-specific.
775      */
776     AMOTION_EVENT_AXIS_GENERIC_16 = 47
777 
778     // NOTE: If you add a new axis here you must also add it to several other files.
779     //       Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list.
780 }
781 
782 /**
783  * Constants that identify buttons that are associated with motion events.
784  * Refer to the documentation on the MotionEvent class for descriptions of each button.
785  */
786 enum
787 {
788     /** primary */
789     AMOTION_EVENT_BUTTON_PRIMARY = 1,
790     /** secondary */
791     AMOTION_EVENT_BUTTON_SECONDARY = 2,
792     /** tertiary */
793     AMOTION_EVENT_BUTTON_TERTIARY = 4,
794     /** back */
795     AMOTION_EVENT_BUTTON_BACK = 8,
796     /** forward */
797     AMOTION_EVENT_BUTTON_FORWARD = 16,
798     AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 32,
799     AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 64
800 }
801 
802 /**
803  * Constants that identify tool types.
804  * Refer to the documentation on the MotionEvent class for descriptions of each tool type.
805  */
806 enum
807 {
808     /** unknown */
809     AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0,
810     /** finger */
811     AMOTION_EVENT_TOOL_TYPE_FINGER = 1,
812     /** stylus */
813     AMOTION_EVENT_TOOL_TYPE_STYLUS = 2,
814     /** mouse */
815     AMOTION_EVENT_TOOL_TYPE_MOUSE = 3,
816     /** eraser */
817     AMOTION_EVENT_TOOL_TYPE_ERASER = 4
818 }
819 
820 /**
821  * Input source masks.
822  *
823  * Refer to the documentation on android.view.InputDevice for more details about input sources
824  * and their correct interpretation.
825  */
826 enum
827 {
828     /** mask */
829     AINPUT_SOURCE_CLASS_MASK = 255,
830 
831     /** none */
832     AINPUT_SOURCE_CLASS_NONE = 0,
833     /** button */
834     AINPUT_SOURCE_CLASS_BUTTON = 1,
835     /** pointer */
836     AINPUT_SOURCE_CLASS_POINTER = 2,
837     /** navigation */
838     AINPUT_SOURCE_CLASS_NAVIGATION = 4,
839     /** position */
840     AINPUT_SOURCE_CLASS_POSITION = 8,
841     /** joystick */
842     AINPUT_SOURCE_CLASS_JOYSTICK = 16
843 }
844 
845 /**
846  * Input sources.
847  */
848 enum
849 {
850     /** unknown */
851     AINPUT_SOURCE_UNKNOWN = 0,
852 
853     /** keyboard */
854     AINPUT_SOURCE_KEYBOARD = 257,
855     /** dpad */
856     AINPUT_SOURCE_DPAD = 513,
857     /** gamepad */
858     AINPUT_SOURCE_GAMEPAD = 1025,
859     /** touchscreen */
860     AINPUT_SOURCE_TOUCHSCREEN = 4098,
861     /** mouse */
862     AINPUT_SOURCE_MOUSE = 8194,
863     /** stylus */
864     AINPUT_SOURCE_STYLUS = 16386,
865     /** bluetooth stylus */
866     AINPUT_SOURCE_BLUETOOTH_STYLUS = 49154,
867     /** trackball */
868     AINPUT_SOURCE_TRACKBALL = 65540,
869     /** mouse relative */
870     AINPUT_SOURCE_MOUSE_RELATIVE = 131076,
871     /** touchpad */
872     AINPUT_SOURCE_TOUCHPAD = 1048584,
873     /** navigation */
874     AINPUT_SOURCE_TOUCH_NAVIGATION = 2097152,
875     /** joystick */
876     AINPUT_SOURCE_JOYSTICK = 16777232,
877     /** rotary encoder */
878     AINPUT_SOURCE_ROTARY_ENCODER = 4194304,
879 
880     /** any */
881     AINPUT_SOURCE_ANY = -256
882 }
883 
884 /**
885  * Keyboard types.
886  *
887  * Refer to the documentation on android.view.InputDevice for more details.
888  */
889 enum
890 {
891     /** none */
892     AINPUT_KEYBOARD_TYPE_NONE = 0,
893     /** non alphabetic */
894     AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1,
895     /** alphabetic */
896     AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2
897 }
898 
899 /**
900  * Constants used to retrieve information about the range of motion for a particular
901  * coordinate of a motion event.
902  *
903  * Refer to the documentation on android.view.InputDevice for more details about input sources
904  * and their correct interpretation.
905  *
906  * @deprecated These constants are deprecated. Use {@link AMOTION_EVENT_AXIS AMOTION_EVENT_AXIS_*} constants instead.
907  */
908 enum
909 {
910     /** x */
911     AINPUT_MOTION_RANGE_X = 0,
912     /** y */
913     AINPUT_MOTION_RANGE_Y = 1,
914     /** pressure */
915     AINPUT_MOTION_RANGE_PRESSURE = 2,
916     /** size */
917     AINPUT_MOTION_RANGE_SIZE = 3,
918     /** touch major */
919     AINPUT_MOTION_RANGE_TOUCH_MAJOR = 4,
920     /** touch minor */
921     AINPUT_MOTION_RANGE_TOUCH_MINOR = 5,
922     /** tool major */
923     AINPUT_MOTION_RANGE_TOOL_MAJOR = 6,
924     /** tool minor */
925     AINPUT_MOTION_RANGE_TOOL_MINOR = 7,
926     /** orientation */
927     AINPUT_MOTION_RANGE_ORIENTATION = 8
928 }
929 
930 /**
931  * Input event accessors.
932  *
933  * Note that most functions can only be used on input events that are of a given type.
934  * Calling these functions on input events of other types will yield undefined behavior.
935  */
936 
937 /*** Accessors for all input events. ***/
938 
939 /** Get the input event type. */
940 int AInputEvent_getType (const(AInputEvent)* event);
941 
942 /** Get the id for the device that an input event came from.
943  *
944  * Input events can be generated by multiple different input devices.
945  * Use the input device id to obtain information about the input
946  * device that was responsible for generating a particular event.
947  *
948  * An input device id of 0 indicates that the event didn't come from a physical device;
949  * other numbers are arbitrary and you shouldn't depend on the values.
950  * Use the provided input device query API to obtain information about input devices.
951  */
952 int AInputEvent_getDeviceId (const(AInputEvent)* event);
953 
954 /** Get the input event source. */
955 int AInputEvent_getSource (const(AInputEvent)* event);
956 
957 /*** Accessors for key events only. ***/
958 
959 /** Get the key event action. */
960 int AKeyEvent_getAction (const(AInputEvent)* key_event);
961 
962 /** Get the key event flags. */
963 int AKeyEvent_getFlags (const(AInputEvent)* key_event);
964 
965 /**
966  * Get the key code of the key event.
967  * This is the physical key that was pressed, not the Unicode character.
968  */
969 int AKeyEvent_getKeyCode (const(AInputEvent)* key_event);
970 
971 /**
972  * Get the hardware key id of this key event.
973  * These values are not reliable and vary from device to device.
974  */
975 int AKeyEvent_getScanCode (const(AInputEvent)* key_event);
976 
977 /** Get the meta key state. */
978 int AKeyEvent_getMetaState (const(AInputEvent)* key_event);
979 
980 /**
981  * Get the repeat count of the event.
982  * For both key up an key down events, this is the number of times the key has
983  * repeated with the first down starting at 0 and counting up from there.  For
984  * multiple key events, this is the number of down/up pairs that have occurred.
985  */
986 int AKeyEvent_getRepeatCount (const(AInputEvent)* key_event);
987 
988 /**
989  * Get the time of the most recent key down event, in the
990  * java.lang.System.nanoTime() time base.  If this is a down event,
991  * this will be the same as eventTime.
992  * Note that when chording keys, this value is the down time of the most recently
993  * pressed key, which may not be the same physical key of this event.
994  */
995 long AKeyEvent_getDownTime (const(AInputEvent)* key_event);
996 
997 /**
998  * Get the time this event occurred, in the
999  * java.lang.System.nanoTime() time base.
1000  */
1001 long AKeyEvent_getEventTime (const(AInputEvent)* key_event);
1002 
1003 /*** Accessors for motion events only. ***/
1004 
1005 /** Get the combined motion event action code and pointer index. */
1006 int AMotionEvent_getAction (const(AInputEvent)* motion_event);
1007 
1008 /** Get the motion event flags. */
1009 int AMotionEvent_getFlags (const(AInputEvent)* motion_event);
1010 
1011 /**
1012  * Get the state of any meta / modifier keys that were in effect when the
1013  * event was generated.
1014  */
1015 int AMotionEvent_getMetaState (const(AInputEvent)* motion_event);
1016 
1017 /** Get the button state of all buttons that are pressed. */
1018 int AMotionEvent_getButtonState (const(AInputEvent)* motion_event);
1019 
1020 /**
1021  * Get a bitfield indicating which edges, if any, were touched by this motion event.
1022  * For touch events, clients can use this to determine if the user's finger was
1023  * touching the edge of the display.
1024  */
1025 int AMotionEvent_getEdgeFlags (const(AInputEvent)* motion_event);
1026 
1027 /**
1028  * Get the time when the user originally pressed down to start a stream of
1029  * position events, in the java.lang.System.nanoTime() time base.
1030  */
1031 long AMotionEvent_getDownTime (const(AInputEvent)* motion_event);
1032 
1033 /**
1034  * Get the time when this specific event was generated,
1035  * in the java.lang.System.nanoTime() time base.
1036  */
1037 long AMotionEvent_getEventTime (const(AInputEvent)* motion_event);
1038 
1039 /**
1040  * Get the X coordinate offset.
1041  * For touch events on the screen, this is the delta that was added to the raw
1042  * screen coordinates to adjust for the absolute position of the containing windows
1043  * and views.
1044  */
1045 float AMotionEvent_getXOffset (const(AInputEvent)* motion_event);
1046 
1047 /**
1048  * Get the Y coordinate offset.
1049  * For touch events on the screen, this is the delta that was added to the raw
1050  * screen coordinates to adjust for the absolute position of the containing windows
1051  * and views.
1052  */
1053 float AMotionEvent_getYOffset (const(AInputEvent)* motion_event);
1054 
1055 /**
1056  * Get the precision of the X coordinates being reported.
1057  * You can multiply this number with an X coordinate sample to find the
1058  * actual hardware value of the X coordinate.
1059  */
1060 float AMotionEvent_getXPrecision (const(AInputEvent)* motion_event);
1061 
1062 /**
1063  * Get the precision of the Y coordinates being reported.
1064  * You can multiply this number with a Y coordinate sample to find the
1065  * actual hardware value of the Y coordinate.
1066  */
1067 float AMotionEvent_getYPrecision (const(AInputEvent)* motion_event);
1068 
1069 /**
1070  * Get the number of pointers of data contained in this event.
1071  * Always >= 1.
1072  */
1073 size_t AMotionEvent_getPointerCount (const(AInputEvent)* motion_event);
1074 
1075 /**
1076  * Get the pointer identifier associated with a particular pointer
1077  * data index in this event.  The identifier tells you the actual pointer
1078  * number associated with the data, accounting for individual pointers
1079  * going up and down since the start of the current gesture.
1080  */
1081 int AMotionEvent_getPointerId (const(AInputEvent)* motion_event, size_t pointer_index);
1082 
1083 /**
1084  * Get the tool type of a pointer for the given pointer index.
1085  * The tool type indicates the type of tool used to make contact such as a
1086  * finger or stylus, if known.
1087  */
1088 int AMotionEvent_getToolType (const(AInputEvent)* motion_event, size_t pointer_index);
1089 
1090 /**
1091  * Get the original raw X coordinate of this event.
1092  * For touch events on the screen, this is the original location of the event
1093  * on the screen, before it had been adjusted for the containing window
1094  * and views.
1095  */
1096 float AMotionEvent_getRawX (const(AInputEvent)* motion_event, size_t pointer_index);
1097 
1098 /**
1099  * Get the original raw X coordinate of this event.
1100  * For touch events on the screen, this is the original location of the event
1101  * on the screen, before it had been adjusted for the containing window
1102  * and views.
1103  */
1104 float AMotionEvent_getRawY (const(AInputEvent)* motion_event, size_t pointer_index);
1105 
1106 /**
1107  * Get the current X coordinate of this event for the given pointer index.
1108  * Whole numbers are pixels; the value may have a fraction for input devices
1109  * that are sub-pixel precise.
1110  */
1111 float AMotionEvent_getX (const(AInputEvent)* motion_event, size_t pointer_index);
1112 
1113 /**
1114  * Get the current Y coordinate of this event for the given pointer index.
1115  * Whole numbers are pixels; the value may have a fraction for input devices
1116  * that are sub-pixel precise.
1117  */
1118 float AMotionEvent_getY (const(AInputEvent)* motion_event, size_t pointer_index);
1119 
1120 /**
1121  * Get the current pressure of this event for the given pointer index.
1122  * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
1123  * although values higher than 1 may be generated depending on the calibration of
1124  * the input device.
1125  */
1126 float AMotionEvent_getPressure (const(AInputEvent)* motion_event, size_t pointer_index);
1127 
1128 /**
1129  * Get the current scaled value of the approximate size for the given pointer index.
1130  * This represents some approximation of the area of the screen being
1131  * pressed; the actual value in pixels corresponding to the
1132  * touch is normalized with the device specific range of values
1133  * and scaled to a value between 0 and 1.  The value of size can be used to
1134  * determine fat touch events.
1135  */
1136 float AMotionEvent_getSize (const(AInputEvent)* motion_event, size_t pointer_index);
1137 
1138 /**
1139  * Get the current length of the major axis of an ellipse that describes the touch area
1140  * at the point of contact for the given pointer index.
1141  */
1142 float AMotionEvent_getTouchMajor (const(AInputEvent)* motion_event, size_t pointer_index);
1143 
1144 /**
1145  * Get the current length of the minor axis of an ellipse that describes the touch area
1146  * at the point of contact for the given pointer index.
1147  */
1148 float AMotionEvent_getTouchMinor (const(AInputEvent)* motion_event, size_t pointer_index);
1149 
1150 /**
1151  * Get the current length of the major axis of an ellipse that describes the size
1152  * of the approaching tool for the given pointer index.
1153  * The tool area represents the estimated size of the finger or pen that is
1154  * touching the device independent of its actual touch area at the point of contact.
1155  */
1156 float AMotionEvent_getToolMajor (const(AInputEvent)* motion_event, size_t pointer_index);
1157 
1158 /**
1159  * Get the current length of the minor axis of an ellipse that describes the size
1160  * of the approaching tool for the given pointer index.
1161  * The tool area represents the estimated size of the finger or pen that is
1162  * touching the device independent of its actual touch area at the point of contact.
1163  */
1164 float AMotionEvent_getToolMinor (const(AInputEvent)* motion_event, size_t pointer_index);
1165 
1166 /**
1167  * Get the current orientation of the touch area and tool area in radians clockwise from
1168  * vertical for the given pointer index.
1169  * An angle of 0 degrees indicates that the major axis of contact is oriented
1170  * upwards, is perfectly circular or is of unknown orientation.  A positive angle
1171  * indicates that the major axis of contact is oriented to the right.  A negative angle
1172  * indicates that the major axis of contact is oriented to the left.
1173  * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
1174  * (finger pointing fully right).
1175  */
1176 float AMotionEvent_getOrientation (const(AInputEvent)* motion_event, size_t pointer_index);
1177 
1178 /** Get the value of the request axis for the given pointer index. */
1179 float AMotionEvent_getAxisValue (
1180     const(AInputEvent)* motion_event,
1181     int axis,
1182     size_t pointer_index);
1183 
1184 /**
1185  * Get the number of historical points in this event.  These are movements that
1186  * have occurred between this event and the previous event.  This only applies
1187  * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0.
1188  * Historical samples are indexed from oldest to newest.
1189  */
1190 size_t AMotionEvent_getHistorySize (const(AInputEvent)* motion_event);
1191 
1192 /**
1193  * Get the time that a historical movement occurred between this event and
1194  * the previous event, in the java.lang.System.nanoTime() time base.
1195  */
1196 long AMotionEvent_getHistoricalEventTime (
1197     const(AInputEvent)* motion_event,
1198     size_t history_index);
1199 
1200 /**
1201  * Get the historical raw X coordinate of this event for the given pointer index that
1202  * occurred between this event and the previous motion event.
1203  * For touch events on the screen, this is the original location of the event
1204  * on the screen, before it had been adjusted for the containing window
1205  * and views.
1206  * Whole numbers are pixels; the value may have a fraction for input devices
1207  * that are sub-pixel precise.
1208  */
1209 float AMotionEvent_getHistoricalRawX (
1210     const(AInputEvent)* motion_event,
1211     size_t pointer_index,
1212     size_t history_index);
1213 
1214 /**
1215  * Get the historical raw Y coordinate of this event for the given pointer index that
1216  * occurred between this event and the previous motion event.
1217  * For touch events on the screen, this is the original location of the event
1218  * on the screen, before it had been adjusted for the containing window
1219  * and views.
1220  * Whole numbers are pixels; the value may have a fraction for input devices
1221  * that are sub-pixel precise.
1222  */
1223 float AMotionEvent_getHistoricalRawY (
1224     const(AInputEvent)* motion_event,
1225     size_t pointer_index,
1226     size_t history_index);
1227 
1228 /**
1229  * Get the historical X coordinate of this event for the given pointer index that
1230  * occurred between this event and the previous motion event.
1231  * Whole numbers are pixels; the value may have a fraction for input devices
1232  * that are sub-pixel precise.
1233  */
1234 float AMotionEvent_getHistoricalX (
1235     const(AInputEvent)* motion_event,
1236     size_t pointer_index,
1237     size_t history_index);
1238 
1239 /**
1240  * Get the historical Y coordinate of this event for the given pointer index that
1241  * occurred between this event and the previous motion event.
1242  * Whole numbers are pixels; the value may have a fraction for input devices
1243  * that are sub-pixel precise.
1244  */
1245 float AMotionEvent_getHistoricalY (
1246     const(AInputEvent)* motion_event,
1247     size_t pointer_index,
1248     size_t history_index);
1249 
1250 /**
1251  * Get the historical pressure of this event for the given pointer index that
1252  * occurred between this event and the previous motion event.
1253  * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
1254  * although values higher than 1 may be generated depending on the calibration of
1255  * the input device.
1256  */
1257 float AMotionEvent_getHistoricalPressure (
1258     const(AInputEvent)* motion_event,
1259     size_t pointer_index,
1260     size_t history_index);
1261 
1262 /**
1263  * Get the current scaled value of the approximate size for the given pointer index that
1264  * occurred between this event and the previous motion event.
1265  * This represents some approximation of the area of the screen being
1266  * pressed; the actual value in pixels corresponding to the
1267  * touch is normalized with the device specific range of values
1268  * and scaled to a value between 0 and 1.  The value of size can be used to
1269  * determine fat touch events.
1270  */
1271 float AMotionEvent_getHistoricalSize (
1272     const(AInputEvent)* motion_event,
1273     size_t pointer_index,
1274     size_t history_index);
1275 
1276 /**
1277  * Get the historical length of the major axis of an ellipse that describes the touch area
1278  * at the point of contact for the given pointer index that
1279  * occurred between this event and the previous motion event.
1280  */
1281 float AMotionEvent_getHistoricalTouchMajor (
1282     const(AInputEvent)* motion_event,
1283     size_t pointer_index,
1284     size_t history_index);
1285 
1286 /**
1287  * Get the historical length of the minor axis of an ellipse that describes the touch area
1288  * at the point of contact for the given pointer index that
1289  * occurred between this event and the previous motion event.
1290  */
1291 float AMotionEvent_getHistoricalTouchMinor (
1292     const(AInputEvent)* motion_event,
1293     size_t pointer_index,
1294     size_t history_index);
1295 
1296 /**
1297  * Get the historical length of the major axis of an ellipse that describes the size
1298  * of the approaching tool for the given pointer index that
1299  * occurred between this event and the previous motion event.
1300  * The tool area represents the estimated size of the finger or pen that is
1301  * touching the device independent of its actual touch area at the point of contact.
1302  */
1303 float AMotionEvent_getHistoricalToolMajor (
1304     const(AInputEvent)* motion_event,
1305     size_t pointer_index,
1306     size_t history_index);
1307 
1308 /**
1309  * Get the historical length of the minor axis of an ellipse that describes the size
1310  * of the approaching tool for the given pointer index that
1311  * occurred between this event and the previous motion event.
1312  * The tool area represents the estimated size of the finger or pen that is
1313  * touching the device independent of its actual touch area at the point of contact.
1314  */
1315 float AMotionEvent_getHistoricalToolMinor (
1316     const(AInputEvent)* motion_event,
1317     size_t pointer_index,
1318     size_t history_index);
1319 
1320 /**
1321  * Get the historical orientation of the touch area and tool area in radians clockwise from
1322  * vertical for the given pointer index that
1323  * occurred between this event and the previous motion event.
1324  * An angle of 0 degrees indicates that the major axis of contact is oriented
1325  * upwards, is perfectly circular or is of unknown orientation.  A positive angle
1326  * indicates that the major axis of contact is oriented to the right.  A negative angle
1327  * indicates that the major axis of contact is oriented to the left.
1328  * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
1329  * (finger pointing fully right).
1330  */
1331 float AMotionEvent_getHistoricalOrientation (
1332     const(AInputEvent)* motion_event,
1333     size_t pointer_index,
1334     size_t history_index);
1335 
1336 /**
1337  * Get the historical value of the request axis for the given pointer index
1338  * that occurred between this event and the previous motion event.
1339  */
1340 float AMotionEvent_getHistoricalAxisValue (
1341     const(AInputEvent)* motion_event,
1342     int axis,
1343     size_t pointer_index,
1344     size_t history_index);
1345 
1346 struct AInputQueue;
1347 /**
1348  * Input queue
1349  *
1350  * An input queue is the facility through which you retrieve input
1351  * events.
1352  */
1353 
1354 /**
1355  * Add this input queue to a looper for processing.  See
1356  * ALooper_addFd() for information on the ident, callback, and data params.
1357  */
1358 void AInputQueue_attachLooper (
1359     AInputQueue* queue,
1360     ALooper* looper,
1361     int ident,
1362     ALooper_callbackFunc callback,
1363     void* data);
1364 
1365 /**
1366  * Remove the input queue from the looper it is currently attached to.
1367  */
1368 void AInputQueue_detachLooper (AInputQueue* queue);
1369 
1370 /**
1371  * Returns true if there are one or more events available in the
1372  * input queue.  Returns 1 if the queue has events; 0 if
1373  * it does not have events; and a negative value if there is an error.
1374  */
1375 int AInputQueue_hasEvents (AInputQueue* queue);
1376 
1377 /**
1378  * Returns the next available event from the queue.  Returns a negative
1379  * value if no events are available or an error has occurred.
1380  */
1381 int AInputQueue_getEvent (AInputQueue* queue, AInputEvent** outEvent);
1382 
1383 /**
1384  * Sends the key for standard pre-dispatching -- that is, possibly deliver
1385  * it to the current IME to be consumed before the app.  Returns 0 if it
1386  * was not pre-dispatched, meaning you can process it right now.  If non-zero
1387  * is returned, you must abandon the current event processing and allow the
1388  * event to appear again in the event queue (if it does not get consumed during
1389  * pre-dispatching).
1390  */
1391 int AInputQueue_preDispatchEvent (AInputQueue* queue, AInputEvent* event);
1392 
1393 /**
1394  * Report that dispatching has finished with the given event.
1395  * This must be called after receiving an event with AInputQueue_get_event().
1396  */
1397 void AInputQueue_finishEvent (AInputQueue* queue, AInputEvent* event, int handled);
1398 
1399 // _ANDROID_INPUT_H
1400 
1401 /** @} */