1 (*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *)
16
17 unit input;
18
19 interface
20
21 uses ctypes,looper,keycodes;
22
23 (******************************************************************
24 *
25 * IMPORTANT NOTICE:
26 *
27 * This file is part of Android's set of stable system headers
28 * exposed by the Android NDK (Native Development Kit).
29 *
30 * Third-party source AND binary code relies on the definitions
31 * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
32 *
33 * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
34 * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
35 * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
36 * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
37 *)
38
39 (*
40 * Structures and functions to receive and process input events in
41 * native code.
42 *
43 * NOTE: These functions MUST be implemented by /system/lib/libui.so
44 *)
45
46 (*
47 * Key states (may be returned by queries about the current state of a
48 * particular key code, scan code or switch).
49 *)
50 const
51 (* The key state is unknown or the requested key itself is not supported. *)
52 AKEY_STATE_UNKNOWN = - 1;
53 (* The key is up. *)
54 AKEY_STATE_UP = 0;
55 (* The key is down. *)
56 AKEY_STATE_DOWN = 1;
57 (* The key is down but is a virtual key press that is being emulated by the system. *)
58 AKEY_STATE_VIRTUAL = 2;
59
60 (*
61 * Meta key / modifer state.
62 *)
63 const
64 (* No meta keys are pressed. *)
65 AMETA_NONE = 0;
66 (* This mask is used to check whether one of the ALT meta keys is pressed. *)
67 AMETA_ALT_ON = $02;
68 (* This mask is used to check whether the left ALT meta key is pressed. *)
69 AMETA_ALT_LEFT_ON = $10;
70 (* This mask is used to check whether the right ALT meta key is pressed. *)
71 AMETA_ALT_RIGHT_ON = $20;
72 (* This mask is used to check whether one of the SHIFT meta keys is pressed. *)
73 AMETA_SHIFT_ON = $01;
74 (* This mask is used to check whether the left SHIFT meta key is pressed. *)
75 AMETA_SHIFT_LEFT_ON = $40;
76 (* This mask is used to check whether the right SHIFT meta key is pressed. *)
77 AMETA_SHIFT_RIGHT_ON = $80;
78 (* This mask is used to check whether the SYM meta key is pressed. *)
79 AMETA_SYM_ON = $04;
80
81 (*
82 * Input events.
83 *
84 * Input events are opaque structures. Use the provided accessors functions to
85 * read their properties.
86 *)
87 type
88 PPAInputEvent = ^PAInputEvent;
89 PAInputEvent = ^AInputEvent;
90
91 AInputEvent = record end;
92
93 (*
94 * Input event types.
95 *)
96 const
97 (* Indicates that the input event is a key event. *)
98 AINPUT_EVENT_TYPE_KEY = 1;
99 (* Indicates that the input event is a motion event. *)
100 AINPUT_EVENT_TYPE_MOTION = 2;
101
102 (*
103 * Key event actions.
104 *)
105 const
106 (* The key has been pressed down. *)
107 AKEY_EVENT_ACTION_DOWN = 0;
108 (* The key has been released. *)
109 AKEY_EVENT_ACTION_UP = 1;
110 (* Multiple duplicate key events have occurred in a row, or a complex string is
111 * being delivered. The repeat_count property of the key event contains the number
112 * of times the given key code should be executed.
113 *)
114 AKEY_EVENT_ACTION_MULTIPLE = 2;
115
116 (*
117 * Key event flags.
118 *)
119 const
120 (* This mask is set if the device woke because of this key event. *)
121 AKEY_EVENT_FLAG_WOKE_HERE = $1;
122 (* This mask is set if the key event was generated by a software keyboard. *)
123 AKEY_EVENT_FLAG_SOFT_KEYBOARD = $2;
124 (* This mask is set if we don't want the key event to cause us to leave touch mode. *)
125 AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = $4;
126 (* This mask is set if an event was known to come from a trusted part
127 * of the system. That is, the event is known to come from the user,
128 * and could not have been spoofed by a third party component. *)
129 AKEY_EVENT_FLAG_FROM_SYSTEM = $8;
130 (* This mask is used for compatibility, to identify enter keys that are
131 * coming from an IME whose enter key has been auto-labelled "next" or
132 * "done". This allows TextView to dispatch these as normal enter keys
133 * for old applications, but still do the appropriate action when
134 * receiving them. *)
135 AKEY_EVENT_FLAG_EDITOR_ACTION = $10;
136 (* When associated with up key events, this indicates that the key press
137 * has been canceled. Typically this is used with virtual touch screen
138 * keys, where the user can slide from the virtual key area on to the
139 * display: in that case, the application will receive a canceled up
140 * event and should not perform the action normally associated with the
141 * key. Note that for this to work, the application can not perform an
142 * action for a key until it receives an up or the long press timeout has
143 * expired. *)
144 AKEY_EVENT_FLAG_CANCELED = $20;
145 (* This key event was generated by a virtual (on-screen) hard key area.
146 * Typically this is an area of the touchscreen, outside of the regular
147 * display, dedicated to "hardware" buttons. *)
148 AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = $40;
149 (* This flag is set for the first key repeat that occurs after the
150 * long press timeout. *)
151 AKEY_EVENT_FLAG_LONG_PRESS = $80;
152 (* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long
153 * press action was executed while it was down. *)
154 AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = $100;
155 (* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being
156 * tracked from its initial down. That is, somebody requested that tracking
157 * started on the key down and a long press has not caused
158 * the tracking to be canceled. *)
159 AKEY_EVENT_FLAG_TRACKING = $200;
160
161
162 (*
163 * Motion event actions.
164 *)
165
166 (* Bit shift for the action bits holding the pointer index as
167 * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
168 *)
169 const
170 AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT = 8;
171
172 const
173 (* Bit mask of the parts of the action code that are the action itself.
174 *)
175 AMOTION_EVENT_ACTION_MASK = $ff;
176 (* Bits in the action code that represent a pointer index, used with
177 * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting
178 * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
179 * index where the data for the pointer going up or down can be found.
180 *)
181 AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = $ff00;
182 (* A pressed gesture has started, the motion contains the initial starting location.
183 *)
184 AMOTION_EVENT_ACTION_DOWN = 0;
185 (* A pressed gesture has finished, the motion contains the final release location
186 * as well as any intermediate points since the last down or move event.
187 *)
188 AMOTION_EVENT_ACTION_UP = 1;
189 (* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
190 * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as
191 * any intermediate points since the last down or move event.
192 *)
193 AMOTION_EVENT_ACTION_MOVE = 2;
194 (* The current gesture has been aborted.
195 * You will not receive any more points in it. You should treat this as
196 * an up event, but not perform any action that you normally would.
197 *)
198 AMOTION_EVENT_ACTION_CANCEL = 3;
199 (* A movement has happened outside of the normal bounds of the UI element.
200 * This does not provide a full gesture, but only the initial location of the movement/touch.
201 *)
202 AMOTION_EVENT_ACTION_OUTSIDE = 4;
203 (* A non-primary pointer has gone down.
204 * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
205 *)
206 AMOTION_EVENT_ACTION_POINTER_DOWN = 5;
207 (* A non-primary pointer has gone up.
208 * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
209 *)
210 AMOTION_EVENT_ACTION_POINTER_UP = 6;
211
212 (*
213 * Motion event flags.
214 *)
215
216 const
217 (* This flag indicates that the window that received this motion event is partly
218 * or wholly obscured by another visible window above it. This flag is set to true
219 * even if the event did not directly pass through the obscured area.
220 * A security sensitive application can check this flag to identify situations in which
221 * a malicious application may have covered up part of its content for the purpose
222 * of misleading the user or hijacking touches. An appropriate response might be
223 * to drop the suspect touches or to take additional precautions to confirm the user's
224 * actual intent.
225 *)
226 AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = $1;
227
228 (*
229 * Motion event edge touch flags.
230 *)
231
232 const
233 (* No edges intersected *)
234 AMOTION_EVENT_EDGE_FLAG_NONE = 0;
235 (* Flag indicating the motion event intersected the top edge of the screen. *)
236 AMOTION_EVENT_EDGE_FLAG_TOP = $01;
237 (* Flag indicating the motion event intersected the bottom edge of the screen. *)
238 AMOTION_EVENT_EDGE_FLAG_BOTTOM = $02;
239 (* Flag indicating the motion event intersected the left edge of the screen. *)
240 AMOTION_EVENT_EDGE_FLAG_LEFT = $04;
241 (* Flag indicating the motion event intersected the right edge of the screen. *)
242 AMOTION_EVENT_EDGE_FLAG_RIGHT = $08;
243
244 (*
245 * Input sources.
246 *
247 * Refer to the documentation on android.view.InputDevice for more details about input sources
248 * and their correct interpretation.
249 *)
250
251 const
252 AINPUT_SOURCE_CLASS_MASK = $000000ff;
253 AINPUT_SOURCE_CLASS_BUTTON = $00000001;
254 AINPUT_SOURCE_CLASS_POINTER = $00000002;
255 AINPUT_SOURCE_CLASS_NAVIGATION = $00000004;
256 AINPUT_SOURCE_CLASS_POSITION = $00000008;
257
258 const
259 AINPUT_SOURCE_UNKNOWN = $00000000;
260 AINPUT_SOURCE_KEYBOARD = $00000100 or AINPUT_SOURCE_CLASS_BUTTON;
261 AINPUT_SOURCE_DPAD = $00000200 or AINPUT_SOURCE_CLASS_BUTTON;
262 AINPUT_SOURCE_TOUCHSCREEN = $00001000 or AINPUT_SOURCE_CLASS_POINTER;
263 AINPUT_SOURCE_MOUSE = $00002000 or AINPUT_SOURCE_CLASS_POINTER;
264 AINPUT_SOURCE_TRACKBALL = $00010000 or AINPUT_SOURCE_CLASS_NAVIGATION;
265 AINPUT_SOURCE_TOUCHPAD = $00100000 or AINPUT_SOURCE_CLASS_POSITION;
266 AINPUT_SOURCE_ANY = $ffffff00;
267
268 (*
269 * Keyboard types.
270 *
271 * Refer to the documentation on android.view.InputDevice for more details.
272 *)
273
274 const
275 AINPUT_KEYBOARD_TYPE_NONE = 0;
276 AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1;
277 AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2;
278
279 (*
280 * Constants used to retrieve information about the range of motion for a particular
281 * coordinate of a motion event.
282 *
283 * Refer to the documentation on android.view.InputDevice for more details about input sources
284 * and their correct interpretation.
285 *)
286
287 const
288 AINPUT_MOTION_RANGE_X = 0;
289 AINPUT_MOTION_RANGE_Y = 1;
290 AINPUT_MOTION_RANGE_PRESSURE = 2;
291 AINPUT_MOTION_RANGE_SIZE = 3;
292 AINPUT_MOTION_RANGE_TOUCH_MAJOR = 4;
293 AINPUT_MOTION_RANGE_TOUCH_MINOR = 5;
294 AINPUT_MOTION_RANGE_TOOL_MAJOR = 6;
295 AINPUT_MOTION_RANGE_TOOL_MINOR = 7;
296 AINPUT_MOTION_RANGE_ORIENTATION = 8;
297
298
299 (*
300 * Input event accessors.
301 *
302 * Note that most functions can only be used on input events that are of a given type.
303 * Calling these functions on input events of other types will yield undefined behavior.
304 *)
305
306 (*** Accessors for all input events. ** *)
307
308 (* Get the input event type. *)
AInputEvent_getTypenull309 function AInputEvent_getType(event: PAInputEvent): cint32; cdecl; external;
310
311 (* Get the id for the device that an input event came from.
312 *
313 * Input events can be generated by multiple different input devices.
314 * Use the input device id to obtain information about the input
315 * device that was responsible for generating a particular event.
316 *
317 * An input device id of 0 indicates that the event didn't come from a physical device;
318 * other numbers are arbitrary and you shouldn't depend on the values.
319 * Use the provided input device query API to obtain information about input devices.
320 *)
AInputEvent_getDeviceIdnull321 function AInputEvent_getDeviceId(event: PAInputEvent): cint32; cdecl; external;
322
323 (* Get the input event source. *)
AInputEvent_getSourcenull324 function AInputEvent_getSource(event: PAInputEvent): cint32; cdecl; external;
325
326 (*** Accessors for key events only. ** *)
327
328 (* Get the key event action. *)
329
AKeyEvent_getActionnull330 function AKeyEvent_getAction(key_event: PAInputEvent): cint32; cdecl; external;
331
332 (* Get the key event flags. *)
333
AKeyEvent_getFlagsnull334 function AKeyEvent_getFlags(key_event: PAInputEvent): cint32; cdecl; external;
335
336 (* Get the key code of the key event.
337 * This is the physical key that was pressed, not the Unicode character. *)
338
AKeyEvent_getKeyCodenull339 function AKeyEvent_getKeyCode(key_event: PAInputEvent): cint32; cdecl; external;
340
341 (* Get the hardware key id of this key event.
342 * These values are not reliable and vary from device to device. *)
343
AKeyEvent_getScanCodenull344 function AKeyEvent_getScanCode(key_event: PAInputEvent): cint32; cdecl; external;
345
346 (* Get the meta key state. *)
347
AKeyEvent_getMetaStatenull348 function AKeyEvent_getMetaState(key_event: PAInputEvent): cint32; cdecl; external;
349
350 (* Get the repeat count of the event.
351 * For both key up an key down events, this is the number of times the key has
352 * repeated with the first down starting at 0 and counting up from there. For
353 * multiple key events, this is the number of down/up pairs that have occurred. *)
354
AKeyEvent_getRepeatCountnull355 function AKeyEvent_getRepeatCount(key_event: PAInputEvent): cint32; cdecl; external;
356
357 (* Get the time of the most recent key down event, in the
358 * java.lang.System.nanoTime() time base. If this is a down event,
359 * this will be the same as eventTime.
360 * Note that when chording keys, this value is the down time of the most recently
361 * pressed key, which may not be the same physical key of this event. *)
362
AKeyEvent_getDownTimenull363 function AKeyEvent_getDownTime(key_event: PAInputEvent): cint64; cdecl; external;
364
365 (* Get the time this event occurred, in the
366 * java.lang.System.nanoTime() time base. *)
367
AKeyEvent_getEventTimenull368 function AKeyEvent_getEventTime(key_event: PAInputEvent): cint64; cdecl; external;
369
370 (*** Accessors for motion events only. ** *)
371
372 (* Get the combined motion event action code and pointer index. *)
373
AMotionEvent_getActionnull374 function AMotionEvent_getAction(motion_event: PAInputEvent): cint32; cdecl; external;
375
376 (* Get the motion event flags. *)
377
AMotionEvent_getFlagsnull378 function AMotionEvent_getFlags(motion_event: PAInputEvent): cint32; cdecl; external;
379
380 (* Get the state of any meta / modifier keys that were in effect when the
381 * event was generated. *)
382
AMotionEvent_getMetaStatenull383 function AMotionEvent_getMetaState(motion_event: PAInputEvent): cint32; cdecl; external;
384
385 (* Get a bitfield indicating which edges, if any, were touched by this motion event.
386 * For touch events, clients can use this to determine if the user's finger was
387 * touching the edge of the display. *)
388
AMotionEvent_getEdgeFlagsnull389 function AMotionEvent_getEdgeFlags(motion_event: PAInputEvent): cint32; cdecl; external;
390
391 (* Get the time when the user originally pressed down to start a stream of
392 * position events, in the java.lang.System.nanoTime() time base. *)
393
AMotionEvent_getDownTimenull394 function AMotionEvent_getDownTime(motion_event: PAInputEvent): cint64; cdecl; external;
395
396 (* Get the time when this specific event was generated,
397 * in the java.lang.System.nanoTime() time base. *)
398
AMotionEvent_getEventTimenull399 function AMotionEvent_getEventTime(motion_event: PAInputEvent): cint64; cdecl; external;
400
401 (* Get the X coordinate offset.
402 * For touch events on the screen, this is the delta that was added to the raw
403 * screen coordinates to adjust for the absolute position of the containing windows
404 * and views. *)
405
AMotionEvent_getXOffsetnull406 function AMotionEvent_getXOffset(motion_event: PAInputEvent): cfloat; cdecl; external;
407
408 (* Get the precision of the Y coordinates being reported.
409 * For touch events on the screen, this is the delta that was added to the raw
410 * screen coordinates to adjust for the absolute position of the containing windows
411 * and views. *)
412
AMotionEvent_getYOffsetnull413 function AMotionEvent_getYOffset(motion_event: PAInputEvent): cfloat; cdecl; external;
414
415 (* Get the precision of the X coordinates being reported.
416 * You can multiply this number with an X coordinate sample to find the
417 * actual hardware value of the X coordinate. *)
418
AMotionEvent_getXPrecisionnull419 function AMotionEvent_getXPrecision(motion_event: PAInputEvent): cfloat; cdecl; external;
420
421 (* Get the precision of the Y coordinates being reported.
422 * You can multiply this number with a Y coordinate sample to find the
423 * actual hardware value of the Y coordinate. *)
424
AMotionEvent_getYPrecisionnull425 function AMotionEvent_getYPrecision(motion_event: PAInputEvent): cfloat; cdecl; external;
426
427 (* Get the number of pointers of data contained in this event.
428 * Always >= 1. *)
429
AMotionEvent_getPointerCountnull430 function AMotionEvent_getPointerCount(motion_event: PAInputEvent): csize_t; cdecl; external;
431
432 (* Get the pointer identifier associated with a particular pointer
433 * data index is this event. The identifier tells you the actual pointer
434 * number associated with the data, accounting for individual pointers
435 * going up and down since the start of the current gesture. *)
436
AMotionEvent_getPointerIdnull437 function AMotionEvent_getPointerId(motion_event: PAInputEvent; pointer_index: csize_t): cint32; cdecl; external;
438
439 (* Get the original raw X coordinate of this event.
440 * For touch events on the screen, this is the original location of the event
441 * on the screen, before it had been adjusted for the containing window
442 * and views. *)
443
AMotionEvent_getRawXnull444 function AMotionEvent_getRawX(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
445
446 (* Get the original raw X coordinate of this event.
447 * For touch events on the screen, this is the original location of the event
448 * on the screen, before it had been adjusted for the containing window
449 * and views. *)
450
AMotionEvent_getRawYnull451 function AMotionEvent_getRawY(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
452
453 (* Get the current X coordinate of this event for the given pointer index.
454 * Whole numbers are pixels; the value may have a fraction for input devices
455 * that are sub-pixel precise. *)
456
AMotionEvent_getXnull457 function AMotionEvent_getX(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
458
459 (* Get the current Y coordinate of this event for the given pointer index.
460 * Whole numbers are pixels; the value may have a fraction for input devices
461 * that are sub-pixel precise. *)
462
AMotionEvent_getYnull463 function AMotionEvent_getY(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
464
465 (* Get the current pressure of this event for the given pointer index.
466 * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
467 * however values higher than 1 may be generated depending on the calibration of
468 * the input device. *)
469
AMotionEvent_getPressurenull470 function AMotionEvent_getPressure(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
471
472 (* Get the current scaled value of the approximate size for the given pointer index.
473 * This represents some approximation of the area of the screen being
474 * pressed; the actual value in pixels corresponding to the
475 * touch is normalized with the device specific range of values
476 * and scaled to a value between 0 and 1. The value of size can be used to
477 * determine fat touch events. *)
478
AMotionEvent_getSizenull479 function AMotionEvent_getSize(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
480
481 (* Get the current length of the major axis of an ellipse that describes the touch area
482 * at the point of contact for the given pointer index. *)
483
AMotionEvent_getTouchMajornull484 function AMotionEvent_getTouchMajor(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
485
486 (* Get the current length of the minor axis of an ellipse that describes the touch area
487 * at the point of contact for the given pointer index. *)
488
AMotionEvent_getTouchMinornull489 function AMotionEvent_getTouchMinor(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
490
491 (* Get the current length of the major axis of an ellipse that describes the size
492 * of the approaching tool for the given pointer index.
493 * The tool area represents the estimated size of the finger or pen that is
494 * touching the device independent of its actual touch area at the point of contact. *)
495
AMotionEvent_getToolMajornull496 function AMotionEvent_getToolMajor(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
497
498 (* Get the current length of the minor axis of an ellipse that describes the size
499 * of the approaching tool for the given pointer index.
500 * The tool area represents the estimated size of the finger or pen that is
501 * touching the device independent of its actual touch area at the point of contact. *)
502
AMotionEvent_getToolMinornull503 function AMotionEvent_getToolMinor(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
504
505 (* Get the current orientation of the touch area and tool area in radians clockwise from
506 * vertical for the given pointer index.
507 * An angle of 0 degrees indicates that the major axis of contact is oriented
508 * upwards, is perfectly circular or is of unknown orientation. A positive angle
509 * indicates that the major axis of contact is oriented to the right. A negative angle
510 * indicates that the major axis of contact is oriented to the left.
511 * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
512 * (finger pointing fully right). *)
513
AMotionEvent_getOrientationnull514 function AMotionEvent_getOrientation(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
515
516 (* Get the number of historical points in this event. These are movements that
517 * have occurred between this event and the previous event. This only applies
518 * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0.
519 * Historical samples are indexed from oldest to newest. *)
520
AMotionEvent_getHistorySizenull521 function AMotionEvent_getHistorySize(motion_event: PAInputEvent): csize_t; cdecl; external;
522
523 (* Get the time that a historical movement occurred between this event and
524 * the previous event, in the java.lang.System.nanoTime() time base. *)
525
AMotionEvent_getHistoricalEventTimenull526 function AMotionEvent_getHistoricalEventTime(motion_event: PAInputEvent; history_index: csize_t): cint64; cdecl; external;
527
528 (* Get the historical raw X coordinate of this event for the given pointer index that
529 * occurred between this event and the previous motion event.
530 * For touch events on the screen, this is the original location of the event
531 * on the screen, before it had been adjusted for the containing window
532 * and views.
533 * Whole numbers are pixels; the value may have a fraction for input devices
534 * that are sub-pixel precise. *)
535
AMotionEvent_getHistoricalRawXnull536 function AMotionEvent_getHistoricalRawX(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
537
538 (* Get the historical raw Y coordinate of this event for the given pointer index that
539 * occurred between this event and the previous motion event.
540 * For touch events on the screen, this is the original location of the event
541 * on the screen, before it had been adjusted for the containing window
542 * and views.
543 * Whole numbers are pixels; the value may have a fraction for input devices
544 * that are sub-pixel precise. *)
545
AMotionEvent_getHistoricalRawYnull546 function AMotionEvent_getHistoricalRawY(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
547
548 (* Get the historical X coordinate of this event for the given pointer index that
549 * occurred between this event and the previous motion event.
550 * Whole numbers are pixels; the value may have a fraction for input devices
551 * that are sub-pixel precise. *)
552
AMotionEvent_getHistoricalXnull553 function AMotionEvent_getHistoricalX(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
554
555 (* Get the historical Y coordinate of this event for the given pointer index that
556 * occurred between this event and the previous motion event.
557 * Whole numbers are pixels; the value may have a fraction for input devices
558 * that are sub-pixel precise. *)
559
AMotionEvent_getHistoricalYnull560 function AMotionEvent_getHistoricalY(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
561
562 (* Get the historical pressure of this event for the given pointer index that
563 * occurred between this event and the previous motion event.
564 * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
565 * however values higher than 1 may be generated depending on the calibration of
566 * the input device. *)
567
AMotionEvent_getHistoricalPressurenull568 function AMotionEvent_getHistoricalPressure(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
569
570 (* Get the current scaled value of the approximate size for the given pointer index that
571 * occurred between this event and the previous motion event.
572 * This represents some approximation of the area of the screen being
573 * pressed; the actual value in pixels corresponding to the
574 * touch is normalized with the device specific range of values
575 * and scaled to a value between 0 and 1. The value of size can be used to
576 * determine fat touch events. *)
577
AMotionEvent_getHistoricalSizenull578 function AMotionEvent_getHistoricalSize(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
579
580 (* Get the historical length of the major axis of an ellipse that describes the touch area
581 * at the point of contact for the given pointer index that
582 * occurred between this event and the previous motion event. *)
583
AMotionEvent_getHistoricalTouchMajornull584 function AMotionEvent_getHistoricalTouchMajor(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
585
586 (* Get the historical length of the minor axis of an ellipse that describes the touch area
587 * at the point of contact for the given pointer index that
588 * occurred between this event and the previous motion event. *)
589
AMotionEvent_getHistoricalTouchMinornull590 function AMotionEvent_getHistoricalTouchMinor(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
591
592 (* Get the historical length of the major axis of an ellipse that describes the size
593 * of the approaching tool for the given pointer index that
594 * occurred between this event and the previous motion event.
595 * The tool area represents the estimated size of the finger or pen that is
596 * touching the device independent of its actual touch area at the point of contact. *)
597
AMotionEvent_getHistoricalToolMajornull598 function AMotionEvent_getHistoricalToolMajor(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
599
600 (* Get the historical length of the minor axis of an ellipse that describes the size
601 * of the approaching tool for the given pointer index that
602 * occurred between this event and the previous motion event.
603 * The tool area represents the estimated size of the finger or pen that is
604 * touching the device independent of its actual touch area at the point of contact. *)
605
AMotionEvent_getHistoricalToolMinornull606 function AMotionEvent_getHistoricalToolMinor(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
607
608 (* Get the historical orientation of the touch area and tool area in radians clockwise from
609 * vertical for the given pointer index that
610 * occurred between this event and the previous motion event.
611 * An angle of 0 degrees indicates that the major axis of contact is oriented
612 * upwards, is perfectly circular or is of unknown orientation. A positive angle
613 * indicates that the major axis of contact is oriented to the right. A negative angle
614 * indicates that the major axis of contact is oriented to the left.
615 * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
616 * (finger pointing fully right). *)
617
AMotionEvent_getHistoricalOrientationnull618 function AMotionEvent_getHistoricalOrientation(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
619
620
621 (*
622 * Input queue
623 *
624 * An input queue is the facility through which you retrieve input
625 * events.
626 *)
627
628 type
629 PAInputQueue = ^AInputQueue;
630 AInputQueue = record end;
631
632 (*
633 * Add this input queue to a looper for processing. See
634 * ALooper_addFd() for information on the ident, callback, and data params.
635 *)
636 procedure AInputQueue_attachLooper(queue: PAInputQueue; looper: PALooper; ident: cint; callback: ALooper_callbackFunc; data: Pointer); cdecl; external;
637
638 (*
639 * Remove the input queue from the looper it is currently attached to.
640 *)
641
642 procedure AInputQueue_detachLooper(queue: PAInputQueue); cdecl; external;
643
644 (*
645 * Returns true if there are one or more events available in the
646 * input queue. Returns 1 if the queue has events; 0 if
647 * it does not have events; and a negative value if there is an error.
648 *)
649
AInputQueue_hasEventsnull650 function AInputQueue_hasEvents(queue: PAInputQueue): cint32; cdecl; external;
651
652 (*
653 * Returns the next available event from the queue. Returns a negative
654 * value if no events are available or an error has occurred.
655 *)
AInputQueue_getEventnull656 function AInputQueue_getEvent(queue: PAInputQueue; outEvent: PPAInputEvent): cint32; cdecl; external;
657
658 (*
659 * Sends the key for standard pre-dispatching -- that is, possibly deliver
660 * it to the current IME to be consumed before the app. Returns 0 if it
661 * was not pre-dispatched, meaning you can process it right now. If non-zero
662 * is returned, you must abandon the current event processing and allow the
663 * event to appear again in the event queue (if it does not get consumed during
664 * pre-dispatching).
665 *)
AInputQueue_preDispatchEventnull666 function AInputQueue_preDispatchEvent(queue: PAInputQueue; event: PAInputEvent): cint32; cdecl; external;
667
668 (*
669 * Report that dispatching has finished with the given event.
670 * This must be called after receiving an event with AInputQueue_get_event().
671 *)
672
673 procedure AInputQueue_finishEvent(queue: PAInputQueue; event: PAInputEvent; handled: cint); cdecl; external;
674
675 implementation
676
677 end.
678
679