Skip to content

Commit

Permalink
On X11, fix window hints not persisting
Browse files Browse the repository at this point in the history
This commit fixes the issue with min, max, and resize increments
not persisting across the dpi changes.
  • Loading branch information
necauqua authored Aug 8, 2022
1 parent 6b7ceed commit cdbaf48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions src/platform_impl/linux/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit cdbaf48

Please sign in to comment.