1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-01 08:17:38 +00:00

Update Android port

* doc/emacs/android.texi (Android File System): Document new
behavior of starting a subprocess from /assets.
* java/org/gnu/emacs/EmacsWindow.java (onSomeKindOfMotionEvent):
Don't use isFromSource where not present.
* src/androidterm.c (android_scroll_run): Avoid undefined
behavior writing to bitfields.
* src/callproc.c (get_current_directory): When trying to run a
subprocess inside /assets, run it from the home directory
instead.
This commit is contained in:
Po Lu 2023-03-01 15:49:02 +08:00
parent 194b3f948c
commit ad8e12b9f9
4 changed files with 32 additions and 4 deletions

View File

@ -169,7 +169,9 @@ that result from such an implementation:
@itemize @bullet
@item
Subprocesses (such as @command{ls}) can not run from the
@file{/assets} directory.
@file{/assets} directory; if you try to run a subprocess with
@code{current-directory} set to @file{/assets} or a subdirectory
thereof, it will run from the home directory instead.
@item
There are no @file{.} and @file{..} directories inside the

View File

@ -875,7 +875,14 @@ private class Coordinate
public boolean
onSomeKindOfMotionEvent (MotionEvent event)
{
if (!event.isFromSource (InputDevice.SOURCE_CLASS_POINTER))
/* isFromSource is not available until API level 18. */
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
{
if (!event.isFromSource (InputDevice.SOURCE_CLASS_POINTER))
return false;
}
else if (event.getSource () != InputDevice.SOURCE_CLASS_POINTER)
return false;
switch (event.getAction ())

View File

@ -2124,8 +2124,10 @@ android_scroll_run (struct window *w, struct run *run)
/* Cursor off. Will be switched on again in gui_update_window_end. */
gui_clear_cursor (w);
/* To avoid sequence point problems, make sure to only call
FRAME_ANDROID_DRAWABLE once. */
android_copy_area (FRAME_ANDROID_DRAWABLE (f),
FRAME_ANDROID_DRAWABLE (f),
FRAME_ANDROID_WINDOW (f),
f->output_data.android->normal_gc,
x, from_y, width, height, x, to_y);

View File

@ -144,7 +144,11 @@ static CHILD_SETUP_TYPE child_setup (int, int, int, char **, char **,
directory if it's unreachable. If ENCODE is true, return as a string
suitable for a system call; otherwise, return a string in its
internal representation. Signal an error if the result would not be
an accessible directory. */
an accessible directory.
If the default directory lies inside a special directory which
cannot be made the current working directory, and ENCODE is also
set, simply return the home directory. */
Lisp_Object
get_current_directory (bool encode)
@ -157,6 +161,19 @@ get_current_directory (bool encode)
if (NILP (dir))
dir = build_string ("~");
#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
/* If DIR is an asset directory or a content directory, return
the home directory instead. */
if (encode && (!strcmp (SSDATA (dir), "/assets")
|| !strncmp (SSDATA (dir), "/assets/", 8)
|| !strcmp (SSDATA (dir), "/content")
|| !strncmp (SSDATA (dir), "/content/", 9)))
dir = build_string ("~");
#endif /* HAVE_ANDROID && ANDROID_STUBIFY */
dir = expand_and_dir_to_file (dir);
Lisp_Object encoded_dir = ENCODE_FILE (remove_slash_colon (dir));