diff options
| author | Po Lu | 2023-07-10 13:31:57 +0800 |
|---|---|---|
| committer | Po Lu | 2023-07-10 13:31:57 +0800 |
| commit | cf2dde4261a311406203a38d6bf1be72b4f9e8a7 (patch) | |
| tree | 904aa8c47417f9c16018ed04bf7ef05bfd446268 /src | |
| parent | faca007b61422969f5c8888c67a1e356a8c5b64a (diff) | |
| download | emacs-cf2dde4261a311406203a38d6bf1be72b4f9e8a7.tar.gz emacs-cf2dde4261a311406203a38d6bf1be72b4f9e8a7.zip | |
Update Android port
* java/org/gnu/emacs/EmacsService.java (browseUrl): New argument
SEND. Choose from a list of applications that want to share the
URL if true.
* lisp/net/browse-url.el (browse-url-android-share): New user
option.
(browse-url-default-android-browser): Respect said user option.
* src/android.c (android_init_emacs_service)
(android_browse_url): Expose new option.
* src/android.h: Update prototypes.
* src/androidselect.c (Fandroid_browse_url): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/android.c | 16 | ||||
| -rw-r--r-- | src/android.h | 2 | ||||
| -rw-r--r-- | src/androidselect.c | 16 |
3 files changed, 21 insertions, 13 deletions
diff --git a/src/android.c b/src/android.c index 5850b6079c9..4e9897f4648 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -2286,7 +2286,7 @@ android_init_emacs_service (void) | |||
| 2286 | FIND_METHOD (get_screen_height, "getScreenHeight", "(Z)I"); | 2286 | FIND_METHOD (get_screen_height, "getScreenHeight", "(Z)I"); |
| 2287 | FIND_METHOD (detect_mouse, "detectMouse", "()Z"); | 2287 | FIND_METHOD (detect_mouse, "detectMouse", "()Z"); |
| 2288 | FIND_METHOD (name_keysym, "nameKeysym", "(I)Ljava/lang/String;"); | 2288 | FIND_METHOD (name_keysym, "nameKeysym", "(I)Ljava/lang/String;"); |
| 2289 | FIND_METHOD (browse_url, "browseUrl", "(Ljava/lang/String;)" | 2289 | FIND_METHOD (browse_url, "browseUrl", "(Ljava/lang/String;Z)" |
| 2290 | "Ljava/lang/String;"); | 2290 | "Ljava/lang/String;"); |
| 2291 | FIND_METHOD (restart_emacs, "restartEmacs", "()V"); | 2291 | FIND_METHOD (restart_emacs, "restartEmacs", "()V"); |
| 2292 | FIND_METHOD (update_ic, "updateIC", | 2292 | FIND_METHOD (update_ic, "updateIC", |
| @@ -6959,12 +6959,15 @@ android_project_image_nearest (struct android_image *image, | |||
| 6959 | 6959 | ||
| 6960 | /* Other miscellaneous functions. */ | 6960 | /* Other miscellaneous functions. */ |
| 6961 | 6961 | ||
| 6962 | /* Ask the system to start browsing the specified encoded URL. Upon | 6962 | /* Ask the system to start browsing the specified URL. Upon failure, |
| 6963 | failure, return a string describing the error. Else, value is | 6963 | return a string describing the error. Else, value is nil. URL |
| 6964 | nil. */ | 6964 | should be encoded unless SEND. |
| 6965 | |||
| 6966 | If SEND, open the URL with applications that can ``send'' or | ||
| 6967 | ``share'' the URL (through mail, for example.) */ | ||
| 6965 | 6968 | ||
| 6966 | Lisp_Object | 6969 | Lisp_Object |
| 6967 | android_browse_url (Lisp_Object url) | 6970 | android_browse_url (Lisp_Object url, Lisp_Object send) |
| 6968 | { | 6971 | { |
| 6969 | jobject value, string; | 6972 | jobject value, string; |
| 6970 | Lisp_Object tem; | 6973 | Lisp_Object tem; |
| @@ -6974,7 +6977,8 @@ android_browse_url (Lisp_Object url) | |||
| 6974 | value = (*android_java_env)->CallObjectMethod (android_java_env, | 6977 | value = (*android_java_env)->CallObjectMethod (android_java_env, |
| 6975 | emacs_service, | 6978 | emacs_service, |
| 6976 | service_class.browse_url, | 6979 | service_class.browse_url, |
| 6977 | string); | 6980 | string, |
| 6981 | (jboolean) !NILP (send)); | ||
| 6978 | android_exception_check (); | 6982 | android_exception_check (); |
| 6979 | 6983 | ||
| 6980 | ANDROID_DELETE_LOCAL_REF (string); | 6984 | ANDROID_DELETE_LOCAL_REF (string); |
diff --git a/src/android.h b/src/android.h index 33ca379e6ba..2323690fa25 100644 --- a/src/android.h +++ b/src/android.h | |||
| @@ -178,7 +178,7 @@ struct android_battery_state | |||
| 178 | int temperature; | 178 | int temperature; |
| 179 | }; | 179 | }; |
| 180 | 180 | ||
| 181 | extern Lisp_Object android_browse_url (Lisp_Object); | 181 | extern Lisp_Object android_browse_url (Lisp_Object, Lisp_Object); |
| 182 | extern int android_query_battery (struct android_battery_state *); | 182 | extern int android_query_battery (struct android_battery_state *); |
| 183 | extern void android_display_toast (const char *); | 183 | extern void android_display_toast (const char *); |
| 184 | 184 | ||
diff --git a/src/androidselect.c b/src/androidselect.c index d1f2ebb52f9..f5371280457 100644 --- a/src/androidselect.c +++ b/src/androidselect.c | |||
| @@ -232,11 +232,15 @@ DEFUN ("android-clipboard-exists-p", Fandroid_clipboard_exists_p, | |||
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | DEFUN ("android-browse-url", Fandroid_browse_url, | 234 | DEFUN ("android-browse-url", Fandroid_browse_url, |
| 235 | Sandroid_browse_url, 1, 1, 0, | 235 | Sandroid_browse_url, 1, 2, 0, |
| 236 | doc: /* Start the system web browser. | 236 | doc: /* Open URL in an external application. URL should be a |
| 237 | Then, point the web browser to URL, which should be a URL-encoded | 237 | URL-encoded URL with a scheme specified unless SEND is non-nil. |
| 238 | URL with a scheme specified. Signal an error upon failure. */) | 238 | Signal an error upon failure. |
| 239 | (Lisp_Object url) | 239 | |
| 240 | If SEND is nil, start a program that is able to display the URL, such | ||
| 241 | as a web browser. Otherwise, try to share URL using programs such as | ||
| 242 | email clients. */) | ||
| 243 | (Lisp_Object url, Lisp_Object send) | ||
| 240 | { | 244 | { |
| 241 | Lisp_Object value; | 245 | Lisp_Object value; |
| 242 | 246 | ||
| @@ -244,7 +248,7 @@ URL with a scheme specified. Signal an error upon failure. */) | |||
| 244 | error ("No Android display connection!"); | 248 | error ("No Android display connection!"); |
| 245 | 249 | ||
| 246 | CHECK_STRING (url); | 250 | CHECK_STRING (url); |
| 247 | value = android_browse_url (url); | 251 | value = android_browse_url (url, send); |
| 248 | 252 | ||
| 249 | /* Signal an error upon failure. */ | 253 | /* Signal an error upon failure. */ |
| 250 | if (!NILP (value)) | 254 | if (!NILP (value)) |