From 4509cda5c943964fc8a2983fd90f10b9c255f97a Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 17 Aug 2023 08:45:57 +0800 Subject: [PATCH] Update Android port * configure.ac (emacs_cv_tputs_lib): Only circumvent termcap if Android windowing support is enabled. (bug#65340) * etc/PROBLEMS: Fix typo in section recouting problems with the Anonymous Pro font. * lisp/subr.el (event-start, event-end): Return the mouse position list tied to touchscreen-begin and end events. Reported by Stefan Monnier . * lisp/version.el (emacs-build-system, emacs-build-time) (emacs-repository-get-version, emacs-repository-get-branch): Bypass Android specific code on non-GUI builds running on Android. (bug#65340) * lisp/wid-edit.el (widget-event-point): Remove now redundant code. --- configure.ac | 2 +- etc/PROBLEMS | 2 +- lisp/subr.el | 40 +++++++++++++++++++++++----------------- lisp/version.el | 16 ++++++++++++---- lisp/wid-edit.el | 6 ++---- 5 files changed, 39 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index 8120935978d..4cf6751ab82 100644 --- a/configure.ac +++ b/configure.ac @@ -5992,7 +5992,7 @@ AC_DEFUN([tputs_link_source], [ # than to expect to find it in ncurses. # Also we need tputs and friends to be able to build at all. AC_CACHE_CHECK([for library containing tputs], [emacs_cv_tputs_lib], -[if test "${opsys}" = "mingw32" || test "$opsys" = "android"; then +[if test "${opsys}" = "mingw32" || test x"$REALLY_ANDROID" = "xyes"; then emacs_cv_tputs_lib='none required' else # curses precedes termcap because of AIX (Bug#9736#35) and OpenIndiana. diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 6a4c8cdb34c..6fe0b93f538 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -3400,7 +3400,7 @@ results that are easier to read. ** The "Anonymous Pro" font displays incorrectly. -Glyphs instruction code within the Anonymous Pro font relies on +Glyph instruction code within the Anonymous Pro font relies on undocumented features of the Microsoft TrueType font scaler, namely that the scaler always resets the "projection" and "freedom" vector interpreter control registers after the execution of the font diff --git a/lisp/subr.el b/lisp/subr.el index 616f0a8dfb6..f6bf7988e9d 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1651,8 +1651,9 @@ in the current Emacs session, then this function may return nil." (defun event-start (event) "Return the starting position of EVENT. -EVENT should be a mouse click, drag, or key press event. If -EVENT is nil, the value of `posn-at-point' is used instead. +EVENT should be a mouse click, drag, touch screen, or key press +event. If EVENT is nil, the value of `posn-at-point' is used +instead. The following accessor functions are used to access the elements of the position: @@ -1675,27 +1676,32 @@ nil or (STRING . POSITION)'. For more information, see Info node `(elisp)Click Events'." (declare (side-effect-free t)) - (or (and (consp event) - ;; Ignore touchscreen events. They store the posn in a - ;; different format, and can have multiple posns. - (not (memq (car event) '(touchscreen-begin - touchscreen-update - touchscreen-end))) - (nth 1 event)) - (event--posn-at-point))) + (if (or (eq (car event) 'touchscreen-begin) + (eq (car event) 'touchscreen-end)) + ;; Touch screen begin and end events save their information in a + ;; different format, where the mouse position list is the cdr of + ;; (nth 1 event). + (cdadr event) + (or (and (consp event) + ;; Ignore touchscreen update events. They store the posn + ;; in a different format, and can have multiple posns. + (not (eq (car event) 'touchscreen-update)) + (nth 1 event)) + (event--posn-at-point)))) (defun event-end (event) "Return the ending position of EVENT. -EVENT should be a click, drag, or key press event. +EVENT should be a click, drag, touch screen, or key press event. See `event-start' for a description of the value returned." (declare (side-effect-free t)) - (or (and (consp event) - (not (memq (car event) '(touchscreen-begin - touchscreen-update - touchscreen-end))) - (nth (if (consp (nth 2 event)) 2 1) event)) - (event--posn-at-point))) + (if (or (eq (car event) 'touchscreen-begin) + (eq (car event) 'touchscreen-end)) + (cdadr event) + (or (and (consp event) + (not (eq (car event) 'touchscreen-update)) + (nth (if (consp (nth 2 event)) 2 1) event)) + (event--posn-at-point)))) (defsubst event-click-count (event) "Return the multi-click count of EVENT, a click or drag event. diff --git a/lisp/version.el b/lisp/version.el index ca61f8cfeee..0eb4ea76f4f 100644 --- a/lisp/version.el +++ b/lisp/version.el @@ -61,13 +61,19 @@ returned by `current-time'." (string-to-number (match-string 1 emacs-version))) "Minor version number of this version of Emacs.") -(defconst emacs-build-system (or (and (eq system-type 'android) +;; N.B. (featurep 'android) is tested for in addition to +;; `system-type', because that can also be Android on a TTY-only +;; Android build that doesn't employ the window system packaging +;; support. (bug#65319) +(defconst emacs-build-system (or (and (featurep 'android) + (eq system-type 'android) (android-read-build-system)) (system-name)) "Name of the system on which Emacs was built, or nil if not available.") (defconst emacs-build-time (if emacs-build-system - (or (and (eq system-type 'android) + (or (and (featurep 'android) + (eq system-type 'android) (android-read-build-time)) (current-time))) "Time at which Emacs was dumped out, or nil if not available.") @@ -183,7 +189,8 @@ correspond to the running Emacs. Optional argument DIR is a directory to use instead of `source-directory'. Optional argument EXTERNAL is ignored." - (cond ((eq system-type 'android) + (cond ((and (featurep 'android) + (eq system-type 'android)) (emacs-repository-version-android)) (t (emacs-repository-version-git (or dir source-directory))))) @@ -229,7 +236,8 @@ this reports on the current state of the sources, which may not correspond to the running Emacs. Optional argument DIR is a directory to use instead of `source-directory'." - (cond ((eq system-type 'android) + (cond ((and (featurep 'android) + (eq system-type 'android)) (emacs-repository-branch-android)) (t (emacs-repository-branch-git (or dir source-directory))))) diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 9e7c31224e0..fabf590f6b8 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -64,12 +64,10 @@ ;;; Compatibility. -(defun widget-event-point (event) +(defsubst widget-event-point (event) "Character position of the end of event if that exists, or nil. EVENT can either be a mouse event or a touch screen event." - (if (eq (car-safe event) 'touchscreen-begin) - (posn-point (cdadr event)) - (posn-point (event-end event)))) + (posn-point (event-end event))) (defun widget-button-release-event-p (event) "Non-nil if EVENT is a mouse-button-release event object." -- 2.39.2