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.
This commit is contained in:
Po Lu 2023-07-16 20:10:18 +08:00
parent 64256d2923
commit 8335c76e88
3 changed files with 22 additions and 25 deletions

View file

@ -1086,26 +1086,6 @@ else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
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)

View file

@ -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]

View file

@ -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");