diff options
| author | Po Lu | 2023-07-18 10:12:40 +0800 |
|---|---|---|
| committer | Po Lu | 2023-07-18 10:12:40 +0800 |
| commit | 5ff31bf36cf00f9d5a378ce139fd5c2ae8d3f25e (patch) | |
| tree | 5f1d6659da915840edcb12ed1931a8c379cedfce | |
| parent | 46fd03a49617066fca87000378771caedfd150f3 (diff) | |
| download | emacs-5ff31bf36cf00f9d5a378ce139fd5c2ae8d3f25e.tar.gz emacs-5ff31bf36cf00f9d5a378ce139fd5c2ae8d3f25e.zip | |
Update Android port
* doc/lispref/commands.texi (Touchscreen Events): Describe
treatment of canceled touch sequences during touch event
translation.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Update JNI
prototypes.
* java/org/gnu/emacs/EmacsWindow.java (motionEvent): Set
cancelation flag in events sent where appropriate.
* lisp/touch-screen.el (touch-screen-handle-point-update):
Improve treatment of horizontal scrolling near window edges.
(touch-screen-handle-touch): Don't handle point up if the touch
sequence has been canceled.
* src/android.c (sendTouchDown, sendTouchUp, sendTouchMove): New
argument `flags'.
* src/androidgui.h (enum android_touch_event_flags): New enum.
(struct android_touch_event): New field `flags'.
* src/androidterm.c (handle_one_android_event): Report
cancelation in TOUCHSCREEN_END_EVENTs.
* src/keyboard.c (make_lispy_event): Fix botched merge.
| -rw-r--r-- | doc/lispref/commands.texi | 23 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsNative.java | 9 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsWindow.java | 19 | ||||
| -rw-r--r-- | lisp/touch-screen.el | 27 | ||||
| -rw-r--r-- | src/android.c | 12 | ||||
| -rw-r--r-- | src/androidgui.h | 10 | ||||
| -rw-r--r-- | src/androidterm.c | 5 | ||||
| -rw-r--r-- | src/keyboard.c | 103 |
8 files changed, 152 insertions, 56 deletions
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index ffb01254fc9..55fecdce2d7 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi | |||
| @@ -2061,9 +2061,11 @@ keymaps that are active at the location of the | |||
| 2061 | of a single @code{down-mouse-1} event, with subsequent | 2061 | of a single @code{down-mouse-1} event, with subsequent |
| 2062 | @code{touchscreen-update} events translated to mouse motion events | 2062 | @code{touchscreen-update} events translated to mouse motion events |
| 2063 | (@pxref{Motion Events}), and a final @code{touchscreen-end} event | 2063 | (@pxref{Motion Events}), and a final @code{touchscreen-end} event |
| 2064 | translated to a @code{mouse-1} or @code{drag-mouse-1} event. This is | 2064 | translated to a @code{mouse-1} or @code{drag-mouse-1} event (unless |
| 2065 | referred to ``simple translation'', and produces a simple | 2065 | the @code{touchscreen-end} event indicates that the touch sequence has |
| 2066 | correspondence between touchpoint motion and mouse motion. | 2066 | been intercepted by another program.) This is referred to ``simple |
| 2067 | translation'', and produces a simple correspondence between touchpoint | ||
| 2068 | motion and mouse motion. | ||
| 2067 | 2069 | ||
| 2068 | @cindex @code{ignored-mouse-command}, a symbol property | 2070 | @cindex @code{ignored-mouse-command}, a symbol property |
| 2069 | However, some commands bound to | 2071 | However, some commands bound to |
| @@ -2078,13 +2080,14 @@ takes place: here, Emacs processes touch screen gestures | |||
| 2078 | (@pxref{Touchscreens,,, emacs, The GNU Emacs Manual}) first, and | 2080 | (@pxref{Touchscreens,,, emacs, The GNU Emacs Manual}) first, and |
| 2079 | finally attempts to translate touch screen events into mouse events if | 2081 | finally attempts to translate touch screen events into mouse events if |
| 2080 | no gesture was detected prior to a closing @code{touchscreen-end} | 2082 | no gesture was detected prior to a closing @code{touchscreen-end} |
| 2081 | event and a command is bound to @code{mouse-1} at the location of that | 2083 | event (with its @var{canceled} parameter @code{nil}, as with simple |
| 2082 | event. Before generating the @code{mouse-1} event, point is also set | 2084 | translation) and a command is bound to @code{mouse-1} at the location |
| 2083 | to the location of the @code{touchscreen-end} event, and the window | 2085 | of that event. Before generating the @code{mouse-1} event, point is |
| 2084 | containing the position of that event is selected, as a compromise for | 2086 | also set to the location of the @code{touchscreen-end} event, and the |
| 2085 | packages which assume @code{mouse-drag-region} has already set point | 2087 | window containing the position of that event is selected, as a |
| 2086 | to the location of any mouse click and selected the window where it | 2088 | compromise for packages which assume @code{mouse-drag-region} has |
| 2087 | took place. | 2089 | already set point to the location of any mouse click and selected the |
| 2090 | window where it took place. | ||
| 2088 | 2091 | ||
| 2089 | To prevent unwanted @code{mouse-1} events arriving after a mouse menu | 2092 | To prevent unwanted @code{mouse-1} events arriving after a mouse menu |
| 2090 | is dismissed (@pxref{Mouse Menus}), Emacs also avoids simple | 2093 | is dismissed (@pxref{Mouse Menus}), Emacs also avoids simple |
diff --git a/java/org/gnu/emacs/EmacsNative.java b/java/org/gnu/emacs/EmacsNative.java index 1331539879a..d4d502ede5a 100644 --- a/java/org/gnu/emacs/EmacsNative.java +++ b/java/org/gnu/emacs/EmacsNative.java | |||
| @@ -142,15 +142,18 @@ public final class EmacsNative | |||
| 142 | 142 | ||
| 143 | /* Send an ANDROID_TOUCH_DOWN event. */ | 143 | /* Send an ANDROID_TOUCH_DOWN event. */ |
| 144 | public static native long sendTouchDown (short window, int x, int y, | 144 | public static native long sendTouchDown (short window, int x, int y, |
| 145 | long time, int pointerID); | 145 | long time, int pointerID, |
| 146 | int flags); | ||
| 146 | 147 | ||
| 147 | /* Send an ANDROID_TOUCH_UP event. */ | 148 | /* Send an ANDROID_TOUCH_UP event. */ |
| 148 | public static native long sendTouchUp (short window, int x, int y, | 149 | public static native long sendTouchUp (short window, int x, int y, |
| 149 | long time, int pointerID); | 150 | long time, int pointerID, |
| 151 | int flags); | ||
| 150 | 152 | ||
| 151 | /* Send an ANDROID_TOUCH_MOVE event. */ | 153 | /* Send an ANDROID_TOUCH_MOVE event. */ |
| 152 | public static native long sendTouchMove (short window, int x, int y, | 154 | public static native long sendTouchMove (short window, int x, int y, |
| 153 | long time, int pointerID); | 155 | long time, int pointerID, |
| 156 | int flags); | ||
| 154 | 157 | ||
| 155 | /* Send an ANDROID_WHEEL event. */ | 158 | /* Send an ANDROID_WHEEL event. */ |
| 156 | public static native long sendWheel (short window, int x, int y, | 159 | public static native long sendWheel (short window, int x, int y, |
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java index 0e96a8382d0..8118479319e 100644 --- a/java/org/gnu/emacs/EmacsWindow.java +++ b/java/org/gnu/emacs/EmacsWindow.java | |||
| @@ -1025,23 +1025,30 @@ public final class EmacsWindow extends EmacsHandleObject | |||
| 1025 | /* Touch down event. */ | 1025 | /* Touch down event. */ |
| 1026 | EmacsNative.sendTouchDown (this.handle, coordinate.x, | 1026 | EmacsNative.sendTouchDown (this.handle, coordinate.x, |
| 1027 | coordinate.y, time, | 1027 | coordinate.y, time, |
| 1028 | coordinate.id); | 1028 | coordinate.id, 0); |
| 1029 | break; | 1029 | break; |
| 1030 | 1030 | ||
| 1031 | case MotionEvent.ACTION_UP: | 1031 | case MotionEvent.ACTION_UP: |
| 1032 | case MotionEvent.ACTION_POINTER_UP: | 1032 | case MotionEvent.ACTION_POINTER_UP: |
| 1033 | /* Touch up event. */ | ||
| 1034 | EmacsNative.sendTouchUp (this.handle, coordinate.x, | ||
| 1035 | coordinate.y, time, | ||
| 1036 | coordinate.id, 0); | ||
| 1037 | break; | ||
| 1038 | |||
| 1033 | case MotionEvent.ACTION_CANCEL: | 1039 | case MotionEvent.ACTION_CANCEL: |
| 1034 | /* Touch up event. Android documentation says ACTION_CANCEL | 1040 | /* Touch sequence cancellation event. */ |
| 1035 | should be treated as more or less equivalent to ACTION_UP, | ||
| 1036 | so that is what is done here. */ | ||
| 1037 | EmacsNative.sendTouchUp (this.handle, coordinate.x, | 1041 | EmacsNative.sendTouchUp (this.handle, coordinate.x, |
| 1038 | coordinate.y, time, coordinate.id); | 1042 | coordinate.y, time, |
| 1043 | coordinate.id, | ||
| 1044 | 1 /* ANDROID_TOUCH_SEQUENCE_CANCELED */); | ||
| 1039 | break; | 1045 | break; |
| 1040 | 1046 | ||
| 1041 | case MotionEvent.ACTION_MOVE: | 1047 | case MotionEvent.ACTION_MOVE: |
| 1042 | /* Pointer motion event. */ | 1048 | /* Pointer motion event. */ |
| 1043 | EmacsNative.sendTouchMove (this.handle, coordinate.x, | 1049 | EmacsNative.sendTouchMove (this.handle, coordinate.x, |
| 1044 | coordinate.y, time, coordinate.id); | 1050 | coordinate.y, time, |
| 1051 | coordinate.id, 0); | ||
| 1045 | break; | 1052 | break; |
| 1046 | } | 1053 | } |
| 1047 | } | 1054 | } |
diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index 1ef66d0043f..8f10bc3e794 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el | |||
| @@ -548,11 +548,26 @@ then move point to the position of POINT." | |||
| 548 | ;; WINDOW. | 548 | ;; WINDOW. |
| 549 | (relative-xy | 549 | (relative-xy |
| 550 | (touch-screen-relative-xy posn window)) | 550 | (touch-screen-relative-xy posn window)) |
| 551 | (col (and (eq (posn-area posn) 'text-area) | ||
| 552 | (car (posn-col-row posn | ||
| 553 | (posn-window posn))))) | ||
| 554 | ;; Don't start horizontal scrolling if the touch | ||
| 555 | ;; point originated within two columns of the window | ||
| 556 | ;; edges, as systems like Android use those two | ||
| 557 | ;; columns to implement gesture navigation. | ||
| 558 | (diff-x-eligible | ||
| 559 | (and col (> (car col) 2) | ||
| 560 | (< (car col) (- (window-width window) 2)))) | ||
| 551 | (diff-x (- (car last-posn) (car relative-xy))) | 561 | (diff-x (- (car last-posn) (car relative-xy))) |
| 552 | (diff-y (- (cdr last-posn) (cdr relative-xy)))) | 562 | (diff-y (- (cdr last-posn) (cdr relative-xy)))) |
| 553 | ;; Decide whether or not to start scrolling. | 563 | ;; Decide whether or not to start scrolling. Make the |
| 554 | (when (or (> diff-y 10) (> diff-x 10) | 564 | ;; hscrolling threshold slightly larger than the vertical |
| 555 | (< diff-y -10) (< diff-x -10)) | 565 | ;; scrolling threshold, to compensate better for |
| 566 | ;; Android-style gesture navigation. | ||
| 567 | (when (or (> diff-y 10) (and diff-x-eligible | ||
| 568 | (> diff-x 20)) | ||
| 569 | (< diff-y -10) (and diff-x-eligible | ||
| 570 | (< diff-x -20))) | ||
| 556 | (setcar (nthcdr 3 touch-screen-current-tool) | 571 | (setcar (nthcdr 3 touch-screen-current-tool) |
| 557 | 'scroll) | 572 | 'scroll) |
| 558 | (setcar (nthcdr 2 touch-screen-current-tool) | 573 | (setcar (nthcdr 2 touch-screen-current-tool) |
| @@ -852,7 +867,11 @@ the place of EVENT within the key sequence being translated, or | |||
| 852 | (cancel-timer touch-screen-current-timer) | 867 | (cancel-timer touch-screen-current-timer) |
| 853 | (setq touch-screen-current-timer nil)) | 868 | (setq touch-screen-current-timer nil)) |
| 854 | (unwind-protect | 869 | (unwind-protect |
| 855 | (touch-screen-handle-point-up (cadr event) prefix) | 870 | ;; Don't perform any actions associated with releasing the |
| 871 | ;; tool if the touch sequence was intercepted by another | ||
| 872 | ;; program. | ||
| 873 | (unless (caddr event) | ||
| 874 | (touch-screen-handle-point-up (cadr event) prefix)) | ||
| 856 | ;; Make sure the tool list is cleared even if | 875 | ;; Make sure the tool list is cleared even if |
| 857 | ;; `touch-screen-handle-point-up' throws. | 876 | ;; `touch-screen-handle-point-up' throws. |
| 858 | (setq touch-screen-current-tool nil))) | 877 | (setq touch-screen-current-tool nil))) |
diff --git a/src/android.c b/src/android.c index 90288737c77..f2e5e75d35e 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -2870,7 +2870,8 @@ NATIVE_NAME (sendButtonRelease) (JNIEnv *env, jobject object, | |||
| 2870 | JNIEXPORT jlong JNICALL | 2870 | JNIEXPORT jlong JNICALL |
| 2871 | NATIVE_NAME (sendTouchDown) (JNIEnv *env, jobject object, | 2871 | NATIVE_NAME (sendTouchDown) (JNIEnv *env, jobject object, |
| 2872 | jshort window, jint x, jint y, | 2872 | jshort window, jint x, jint y, |
| 2873 | jlong time, jint pointer_id) | 2873 | jlong time, jint pointer_id, |
| 2874 | jint flags) | ||
| 2874 | { | 2875 | { |
| 2875 | JNI_STACK_ALIGNMENT_PROLOGUE; | 2876 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 2876 | 2877 | ||
| @@ -2883,6 +2884,7 @@ NATIVE_NAME (sendTouchDown) (JNIEnv *env, jobject object, | |||
| 2883 | event.touch.y = y; | 2884 | event.touch.y = y; |
| 2884 | event.touch.time = time; | 2885 | event.touch.time = time; |
| 2885 | event.touch.pointer_id = pointer_id; | 2886 | event.touch.pointer_id = pointer_id; |
| 2887 | event.touch.flags = flags; | ||
| 2886 | 2888 | ||
| 2887 | android_write_event (&event); | 2889 | android_write_event (&event); |
| 2888 | return event_serial; | 2890 | return event_serial; |
| @@ -2891,7 +2893,8 @@ NATIVE_NAME (sendTouchDown) (JNIEnv *env, jobject object, | |||
| 2891 | JNIEXPORT jlong JNICALL | 2893 | JNIEXPORT jlong JNICALL |
| 2892 | NATIVE_NAME (sendTouchUp) (JNIEnv *env, jobject object, | 2894 | NATIVE_NAME (sendTouchUp) (JNIEnv *env, jobject object, |
| 2893 | jshort window, jint x, jint y, | 2895 | jshort window, jint x, jint y, |
| 2894 | jlong time, jint pointer_id) | 2896 | jlong time, jint pointer_id, |
| 2897 | jint flags) | ||
| 2895 | { | 2898 | { |
| 2896 | JNI_STACK_ALIGNMENT_PROLOGUE; | 2899 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 2897 | 2900 | ||
| @@ -2904,6 +2907,7 @@ NATIVE_NAME (sendTouchUp) (JNIEnv *env, jobject object, | |||
| 2904 | event.touch.y = y; | 2907 | event.touch.y = y; |
| 2905 | event.touch.time = time; | 2908 | event.touch.time = time; |
| 2906 | event.touch.pointer_id = pointer_id; | 2909 | event.touch.pointer_id = pointer_id; |
| 2910 | event.touch.flags = flags; | ||
| 2907 | 2911 | ||
| 2908 | android_write_event (&event); | 2912 | android_write_event (&event); |
| 2909 | return event_serial; | 2913 | return event_serial; |
| @@ -2912,7 +2916,8 @@ NATIVE_NAME (sendTouchUp) (JNIEnv *env, jobject object, | |||
| 2912 | JNIEXPORT jlong JNICALL | 2916 | JNIEXPORT jlong JNICALL |
| 2913 | NATIVE_NAME (sendTouchMove) (JNIEnv *env, jobject object, | 2917 | NATIVE_NAME (sendTouchMove) (JNIEnv *env, jobject object, |
| 2914 | jshort window, jint x, jint y, | 2918 | jshort window, jint x, jint y, |
| 2915 | jlong time, jint pointer_id) | 2919 | jlong time, jint pointer_id, |
| 2920 | jint flags) | ||
| 2916 | { | 2921 | { |
| 2917 | JNI_STACK_ALIGNMENT_PROLOGUE; | 2922 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 2918 | 2923 | ||
| @@ -2925,6 +2930,7 @@ NATIVE_NAME (sendTouchMove) (JNIEnv *env, jobject object, | |||
| 2925 | event.touch.y = y; | 2930 | event.touch.y = y; |
| 2926 | event.touch.time = time; | 2931 | event.touch.time = time; |
| 2927 | event.touch.pointer_id = pointer_id; | 2932 | event.touch.pointer_id = pointer_id; |
| 2933 | event.touch.flags = flags; | ||
| 2928 | 2934 | ||
| 2929 | android_write_event (&event); | 2935 | android_write_event (&event); |
| 2930 | return event_serial; | 2936 | return event_serial; |
diff --git a/src/androidgui.h b/src/androidgui.h index 9e604cdcb8c..265ec29b678 100644 --- a/src/androidgui.h +++ b/src/androidgui.h | |||
| @@ -365,6 +365,13 @@ struct android_expose_event | |||
| 365 | int width, height; | 365 | int width, height; |
| 366 | }; | 366 | }; |
| 367 | 367 | ||
| 368 | enum android_touch_event_flags | ||
| 369 | { | ||
| 370 | /* This touch sequence has been intercepted by the WM (probably | ||
| 371 | for back gesture navigation or some such.) */ | ||
| 372 | ANDROID_TOUCH_SEQUENCE_CANCELED = 1, | ||
| 373 | }; | ||
| 374 | |||
| 368 | struct android_touch_event | 375 | struct android_touch_event |
| 369 | { | 376 | { |
| 370 | /* Type of the event. */ | 377 | /* Type of the event. */ |
| @@ -384,6 +391,9 @@ struct android_touch_event | |||
| 384 | 391 | ||
| 385 | /* Index of the pointer being tracked. */ | 392 | /* Index of the pointer being tracked. */ |
| 386 | unsigned int pointer_id; | 393 | unsigned int pointer_id; |
| 394 | |||
| 395 | /* Flags associated with this event. */ | ||
| 396 | int flags; | ||
| 387 | }; | 397 | }; |
| 388 | 398 | ||
| 389 | struct android_wheel_event | 399 | struct android_wheel_event |
diff --git a/src/androidterm.c b/src/androidterm.c index 27800a61864..bcb6cd6db45 100644 --- a/src/androidterm.c +++ b/src/androidterm.c | |||
| @@ -1511,6 +1511,11 @@ handle_one_android_event (struct android_display_info *dpyinfo, | |||
| 1511 | inev.ie.kind = TOUCHSCREEN_END_EVENT; | 1511 | inev.ie.kind = TOUCHSCREEN_END_EVENT; |
| 1512 | inev.ie.timestamp = event->touch.time; | 1512 | inev.ie.timestamp = event->touch.time; |
| 1513 | 1513 | ||
| 1514 | /* Report whether the sequence has been canceled. */ | ||
| 1515 | |||
| 1516 | if (event->touch.flags & ANDROID_TOUCH_SEQUENCE_CANCELED) | ||
| 1517 | inev.ie.modifiers = 1; | ||
| 1518 | |||
| 1514 | XSETFRAME (inev.ie.frame_or_window, any); | 1519 | XSETFRAME (inev.ie.frame_or_window, any); |
| 1515 | XSETINT (inev.ie.x, event->touch.x); | 1520 | XSETINT (inev.ie.x, event->touch.x); |
| 1516 | XSETINT (inev.ie.y, event->touch.y); | 1521 | XSETINT (inev.ie.y, event->touch.y); |
diff --git a/src/keyboard.c b/src/keyboard.c index bd7433e584a..73c4e3f2593 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -6560,11 +6560,10 @@ make_lispy_event (struct input_event *event) | |||
| 6560 | { | 6560 | { |
| 6561 | Lisp_Object x, y, id, position; | 6561 | Lisp_Object x, y, id, position; |
| 6562 | struct frame *f; | 6562 | struct frame *f; |
| 6563 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 6563 | int tab_bar_item; | 6564 | int tab_bar_item; |
| 6564 | bool close; | 6565 | bool close; |
| 6565 | #if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR | 6566 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 6566 | int column, row, dummy; | ||
| 6567 | #endif /* defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR */ | ||
| 6568 | 6567 | ||
| 6569 | f = XFRAME (event->frame_or_window); | 6568 | f = XFRAME (event->frame_or_window); |
| 6570 | id = event->arg; | 6569 | id = event->arg; |
| @@ -6572,16 +6571,82 @@ make_lispy_event (struct input_event *event) | |||
| 6572 | y = event->y; | 6571 | y = event->y; |
| 6573 | 6572 | ||
| 6574 | #if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR | 6573 | #if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR |
| 6575 | if (event->kind == TOUCHSCREEN_BEGIN_EVENT | 6574 | if (coords_in_menu_bar_window (f, XFIXNUM (x), XFIXNUM (y))) |
| 6576 | && coords_in_menu_bar_window (f, XFIXNUM (x), XFIXNUM (y))) | ||
| 6577 | { | 6575 | { |
| 6578 | /* If the tap began in the menu bar window, then save the | 6576 | /* If the tap began in the menu bar window, then save the |
| 6579 | id. */ | 6577 | id. */ |
| 6580 | menu_bar_touch_id = id; | 6578 | menu_bar_touch_id = id; |
| 6581 | return Qnil; | 6579 | return Qnil; |
| 6582 | } | 6580 | } |
| 6583 | else if (event->kind == TOUCHSCREEN_END_EVENT | 6581 | #endif /* defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR */ |
| 6584 | && EQ (menu_bar_touch_id, id)) | 6582 | |
| 6583 | position = make_lispy_position (f, x, y, event->timestamp); | ||
| 6584 | |||
| 6585 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 6586 | |||
| 6587 | /* Now check if POSITION lies on the tab bar. If so, look up | ||
| 6588 | the corresponding tab bar item's propertized string as the | ||
| 6589 | OBJECT. */ | ||
| 6590 | |||
| 6591 | if (coords_in_tab_bar_window (f, XFIXNUM (event->x), | ||
| 6592 | XFIXNUM (event->y)) | ||
| 6593 | /* `get_tab_bar_item_kbd' returns 0 if the item was | ||
| 6594 | previously highlighted, 1 otherwise, and -1 if there is | ||
| 6595 | no tab bar item. */ | ||
| 6596 | && get_tab_bar_item_kbd (f, XFIXNUM (event->x), | ||
| 6597 | XFIXNUM (event->y), &tab_bar_item, | ||
| 6598 | &close) >= 0) | ||
| 6599 | { | ||
| 6600 | /* First, obtain the propertized string. */ | ||
| 6601 | x = Fcopy_sequence (AREF (f->tab_bar_items, | ||
| 6602 | (tab_bar_item | ||
| 6603 | + TAB_BAR_ITEM_CAPTION))); | ||
| 6604 | |||
| 6605 | /* Next, add the key binding. */ | ||
| 6606 | AUTO_LIST2 (y, Qmenu_item, list3 (AREF (f->tab_bar_items, | ||
| 6607 | (tab_bar_item | ||
| 6608 | + TAB_BAR_ITEM_KEY)), | ||
| 6609 | AREF (f->tab_bar_items, | ||
| 6610 | (tab_bar_item | ||
| 6611 | + TAB_BAR_ITEM_BINDING)), | ||
| 6612 | close ? Qt : Qnil)); | ||
| 6613 | |||
| 6614 | /* And add the new properties to the propertized string. */ | ||
| 6615 | Fadd_text_properties (make_fixnum (0), | ||
| 6616 | make_fixnum (SCHARS (x)), | ||
| 6617 | y, x); | ||
| 6618 | |||
| 6619 | /* Set the position to 0. */ | ||
| 6620 | x = Fcons (x, make_fixnum (0)); | ||
| 6621 | |||
| 6622 | /* Finally, add the OBJECT. */ | ||
| 6623 | position = nconc2 (position, Fcons (x, Qnil)); | ||
| 6624 | } | ||
| 6625 | |||
| 6626 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 6627 | |||
| 6628 | return list2 (Qtouchscreen_begin, | ||
| 6629 | Fcons (id, position)); | ||
| 6630 | } | ||
| 6631 | |||
| 6632 | case TOUCHSCREEN_END_EVENT: | ||
| 6633 | { | ||
| 6634 | Lisp_Object x, y, id, position; | ||
| 6635 | struct frame *f = XFRAME (event->frame_or_window); | ||
| 6636 | #if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR | ||
| 6637 | int column, row, dummy; | ||
| 6638 | #endif /* defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR */ | ||
| 6639 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 6640 | int tab_bar_item; | ||
| 6641 | bool close; | ||
| 6642 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 6643 | |||
| 6644 | id = event->arg; | ||
| 6645 | x = event->x; | ||
| 6646 | y = event->y; | ||
| 6647 | |||
| 6648 | #if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR | ||
| 6649 | if (EQ (menu_bar_touch_id, id)) | ||
| 6585 | { | 6650 | { |
| 6586 | /* This touch should activate the menu bar. Generate the | 6651 | /* This touch should activate the menu bar. Generate the |
| 6587 | menu bar event. */ | 6652 | menu bar event. */ |
| @@ -6631,8 +6696,6 @@ make_lispy_event (struct input_event *event) | |||
| 6631 | } | 6696 | } |
| 6632 | #endif /* defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR */ | 6697 | #endif /* defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR */ |
| 6633 | 6698 | ||
| 6634 | position = make_lispy_position (f, x, y, event->timestamp); | ||
| 6635 | |||
| 6636 | #ifdef HAVE_WINDOW_SYSTEM | 6699 | #ifdef HAVE_WINDOW_SYSTEM |
| 6637 | 6700 | ||
| 6638 | /* Now check if POSITION lies on the tab bar. If so, look up | 6701 | /* Now check if POSITION lies on the tab bar. If so, look up |
| @@ -6676,29 +6739,9 @@ make_lispy_event (struct input_event *event) | |||
| 6676 | 6739 | ||
| 6677 | #endif /* HAVE_WINDOW_SYSTEM */ | 6740 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 6678 | 6741 | ||
| 6679 | return list2 (((event->kind | ||
| 6680 | == TOUCHSCREEN_BEGIN_EVENT) | ||
| 6681 | ? Qtouchscreen_begin | ||
| 6682 | : Qtouchscreen_end), | ||
| 6683 | Fcons (id, position)); | ||
| 6684 | } | ||
| 6685 | |||
| 6686 | case TOUCHSCREEN_END_EVENT: | ||
| 6687 | { | ||
| 6688 | Lisp_Object x, y, id, position; | ||
| 6689 | struct frame *f = XFRAME (event->frame_or_window); | ||
| 6690 | |||
| 6691 | id = event->arg; | ||
| 6692 | x = event->x; | ||
| 6693 | y = event->y; | ||
| 6694 | |||
| 6695 | position = make_lispy_position (f, x, y, event->timestamp); | 6742 | position = make_lispy_position (f, x, y, event->timestamp); |
| 6696 | 6743 | ||
| 6697 | return list3 (((event->kind | 6744 | return list3 (Qtouchscreen_end, Fcons (id, position), |
| 6698 | == TOUCHSCREEN_BEGIN_EVENT) | ||
| 6699 | ? Qtouchscreen_begin | ||
| 6700 | : Qtouchscreen_end), | ||
| 6701 | Fcons (id, position), | ||
| 6702 | event->modifiers ? Qt : Qnil); | 6745 | event->modifiers ? Qt : Qnil); |
| 6703 | } | 6746 | } |
| 6704 | 6747 | ||