1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Don't forcibly display dialogs on Android if a keyboard is present

* java/org/gnu/emacs/EmacsService.java (detectKeyboard): New
function.

* lisp/subr.el (use-dialog-box-p): Don't always return t if a
keyboard is present on Android.

* src/android.c (android_init_emacs_service): Link to new
function.
(android_detect_keyboard): New function.

* src/android.h: Update prototypes.

* src/androidfns.c (Fandroid_detect_keyboard)
(syms_of_androidfns): New function.
This commit is contained in:
Po Lu 2024-02-06 13:10:57 +08:00
parent cebd26b2e1
commit 0d2b712078
5 changed files with 53 additions and 1 deletions

View file

@ -2476,6 +2476,25 @@ there is no mouse. */)
#endif
}
DEFUN ("android-detect-keyboard", Fandroid_detect_keyboard,
Sandroid_detect_keyboard, 0, 0, 0,
doc: /* Return whether a keyboard is connected.
Return non-nil if a key is connected to this computer, or nil
if there is no keyboard. */)
(void)
{
#ifndef ANDROID_STUBIFY
/* If no display connection is present, just return nil. */
if (!android_init_gui)
return Qnil;
return android_detect_keyboard () ? Qt : Qnil;
#else /* ANDROID_STUBIFY */
return Qt;
#endif /* ANDROID_STUBIFY */
}
DEFUN ("android-toggle-on-screen-keyboard",
Fandroid_toggle_on_screen_keyboard,
Sandroid_toggle_on_screen_keyboard, 2, 2, 0,
@ -3560,6 +3579,7 @@ language to be US English if LANGUAGE is empty. */);
defsubr (&Sx_show_tip);
defsubr (&Sx_hide_tip);
defsubr (&Sandroid_detect_mouse);
defsubr (&Sandroid_detect_keyboard);
defsubr (&Sandroid_toggle_on_screen_keyboard);
defsubr (&Sx_server_vendor);
defsubr (&Sx_server_version);