[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android ad8e12b9f99 5/7: Update Android port
From: |
Po Lu |
Subject: |
feature/android ad8e12b9f99 5/7: Update Android port |
Date: |
Wed, 1 Mar 2023 03:00:47 -0500 (EST) |
branch: feature/android
commit ad8e12b9f9937f999a277e2608a1098a1c494532
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
doc/emacs/android.texi | 4 +++-
java/org/gnu/emacs/EmacsWindow.java | 9 ++++++++-
src/androidterm.c | 4 +++-
src/callproc.c | 19 ++++++++++++++++++-
4 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi
index 428cf1049b0..65ebdfa9ab1 100644
--- a/doc/emacs/android.texi
+++ b/doc/emacs/android.texi
@@ -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
diff --git a/java/org/gnu/emacs/EmacsWindow.java
b/java/org/gnu/emacs/EmacsWindow.java
index 007a2a86e68..5c481aa3ef4 100644
--- a/java/org/gnu/emacs/EmacsWindow.java
+++ b/java/org/gnu/emacs/EmacsWindow.java
@@ -875,7 +875,14 @@ public final class EmacsWindow extends EmacsHandleObject
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 ())
diff --git a/src/androidterm.c b/src/androidterm.c
index 42ce03d4e7d..8a67d128348 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -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);
diff --git a/src/callproc.c b/src/callproc.c
index e15eebe23dd..ea9c946f158 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -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));
- feature/android updated (03c0cb86713 -> a0c3643abde), Po Lu, 2023/03/01
- feature/android 15bcb446be2 3/7: Update Android port, Po Lu, 2023/03/01
- feature/android ad8e12b9f99 5/7: Update Android port,
Po Lu <=
- feature/android f8a2619d981 2/7: More fixes to JNI error checking, Po Lu, 2023/03/01
- feature/android 920168c5d87 6/7: Fix mostlyclean rules, Po Lu, 2023/03/01
- feature/android 194b3f948cb 4/7: Update Android port, Po Lu, 2023/03/01
- feature/android 49d5aa36579 1/7: Merge remote-tracking branch 'origin/master' into feature/android, Po Lu, 2023/03/01
- feature/android a0c3643abde 7/7: Merge remote-tracking branch 'origin/master' into feature/android, Po Lu, 2023/03/01