From dc1ed3dbfa012a44d65a87d22f510a71474d8123 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 2 Sep 2023 09:28:50 +0800 Subject: [PATCH] Update Android port * lisp/touch-screen.el (touch-screen-handle-point-up) : Treat `held' as `drag' as well. * src/android.c (android_is_special_directory): Return bool rather than a pointer to the remainder of the file name, given that said pointer is never used. * src/android.h (android_is_special_directory): Modify correspondingly. --- lisp/touch-screen.el | 11 +++++++---- src/android.c | 37 +++++++++++++------------------------ src/android.h | 4 ++-- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index 7c9a68306ad..23c5bbf71ff 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el @@ -1034,9 +1034,9 @@ If the fourth element of `touch-screen-current-tool' is original position of the tool to display its bound keymap as a menu. -If the fourth element of `touch-screen-current-tool' is `drag', -the region is active, and the tool's initial window's selected -buffer isn't read-only, display the on screen keyboard. +If the fourth element of `touch-screen-current-tool' is `drag' or +`held', the region is active, and the tool's initial window's +selected buffer isn't read-only, display the on screen keyboard. If the command being executed is listed in `touch-screen-set-point-commands' also display the on-screen @@ -1159,7 +1159,10 @@ is not read-only." (throw 'input-event (list 'down-mouse-1 (nth 4 touch-screen-current-tool)))) - ((eq what 'drag) + ((or (eq what 'drag) + ;; Merely initiating a drag is sufficient to select a + ;; word if word selection is enabled. + (eq what 'held)) ;; Display the on screen keyboard if the region is now ;; active. Check this within the window where the tool was ;; first place. diff --git a/src/android.c b/src/android.c index 94aeb726fc6..b501a66b25d 100644 --- a/src/android.c +++ b/src/android.c @@ -833,22 +833,18 @@ android_user_full_name (struct passwd *pw) return (char *) "Android user"; return pw->pw_gecos; -#else +#else /* !HAVE_STRUCT_PASSWD_PW_GECOS */ return "Android user"; -#endif +#endif /* HAVE_STRUCT_PASSWD_PW_GECOS */ } -/* Determine whether or not the specified file NAME describes a file - in the directory DIR, which should be an absolute file name. NAME - must be in canonical form. - - Value is NULL if not. Otherwise, it is a pointer to the first - character in NAME after the part containing DIR and its trailing - directory separator. */ +/* Return whether or not the specified file NAME designates a file in + the directory DIR, which should be an absolute file name. NAME + must be in canonical form. */ -const char * +bool android_is_special_directory (const char *name, const char *dir) { size_t len; @@ -857,7 +853,7 @@ android_is_special_directory (const char *name, const char *dir) len = strlen (dir); if (strncmp (name, dir, len)) - return NULL; + return false; /* Now see if the character of NAME after len is either a directory separator or a terminating NULL. */ @@ -865,20 +861,13 @@ android_is_special_directory (const char *name, const char *dir) name += len; switch (*name) { - case '\0': - /* Return the empty string if this is the end of the file - name. */ - return name; - - case '/': - /* Return NAME (with the separator removed) if it describes a - file. */ - return name + 1; - - default: - /* The file name doesn't match. */ - return NULL; + case '\0': /* NAME is an exact match for DIR. */ + case '/': /* NAME is a constituent of DIR. */ + return true; } + + /* The file name doesn't match. */ + return false; } #if 0 diff --git a/src/android.h b/src/android.h index a34469284d5..d4605c11ad0 100644 --- a/src/android.h +++ b/src/android.h @@ -54,7 +54,7 @@ extern char *android_user_full_name (struct passwd *); /* File I/O operations. Many of these are defined in androidvfs.c. */ -extern const char *android_is_special_directory (const char *, const char *); +extern bool android_is_special_directory (const char *, const char *); extern const char *android_get_home_directory (void); extern void android_vfs_init (JNIEnv *, jobject); @@ -238,7 +238,7 @@ extern int android_rewrite_spawn_argv (const char ***); /* Define a substitute for use during Emacs compilation. */ -#define android_is_special_directory(name, dir) ((const char *) NULL) +#define android_is_special_directory(name, dir) (false) #endif /* !ANDROID_STUBIFY */ -- 2.39.5