slint/internal/backends/winit
Simon Hausmann 3101104f5c Switch from WGPU 24 to WGPU 25
- Use a version of FemtoVG that uses WGPU 25
- Rename the unstable-wgpu-24 feature and wgpu_24 module
- Fetch bevy from a revision on master branch that switches to WGPU 25
- Move the bevy example out of the common workspace: That way users of the repo don't get bevy pulled from git, unless they want to build the bevy example.
2025-07-09 11:30:05 +02:00
..
LICENSES Simplify commercial license (#3063) 2024-05-31 14:06:17 +02:00
renderer Switch from WGPU 24 to WGPU 25 2025-07-09 11:30:05 +02:00
accesskit.rs Renames after the API review 2025-06-06 12:31:50 +02:00
build.rs winit backend: Enable Skia by default on iOS, etc. (but not macOS) 2025-05-09 20:54:47 +02:00
Cargo.toml Switch from WGPU 24 to WGPU 25 2025-07-09 11:30:05 +02:00
clipboard.rs Clean up cfgs for Apple operating systems 2025-05-09 20:54:47 +02:00
drag_resize_window.rs Fix two winit deprecation warnings 2024-06-18 17:48:17 +02:00
event_loop.rs winit: Abort the event loop if creating a window failed 2025-06-16 11:06:20 +02:00
frame_throttle.rs winit: Add support for timer based frame throttling (#8828) 2025-07-02 09:37:57 +02:00
lib.rs Switch from WGPU 24 to WGPU 25 2025-07-09 11:30:05 +02:00
muda.rs Menu: Add icon property 2025-06-26 18:45:37 +02:00
README.md Simplify commercial license (#3063) 2024-05-31 14:06:17 +02:00
wasm_input_helper.rs winit backend: remove the GLOBAL_PROXY 2025-04-09 08:50:39 +02:00
winitwindowadapter.rs winit: Add support for timer based frame throttling (#8828) 2025-07-02 09:37:57 +02:00
xdg_color_scheme.rs backend-winit: Don't call deprecated xdg settings portal method 2025-01-16 09:57:00 +00:00

NOTE: This library is an internal crate of the Slint project. This crate should not be used directly by applications using Slint. You should use the slint crate instead.

WARNING: This crate does not follow the semver convention for versioning and can only be used with version = "=x.y.z" in Cargo.toml.

The Slint winit Backend

This crate implements the winit backend/platform for Slint. It is enabled by default as a default feature of the slint crate.

Although this crate is primarily internal, it can also be used by applications to leverage the full power of [winit::window::Window] for Slint Window.

To use this functionality, you need to be cautious when importing dependencies since this crate does not adhere to semver and may introduce breaking changes in any patch release. Additionally, the version of this crate must match the version of Slint. To indicate that you specifically want this version, include the = symbol in the version string.

Make sure that the version of winit matches the version used by this crate. Check this crate's dependencies to determine the required version.

[dependencies]
slint = { version = "x.y.z", ... }
i-slint-backend-winit = "=x.y.z"
winit = "0.w"

To ensure that the runtime backend is selected, initialize the backend as the first step in the main function:

fn main() {
    slint::platform::set_platform(Box::new(i_slint_backend_winit::Backend::new().unwrap()));
    // ...
}

Once you have a slint::Window (accessible through the window() function of the generated component), you can utilize the [WinitWindowAccessor::with_winit_window] function to access the [winit::window::Window] object.

# // similar to code generated by the slint! macro
# struct C; impl C { fn window(&self) ->i_slint_core::api::Window {todo!()} }
# let my_ui = C;
use i_slint_backend_winit::WinitWindowAccessor; // import the trait
my_ui.window().with_winit_window(|winit_window: &winit::window::Window| {
    // Here, you can use the winit API
});