]> git.eshelyaron.com Git - emacs.git/commitdiff
Update Android port
authorPo Lu <luangruo@yahoo.com>
Sat, 2 Sep 2023 01:28:50 +0000 (09:28 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 2 Sep 2023 01:30:05 +0000 (09:30 +0800)
* lisp/touch-screen.el (touch-screen-handle-point-up) <held>:
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
src/android.c
src/android.h

index 7c9a68306ad72ded959047d2e3a3ebbfcbc08e77..23c5bbf71ffeb6d4ca658c72fb14224a9bd4e8ae 100644 (file)
@@ -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.
index 94aeb726fc6e183fb80962771bbf3f22e6f3940b..b501a66b25d90a014408511e637bb01a581d42a4 100644 (file)
@@ -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 */
 }
 
 \f
 
-/* 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
index a34469284d5722aac0c624da2f8c802b77e23590..d4605c11ad0442d65b5fdc1e7def9345b15de59b 100644 (file)
@@ -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 */