fix: Round up the width under HIDPI (#374)

This commit is contained in:
磁铁开发部(MDD) 2026-02-16 06:52:49 +08:00 committed by GitHub
parent 86f5bd5d86
commit 536bd32efc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -472,8 +472,8 @@ pub(super) fn update_surface_viewport(
let dims = &window_data.attrs.dims; let dims = &window_data.attrs.dims;
let size_hints = &window_data.attrs.size_hints; let size_hints = &window_data.attrs.size_hints;
let width = (dims.width as f64 / scale_factor.0) as i32; let width = (dims.width as f64 / scale_factor.0).ceil() as i32;
let height = (dims.height as f64 / scale_factor.0) as i32; let height = (dims.height as f64 / scale_factor.0).ceil() as i32;
if width > 0 && height > 0 { if width > 0 && height > 0 {
viewport.set_destination(width, height); viewport.set_destination(width, height);
} }

View file

@ -2300,8 +2300,8 @@ fn fractional_scale_small_popup() {
{ {
let data = f.testwl.get_surface_data(toplevel_id).unwrap(); let data = f.testwl.get_surface_data(toplevel_id).unwrap();
let viewport = data.viewport.as_ref().expect("Missing viewport"); let viewport = data.viewport.as_ref().expect("Missing viewport");
assert_eq!(viewport.width, 66); assert_eq!(viewport.width, 67);
assert_eq!(viewport.height, 66); assert_eq!(viewport.height, 67);
} }
let popup = Window::new(2); let popup = Window::new(2);