diff options
| author | Po Lu | 2023-06-04 12:04:15 +0800 |
|---|---|---|
| committer | Po Lu | 2023-06-04 12:04:15 +0800 |
| commit | 740af4668c8d9bc8e4ee1e60ebeb366690fee93e (patch) | |
| tree | 99d1b732788406053b9fbeb30609b3c4410d94d6 /src/android.c | |
| parent | c389df992a9f054f9aced4f9a267730b2221e03a (diff) | |
| download | emacs-740af4668c8d9bc8e4ee1e60ebeb366690fee93e.tar.gz emacs-740af4668c8d9bc8e4ee1e60ebeb366690fee93e.zip | |
Fix input method synchronization problems
* java/debug.sh (gdbserver_cmd, is_root): Prefer TCP again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New
function `queryAndSpin'.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(icBeginSynchronous, icEndSynchronous, viewGetSelection): New
synchronization functions.
(resetIC, updateCursorAnchorInfo): Call those instead.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Call viewGetSelection.
* src/android.c (JNICALL, android_answer_query_spin): New
functions.
Diffstat (limited to 'src/android.c')
| -rw-r--r-- | src/android.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/android.c b/src/android.c index e74d40a0cdb..f59c0d9e5d2 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -2997,6 +2997,7 @@ NATIVE_NAME (blitRect) (JNIEnv *env, jobject object, | |||
| 2997 | 2997 | ||
| 2998 | static void android_begin_query (void); | 2998 | static void android_begin_query (void); |
| 2999 | static void android_end_query (void); | 2999 | static void android_end_query (void); |
| 3000 | static void android_answer_query_spin (void); | ||
| 3000 | 3001 | ||
| 3001 | JNIEXPORT void JNICALL | 3002 | JNIEXPORT void JNICALL |
| 3002 | NATIVE_NAME (beginSynchronous) (JNIEnv *env, jobject object) | 3003 | NATIVE_NAME (beginSynchronous) (JNIEnv *env, jobject object) |
| @@ -3014,6 +3015,14 @@ NATIVE_NAME (endSynchronous) (JNIEnv *env, jobject object) | |||
| 3014 | android_end_query (); | 3015 | android_end_query (); |
| 3015 | } | 3016 | } |
| 3016 | 3017 | ||
| 3018 | JNIEXPORT void JNICALL | ||
| 3019 | NATIVE_NAME (answerQuerySpin) (JNIEnv *env, jobject object) | ||
| 3020 | { | ||
| 3021 | JNI_STACK_ALIGNMENT_PROLOGUE; | ||
| 3022 | |||
| 3023 | android_answer_query_spin (); | ||
| 3024 | } | ||
| 3025 | |||
| 3017 | #ifdef __clang__ | 3026 | #ifdef __clang__ |
| 3018 | #pragma clang diagnostic pop | 3027 | #pragma clang diagnostic pop |
| 3019 | #else | 3028 | #else |
| @@ -7041,6 +7050,23 @@ android_answer_query (void) | |||
| 7041 | sem_post (&android_query_sem); | 7050 | sem_post (&android_query_sem); |
| 7042 | } | 7051 | } |
| 7043 | 7052 | ||
| 7053 | /* Like `android_answer_query'. However, the query may not have | ||
| 7054 | begun; spin until it has. */ | ||
| 7055 | |||
| 7056 | static void | ||
| 7057 | android_answer_query_spin (void) | ||
| 7058 | { | ||
| 7059 | int n; | ||
| 7060 | |||
| 7061 | while (!(n = __atomic_load_n (&android_servicing_query, | ||
| 7062 | __ATOMIC_SEQ_CST))) | ||
| 7063 | eassert (!n); | ||
| 7064 | |||
| 7065 | /* Note that this function is supposed to be called before | ||
| 7066 | `android_begin_query' starts, so clear the service flag. */ | ||
| 7067 | android_check_query (); | ||
| 7068 | } | ||
| 7069 | |||
| 7044 | /* Notice that the Emacs thread will start blocking waiting for a | 7070 | /* Notice that the Emacs thread will start blocking waiting for a |
| 7045 | response from the UI thread. Process any pending queries from the | 7071 | response from the UI thread. Process any pending queries from the |
| 7046 | UI thread. | 7072 | UI thread. |