Skip to content

Commit 8a023ab

Browse files
authored
fix Scale::FitScreen on X11 making too large window (#397)
1 parent 0a457e6 commit 8a023ab

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/os/posix/x11.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,14 +852,15 @@ impl Window {
852852
let mut scale = 1;
853853

854854
loop {
855-
let w = width * (scale + 1);
856-
let h = height * (scale + 1);
855+
let next_scale = scale * 2;
856+
let w = width * next_scale;
857+
let h = height * next_scale;
857858

858-
if w >= screen_width || h >= screen_height {
859+
if w > screen_width || h > screen_height {
859860
break;
860861
}
861862

862-
scale *= 2;
863+
scale = next_scale;
863864
}
864865

865866
if scale >= 32 {

0 commit comments

Comments
 (0)