diff options
| author | Po Lu | 2023-05-01 13:51:12 +0800 |
|---|---|---|
| committer | Po Lu | 2023-05-01 13:51:12 +0800 |
| commit | 6c3369abe5de22a86645793fb6be00b234d4cc87 (patch) | |
| tree | 433794670e336d3aed4851a49539cfe8934a842b /src | |
| parent | 6a30a74cb2ac2cba69aa01da12caf1eac7134f43 (diff) | |
| download | emacs-6c3369abe5de22a86645793fb6be00b234d4cc87.tar.gz emacs-6c3369abe5de22a86645793fb6be00b234d4cc87.zip | |
Make it easier to quit on Android
* src/android.c (android_write_event):
(JNICALL): Raise SIGIO on key press and window action events.
Diffstat (limited to 'src')
| -rw-r--r-- | src/android.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/android.c b/src/android.c index 0244113285b..129ad6b5767 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -669,9 +669,23 @@ android_write_event (union android_event *event) | |||
| 669 | pthread_cond_broadcast (&event_queue.read_var); | 669 | pthread_cond_broadcast (&event_queue.read_var); |
| 670 | pthread_mutex_unlock (&event_queue.mutex); | 670 | pthread_mutex_unlock (&event_queue.mutex); |
| 671 | 671 | ||
| 672 | /* Now set pending_signals to true. This allows C-g to be handled | 672 | /* Now set pending_signals to true, and raise SIGIO to interrupt any |
| 673 | immediately even without SIGIO. */ | 673 | ongoing reads if the event is important. */ |
| 674 | pending_signals = true; | 674 | pending_signals = true; |
| 675 | |||
| 676 | switch (event->type) | ||
| 677 | { | ||
| 678 | /* Key press and window action events are considered important, | ||
| 679 | as they either end up quitting or asking for responses to the | ||
| 680 | IME. */ | ||
| 681 | case ANDROID_KEY_PRESS: | ||
| 682 | case ANDROID_WINDOW_ACTION: | ||
| 683 | raise (SIGIO); | ||
| 684 | break; | ||
| 685 | |||
| 686 | default: | ||
| 687 | break; | ||
| 688 | } | ||
| 675 | } | 689 | } |
| 676 | 690 | ||
| 677 | int | 691 | int |
| @@ -2480,7 +2494,10 @@ NATIVE_NAME (quit) (JNIEnv *env, jobject object) | |||
| 2480 | { | 2494 | { |
| 2481 | JNI_STACK_ALIGNMENT_PROLOGUE; | 2495 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 2482 | 2496 | ||
| 2497 | /* Raise sigio to interrupt anything that could be reading | ||
| 2498 | input. */ | ||
| 2483 | Vquit_flag = Qt; | 2499 | Vquit_flag = Qt; |
| 2500 | raise (SIGIO); | ||
| 2484 | } | 2501 | } |
| 2485 | 2502 | ||
| 2486 | JNIEXPORT jlong JNICALL | 2503 | JNIEXPORT jlong JNICALL |