Skip to content

Commit

Permalink
wayland: avoid panic w/ resize of hidden frame, part 2
Browse files Browse the repository at this point in the history
refs: #4948
  • Loading branch information
wez committed Feb 4, 2024
1 parent 2ce302c commit 32f5d1c
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions window/src/os/wayland/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,9 @@ impl WaylandWindow {
FallbackFrame::new(&window, shm, subcompositor, qh.clone())
.expect("failed to create csd frame")
};
let hidden = if let Some(decor) = decor_mode {
match decor {
DecorationMode::Client => false,
_ => true,
}
} else {
true
let hidden = match decor_mode {
Some(DecorationMode::Client) => false,
_ => true,
};
window_frame.set_hidden(hidden);
if !hidden {
Expand Down Expand Up @@ -802,15 +798,16 @@ impl WaylandWindowInner {
// Clamp the size to at least one pixel.
let width = width.unwrap_or(NonZeroU32::new(1).unwrap());
let height = height.unwrap_or(NonZeroU32::new(1).unwrap());
self.window_frame.resize(width, height);
if !self.window_frame.is_hidden() {
self.window_frame.resize(width, height);
}
let (x, y) = self.window_frame.location();
let outer_size = self.window_frame.add_borders(width.get(), height.get());
self.window
.as_mut()
.unwrap()
.xdg_surface()
.set_window_geometry(x, y, outer_size.0 as i32, outer_size.1 as i32);
// }
// Compute the new pixel dimensions
let new_dimensions = Dimensions {
pixel_width: pixel_width.try_into().unwrap(),
Expand Down

0 comments on commit 32f5d1c

Please sign in to comment.