diff options
| author | Po Lu | 2024-05-04 11:36:09 +0800 |
|---|---|---|
| committer | Po Lu | 2024-05-04 11:36:09 +0800 |
| commit | 139931fefb4cde3132ca68c3caa6ee9c4889c1b6 (patch) | |
| tree | 0d34b5ae78706d4c1345ff8f70e865f3503ead4f /src/androidterm.c | |
| parent | 7a7dd87842fde85666208b1ce26882aa83d99107 (diff) | |
| download | emacs-139931fefb4cde3132ca68c3caa6ee9c4889c1b6.tar.gz emacs-139931fefb4cde3132ca68c3caa6ee9c4889c1b6.zip | |
Simplify management of Android handle IDs
* java/org/gnu/emacs/EmacsCursor.java (EmacsCursor):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsHandleObject.java (EmacsHandleObject):
Remove HANDLE argument to constructor.
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow):
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection) <windowHandle>: Change type to long.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative)
(sendConfigureNotify, sendKeyPress, sendKeyRelease, sendFocusIn)
(sendFocusOut, sendWindowAction, sendEnterNotify)
(sendLeaveNotify, sendMotionNotify, sendButtonPress)
(sendButtonRelease, sendTouchDown, sendTouchUp, sendTouchMove)
(sendWheel, sendIconified, sendDeiconified, sendContextMenu)
(sendExpose, sendDndDrag, sendDndUri, sendDndText)
(beginBatchEdit, commitCompletion, endBatchEdit, commitText)
(deleteSurroundingText, finishComposingText, replaceText)
(getSelectedText, getTextAfterCursor, getTextBeforeCursor)
(setComposingText, setComposingRegion, setSelection)
(performEditorAction, performContextMenuAction, getExtractedText)
(requestSelectionUpdate, requestCursorUpdates, clearInputFlags)
(getSurroundingText, takeSnapshot, getSelection): Accept handles
as longs, rather than shorts. All callers changed.
* java/org/gnu/emacs/EmacsService.java (queryTree): Return
handles as longs rather than shorts.
(viewGetSelection): Take long WINDOW, not short.
* src/android.c (struct android_emacs_handle): New structure.
(handle_class): New variable.
(android_init_emacs_service, android_init_emacs_pixmap)
(android_init_emacs_gc_class, android_init_emacs_cursor): Adjust
to match signature changes in constructors.
(android_init_emacs_handle): New function.
(initEmacs): Initialize the handle class, its fields and metods.
(sendConfigureNotify, sendKeyPress, sendKeyRelease, sendFocusIn)
(sendFocusOut, sendWindowAction, sendEnterNotify)
(sendLeaveNotify, sendMotionNotify, sendButtonPress)
(sendButtonRelease, sendTouchDown, sendTouchUp, sendTouchMove)
(sendWheel, sendIconified, sendDeiconified, sendContextMenu)
(sendExpose, sendDndDrag, sendDndUri, sendDndText): Update for
changes to handle type.
(android_alloc_id, android_resolve_handle)
(android_resolve_handle2): Remove functions; replace the second
with a macro that accepts one fewer argument. All callers
changed.
(android_destroy_handle): Cease indexing the handle list for the
handle object.
(android_globalize_reference): New function.
(android_create_window, android_create_gc, android_create_pixmap)
(android_create_font_cursor): Call android_globalize_reference
to convert global references into handles.
(android_free_cursor, android_destroy_window): Cease verifying
the handle type.
(android_copy_area): Check destination object type rather than
handle entry.
(android_query_tree): Adjust for changes to return types.
(likely): Define __builtin_expect variant unconditionally.
* src/android.h (android_resolve_handle): New macro.
* src/androidgui.h (android_handle): Define to intptr_t.
* src/androidterm.c (deleteSurroundingText, finishComposingText)
(performEditorAction, performContextMenuAction, getExtractedText)
(getSelectedText, requestSelectionUpdate, requestCursorUpdates)
(clearInputFlags, getSurroundingText)
(android_get_surrounding_text_internal): Accept handles as
longs, not jshorts.
Diffstat (limited to 'src/androidterm.c')
| -rw-r--r-- | src/androidterm.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/androidterm.c b/src/androidterm.c index 2979e5c1401..f4c071f4519 100644 --- a/src/androidterm.c +++ b/src/androidterm.c | |||
| @@ -4925,7 +4925,7 @@ android_copy_java_string (JNIEnv *env, jstring string, size_t *length) | |||
| 4925 | } | 4925 | } |
| 4926 | 4926 | ||
| 4927 | JNIEXPORT void JNICALL | 4927 | JNIEXPORT void JNICALL |
| 4928 | NATIVE_NAME (beginBatchEdit) (JNIEnv *env, jobject object, jshort window) | 4928 | NATIVE_NAME (beginBatchEdit) (JNIEnv *env, jobject object, jlong window) |
| 4929 | { | 4929 | { |
| 4930 | JNI_STACK_ALIGNMENT_PROLOGUE; | 4930 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 4931 | 4931 | ||
| @@ -4946,7 +4946,7 @@ NATIVE_NAME (beginBatchEdit) (JNIEnv *env, jobject object, jshort window) | |||
| 4946 | } | 4946 | } |
| 4947 | 4947 | ||
| 4948 | JNIEXPORT void JNICALL | 4948 | JNIEXPORT void JNICALL |
| 4949 | NATIVE_NAME (endBatchEdit) (JNIEnv *env, jobject object, jshort window) | 4949 | NATIVE_NAME (endBatchEdit) (JNIEnv *env, jobject object, jlong window) |
| 4950 | { | 4950 | { |
| 4951 | JNI_STACK_ALIGNMENT_PROLOGUE; | 4951 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 4952 | 4952 | ||
| @@ -4967,7 +4967,7 @@ NATIVE_NAME (endBatchEdit) (JNIEnv *env, jobject object, jshort window) | |||
| 4967 | } | 4967 | } |
| 4968 | 4968 | ||
| 4969 | JNIEXPORT void JNICALL | 4969 | JNIEXPORT void JNICALL |
| 4970 | NATIVE_NAME (commitCompletion) (JNIEnv *env, jobject object, jshort window, | 4970 | NATIVE_NAME (commitCompletion) (JNIEnv *env, jobject object, jlong window, |
| 4971 | jstring completion_text, jint position) | 4971 | jstring completion_text, jint position) |
| 4972 | { | 4972 | { |
| 4973 | JNI_STACK_ALIGNMENT_PROLOGUE; | 4973 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| @@ -5001,7 +5001,7 @@ NATIVE_NAME (commitCompletion) (JNIEnv *env, jobject object, jshort window, | |||
| 5001 | } | 5001 | } |
| 5002 | 5002 | ||
| 5003 | JNIEXPORT void JNICALL | 5003 | JNIEXPORT void JNICALL |
| 5004 | NATIVE_NAME (commitText) (JNIEnv *env, jobject object, jshort window, | 5004 | NATIVE_NAME (commitText) (JNIEnv *env, jobject object, jlong window, |
| 5005 | jstring commit_text, jint position) | 5005 | jstring commit_text, jint position) |
| 5006 | { | 5006 | { |
| 5007 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5007 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| @@ -5036,7 +5036,7 @@ NATIVE_NAME (commitText) (JNIEnv *env, jobject object, jshort window, | |||
| 5036 | 5036 | ||
| 5037 | JNIEXPORT void JNICALL | 5037 | JNIEXPORT void JNICALL |
| 5038 | NATIVE_NAME (deleteSurroundingText) (JNIEnv *env, jobject object, | 5038 | NATIVE_NAME (deleteSurroundingText) (JNIEnv *env, jobject object, |
| 5039 | jshort window, jint left_length, | 5039 | jlong window, jint left_length, |
| 5040 | jint right_length) | 5040 | jint right_length) |
| 5041 | { | 5041 | { |
| 5042 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5042 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| @@ -5059,7 +5059,7 @@ NATIVE_NAME (deleteSurroundingText) (JNIEnv *env, jobject object, | |||
| 5059 | 5059 | ||
| 5060 | JNIEXPORT void JNICALL | 5060 | JNIEXPORT void JNICALL |
| 5061 | NATIVE_NAME (finishComposingText) (JNIEnv *env, jobject object, | 5061 | NATIVE_NAME (finishComposingText) (JNIEnv *env, jobject object, |
| 5062 | jshort window) | 5062 | jlong window) |
| 5063 | { | 5063 | { |
| 5064 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5064 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 5065 | 5065 | ||
| @@ -5080,7 +5080,7 @@ NATIVE_NAME (finishComposingText) (JNIEnv *env, jobject object, | |||
| 5080 | } | 5080 | } |
| 5081 | 5081 | ||
| 5082 | JNIEXPORT void JNICALL | 5082 | JNIEXPORT void JNICALL |
| 5083 | NATIVE_NAME (replaceText) (JNIEnv *env, jobject object, jshort window, | 5083 | NATIVE_NAME (replaceText) (JNIEnv *env, jobject object, jlong window, |
| 5084 | jint start, jint end, jobject text, | 5084 | jint start, jint end, jobject text, |
| 5085 | int new_cursor_position, jobject attribute) | 5085 | int new_cursor_position, jobject attribute) |
| 5086 | { | 5086 | { |
| @@ -5246,7 +5246,7 @@ android_text_to_string (JNIEnv *env, char *buffer, ptrdiff_t n, | |||
| 5246 | } | 5246 | } |
| 5247 | 5247 | ||
| 5248 | JNIEXPORT jstring JNICALL | 5248 | JNIEXPORT jstring JNICALL |
| 5249 | NATIVE_NAME (getTextAfterCursor) (JNIEnv *env, jobject object, jshort window, | 5249 | NATIVE_NAME (getTextAfterCursor) (JNIEnv *env, jobject object, jlong window, |
| 5250 | jint length, jint flags) | 5250 | jint length, jint flags) |
| 5251 | { | 5251 | { |
| 5252 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5252 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| @@ -5290,7 +5290,7 @@ NATIVE_NAME (getTextAfterCursor) (JNIEnv *env, jobject object, jshort window, | |||
| 5290 | } | 5290 | } |
| 5291 | 5291 | ||
| 5292 | JNIEXPORT jstring JNICALL | 5292 | JNIEXPORT jstring JNICALL |
| 5293 | NATIVE_NAME (getTextBeforeCursor) (JNIEnv *env, jobject object, jshort window, | 5293 | NATIVE_NAME (getTextBeforeCursor) (JNIEnv *env, jobject object, jlong window, |
| 5294 | jint length, jint flags) | 5294 | jint length, jint flags) |
| 5295 | { | 5295 | { |
| 5296 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5296 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| @@ -5334,7 +5334,7 @@ NATIVE_NAME (getTextBeforeCursor) (JNIEnv *env, jobject object, jshort window, | |||
| 5334 | } | 5334 | } |
| 5335 | 5335 | ||
| 5336 | JNIEXPORT void JNICALL | 5336 | JNIEXPORT void JNICALL |
| 5337 | NATIVE_NAME (setComposingText) (JNIEnv *env, jobject object, jshort window, | 5337 | NATIVE_NAME (setComposingText) (JNIEnv *env, jobject object, jlong window, |
| 5338 | jstring composing_text, | 5338 | jstring composing_text, |
| 5339 | jint new_cursor_position) | 5339 | jint new_cursor_position) |
| 5340 | { | 5340 | { |
| @@ -5369,7 +5369,7 @@ NATIVE_NAME (setComposingText) (JNIEnv *env, jobject object, jshort window, | |||
| 5369 | } | 5369 | } |
| 5370 | 5370 | ||
| 5371 | JNIEXPORT void JNICALL | 5371 | JNIEXPORT void JNICALL |
| 5372 | NATIVE_NAME (setComposingRegion) (JNIEnv *env, jobject object, jshort window, | 5372 | NATIVE_NAME (setComposingRegion) (JNIEnv *env, jobject object, jlong window, |
| 5373 | jint start, jint end) | 5373 | jint start, jint end) |
| 5374 | { | 5374 | { |
| 5375 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5375 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| @@ -5391,7 +5391,7 @@ NATIVE_NAME (setComposingRegion) (JNIEnv *env, jobject object, jshort window, | |||
| 5391 | } | 5391 | } |
| 5392 | 5392 | ||
| 5393 | JNIEXPORT void JNICALL | 5393 | JNIEXPORT void JNICALL |
| 5394 | NATIVE_NAME (setSelection) (JNIEnv *env, jobject object, jshort window, | 5394 | NATIVE_NAME (setSelection) (JNIEnv *env, jobject object, jlong window, |
| 5395 | jint start, jint end) | 5395 | jint start, jint end) |
| 5396 | { | 5396 | { |
| 5397 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5397 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| @@ -5469,7 +5469,7 @@ android_get_selection (void *data) | |||
| 5469 | } | 5469 | } |
| 5470 | 5470 | ||
| 5471 | JNIEXPORT jintArray JNICALL | 5471 | JNIEXPORT jintArray JNICALL |
| 5472 | NATIVE_NAME (getSelection) (JNIEnv *env, jobject object, jshort window) | 5472 | NATIVE_NAME (getSelection) (JNIEnv *env, jobject object, jlong window) |
| 5473 | { | 5473 | { |
| 5474 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5474 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 5475 | 5475 | ||
| @@ -5508,7 +5508,7 @@ NATIVE_NAME (getSelection) (JNIEnv *env, jobject object, jshort window) | |||
| 5508 | 5508 | ||
| 5509 | JNIEXPORT void JNICALL | 5509 | JNIEXPORT void JNICALL |
| 5510 | NATIVE_NAME (performEditorAction) (JNIEnv *env, jobject object, | 5510 | NATIVE_NAME (performEditorAction) (JNIEnv *env, jobject object, |
| 5511 | jshort window, int action) | 5511 | jlong window, int action) |
| 5512 | { | 5512 | { |
| 5513 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5513 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 5514 | 5514 | ||
| @@ -5560,7 +5560,7 @@ NATIVE_NAME (performEditorAction) (JNIEnv *env, jobject object, | |||
| 5560 | 5560 | ||
| 5561 | JNIEXPORT void JNICALL | 5561 | JNIEXPORT void JNICALL |
| 5562 | NATIVE_NAME (performContextMenuAction) (JNIEnv *env, jobject object, | 5562 | NATIVE_NAME (performContextMenuAction) (JNIEnv *env, jobject object, |
| 5563 | jshort window, int action) | 5563 | jlong window, int action) |
| 5564 | { | 5564 | { |
| 5565 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5565 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 5566 | 5566 | ||
| @@ -5765,7 +5765,7 @@ android_build_extracted_text (jstring text, ptrdiff_t start, | |||
| 5765 | 5765 | ||
| 5766 | JNIEXPORT jobject JNICALL | 5766 | JNIEXPORT jobject JNICALL |
| 5767 | NATIVE_NAME (getExtractedText) (JNIEnv *env, jobject ignored_object, | 5767 | NATIVE_NAME (getExtractedText) (JNIEnv *env, jobject ignored_object, |
| 5768 | jshort window, jobject request, | 5768 | jlong window, jobject request, |
| 5769 | jint flags) | 5769 | jint flags) |
| 5770 | { | 5770 | { |
| 5771 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5771 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| @@ -5877,7 +5877,7 @@ NATIVE_NAME (getExtractedText) (JNIEnv *env, jobject ignored_object, | |||
| 5877 | 5877 | ||
| 5878 | JNIEXPORT jstring JNICALL | 5878 | JNIEXPORT jstring JNICALL |
| 5879 | NATIVE_NAME (getSelectedText) (JNIEnv *env, jobject object, | 5879 | NATIVE_NAME (getSelectedText) (JNIEnv *env, jobject object, |
| 5880 | jshort window) | 5880 | jlong window) |
| 5881 | { | 5881 | { |
| 5882 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5882 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 5883 | 5883 | ||
| @@ -5907,7 +5907,7 @@ NATIVE_NAME (getSelectedText) (JNIEnv *env, jobject object, | |||
| 5907 | 5907 | ||
| 5908 | JNIEXPORT void JNICALL | 5908 | JNIEXPORT void JNICALL |
| 5909 | NATIVE_NAME (requestSelectionUpdate) (JNIEnv *env, jobject object, | 5909 | NATIVE_NAME (requestSelectionUpdate) (JNIEnv *env, jobject object, |
| 5910 | jshort window) | 5910 | jlong window) |
| 5911 | { | 5911 | { |
| 5912 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5912 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 5913 | 5913 | ||
| @@ -5929,7 +5929,7 @@ NATIVE_NAME (requestSelectionUpdate) (JNIEnv *env, jobject object, | |||
| 5929 | 5929 | ||
| 5930 | JNIEXPORT void JNICALL | 5930 | JNIEXPORT void JNICALL |
| 5931 | NATIVE_NAME (requestCursorUpdates) (JNIEnv *env, jobject object, | 5931 | NATIVE_NAME (requestCursorUpdates) (JNIEnv *env, jobject object, |
| 5932 | jshort window, jint mode) | 5932 | jlong window, jint mode) |
| 5933 | { | 5933 | { |
| 5934 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5934 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 5935 | 5935 | ||
| @@ -5958,7 +5958,7 @@ NATIVE_NAME (requestCursorUpdates) (JNIEnv *env, jobject object, | |||
| 5958 | 5958 | ||
| 5959 | JNIEXPORT void JNICALL | 5959 | JNIEXPORT void JNICALL |
| 5960 | NATIVE_NAME (clearInputFlags) (JNIEnv *env, jobject object, | 5960 | NATIVE_NAME (clearInputFlags) (JNIEnv *env, jobject object, |
| 5961 | jshort window) | 5961 | jlong window) |
| 5962 | { | 5962 | { |
| 5963 | JNI_STACK_ALIGNMENT_PROLOGUE; | 5963 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 5964 | 5964 | ||
| @@ -6073,7 +6073,7 @@ android_get_surrounding_text (void *data) | |||
| 6073 | Value is the object upon success, else NULL. */ | 6073 | Value is the object upon success, else NULL. */ |
| 6074 | 6074 | ||
| 6075 | static jobject | 6075 | static jobject |
| 6076 | android_get_surrounding_text_internal (JNIEnv *env, jshort window, | 6076 | android_get_surrounding_text_internal (JNIEnv *env, jlong window, |
| 6077 | jint before_length, | 6077 | jint before_length, |
| 6078 | jint after_length, | 6078 | jint after_length, |
| 6079 | ptrdiff_t *conversion_start, | 6079 | ptrdiff_t *conversion_start, |
| @@ -6166,7 +6166,7 @@ android_get_surrounding_text_internal (JNIEnv *env, jshort window, | |||
| 6166 | 6166 | ||
| 6167 | JNIEXPORT jobject JNICALL | 6167 | JNIEXPORT jobject JNICALL |
| 6168 | NATIVE_NAME (getSurroundingText) (JNIEnv *env, jobject object, | 6168 | NATIVE_NAME (getSurroundingText) (JNIEnv *env, jobject object, |
| 6169 | jshort window, jint before_length, | 6169 | jlong window, jint before_length, |
| 6170 | jint after_length, jint flags) | 6170 | jint after_length, jint flags) |
| 6171 | { | 6171 | { |
| 6172 | JNI_STACK_ALIGNMENT_PROLOGUE; | 6172 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| @@ -6176,7 +6176,7 @@ NATIVE_NAME (getSurroundingText) (JNIEnv *env, jobject object, | |||
| 6176 | } | 6176 | } |
| 6177 | 6177 | ||
| 6178 | JNIEXPORT jobject JNICALL | 6178 | JNIEXPORT jobject JNICALL |
| 6179 | NATIVE_NAME (takeSnapshot) (JNIEnv *env, jobject object, jshort window) | 6179 | NATIVE_NAME (takeSnapshot) (JNIEnv *env, jobject object, jlong window) |
| 6180 | { | 6180 | { |
| 6181 | JNI_STACK_ALIGNMENT_PROLOGUE; | 6181 | JNI_STACK_ALIGNMENT_PROLOGUE; |
| 6182 | 6182 | ||