Repository navigation
feat(winit-android): Ime events from the application, an event loop that ends with its activity, and DeleteSurrounding in text inputs - #21
Merged
Conversation
…eSurrounding A text input ignored `Ime::DeleteSurrounding` (a `TODO`), so an input method that deletes before its next step (a correction, a word composed again, Backspace from a keyboard that edits text rather than sending keys) left the old text in place and typed after it. It now deletes that many bytes after and before the selection, with parley's `delete_bytes_after_selection` and `delete_bytes_before_selection`, and reports an input event. Behavioural-change: a text input deletes the text an `Ime::DeleteSurrounding` names, and fires `input`, where it did nothing.
…e event loop on Destroy A NativeActivity gives an input method no InputConnection, so winit-android reported no `WindowEvent::Ime`, and a soft keyboard could only send keys. `winit_android::ime::send` takes an `Ime` event from any thread (from an application's own input connection, a Java view over the activity) and the event loop delivers it to the window as `WindowEvent::Ime`. `MainEvent::Destroy` was a `TODO`, and the loop outlived its activity in a process Android keeps for the next one; launched again, the app called `android_main` there, winit refused a second event loop, and nothing drew. The loop now exits on `Destroy`, so `run_app` returns. Vendored unmodified in the commit before; patches/winit-android/PATCH.md says what changed and why. FORK.md lists it. Behavioural-change: on Android, `run_app` returns when the activity is destroyed, instead of the event loop running on.
adammharris
marked this pull request as ready for review
October 23, 2026 21:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For Diaryx's Android app (diaryx-org/diaryx, stacked on DioxusLabs#197).
winit-android, vendored and patched (
patches/winit-android, see itsPATCH.md)winit_android::ime::send(Ime): queues anImeevent from any thread and wakes the loop, which delivers it to the window asWindowEvent::Ime. A NativeActivity gives the input method no InputConnection, so winit reported no IME events and a soft keyboard could only send keys. Diaryx gives the input method a connection of its own (a Java view over the activity), and now hands winit what it hears. Blitz's<input>s, which read only the window's events, then get accents, emoji, suggestions, swipe and corrections like the rest.MainEvent::Destroy(aTODObefore). Until now it outlived its activity in a process Android keeps. On the next launchandroid_mainran again there, winit refused a second event loop, and the app stood on its splash screen.The first commit vendors 0.31.0-beta.3 unmodified, so the second shows the patch alone.
blitz-dom
Ime::DeleteSurroundingin a text input was aTODO. It now deletes the bytes either side of the selection (parley'sdelete_bytes_after_selectionanddelete_bytes_before_selection) and firesinput.Tested
Tested in Diaryx on the API 36 emulator with Gboard, in a Blitz
<input>: a long-press accent (ë), an emoji from the panel, Backspace over it, a swiped word, a picked suggestion replacing the word before the caret. Then Back out of the app and relaunch, three times: the process ends and the app opens each time.FORK.md lists the new patch.
WPT results
Subtests: 1621 newly passing, 796 newly failing (net +825). Tests: 20 added, 130 removed. Crashes: +25. Timeouts: -2.
Subtest changes by area (75 areas)
Full diff (283 changed tests)
Generated by the WPT workflow.