From 94e991a785eddcc1c706a5a7111e1e88b18aef41 Mon Sep 17 00:00:00 2001 From: Cory Forsstrom Date: Fri, 21 Jul 2023 13:57:49 -0700 Subject: [PATCH 1/2] Add app id setting for linux --- winit/src/settings.rs | 28 +++++++++++++++++++++++++++- winit/src/settings/linux.rs | 11 +++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 winit/src/settings/linux.rs diff --git a/winit/src/settings.rs b/winit/src/settings.rs index 40b3d487d1..8d3e1b47fd 100644 --- a/winit/src/settings.rs +++ b/winit/src/settings.rs @@ -7,6 +7,10 @@ mod platform; #[path = "settings/macos.rs"] mod platform; +#[cfg(target_os = "linux")] +#[path = "settings/linux.rs"] +mod platform; + #[cfg(target_arch = "wasm32")] #[path = "settings/wasm.rs"] mod platform; @@ -14,6 +18,7 @@ mod platform; #[cfg(not(any( target_os = "windows", target_os = "macos", + target_os = "linux", target_arch = "wasm32" )))] #[path = "settings/other.rs"] @@ -150,7 +155,6 @@ impl Window { } #[cfg(any( - target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", @@ -192,6 +196,28 @@ impl Window { ); } + #[cfg(target_os = "linux")] + { + #[cfg(feature = "x11")] + { + use winit::platform::x11::WindowBuilderExtX11; + + window_builder = window_builder.with_name( + &self.platform_specific.application_id, + &self.platform_specific.application_id, + ); + } + #[cfg(feature = "wayland")] + { + use winit::platform::wayland::WindowBuilderExtWayland; + + window_builder = window_builder.with_name( + &self.platform_specific.application_id, + &self.platform_specific.application_id, + ); + } + } + window_builder } } diff --git a/winit/src/settings/linux.rs b/winit/src/settings/linux.rs new file mode 100644 index 0000000000..009b9d9e0a --- /dev/null +++ b/winit/src/settings/linux.rs @@ -0,0 +1,11 @@ +//! Platform specific settings for Linux. + +/// The platform specific window settings of an application. +#[derive(Debug, Clone, PartialEq, Eq, Default)] +pub struct PlatformSpecific { + /// Sets the application id of the window. + /// + /// As a best practice, it is suggested to select an application id that match + /// the basename of the application’s .desktop file. + pub application_id: String, +} From 13c8d965d3295c83a6b77b1831db1139833a5b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 26 Jul 2023 20:15:49 +0200 Subject: [PATCH 2/2] Update `CHANGELOG` --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7174bb81b..4481008fe7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Conversion support from `Fn` trait to custom theme. [#1861](https://github.com/iced-rs/iced/pull/1861) - Configurable border radii on relevant widgets. [#1869](https://github.com/iced-rs/iced/pull/1869) - `border_radius` styling to `Slider` rail. [#1892](https://github.com/iced-rs/iced/pull/1892) +- `application_id` in `PlatformSpecific` settings for Linux. [#1963](https://github.com/iced-rs/iced/pull/1963) - Aliased entries in `text::Cache`. [#1934](https://github.com/iced-rs/iced/pull/1934) - Text cache modes. [#1938](https://github.com/iced-rs/iced/pull/1938) - `operate` method for `program::State`. [#1913](https://github.com/iced-rs/iced/pull/1913)