mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
backend selector: Prefer the winit backend over the default backend (… (#8402)
On Linux, if Qt is found, the qt backend is the default. This backend doesn't support selecting graphics APIs, thus the OpenGL and WGPU examples don't run out of the box. This patch fixes that by preferring winit.
This commit is contained in:
parent
126955fd1e
commit
8e046a2553
1 changed files with 9 additions and 1 deletions
|
@ -211,7 +211,15 @@ impl BackendSelector {
|
|||
}
|
||||
}
|
||||
|
||||
let backend_name = self.backend.as_deref().unwrap_or(super::DEFAULT_BACKEND_NAME);
|
||||
let backend_name = self.backend.as_deref().unwrap_or_else(|| {
|
||||
// Only the winit backend supports graphics API requests right now, so prefer that over
|
||||
// aborting.
|
||||
#[cfg(feature = "i-slint-backend-winit")]
|
||||
if self.requested_graphics_api.is_some() {
|
||||
return "winit";
|
||||
}
|
||||
super::DEFAULT_BACKEND_NAME
|
||||
});
|
||||
|
||||
let backend: Box<dyn i_slint_core::platform::Platform> = match backend_name {
|
||||
#[cfg(all(feature = "i-slint-backend-linuxkms", target_os = "linux"))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue