diff options
author | 2021-08-11 19:23:05 +0700 | |
---|---|---|
committer | 2021-08-11 19:48:55 +0700 | |
commit | 7337ab63bc9e167116f8adbfedb5a8e8203a4a5b (patch) | |
tree | bb4881a08b483bca5b356f8d2c1aac7c454c8352 /winit/src/settings.rs | |
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 '')
-rw-r--r-- | winit/src/settings.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/winit/src/settings.rs b/winit/src/settings.rs index 6051e5bc..72a1a24a 100644 --- a/winit/src/settings.rs +++ b/winit/src/settings.rs @@ -16,6 +16,12 @@ use winit::window::WindowBuilder; /// The settings of an application. #[derive(Debug, Clone, Default)] 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 pub window: Window, @@ -70,6 +76,7 @@ impl Window { title: &str, mode: Mode, primary_monitor: Option<MonitorHandle>, + _id: Option<String>, ) -> WindowBuilder { let mut window_builder = WindowBuilder::new(); @@ -112,7 +119,10 @@ impl Window { ))] { use ::winit::platform::unix::WindowBuilderExtUnix; - window_builder = window_builder.with_app_id(title.to_string()); + + if let Some(id) = _id { + window_builder = window_builder.with_app_id(id); + } } #[cfg(target_os = "windows")] @@ -122,6 +132,7 @@ impl Window { if let Some(parent) = self.platform_specific.parent { window_builder = window_builder.with_parent_window(parent); } + window_builder = window_builder .with_drag_and_drop(self.platform_specific.drag_and_drop); } |