~mir-team/mir/in-process-egl+input-conglomeration

« back to all changes in this revision

Viewing changes to 3rd_party/android-deps/android/input.h

Merged trunk and fixed issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
#include <stdint.h>
44
44
#include <sys/types.h>
45
 
#if !defined(ANDROID_USE_STD)
46
 
#include <android/keycodes.h>
47
 
#include <android/looper.h>
48
 
#endif
49
45
 
50
46
#ifdef __cplusplus
51
47
extern "C" {
485
481
    AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION
486
482
} __attribute__ ((deprecated));
487
483
 
488
 
 
489
 
#if !defined(ANDROID_USE_STD)
490
 
/*
491
 
 * Input event accessors.
492
 
 *
493
 
 * Note that most functions can only be used on input events that are of a given type.
494
 
 * Calling these functions on input events of other types will yield undefined behavior.
495
 
 */
496
 
 
497
 
/*** Accessors for all input events. ***/
498
 
 
499
 
/* Get the input event type. */
500
 
int32_t AInputEvent_getType(const AInputEvent* event);
501
 
 
502
 
/* Get the id for the device that an input event came from.
503
 
 *
504
 
 * Input events can be generated by multiple different input devices.
505
 
 * Use the input device id to obtain information about the input
506
 
 * device that was responsible for generating a particular event.
507
 
 *
508
 
 * An input device id of 0 indicates that the event didn't come from a physical device;
509
 
 * other numbers are arbitrary and you shouldn't depend on the values.
510
 
 * Use the provided input device query API to obtain information about input devices.
511
 
 */
512
 
int32_t AInputEvent_getDeviceId(const AInputEvent* event);
513
 
 
514
 
/* Get the input event source. */
515
 
int32_t AInputEvent_getSource(const AInputEvent* event);
516
 
 
517
 
/*** Accessors for key events only. ***/
518
 
 
519
 
/* Get the key event action. */
520
 
int32_t AKeyEvent_getAction(const AInputEvent* key_event);
521
 
 
522
 
/* Get the key event flags. */
523
 
int32_t AKeyEvent_getFlags(const AInputEvent* key_event);
524
 
 
525
 
/* Get the key code of the key event.
526
 
 * This is the physical key that was pressed, not the Unicode character. */
527
 
int32_t AKeyEvent_getKeyCode(const AInputEvent* key_event);
528
 
 
529
 
/* Get the hardware key id of this key event.
530
 
 * These values are not reliable and vary from device to device. */
531
 
int32_t AKeyEvent_getScanCode(const AInputEvent* key_event);
532
 
 
533
 
/* Get the meta key state. */
534
 
int32_t AKeyEvent_getMetaState(const AInputEvent* key_event);
535
 
 
536
 
/* Get the repeat count of the event.
537
 
 * For both key up an key down events, this is the number of times the key has
538
 
 * repeated with the first down starting at 0 and counting up from there.  For
539
 
 * multiple key events, this is the number of down/up pairs that have occurred. */
540
 
int32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event);
541
 
 
542
 
/* Get the time of the most recent key down event, in the
543
 
 * java.lang.System.nanoTime() time base.  If this is a down event,
544
 
 * this will be the same as eventTime.
545
 
 * Note that when chording keys, this value is the down time of the most recently
546
 
 * pressed key, which may not be the same physical key of this event. */
547
 
int64_t AKeyEvent_getDownTime(const AInputEvent* key_event);
548
 
 
549
 
/* Get the time this event occurred, in the
550
 
 * java.lang.System.nanoTime() time base. */
551
 
int64_t AKeyEvent_getEventTime(const AInputEvent* key_event);
552
 
 
553
 
/*** Accessors for motion events only. ***/
554
 
 
555
 
/* Get the combined motion event action code and pointer index. */
556
 
int32_t AMotionEvent_getAction(const AInputEvent* motion_event);
557
 
 
558
 
/* Get the motion event flags. */
559
 
int32_t AMotionEvent_getFlags(const AInputEvent* motion_event);
560
 
 
561
 
/* Get the state of any meta / modifier keys that were in effect when the
562
 
 * event was generated. */
563
 
int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event);
564
 
 
565
 
/* Get the button state of all buttons that are pressed. */
566
 
int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event);
567
 
 
568
 
/* Get a bitfield indicating which edges, if any, were touched by this motion event.
569
 
 * For touch events, clients can use this to determine if the user's finger was
570
 
 * touching the edge of the display. */
571
 
int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event);
572
 
 
573
 
/* Get the time when the user originally pressed down to start a stream of
574
 
 * position events, in the java.lang.System.nanoTime() time base. */
575
 
int64_t AMotionEvent_getDownTime(const AInputEvent* motion_event);
576
 
 
577
 
/* Get the time when this specific event was generated,
578
 
 * in the java.lang.System.nanoTime() time base. */
579
 
int64_t AMotionEvent_getEventTime(const AInputEvent* motion_event);
580
 
 
581
 
/* Get the X coordinate offset.
582
 
 * For touch events on the screen, this is the delta that was added to the raw
583
 
 * screen coordinates to adjust for the absolute position of the containing windows
584
 
 * and views. */
585
 
float AMotionEvent_getXOffset(const AInputEvent* motion_event);
586
 
 
587
 
/* Get the precision of the Y coordinates being reported.
588
 
 * For touch events on the screen, this is the delta that was added to the raw
589
 
 * screen coordinates to adjust for the absolute position of the containing windows
590
 
 * and views. */
591
 
float AMotionEvent_getYOffset(const AInputEvent* motion_event);
592
 
 
593
 
/* Get the precision of the X coordinates being reported.
594
 
 * You can multiply this number with an X coordinate sample to find the
595
 
 * actual hardware value of the X coordinate. */
596
 
float AMotionEvent_getXPrecision(const AInputEvent* motion_event);
597
 
 
598
 
/* Get the precision of the Y coordinates being reported.
599
 
 * You can multiply this number with a Y coordinate sample to find the
600
 
 * actual hardware value of the Y coordinate. */
601
 
float AMotionEvent_getYPrecision(const AInputEvent* motion_event);
602
 
 
603
 
/* Get the number of pointers of data contained in this event.
604
 
 * Always >= 1. */
605
 
size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event);
606
 
 
607
 
/* Get the pointer identifier associated with a particular pointer
608
 
 * data index in this event.  The identifier tells you the actual pointer
609
 
 * number associated with the data, accounting for individual pointers
610
 
 * going up and down since the start of the current gesture. */
611
 
int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index);
612
 
 
613
 
/* Get the tool type of a pointer for the given pointer index.
614
 
 * The tool type indicates the type of tool used to make contact such as a
615
 
 * finger or stylus, if known. */
616
 
int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index);
617
 
 
618
 
/* Get the original raw X coordinate of this event.
619
 
 * For touch events on the screen, this is the original location of the event
620
 
 * on the screen, before it had been adjusted for the containing window
621
 
 * and views. */
622
 
float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index);
623
 
 
624
 
/* Get the original raw X coordinate of this event.
625
 
 * For touch events on the screen, this is the original location of the event
626
 
 * on the screen, before it had been adjusted for the containing window
627
 
 * and views. */
628
 
float AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index);
629
 
 
630
 
/* Get the current X coordinate of this event for the given pointer index.
631
 
 * Whole numbers are pixels; the value may have a fraction for input devices
632
 
 * that are sub-pixel precise. */
633
 
float AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index);
634
 
 
635
 
/* Get the current Y coordinate of this event for the given pointer index.
636
 
 * Whole numbers are pixels; the value may have a fraction for input devices
637
 
 * that are sub-pixel precise. */
638
 
float AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index);
639
 
 
640
 
/* Get the current pressure of this event for the given pointer index.
641
 
 * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
642
 
 * although values higher than 1 may be generated depending on the calibration of
643
 
 * the input device. */
644
 
float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index);
645
 
 
646
 
/* Get the current scaled value of the approximate size for the given pointer index.
647
 
 * This represents some approximation of the area of the screen being
648
 
 * pressed; the actual value in pixels corresponding to the
649
 
 * touch is normalized with the device specific range of values
650
 
 * and scaled to a value between 0 and 1.  The value of size can be used to
651
 
 * determine fat touch events. */
652
 
float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index);
653
 
 
654
 
/* Get the current length of the major axis of an ellipse that describes the touch area
655
 
 * at the point of contact for the given pointer index. */
656
 
float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index);
657
 
 
658
 
/* Get the current length of the minor axis of an ellipse that describes the touch area
659
 
 * at the point of contact for the given pointer index. */
660
 
float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index);
661
 
 
662
 
/* Get the current length of the major axis of an ellipse that describes the size
663
 
 * of the approaching tool for the given pointer index.
664
 
 * The tool area represents the estimated size of the finger or pen that is
665
 
 * touching the device independent of its actual touch area at the point of contact. */
666
 
float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index);
667
 
 
668
 
/* Get the current length of the minor axis of an ellipse that describes the size
669
 
 * of the approaching tool for the given pointer index.
670
 
 * The tool area represents the estimated size of the finger or pen that is
671
 
 * touching the device independent of its actual touch area at the point of contact. */
672
 
float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index);
673
 
 
674
 
/* Get the current orientation of the touch area and tool area in radians clockwise from
675
 
 * vertical for the given pointer index.
676
 
 * An angle of 0 degrees indicates that the major axis of contact is oriented
677
 
 * upwards, is perfectly circular or is of unknown orientation.  A positive angle
678
 
 * indicates that the major axis of contact is oriented to the right.  A negative angle
679
 
 * indicates that the major axis of contact is oriented to the left.
680
 
 * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
681
 
 * (finger pointing fully right). */
682
 
float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index);
683
 
 
684
 
/* Get the value of the request axis for the given pointer index. */
685
 
float AMotionEvent_getAxisValue(const AInputEvent* motion_event,
686
 
        int32_t axis, size_t pointer_index);
687
 
 
688
 
/* Get the number of historical points in this event.  These are movements that
689
 
 * have occurred between this event and the previous event.  This only applies
690
 
 * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0.
691
 
 * Historical samples are indexed from oldest to newest. */
692
 
size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event);
693
 
 
694
 
/* Get the time that a historical movement occurred between this event and
695
 
 * the previous event, in the java.lang.System.nanoTime() time base. */
696
 
int64_t AMotionEvent_getHistoricalEventTime(AInputEvent* motion_event,
697
 
        size_t history_index);
698
 
 
699
 
/* Get the historical raw X coordinate of this event for the given pointer index that
700
 
 * occurred between this event and the previous motion event.
701
 
 * For touch events on the screen, this is the original location of the event
702
 
 * on the screen, before it had been adjusted for the containing window
703
 
 * and views.
704
 
 * Whole numbers are pixels; the value may have a fraction for input devices
705
 
 * that are sub-pixel precise. */
706
 
float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index,
707
 
        size_t history_index);
708
 
 
709
 
/* Get the historical raw Y coordinate of this event for the given pointer index that
710
 
 * occurred between this event and the previous motion event.
711
 
 * For touch events on the screen, this is the original location of the event
712
 
 * on the screen, before it had been adjusted for the containing window
713
 
 * and views.
714
 
 * Whole numbers are pixels; the value may have a fraction for input devices
715
 
 * that are sub-pixel precise. */
716
 
float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index,
717
 
        size_t history_index);
718
 
 
719
 
/* Get the historical X coordinate of this event for the given pointer index that
720
 
 * occurred between this event and the previous motion event.
721
 
 * Whole numbers are pixels; the value may have a fraction for input devices
722
 
 * that are sub-pixel precise. */
723
 
float AMotionEvent_getHistoricalX(AInputEvent* motion_event, size_t pointer_index,
724
 
        size_t history_index);
725
 
 
726
 
/* Get the historical Y coordinate of this event for the given pointer index that
727
 
 * occurred between this event and the previous motion event.
728
 
 * Whole numbers are pixels; the value may have a fraction for input devices
729
 
 * that are sub-pixel precise. */
730
 
float AMotionEvent_getHistoricalY(AInputEvent* motion_event, size_t pointer_index,
731
 
        size_t history_index);
732
 
 
733
 
/* Get the historical pressure of this event for the given pointer index that
734
 
 * occurred between this event and the previous motion event.
735
 
 * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
736
 
 * although values higher than 1 may be generated depending on the calibration of
737
 
 * the input device. */
738
 
float AMotionEvent_getHistoricalPressure(AInputEvent* motion_event, size_t pointer_index,
739
 
        size_t history_index);
740
 
 
741
 
/* Get the current scaled value of the approximate size for the given pointer index that
742
 
 * occurred between this event and the previous motion event.
743
 
 * This represents some approximation of the area of the screen being
744
 
 * pressed; the actual value in pixels corresponding to the
745
 
 * touch is normalized with the device specific range of values
746
 
 * and scaled to a value between 0 and 1.  The value of size can be used to
747
 
 * determine fat touch events. */
748
 
float AMotionEvent_getHistoricalSize(AInputEvent* motion_event, size_t pointer_index,
749
 
        size_t history_index);
750
 
 
751
 
/* Get the historical length of the major axis of an ellipse that describes the touch area
752
 
 * at the point of contact for the given pointer index that
753
 
 * occurred between this event and the previous motion event. */
754
 
float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index,
755
 
        size_t history_index);
756
 
 
757
 
/* Get the historical length of the minor axis of an ellipse that describes the touch area
758
 
 * at the point of contact for the given pointer index that
759
 
 * occurred between this event and the previous motion event. */
760
 
float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index,
761
 
        size_t history_index);
762
 
 
763
 
/* Get the historical length of the major axis of an ellipse that describes the size
764
 
 * of the approaching tool for the given pointer index that
765
 
 * occurred between this event and the previous motion event.
766
 
 * The tool area represents the estimated size of the finger or pen that is
767
 
 * touching the device independent of its actual touch area at the point of contact. */
768
 
float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index,
769
 
        size_t history_index);
770
 
 
771
 
/* Get the historical length of the minor axis of an ellipse that describes the size
772
 
 * of the approaching tool for the given pointer index that
773
 
 * occurred between this event and the previous motion event.
774
 
 * The tool area represents the estimated size of the finger or pen that is
775
 
 * touching the device independent of its actual touch area at the point of contact. */
776
 
float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index,
777
 
        size_t history_index);
778
 
 
779
 
/* Get the historical orientation of the touch area and tool area in radians clockwise from
780
 
 * vertical for the given pointer index that
781
 
 * occurred between this event and the previous motion event.
782
 
 * An angle of 0 degrees indicates that the major axis of contact is oriented
783
 
 * upwards, is perfectly circular or is of unknown orientation.  A positive angle
784
 
 * indicates that the major axis of contact is oriented to the right.  A negative angle
785
 
 * indicates that the major axis of contact is oriented to the left.
786
 
 * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
787
 
 * (finger pointing fully right). */
788
 
float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index,
789
 
        size_t history_index);
790
 
 
791
 
/* Get the historical value of the request axis for the given pointer index
792
 
 * that occurred between this event and the previous motion event. */
793
 
float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event,
794
 
        int32_t axis, size_t pointer_index, size_t history_index);
795
 
 
796
 
 
797
 
/*
798
 
 * Input queue
799
 
 *
800
 
 * An input queue is the facility through which you retrieve input
801
 
 * events.
802
 
 */
803
 
struct AInputQueue;
804
 
typedef struct AInputQueue AInputQueue;
805
 
 
806
 
/*
807
 
 * Add this input queue to a looper for processing.  See
808
 
 * ALooper_addFd() for information on the ident, callback, and data params.
809
 
 */
810
 
void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
811
 
        int ident, ALooper_callbackFunc callback, void* data);
812
 
 
813
 
/*
814
 
 * Remove the input queue from the looper it is currently attached to.
815
 
 */
816
 
void AInputQueue_detachLooper(AInputQueue* queue);
817
 
 
818
 
/*
819
 
 * Returns true if there are one or more events available in the
820
 
 * input queue.  Returns 1 if the queue has events; 0 if
821
 
 * it does not have events; and a negative value if there is an error.
822
 
 */
823
 
int32_t AInputQueue_hasEvents(AInputQueue* queue);
824
 
 
825
 
/*
826
 
 * Returns the next available event from the queue.  Returns a negative
827
 
 * value if no events are available or an error has occurred.
828
 
 */
829
 
int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent);
830
 
 
831
 
/*
832
 
 * Sends the key for standard pre-dispatching -- that is, possibly deliver
833
 
 * it to the current IME to be consumed before the app.  Returns 0 if it
834
 
 * was not pre-dispatched, meaning you can process it right now.  If non-zero
835
 
 * is returned, you must abandon the current event processing and allow the
836
 
 * event to appear again in the event queue (if it does not get consumed during
837
 
 * pre-dispatching).
838
 
 */
839
 
int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event);
840
 
 
841
 
/*
842
 
 * Report that dispatching has finished with the given event.
843
 
 * This must be called after receiving an event with AInputQueue_get_event().
844
 
 */
845
 
void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled);
846
 
#endif
847
 
 
848
484
#ifdef __cplusplus
849
485
}
850
486
#endif