Input methods that correct the text around the cursor, such as Vietnamese engines and predictive keyboards, need the field's text (text-input-v3 `set_surrounding_text`) and a way to delete part of it (`delete_surrounding_text`). winit master added both with new core types and an `Ime::DeleteSurrounding` event; winit 0.30's `Ime` enum is exhaustive, so they come here as a Wayland extension instead: - `WindowExtWayland::set_ime_surrounding_text(text, cursor, anchor)` clamps the byte offsets to character boundaries and cuts text over the protocol's 4000 bytes around the cursor and selection. Enabling a text input sends it again with the purpose and cursor area, which enabling resets; disallowing IME forgets it. - A deletion goes out with the `Ime::Commit` of the same input method update, an empty one if the update has no commit. `WindowExtWayland::take_ime_delete_surrounding` returns it while that commit is handled, so the application deletes after removing the preedit and before inserting the text, in text-input-v3's order. Co-authored-by: DorotaC <43449960+dcz-self@users.noreply.github.com>
winit - Cross-platform window creation and management in Rust
[dependencies]
winit = "0.30.13"
Documentation
For features within the scope of winit, see FEATURES.md.
For features outside the scope of winit, see Are we GUI Yet? and Are we game yet?, depending on what kind of project you're looking to do.
Contact Us
The maintainers have a meeting every friday at UTC 15. The meeting notes can be found here.
Usage
Winit is a window creation and management library. It can create windows and lets you handle events (for example: the window being resized, a key being pressed, a mouse movement, etc.) produced by the window.
Winit is designed to be a low-level brick in a hierarchy of libraries. Consequently, in order to show something on the window you need to use the platform-specific getters provided by winit, or another library.
CONTRIBUTING
For contributing guidelines see CONTRIBUTING.md.
MSRV Policy
This crate's Minimum Supported Rust Version (MSRV) is 1.70. Changes to the MSRV will be accompanied by a minor version bump.
As a tentative policy, the upper bound of the MSRV is given by the following formula:
min(sid, stable - 3)
Where sid is the current version of rustc provided by Debian Sid, and
stable is the latest stable version of Rust. This bound may be broken in case of a major ecosystem shift or a security vulnerability.
The exception is for the Android platform, where a higher Rust version must be used for certain Android features. In this case, the MSRV will be capped at the latest stable version of Rust minus three. This inconsistency is not reflected in Cargo metadata, as it is not powerful enough to expose this restriction.
All crates in the rust-windowing organizations have the
same MSRV policy.
Platform-specific usage
Check out the winit::platform module for platform-specific usage.