From: Po Lu Date: Wed, 31 May 2023 05:47:08 +0000 (+0800) Subject: Update Android port X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=69c4bbc0d694594f43b02e9da5c236f3b9271b1d;p=emacs.git Update Android port * doc/emacs/input.texi (Other Input Devices, Touchscreens) (On-Screen Keyboards): * doc/lispref/commands.texi (Misc Events): * src/android.c (android_faccessat): Improve word choices and commentary. * lisp/touch-screen.el (touch-screen-handle-scroll): Make precision scrolling work better with horizontal movement. --- diff --git a/doc/emacs/input.texi b/doc/emacs/input.texi index 96743349a1c..0df3162ce97 100644 --- a/doc/emacs/input.texi +++ b/doc/emacs/input.texi @@ -5,14 +5,14 @@ @appendix Emacs and unconventional input devices @cindex other input devices - Emacs was originally developed with the assumption that users will -be sitting in front of a desktop computer, with a keyboard and perhaps -a suitable pointing device such as a mouse. + Emacs was originally developed with the assumption that its users +have access to a desktop computer or computer terminal, with a +keyboard and perhaps a suitable pointing device such as a mouse. - However, recent developments in the X Window System, and in other -operating systems such as Android, mean that this assumption no longer -holds true. As a result, Emacs now has support for other kinds of -input devices, which is detailed here. + However, recent developments in the X Window System and operating +systems such as Android mean that this assumption no longer holds +true. Emacs supports input from various other kinds of input devices, +which is detailed here. @menu * Touchscreens:: Using Emacs on touchscreens. @@ -23,21 +23,21 @@ input devices, which is detailed here. @section Using Emacs on touchscreens @cindex touchscreens - Touchscreen input works by having the user press tools onto the -screen, which can be his own fingers, or a pointing device such as a -stylus, in order to manipulate the contents there in. + Touchscreen input works by pressing and moving tools (which include +fingers and some pointing devices--styluses, for example) onto a frame +in order to manipulate its contents. When running under the X Window System or Android, Emacs -automatically detects and maps the following touchscreen gestures to -common actions: +automatically detects and maps the following sequences of movements +(``gestures'') to common actions: @itemize @bullet @item @cindex tapping, touchscreens - ``Tapping'', meaning to briefly place and lift a tool from the -display, will result in Emacs selecting the window that was tapped, -and executing any command bound to @code{mouse-1} at that location in -the window. If the tap happened on top of a link (@pxref{Mouse + ``Tapping'', briefly placing and lifting a tool from the display, +will result in Emacs selecting the window that was tapped, and +executing any command bound to @code{mouse-1} at that location in the +window. If the tap happened on top of a link (@pxref{Mouse References}), then Emacs will follow the link instead. @item @@ -52,12 +52,11 @@ window horizontally to follow (@pxref{Horizontal Scrolling}.) @item @cindex dragging, touchscreens @cindex long-press, touchscreens - ``Dragging'', meaning to perform a @dfn{long-press} (placing a tool -on the display and leaving it there for a while) before moving the -tool around, will make Emacs set the point to where the tool was and -begin selecting text under the tool as it moves around, much like what -would happen if @code{mouse-1} were to be held down. @xref{Mouse -Commands}. + ``Dragging'', which is performing a @dfn{long-press} by placing a +tool on the display and leaving it there for a while prior to moving +the tool around will make Emacs set the point to where the tool was +and begin selecting text under the tool as it moves around, as if +@code{mouse-1} were to be held down. @xref{Mouse Commands}. @end itemize @vindex touch-screen-delay @@ -99,9 +98,9 @@ that the user is about to enter text in to the current buffer. @vindex touch-screen-display-keyboard The user option @code{touch-screen-display-keyboard} forces Emacs to -always display the on screen keyboard; it may also be bound buffer -locally, meaning to always display the keyboard when the buffer is -selected. +always display the on screen keyboard; it may also be set buffer +locally, which means that Emacs should always display the keyboard +when the buffer is selected. Emacs also provides a set of functions to show or hide the on-screen keyboard. For more details, @pxref{On-Screen Keyboards,,, elisp, The @@ -109,15 +108,15 @@ Emacs Lisp Reference Manual}. @cindex quitting, without a keyboard Since it may not be possible for Emacs to display the on screen -keyboard when it is executing a command, Emacs implements a feature on -devices with only an on-screen keyboard, by which two rapid clicks of -a hardware button that is always present on the device results in +keyboard while it is executing a command, Emacs implements a feature +on devices with only an on-screen keyboard, by which two rapid clicks +of a hardware button that is always present on the device results in Emacs quitting. @xref{Quitting}. @vindex x-quit-keysym - The exact button is used to do this varies by system: on X, it is -defined in the variable @code{x-quit-keysym}, and on Android, it is -always the volume down button. + Which button is used to do this depends on the window system in use: +on X, it is defined in the variable @code{x-quit-keysym}, and on +Android, it is always the volume down button. @cindex text conversion, keyboards Most input methods designed to work with on-screen keyboards perform diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 783ab583ec4..edeea9ab27c 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -2212,13 +2212,11 @@ This kind of event is sent @strong{after} a system-wide input method performs an edit to one or more buffers. @vindex text-conversion-edits -Once the event is sent, the input method may already have made -changes to multiple buffers inside many different frames. To -determine which buffers have been changed, and what edits have -been made to them, use the variable -@code{text-conversion-edits}, which is set prior to each -@code{text-conversion} event being sent; it is a list of the -form: +Once the event is sent, the input method may already have made changes +to multiple buffers inside many different frames. To determine which +buffers have been changed, and what edits have been made to them, use +the variable @code{text-conversion-edits}, which is set prior to each +@code{text-conversion} event being sent; it is a list of the form: @example @w{@code{((@var{buffer} @var{beg} @var{end} @var{ephemeral}) ...)}} @@ -2227,10 +2225,9 @@ form: Where @var{ephemeral} is the buffer which was modified, @var{beg} and @var{end} are markers set to the positions of the edit at the time it was completed, and @var{ephemeral} is either a string, containing any -text which was inserted, or any text before point which was deleted, +text which was inserted (or any text before point which was deleted), @code{t}, meaning that the edit is a temporary edit made by the input -method, and @code{nil}, meaning that some text was deleted after -point. +method, or @code{nil}, meaning that some text was deleted after point. @vindex text-conversion-style Whether or not this event is sent depends on the value of the @@ -2247,26 +2244,25 @@ events will be sent instead of text conversion events. @item action This means that the input method will be enabled, but @key{RET} will -be sent wherever the input method wanted to insert a new line. +be sent whenever the input method wants to insert a new line. @item t This, or any other value, means that the input method will be enabled -and make edits terminated by @code{text-conversion} events. +and make edits followed by @code{text-conversion} events. @end table @findex disable-text-conversion -Changes to the value of this variable will only take effect upon -the next redisplay after the buffer becomes the selected buffer -of a frame. If you need to disable text conversion in a way -that takes immediate effect, call the function -@code{set-text-conversion-style} instead. This can potentially -lock up the input method for a significant amount of time, so do -not do this lightly! +Changes to the value of this variable will only take effect upon the +next redisplay after the buffer becomes the selected buffer of a +frame. If you need to disable text conversion in a way that takes +immediate effect, call the function @code{set-text-conversion-style} +instead. This has the potential to lock up the input method for a +significant amount of time, and should be used with care. @vindex disable-inhibit-text-conversion In addition, text conversion is automatically disabled after a prefix -key is read by the command loop, or through @code{read-key-sequence}. -This can be disabled by setting or binding the variable +key is read by the command loop or @code{read-key-sequence}. This can +be disabled by setting or binding the variable @code{disable-inhibit-text-conversion} to a non-@code{nil} value. @cindex @code{delete-frame} event diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index 2db8b62f6f9..ba55374d090 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el @@ -108,9 +108,17 @@ horizontal scrolling according to the movement in DX." ;; Show a message instead. (condition-case nil (if touch-screen-precision-scroll - (if (> dy 0) - (pixel-scroll-precision-scroll-down-page dy) - (pixel-scroll-precision-scroll-up-page (- dy))) + (progn + (if (> dy 0) + (pixel-scroll-precision-scroll-down-page dy) + (pixel-scroll-precision-scroll-up-page (- dy))) + ;; Now set `lines-vscrolled' to an value that will result + ;; in hscroll being disabled if dy looks as if a + ;; significant amount of scrolling is about to take + ;; Otherwise, horizontal scrolling may then interfere with + ;; precision scrolling. + (when (> (abs dy) 10) + (setcar (nthcdr 7 touch-screen-current-tool) 10))) ;; Start conventional scrolling. First, determine the ;; direction in which the scrolling is taking place. Load the ;; accumulator value. diff --git a/src/android.c b/src/android.c index 625253bdfe0..43122f73be1 100644 --- a/src/android.c +++ b/src/android.c @@ -5989,20 +5989,6 @@ android_toggle_on_screen_keyboard (android_window window, bool show) -/* When calling the system's faccessat, make sure to clear the flag - AT_EACCESS. - - Android's faccessat simply fails upon using AT_EACCESS, so replace - it with zero here. This isn't caught during configuration as Emacs - is being cross compiled. - - This replacement is only done when building for Android 16 or - later, because earlier versions use the gnulib replacement that - lacks these issues. - - This is unnecessary on earlier API versions, as gnulib's - rpl_faccessat will be used instead, which lacks these problems. */ - /* Like faccessat, except it also understands DIRFD opened using android_dirfd. */ @@ -6046,10 +6032,20 @@ android_faccessat (int dirfd, const char *pathname, int mode, int flags) } #if __ANDROID_API__ >= 16 + /* When calling `faccessat', make sure to clear the flag AT_EACCESS. + + Android's faccessat simply fails if FLAGS contains AT_EACCESS, so + replace it with zero here. This isn't caught at configuration-time + as Emacs is being cross compiled. + + This takes place only when building for Android 16 and later, + because earlier versions use a Gnulib replacement that lacks these + issues. */ + return faccessat (dirfd, pathname, mode, flags & ~AT_EACCESS); -#else +#else /* __ANDROID_API__ < 16 */ return faccessat (dirfd, pathname, mode, flags); -#endif +#endif /* __ANDROID_API__ >= 16 */ }