diff options
author | 2021-08-11 19:23:05 +0700 | |
---|---|---|
committer | 2021-08-11 19:48:55 +0700 | |
commit | 7337ab63bc9e167116f8adbfedb5a8e8203a4a5b (patch) | |
tree | bb4881a08b483bca5b356f8d2c1aac7c454c8352 /src | |
parent | e3bc050aaeb0b7d5a5d463ed06911128e2d6753f (diff) | |
download | iced-7337ab63bc9e167116f8adbfedb5a8e8203a4a5b.tar.gz iced-7337ab63bc9e167116f8adbfedb5a8e8203a4a5b.tar.bz2 iced-7337ab63bc9e167116f8adbfedb5a8e8203a4a5b.zip |
Introduce explicit `id` field to `Settings`
... and use it to set the application id of the window on Unix systems, instead of relying on the title of the application.
Diffstat (limited to 'src')
-rw-r--r-- | src/settings.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/settings.rs b/src/settings.rs index 480bf813..d726dc4f 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -4,12 +4,18 @@ use crate::window; /// The settings of an application. #[derive(Debug, Clone)] pub struct Settings<Flags> { + /// The identifier of the application. + /// + /// If provided, this identifier may be used to identify the application or + /// communicate with it through the windowing system. + pub id: Option<String>, + /// The window settings. /// /// They will be ignored on the Web. pub window: window::Settings, - /// The data needed to initialize an [`Application`]. + /// The data needed to initialize the [`Application`]. /// /// [`Application`]: crate::Application pub flags: Flags, @@ -58,6 +64,7 @@ impl<Flags> Settings<Flags> { Self { flags, + id: default_settings.id, window: default_settings.window, default_font: default_settings.default_font, default_text_size: default_settings.default_text_size, @@ -74,8 +81,9 @@ where { fn default() -> Self { Self { - flags: Default::default(), + id: None, window: Default::default(), + flags: Default::default(), default_font: Default::default(), default_text_size: 20, text_multithreading: false, @@ -89,6 +97,7 @@ where impl<Flags> From<Settings<Flags>> for iced_winit::Settings<Flags> { fn from(settings: Settings<Flags>) -> iced_winit::Settings<Flags> { iced_winit::Settings { + id: settings.id, window: settings.window.into(), flags: settings.flags, exit_on_close_request: settings.exit_on_close_request, |