Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WindowDesc::with_config and impl PartialEq for WindowConfig, WindowLevel #1929

Merged
merged 2 commits into from
Aug 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion druid-shell/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion druid/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Size>,
Expand Down Expand Up @@ -582,6 +582,12 @@ impl<T: Data> WindowDesc<T> {
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,
Expand Down