feat: allow creating apps with no main window on wayland
This commit is contained in:
parent
db8e791b87
commit
55416c8b9d
2 changed files with 21 additions and 11 deletions
|
|
@ -80,17 +80,21 @@ pub fn run<App: Application>(settings: Settings, flags: App::Flags) -> iced::Res
|
||||||
{
|
{
|
||||||
use iced::wayland::actions::window::SctkWindowSettings;
|
use iced::wayland::actions::window::SctkWindowSettings;
|
||||||
use iced_sctk::settings::InitialSurface;
|
use iced_sctk::settings::InitialSurface;
|
||||||
iced.initial_surface = InitialSurface::XdgWindow(SctkWindowSettings {
|
iced.initial_surface = if settings.no_main_window {
|
||||||
app_id: Some(App::APP_ID.to_owned()),
|
InitialSurface::None
|
||||||
autosize: settings.autosize,
|
} else {
|
||||||
client_decorations: settings.client_decorations,
|
InitialSurface::XdgWindow(SctkWindowSettings {
|
||||||
resizable: settings.resizable,
|
app_id: Some(App::APP_ID.to_owned()),
|
||||||
size: settings.size,
|
autosize: settings.autosize,
|
||||||
size_limits: settings.size_limits,
|
client_decorations: settings.client_decorations,
|
||||||
title: None,
|
resizable: settings.resizable,
|
||||||
transparent: settings.transparent,
|
size: settings.size,
|
||||||
..SctkWindowSettings::default()
|
size_limits: settings.size_limits,
|
||||||
});
|
title: None,
|
||||||
|
transparent: settings.transparent,
|
||||||
|
..SctkWindowSettings::default()
|
||||||
|
})
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "wayland"))]
|
#[cfg(not(feature = "wayland"))]
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ pub struct Settings {
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
pub(crate) autosize: bool,
|
pub(crate) autosize: bool,
|
||||||
|
|
||||||
|
/// Set the application to not create a main window
|
||||||
|
#[cfg(feature = "wayland")]
|
||||||
|
pub(crate) no_main_window: bool,
|
||||||
|
|
||||||
/// Whether the window should have a border, a title bar, etc. or not.
|
/// Whether the window should have a border, a title bar, etc. or not.
|
||||||
pub(crate) client_decorations: bool,
|
pub(crate) client_decorations: bool,
|
||||||
|
|
||||||
|
|
@ -71,6 +75,8 @@ impl Default for Settings {
|
||||||
antialiasing: true,
|
antialiasing: true,
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
autosize: false,
|
autosize: false,
|
||||||
|
#[cfg(feature = "wayland")]
|
||||||
|
no_main_window: false,
|
||||||
client_decorations: true,
|
client_decorations: true,
|
||||||
debug: false,
|
debug: false,
|
||||||
default_font: font::FONT,
|
default_font: font::FONT,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue