Unify window size rounding strategy on GTK.
@@ -428,10 +428,9 @@ impl WindowBuilder {
if let Some(min_size_dp) = self.min_size {
let min_area = ScaledArea::from_dp(min_size_dp, scale);
let min_size_px = min_area.size_px();
- win_state.drawing_area.set_size_request(
- min_size_px.width.round() as i32,
- min_size_px.height.round() as i32,
- );
+ win_state
+ .drawing_area
+ .set_size_request(min_size_px.width as i32, min_size_px.height as i32);
}
win_state
@@ -1052,15 +1051,18 @@ impl WindowHandle {
}
}
+ /// Sets the size of the window in display points
pub fn set_size(&self, size: Size) {
if let Some(state) = self.state.upgrade() {
- let px = size.to_px(state.scale.get());
+ let area = ScaledArea::from_dp(size, state.scale.get());
+ let size_px = area.size_px();
state
.window
- .resize(px.width.round() as i32, px.height.round() as i32)
+ .resize(size_px.width as i32, size_px.height as i32);
}
}
+ /// Gets the size of the window in display points
pub fn get_size(&self) -> Size {
if let Some(state) = self.state.upgrade() {
let (x, y) = state.window.size();
