diff options
| author | Po Lu | 2023-07-12 09:45:58 +0800 |
|---|---|---|
| committer | Po Lu | 2023-07-12 09:45:58 +0800 |
| commit | c8c2bec5f8e4964f23345e1150a7ab85003e688b (patch) | |
| tree | 198fe374222ff1846d20e3f96275b44f85192d94 /java | |
| parent | fe7861f8088b481584b8122769121d2bfe26f643 (diff) | |
| download | emacs-c8c2bec5f8e4964f23345e1150a7ab85003e688b.tar.gz emacs-c8c2bec5f8e4964f23345e1150a7ab85003e688b.zip | |
Update Android port
* java/org/gnu/emacs/EmacsWindow.java (whatButtonWasIt): Handle
back and forward buttons along with styluses.
* src/doc.c (close_file_unwind_android_fd): New function.
(get_doc_string, Fsnarf_documentation): Don't create a temporary
fd if it can be avoided.
Diffstat (limited to 'java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsWindow.java | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java index 6816f3e8e71..5e45275631b 100644 --- a/java/org/gnu/emacs/EmacsWindow.java +++ b/java/org/gnu/emacs/EmacsWindow.java | |||
| @@ -700,29 +700,36 @@ public final class EmacsWindow extends EmacsHandleObject | |||
| 700 | 700 | ||
| 701 | Android does not conceptually distinguish between mouse events | 701 | Android does not conceptually distinguish between mouse events |
| 702 | (those coming from a device whose movement affects the on-screen | 702 | (those coming from a device whose movement affects the on-screen |
| 703 | pointer image) and touch screen events. When a touch, click, or | 703 | pointer image) and touch screen events. Each click or touch |
| 704 | pointer motion takes place, several kinds of event can be sent: | 704 | starts a single pointer gesture sequence, and subsequent motion |
| 705 | of the device will result in updates being reported relative to | ||
| 706 | that sequence until the mouse button or touch is released. | ||
| 707 | |||
| 708 | When a touch, click, or pointer motion takes place, several kinds | ||
| 709 | of event can be sent: | ||
| 705 | 710 | ||
| 706 | ACTION_DOWN or ACTION_POINTER_DOWN is sent with a new coordinate | 711 | ACTION_DOWN or ACTION_POINTER_DOWN is sent with a new coordinate |
| 707 | and an associated ``pointer ID'' identifying the event when a | 712 | and an associated ``pointer ID'' identifying the event and its |
| 708 | click or touch takes place. Emacs is responsible for recording | 713 | gesture sequence when a click or touch takes place. Emacs is |
| 709 | both the position of this click for the purpose of determining | 714 | responsible for recording both the position and pointer ID of |
| 710 | future changes to the position of that touch. | 715 | this click for the purpose of determining future changes to its |
| 716 | position. | ||
| 711 | 717 | ||
| 712 | ACTION_UP or ACTION_POINTER_UP is sent with a pointer ID when the | 718 | ACTION_UP or ACTION_POINTER_UP is sent with a pointer ID when the |
| 713 | click associated with a previous ACTION_DOWN event is released. | 719 | click associated with a previous ACTION_DOWN event is released. |
| 714 | 720 | ||
| 715 | ACTION_CANCEL (or ACTION_POINTER_UP with FLAG_CANCELED) is sent | 721 | ACTION_CANCEL (or ACTION_POINTER_UP with FLAG_CANCELED) is sent |
| 716 | if a similar situation transpires: the window system has chosen | 722 | if a similar situation transpires: the window system has chosen |
| 717 | to grab of the click, and future movement will no longer be | 723 | to grab the click, and future changes to its position will no |
| 718 | reported to Emacs. | 724 | longer be reported to Emacs. |
| 719 | 725 | ||
| 720 | ACTION_MOVE is sent if a coordinate tied to a click that has not | 726 | ACTION_MOVE is sent if a coordinate tied to a click that has not |
| 721 | been released changes. Emacs processes this event by comparing | 727 | been released changes. Emacs processes this event by comparing |
| 722 | each of the coordinates within the event with its recollection of | 728 | each of the coordinates within the event with its recollection of |
| 723 | those contained within prior ACTION_DOWN and ACTION_MOVE events; | 729 | those contained within prior ACTION_DOWN and ACTION_MOVE events; |
| 724 | the pointer ID of the difference is then reported within a touch | 730 | the pointer ID of the differing coordinate is then reported |
| 725 | or pointer motion event along with its new position. | 731 | within a touch or pointer motion event along with its new |
| 732 | position. | ||
| 726 | 733 | ||
| 727 | The events described above are all sent for both touch and mouse | 734 | The events described above are all sent for both touch and mouse |
| 728 | click events. Determining whether an ACTION_DOWN event is | 735 | click events. Determining whether an ACTION_DOWN event is |
| @@ -746,7 +753,12 @@ public final class EmacsWindow extends EmacsHandleObject | |||
| 746 | coordinate. | 753 | coordinate. |
| 747 | 754 | ||
| 748 | ACTION_HOVER_ENTER and ACTION_HOVER_LEAVE are respectively sent | 755 | ACTION_HOVER_ENTER and ACTION_HOVER_LEAVE are respectively sent |
| 749 | when the mouse pointer enters and leaves a frame. | 756 | when the mouse pointer enters and leaves a frame. Moreover, |
| 757 | ACTION_HOVER_LEAVE events are sent immediately before an | ||
| 758 | ACTION_DOWN event associated with a mouse click. These | ||
| 759 | extraneous events are distinct in that their button states always | ||
| 760 | contain an additional button compared to the button state | ||
| 761 | recorded at the time of the last ACTION_UP event. | ||
| 750 | 762 | ||
| 751 | On Android 6.0 and later, ACTION_BUTTON_PRESS is sent with the | 763 | On Android 6.0 and later, ACTION_BUTTON_PRESS is sent with the |
| 752 | coordinate of the mouse pointer if a mouse click occurs, | 764 | coordinate of the mouse pointer if a mouse click occurs, |
| @@ -789,8 +801,25 @@ public final class EmacsWindow extends EmacsHandleObject | |||
| 789 | if ((notIn & MotionEvent.BUTTON_TERTIARY) != 0) | 801 | if ((notIn & MotionEvent.BUTTON_TERTIARY) != 0) |
| 790 | return 2; | 802 | return 2; |
| 791 | 803 | ||
| 804 | /* Buttons 4, 5, 6 and 7 are actually scroll wheels under X. | ||
| 805 | Thus, report additional buttons starting at 8. */ | ||
| 806 | |||
| 807 | if ((notIn & MotionEvent.BUTTON_BACK) != 0) | ||
| 808 | return 8; | ||
| 809 | |||
| 810 | if ((notIn & MotionEvent.BUTTON_FORWARD) != 0) | ||
| 811 | return 9; | ||
| 812 | |||
| 813 | /* Report stylus events as touch screen events. */ | ||
| 814 | |||
| 815 | if ((notIn & MotionEvent.BUTTON_STYLUS_PRIMARY) != 0) | ||
| 816 | return 0; | ||
| 817 | |||
| 818 | if ((notIn & MotionEvent.BUTTON_STYLUS_SECONDARY) != 0) | ||
| 819 | return 0; | ||
| 820 | |||
| 792 | /* Not a real value. */ | 821 | /* Not a real value. */ |
| 793 | return 4; | 822 | return 11; |
| 794 | } | 823 | } |
| 795 | 824 | ||
| 796 | /* Return the mouse button associated with the specified ACTION_DOWN | 825 | /* Return the mouse button associated with the specified ACTION_DOWN |