Skip to content

Commit

Permalink
Fixed a GTK shell regression caused by #1057. (#1149)
Browse files Browse the repository at this point in the history
On GTK we need to create an initial Cairo surface, even if there's no resize.
  • Loading branch information
jneem authored Aug 22, 2020
1 parent 5417678 commit 61c9882
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions druid-shell/src/platform/gtk/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,12 @@ impl WindowBuilder {
}
}

// Check if the size of the window has changed
// Create a new cairo surface if necessary (either because there is no surface, or
// because the size or scale changed).
let extents = widget.get_allocation();
let size_px = Size::new(extents.width as f64, extents.height as f64);
if scale_changed || state.area.get().size_px() != size_px {
let no_surface = state.surface.try_borrow().map(|x| x.is_none()).ok() == Some(true);
if no_surface || scale_changed || state.area.get().size_px() != size_px {
let area = ScaledArea::from_px(size_px, scale);
let size_dp = area.size_dp();
state.area.set(area);
Expand Down

0 comments on commit 61c9882

Please sign in to comment.