Commit 734e8af
committed
Add basic IME support for Android
This adds basic support for Ime events to the Android backend.
Note that this will only work when running with the game-activity
backend, which uses AGDK GameText to forward Android IME events:
https://developer.android.com/games/agdk/add-support-for-text-input
Normally on Android, input methods track three things:
- Surrounding text
- A compose region
- A selection
Since Winit (0.30) doesn't track surrounding text and therefore also
wouldn't be able to handle orthogonal compose + selection regions within
some surrounding text, we can treat the whole text region that we edit
as the "preedit" string, and we can then treat the compose region as the
optional selection within the preedit string.
I've tested this with Egui 0.33
I've seem some quirky cases when testing with Egui (such as if you try
and move the cursor in the Egui widget while you're in the middle of
entering text via a soft keyboard) but I think those are related to
general shortcomings of the winit 0.30 IME API and Egui's support for
IMEs (there's no way for Egui to notify through Winit that the cursor
position has changed).1 parent f6893a4 commit 734e8af
3 files changed
+55
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
1 | 8 | | |
2 | 9 | | |
3 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
466 | 468 | | |
467 | 469 | | |
468 | 470 | | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
469 | 496 | | |
470 | 497 | | |
471 | 498 | | |
| |||
770 | 797 | | |
771 | 798 | | |
772 | 799 | | |
| 800 | + | |
773 | 801 | | |
774 | 802 | | |
775 | 803 | | |
| |||
779 | 807 | | |
780 | 808 | | |
781 | 809 | | |
782 | | - | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
783 | 815 | | |
784 | 816 | | |
785 | 817 | | |
| |||
909 | 941 | | |
910 | 942 | | |
911 | 943 | | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
912 | 947 | | |
913 | 948 | | |
914 | 949 | | |
915 | 950 | | |
916 | 951 | | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
917 | 962 | | |
918 | 963 | | |
919 | 964 | | |
| |||
0 commit comments