diff options
| author | Po Lu | 2023-02-12 20:32:25 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-12 20:32:25 +0800 |
| commit | 0198b8cffd82893412c738dae8e50c45a99286f1 (patch) | |
| tree | 5dd87dc03d1c1ee08205c988f2c287f714f1cfa3 /src/coding.c | |
| parent | ab48881a2fb72df016f2a00bc107e5a35a411a9d (diff) | |
| download | emacs-0198b8cffd82893412c738dae8e50c45a99286f1.tar.gz emacs-0198b8cffd82893412c738dae8e50c45a99286f1.zip | |
Update Android port
* doc/emacs/android.texi (Android Environment): Document
notifications permission.
* java/org/gnu/emacs/EmacsEditable.java (EmacsEditable):
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection): New files.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Load
library dependencies in a less verbose fashion.
* java/org/gnu/emacs/EmacsView.java (EmacsView): Make imManager
public.
(onCreateInputConnection): Set InputType to TYPE_NULL for now.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, onKeyDown)
(onKeyUp, getEventUnicodeChar): Correctly handle key events with
strings.
* lisp/term/android-win.el (android-clear-preedit-text)
(android-preedit-text): New special event handlers.
* src/android.c (struct android_emacs_window): Add function
lookup_string.
(android_init_emacs_window): Adjust accordingly.
(android_wc_lookup_string): New function.
* src/androidgui.h (struct android_key_event): Improve
commentary.
(enum android_lookup_status): New enum.
* src/androidterm.c (handle_one_android_event): Synchronize IM
lookup code with X.
* src/coding.c (from_unicode_buffer): Implement on Android.
* src/coding.h:
* src/sfnt.c: Fix commentary.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/coding.c b/src/coding.c index a2e0d7040f8..be5a0252ede 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -8495,7 +8495,7 @@ preferred_coding_system (void) | |||
| 8495 | return CODING_ID_NAME (id); | 8495 | return CODING_ID_NAME (id); |
| 8496 | } | 8496 | } |
| 8497 | 8497 | ||
| 8498 | #if defined (WINDOWSNT) || defined (CYGWIN) | 8498 | #if defined (WINDOWSNT) || defined (CYGWIN) || defined HAVE_ANDROID |
| 8499 | 8499 | ||
| 8500 | Lisp_Object | 8500 | Lisp_Object |
| 8501 | from_unicode (Lisp_Object str) | 8501 | from_unicode (Lisp_Object str) |
| @@ -8513,10 +8513,34 @@ from_unicode (Lisp_Object str) | |||
| 8513 | Lisp_Object | 8513 | Lisp_Object |
| 8514 | from_unicode_buffer (const wchar_t *wstr) | 8514 | from_unicode_buffer (const wchar_t *wstr) |
| 8515 | { | 8515 | { |
| 8516 | /* We get one of the two final null bytes for free. */ | 8516 | if (sizeof (wchar_t) == 2) |
| 8517 | ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); | 8517 | { |
| 8518 | AUTO_STRING_WITH_LEN (str, (char *) wstr, len); | 8518 | /* We get one of the two final null bytes for free. */ |
| 8519 | return from_unicode (str); | 8519 | ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); |
| 8520 | AUTO_STRING_WITH_LEN (str, (char *) wstr, len); | ||
| 8521 | return from_unicode (str); | ||
| 8522 | } | ||
| 8523 | else | ||
| 8524 | { | ||
| 8525 | /* This code is used only on Android, where little endian UTF-16 | ||
| 8526 | strings are extended to 32-bit wchar_t. */ | ||
| 8527 | |||
| 8528 | uint16_t *words; | ||
| 8529 | size_t length, i; | ||
| 8530 | |||
| 8531 | length = wcslen (wstr) + 1; | ||
| 8532 | |||
| 8533 | USE_SAFE_ALLOCA; | ||
| 8534 | SAFE_NALLOCA (words, sizeof *words, length); | ||
| 8535 | |||
| 8536 | for (i = 0; i < length - 1; ++i) | ||
| 8537 | words[i] = wstr[i]; | ||
| 8538 | |||
| 8539 | words[i] = '\0'; | ||
| 8540 | AUTO_STRING_WITH_LEN (str, (char *) words, | ||
| 8541 | (length - 1) * sizeof *words); | ||
| 8542 | return unbind_to (sa_count, from_unicode (str)); | ||
| 8543 | } | ||
| 8520 | } | 8544 | } |
| 8521 | 8545 | ||
| 8522 | wchar_t * | 8546 | wchar_t * |
| @@ -8536,7 +8560,7 @@ to_unicode (Lisp_Object str, Lisp_Object *buf) | |||
| 8536 | return WCSDATA (*buf); | 8560 | return WCSDATA (*buf); |
| 8537 | } | 8561 | } |
| 8538 | 8562 | ||
| 8539 | #endif /* WINDOWSNT || CYGWIN */ | 8563 | #endif /* WINDOWSNT || CYGWIN || HAVE_ANDROID */ |
| 8540 | 8564 | ||
| 8541 | 8565 | ||
| 8542 | /*** 8. Emacs Lisp library functions ***/ | 8566 | /*** 8. Emacs Lisp library functions ***/ |