From: Po Lu Date: Sun, 16 Jul 2023 12:10:18 +0000 (+0800) Subject: Update Android port X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8335c76e88ec9aa44963a3261ce0ab0eb0555a29;p=emacs.git Update Android port * java/org/gnu/emacs/EmacsService.java (displayToast): * src/android.c (android_init_emacs_service): Remove unused function. * lisp/touch-screen.el (touch-screen-handle-point-up): Correctly compute posn point. (touch-screen-translate-touch): Update doc string. (function-key-map): Define touch screen translation functions within the internal border. --- diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java index 22649167f8a..6240b0e475a 100644 --- a/java/org/gnu/emacs/EmacsService.java +++ b/java/org/gnu/emacs/EmacsService.java @@ -1086,26 +1086,6 @@ public final class EmacsService extends Service temp, }; } - /* Display the specified STRING in a small dialog box on the main - thread. */ - - public void - displayToast (final String string) - { - runOnUiThread (new Runnable () { - @Override - public void - run () - { - Toast toast; - - toast = Toast.makeText (getApplicationContext (), - string, Toast.LENGTH_SHORT); - toast.show (); - } - }); - } - public void updateExtractedText (EmacsWindow window, ExtractedText text, int token) diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index ef9b14f27ce..68a7e213cdb 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el @@ -25,6 +25,9 @@ ;; This file provides code to recognize simple touch screen gestures. ;; It is used on X and Android, where the platform cannot recognize ;; them for us. +;; +;; See (elisp)Touchscreen Events for a description of the details of touch +;; events. ;;; Code: @@ -468,7 +471,7 @@ is not read-only." (posn (cdr point)) window point) (cond ((null what) (when (windowp (posn-window posn)) - (setq point (posn-point point) + (setq point (posn-point posn) window (posn-window posn)) ;; Select the window that was tapped. (select-window window) @@ -670,12 +673,18 @@ returned may contain any one of the following events: where WINDOW specifies a window to scroll, and DX and DY are integers describing how many pixels to be scrolled horizontally -and vertically. +and vertically, + + (touchscreen-hold POSN) + (touchscreen-drag POSN) + +where POSN is the position of the long-press or touchpoint +motion, (down-mouse-1 POSN) (drag-mouse-1 POSN) -where POSN is the position of the mouse button press or click. +where POSN is the position of the mouse button press or click, (mouse-1 POSN) (mouse-2 POSN) @@ -744,6 +753,16 @@ if POSN is on a link or a button, or `mouse-1' otherwise." (define-key function-key-map [mode-line touchscreen-end] #'touch-screen-translate-touch) +;; These are used to translate events sent from the internal border +;; or from outside the frame. + +(define-key function-key-map [nil touchscreen-begin] + #'touch-screen-translate-touch) +(define-key function-key-map [nil touchscreen-update] + #'touch-screen-translate-touch) +(define-key function-key-map [nil touchscreen-end] + #'touch-screen-translate-touch) + (define-key function-key-map [header-line touchscreen-begin] #'touch-screen-translate-touch) (define-key function-key-map [header-line touchscreen-update] diff --git a/src/android.c b/src/android.c index acc49219b35..90288737c77 100644 --- a/src/android.c +++ b/src/android.c @@ -2330,8 +2330,6 @@ android_init_emacs_service (void) FIND_METHOD (check_content_uri, "checkContentUri", "([BZZ)Z"); FIND_METHOD (query_battery, "queryBattery", "()[J"); - FIND_METHOD (display_toast, "displayToast", - "(Ljava/lang/String;)V"); FIND_METHOD (update_extracted_text, "updateExtractedText", "(Lorg/gnu/emacs/EmacsWindow;" "Landroid/view/inputmethod/ExtractedText;I)V");