From cdbaf4816a8f03b3177255e4b0e5f4676033bc3a Mon Sep 17 00:00:00 2001 From: Anton Bulakh Date: Mon, 8 Aug 2022 17:27:11 +0300 Subject: [PATCH] On X11, fix window hints not persisting This commit fixes the issue with min, max, and resize increments not persisting across the dpi changes. --- CHANGELOG.md | 1 + src/platform_impl/linux/x11/window.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc0402ccfc..5633f7b23d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ And please only add new entries to the top of this list, right below the `# Unre # Unreleased +- On X11, fix min, max and resize increment hints not persisting for resizable windows (e.g. on DPI change). - On Windows, respect min/max inner sizes when creating the window. # 0.27.1 (2022-07-30) diff --git a/src/platform_impl/linux/x11/window.rs b/src/platform_impl/linux/x11/window.rs index eb3326475b..ab7cddfa42 100644 --- a/src/platform_impl/linux/x11/window.rs +++ b/src/platform_impl/linux/x11/window.rs @@ -371,15 +371,15 @@ impl UnownedWindow { } else { max_inner_size = Some(dimensions.into()); min_inner_size = Some(dimensions.into()); - - let mut shared_state = window.shared_state.get_mut(); - shared_state.min_inner_size = window_attrs.min_inner_size; - shared_state.max_inner_size = window_attrs.max_inner_size; - shared_state.resize_increments = pl_attribs.resize_increments; - shared_state.base_size = pl_attribs.base_size; } } + let mut shared_state = window.shared_state.get_mut(); + shared_state.min_inner_size = min_inner_size.map(Into::into); + shared_state.max_inner_size = max_inner_size.map(Into::into); + shared_state.resize_increments = pl_attribs.resize_increments; + shared_state.base_size = pl_attribs.base_size; + let mut normal_hints = util::NormalHints::new(xconn); normal_hints.set_position(position.map(|PhysicalPosition { x, y }| (x, y))); normal_hints.set_size(Some(dimensions));