From 8738ff70fd09e7d3aae83a168cdf9cd8c4a705cf Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Fri, 20 Aug 2021 10:17:03 +0530 Subject: [PATCH 1/2] impl PartialEq for WindowConfig and WindowLevel --- druid-shell/src/window.rs | 2 +- druid/src/app.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/druid-shell/src/window.rs b/druid-shell/src/window.rs index 5e5258a790..74b6976ae3 100644 --- a/druid-shell/src/window.rs +++ b/druid-shell/src/window.rs @@ -148,7 +148,7 @@ impl FileDialogToken { /// Levels in the window system - Z order for display purposes. /// Describes the purpose of a window and should be mapped appropriately to match platform /// conventions. -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq)] pub enum WindowLevel { /// A top level app window. AppWindow, diff --git a/druid/src/app.rs b/druid/src/app.rs index 543d5d1bec..d688081d1c 100644 --- a/druid/src/app.rs +++ b/druid/src/app.rs @@ -51,7 +51,7 @@ pub enum WindowSizePolicy { /// Window configuration that can be applied to a WindowBuilder, or to an existing WindowHandle. /// It does not include anything related to app data. -#[derive(Debug)] +#[derive(Debug, PartialEq)] pub struct WindowConfig { pub(crate) size_policy: WindowSizePolicy, pub(crate) size: Option, From a4dbefb62d07b6ae80f3cfe088e1a8191ec1602a Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Fri, 20 Aug 2021 10:17:34 +0530 Subject: [PATCH 2/2] WindowDesc::with_config --- CHANGELOG.md | 2 ++ druid/src/app.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ff86f4650..8d1bb0d567 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ You can find its changes [documented below](#070---2021-01-01). - Widget/Slider: Add stepping functionality ([#1875] by [@raymanfx]) - Add #[data(eq)] shorthand attribute for Data derive macro ([#1884] by [@Maan2003]) - X11: detect keyboard layout ([#1779] by [@Maan2003]) +- WindowDesc::with_config ([#1929] by [@Maan2003]) ### Changed @@ -782,6 +783,7 @@ Last release without a changelog :( [#1885]: https://github.com/linebender/druid/pull/1885 [#1886]: https://github.com/linebender/druid/pull/1886 [#1907]: https://github.com/linebender/druid/pull/1907 +[#1929]: https://github.com/linebender/druid/pull/1929 [Unreleased]: https://github.com/linebender/druid/compare/v0.7.0...master [0.7.0]: https://github.com/linebender/druid/compare/v0.6.0...v0.7.0 diff --git a/druid/src/app.rs b/druid/src/app.rs index d688081d1c..b9f79596d0 100644 --- a/druid/src/app.rs +++ b/druid/src/app.rs @@ -582,6 +582,12 @@ impl WindowDesc { self } + /// Set the [`WindowConfig`] of window. + pub fn with_config(mut self, config: WindowConfig) -> Self { + self.config = config; + self + } + /// Attempt to create a platform window from this `WindowDesc`. pub(crate) fn build_native( self,