diff options
author | Po Lu <luangruo@yahoo.com> | 2024-04-27 10:47:12 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2024-04-27 10:47:12 +0800 |
commit | db8f7ed7f652c114e606de423e5094b4cefe49e2 (patch) | |
tree | 2ba2fd002786db7599f9efac0c8965b13f0c54e2 /src | |
parent | 763eaa5a324ff51dddad32d725ec8d416597d6d5 (diff) | |
download | emacs-db8f7ed7f652c114e606de423e5094b4cefe49e2.tar.gz |
Enable customization of the quit key on Android
* doc/emacs/android.texi (Android Windowing):
* doc/emacs/input.texi (On-Screen Keyboards): Document various
tidbits related to the quit key.
* java/org/gnu/emacs/EmacsNative.java (getQuitKeycode): New
function.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow): Rename
`lastVolumeButtonRelease' to `lastQuitKeyRelease'.
(onKeyUp): Treat value returned by getQuitKeycode as the quit
key rather than mandate KEYCODE_VOLUME_DOWN.
* src/android.c (getQuitKeycode): Implement new function.
* src/androidterm.c (syms_of_androidterm)
<android_quit_keycode>: New variable.
Diffstat (limited to 'src')
-rw-r--r-- | src/android.c | 7 | ||||
-rw-r--r-- | src/androidterm.c | 16 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/android.c b/src/android.c index e44b58c5973..00a77fc398d 100644 --- a/src/android.c +++ b/src/android.c @@ -2645,6 +2645,13 @@ NATIVE_NAME (shouldForwardMultimediaButtons) (JNIEnv *env, return !android_pass_multimedia_buttons_to_system; } +JNIEXPORT jint JNICALL +NATIVE_NAME (getQuitKeycode) (JNIEnv *env, jobject object) +{ + /* Likewise. */ + return (jint) android_quit_keycode; +} + JNIEXPORT jboolean JNICALL NATIVE_NAME (shouldForwardCtrlSpace) (JNIEnv *env, jobject object) { diff --git a/src/androidterm.c b/src/androidterm.c index e4f3abdb2d3..5de7b6f4e14 100644 --- a/src/androidterm.c +++ b/src/androidterm.c @@ -6703,6 +6703,22 @@ so it is important to limit the wait. If set to a non-float value, there will be no wait at all. */); Vandroid_wait_for_event_timeout = make_float (0.1); + DEFVAR_INT ("android-quit-keycode", android_quit_keycode, + doc: /* Keycode that signals quit when typed twice in rapid succession. + +This is the key code of a key whose repeated activation should prompt +Emacs to quit, enabling quitting on systems where a keyboard capable of +typing C-g is unavailable, when set to a key that does exist on the +device. Its value must be a keycode defined by the operating system, +and defaults to 25 (KEYCODE_VOLUME_DOWN), though one of the following +values might be desired on those devices where this default is also +unavailable, or if another key must otherwise serve this function +instead: + + - 4 (KEYCODE_BACK) + - 24 (KEYCODE_VOLUME_UP) */); + android_quit_keycode = 25; + DEFVAR_BOOL ("x-use-underline-position-properties", x_use_underline_position_properties, doc: /* SKIP: real doc in xterm.c. */); |