diff options
| author | Po Lu | 2023-01-26 22:11:04 +0800 |
|---|---|---|
| committer | Po Lu | 2023-01-26 22:11:04 +0800 |
| commit | b0e7ae6d5b68a56da40256c395141f071172a622 (patch) | |
| tree | f754ea796e34235be911acb338cbd29db8f03fc6 /java | |
| parent | 22f7ad1057e1a1e20933e0a1ff2a858ecd9e3fec (diff) | |
| download | emacs-b0e7ae6d5b68a56da40256c395141f071172a622.tar.gz emacs-b0e7ae6d5b68a56da40256c395141f071172a622.zip | |
Update Android port
* INSTALL.android: Describe that apksigner is also required.
* configure.ac: Correctly add cross/Makefile to
SUBDIR_MAKEFILES.
* cross/Makefile.in: (config.status): Depend on
$(top_srcdir)/config.status.
* doc/emacs/input.texi (On-Screen Keyboards): Document how to
quit without a physical keyboard.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New
function `quit'.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow): New field
`lastVolumeButtonPress'.
(onKeyDown): Quit if necessary.
* m4/ndk-build.m4 (ndk_where_cc): Fix search if CC is not a
single word.
* src/android.c (android_open): Remove unused variable.
(quit): New function.
* src/androidmenu.c (android_process_events_for_menu): Allow
quitting the menu.
* src/xterm.c (handle_one_xevent, x_term_init, syms_of_xterm):
Implement features described above, so they work on free
operating systems.
* src/xterm.h (struct x_display_info): New fields `quit_keysym',
`quit_keysym_time'.
Diffstat (limited to 'java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsNative.java | 4 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsWindow.java | 19 |
2 files changed, 23 insertions, 0 deletions
diff --git a/java/org/gnu/emacs/EmacsNative.java b/java/org/gnu/emacs/EmacsNative.java index 7bf8b5f6081..4e91a7be322 100644 --- a/java/org/gnu/emacs/EmacsNative.java +++ b/java/org/gnu/emacs/EmacsNative.java | |||
| @@ -74,6 +74,10 @@ public class EmacsNative | |||
| 74 | /* Abort and generate a native core dump. */ | 74 | /* Abort and generate a native core dump. */ |
| 75 | public static native void emacsAbort (); | 75 | public static native void emacsAbort (); |
| 76 | 76 | ||
| 77 | /* Set Vquit_flag to t, resulting in Emacs quitting as soon as | ||
| 78 | possible. */ | ||
| 79 | public static native void quit (); | ||
| 80 | |||
| 77 | /* Send an ANDROID_CONFIGURE_NOTIFY event. The values of all the | 81 | /* Send an ANDROID_CONFIGURE_NOTIFY event. The values of all the |
| 78 | functions below are the serials of the events sent. */ | 82 | functions below are the serials of the events sent. */ |
| 79 | public static native long sendConfigureNotify (short window, long time, | 83 | public static native long sendConfigureNotify (short window, long time, |
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java index 8511af9193e..39eaf2fff80 100644 --- a/java/org/gnu/emacs/EmacsWindow.java +++ b/java/org/gnu/emacs/EmacsWindow.java | |||
| @@ -124,6 +124,10 @@ public class EmacsWindow extends EmacsHandleObject | |||
| 124 | there is no such window manager. */ | 124 | there is no such window manager. */ |
| 125 | private WindowManager windowManager; | 125 | private WindowManager windowManager; |
| 126 | 126 | ||
| 127 | /* The time of the last KEYCODE_VOLUME_DOWN press. This is used to | ||
| 128 | quit Emacs. */ | ||
| 129 | private long lastVolumeButtonPress; | ||
| 130 | |||
| 127 | public | 131 | public |
| 128 | EmacsWindow (short handle, final EmacsWindow parent, int x, int y, | 132 | EmacsWindow (short handle, final EmacsWindow parent, int x, int y, |
| 129 | int width, int height, boolean overrideRedirect) | 133 | int width, int height, boolean overrideRedirect) |
| @@ -513,6 +517,7 @@ public class EmacsWindow extends EmacsHandleObject | |||
| 513 | onKeyDown (int keyCode, KeyEvent event) | 517 | onKeyDown (int keyCode, KeyEvent event) |
| 514 | { | 518 | { |
| 515 | int state, state_1; | 519 | int state, state_1; |
| 520 | long time; | ||
| 516 | 521 | ||
| 517 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) | 522 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) |
| 518 | state = event.getModifiers (); | 523 | state = event.getModifiers (); |
| @@ -544,6 +549,20 @@ public class EmacsWindow extends EmacsHandleObject | |||
| 544 | state, keyCode, | 549 | state, keyCode, |
| 545 | event.getUnicodeChar (state_1)); | 550 | event.getUnicodeChar (state_1)); |
| 546 | lastModifiers = state; | 551 | lastModifiers = state; |
| 552 | |||
| 553 | if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) | ||
| 554 | { | ||
| 555 | /* Check if this volume down press should quit Emacs. | ||
| 556 | Most Android devices have no physical keyboard, so it | ||
| 557 | is unreasonably hard to press C-g. */ | ||
| 558 | |||
| 559 | time = event.getEventTime (); | ||
| 560 | |||
| 561 | if (lastVolumeButtonPress - time < 350) | ||
| 562 | EmacsNative.quit (); | ||
| 563 | |||
| 564 | lastVolumeButtonPress = time; | ||
| 565 | } | ||
| 547 | } | 566 | } |
| 548 | 567 | ||
| 549 | public void | 568 | public void |