aboutsummaryrefslogtreecommitdiffstats
path: root/src/androidgui.h
diff options
context:
space:
mode:
authorPo Lu2023-02-15 12:23:03 +0800
committerPo Lu2023-02-15 12:23:03 +0800
commita158c1d5b964fda36f752998cef076d581dc4df4 (patch)
treeb9c7a22a7259dbd876be0e047304a338ef05e334 /src/androidgui.h
parent5a7855e84abd56e55b456aef4a43ae7623e76899 (diff)
downloademacs-a158c1d5b964fda36f752998cef076d581dc4df4.tar.gz
emacs-a158c1d5b964fda36f752998cef076d581dc4df4.zip
Update Android port
* configure.ac (HAVE_TEXT_CONVERSION): Define on Android. * doc/emacs/input.texi (On-Screen Keyboards): Document ``text conversion'' slightly. * doc/lispref/commands.texi (Misc Events): Document new `text-conversion' event. * java/org/gnu/emacs/EmacsContextMenu.java (display): Use `syncRunnable'. * java/org/gnu/emacs/EmacsDialog.java (display): Likewise. * java/org/gnu/emacs/EmacsEditable.java: Delete file. * java/org/gnu/emacs/EmacsInputConnection.java (EmacsInputConnection): Reimplement from scratch. * java/org/gnu/emacs/EmacsNative.java (EmacsNative): Add new functions. * java/org/gnu/emacs/EmacsService.java (EmacsService, getEmacsView) (getLocationOnScreen, sync, getClipboardManager, restartEmacs): Use syncRunnable. (syncRunnable): New function. (updateIC, resetIC): New functions. * java/org/gnu/emacs/EmacsView.java (EmacsView): New field `inputConnection' and `icMode'. (onCreateInputConnection): Update accordingly. (setICMode, getICMode): New functions. * lisp/bindings.el (global-map): Ignore text conversion events. * src/alloc.c (mark_frame): Mark text conversion data. * src/android.c (struct android_emacs_service): New fields `update_ic' and `reset_ic'. (event_serial): Export. (android_query_sem): New function. (android_init_events): Initialize new semaphore. (android_write_event): Export. (android_select): Check for UI thread code. (setEmacsParams, android_init_emacs_service): Initialize new methods. (android_check_query, android_begin_query, android_end_query) (android_run_in_emacs_thread): (android_update_ic, android_reset_ic): New functions for managing synchronous queries from one thread to another. * src/android.h: Export new functions. * src/androidgui.h (enum android_event_type): Add input method events. (enum android_ime_operation, struct android_ime_event) (union android_event, enum android_ic_mode): New structs and enums. * src/androidterm.c (android_window_to_frame): Allow DPYINFO to be NULL. (android_decode_utf16, android_handle_ime_event) (handle_one_android_event, android_sync_edit) (android_copy_java_string, beginBatchEdit, endBatchEdit) (commitCompletion, deleteSurroundingText, finishComposingText) (getSelectedtext, getTextAfterCursor, getTextBeforeCursor) (setComposingText, setComposingRegion, setSelection, getSelection) (performEditorAction, getExtractedText): New functions. (struct android_conversion_query_context): (android_perform_conversion_query): (android_text_to_string): (struct android_get_selection_context): (android_get_selection): (struct android_get_extracted_text_context): (android_get_extracted_text): (struct android_extracted_text_request_class): (struct android_extracted_text_class): (android_update_selection): (android_reset_conversion): (android_set_point): (android_compose_region_changed): (android_notify_conversion): (text_conversion_interface): New functions and structures. (android_term_init): Initialize text conversion. * src/coding.c (syms_of_coding): Define Qutf_16le on Android. * src/frame.c (make_frame): Clear conversion data. (delete_frame): Reset conversion state. * src/frame.h (enum text_conversion_operation) (struct text_conversion_action, struct text_conversion_state) (GCALIGNED_STRUCT): Update structures. * src/keyboard.c (read_char, readable_events, kbd_buffer_get_event) (syms_of_keyboard): Handle text conversion events. * src/lisp.h: * src/process.c: Fix includes. * src/textconv.c (enum textconv_batch_edit_flags, textconv_query) (reset_frame_state, detect_conversion_events) (restore_selected_window, really_commit_text) (really_finish_composing_text, really_set_composing_text) (really_set_composing_region, really_delete_surrounding_text) (really_set_point, complete_edit) (handle_pending_conversion_events_1) (handle_pending_conversion_events, start_batch_edit) (end_batch_edit, commit_text, finish_composing_text) (set_composing_text, set_composing_region, textconv_set_point) (delete_surrounding_text, get_extracted_text) (report_selected_window_change, report_point_change) (register_texconv_interface): New functions. * src/textconv.h (struct textconv_interface) (TEXTCONV_SKIP_CONVERSION_REGION): Update prototype. * src/xdisp.c (mark_window_display_accurate_1): * src/xfns.c (xic_string_conversion_callback): * src/xterm.c (init_xterm): Adjust accordingly.
Diffstat (limited to 'src/androidgui.h')
-rw-r--r--src/androidgui.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/androidgui.h b/src/androidgui.h
index 1f0d34e67aa..25dc6754fff 100644
--- a/src/androidgui.h
+++ b/src/androidgui.h
@@ -235,6 +235,7 @@ enum android_event_type
235 ANDROID_DEICONIFIED, 235 ANDROID_DEICONIFIED,
236 ANDROID_CONTEXT_MENU, 236 ANDROID_CONTEXT_MENU,
237 ANDROID_EXPOSE, 237 ANDROID_EXPOSE,
238 ANDROID_INPUT_METHOD,
238 }; 239 };
239 240
240struct android_any_event 241struct android_any_event
@@ -419,6 +420,52 @@ struct android_menu_event
419 int menu_event_id; 420 int menu_event_id;
420}; 421};
421 422
423enum android_ime_operation
424 {
425 ANDROID_IME_COMMIT_TEXT,
426 ANDROID_IME_DELETE_SURROUNDING_TEXT,
427 ANDROID_IME_FINISH_COMPOSING_TEXT,
428 ANDROID_IME_SET_COMPOSING_TEXT,
429 ANDROID_IME_SET_COMPOSING_REGION,
430 ANDROID_IME_SET_POINT,
431 ANDROID_IME_START_BATCH_EDIT,
432 ANDROID_IME_END_BATCH_EDIT,
433 };
434
435struct android_ime_event
436{
437 /* Type of the event. */
438 enum android_event_type type;
439
440 /* The event serial. */
441 unsigned long serial;
442
443 /* The associated window. */
444 android_window window;
445
446 /* What operation is being performed. */
447 enum android_ime_operation operation;
448
449 /* The details of the operation. START and END provide buffer
450 indices, and may actually mean ``left'' and ``right''. */
451 ptrdiff_t start, end, position;
452
453 /* The number of characters in TEXT. */
454 size_t length;
455
456 /* TEXT is either NULL, or a pointer to LENGTH bytes of malloced
457 UTF-16 encoded text that must be decoded by Emacs.
458
459 POSITION is where point should end up after the text is
460 committed, relative to TEXT. If POSITION is less than 0, it is
461 relative to TEXT's start; otherwise, it is relative to its
462 end. */
463 unsigned short *text;
464
465 /* Value to set the counter to after the operation completes. */
466 unsigned long counter;
467};
468
422union android_event 469union android_event
423{ 470{
424 enum android_event_type type; 471 enum android_event_type type;
@@ -447,6 +494,9 @@ union android_event
447 494
448 /* This is only used to transmit selected menu items. */ 495 /* This is only used to transmit selected menu items. */
449 struct android_menu_event menu; 496 struct android_menu_event menu;
497
498 /* This is used to dispatch input method editing requests. */
499 struct android_ime_event ime;
450}; 500};
451 501
452enum 502enum
@@ -463,6 +513,13 @@ enum android_lookup_status
463 ANDROID_LOOKUP_BOTH, 513 ANDROID_LOOKUP_BOTH,
464 }; 514 };
465 515
516enum android_ic_mode
517 {
518 ANDROID_IC_MODE_NULL = 0,
519 ANDROID_IC_MODE_ACTION = 1,
520 ANDROID_IC_MODE_TEXT = 2,
521 };
522
466extern int android_pending (void); 523extern int android_pending (void);
467extern void android_next_event (union android_event *); 524extern void android_next_event (union android_event *);
468 525
@@ -554,6 +611,9 @@ extern void android_sync (void);
554extern int android_wc_lookup_string (android_key_pressed_event *, 611extern int android_wc_lookup_string (android_key_pressed_event *,
555 wchar_t *, int, int *, 612 wchar_t *, int, int *,
556 enum android_lookup_status *); 613 enum android_lookup_status *);
614extern void android_update_ic (android_window, ptrdiff_t, ptrdiff_t,
615 ptrdiff_t, ptrdiff_t);
616extern void android_reset_ic (android_window, enum android_ic_mode);
557 617
558#endif 618#endif
559 619