From ded6255a03ae37a12022be9c44457388520ade7f Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Fri, 25 Aug 2023 21:23:37 +0200 Subject: [PATCH] make util_get_lowest_resolution slightly more strict --- src/utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.c b/src/utils.c index ec231d4..f556bd6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -212,7 +212,7 @@ BOOL util_get_lowest_resolution( DWORD max_height) { BOOL result = FALSE; - int org_ratio = (int)((ratio + 0.005f) * 10); + int org_ratio = (int)((ratio + 0.005f) * 100); SIZE lowest = { .cx = max_width + 1, .cy = max_height + 1 }; DWORD i = 0; DEVMODE m; @@ -228,9 +228,9 @@ BOOL util_get_lowest_resolution( m.dmPelsWidth <= lowest.cx && m.dmPelsHeight <= lowest.cy) { - int res_ratio = (int)((((float)m.dmPelsWidth / m.dmPelsHeight) + 0.005f) * 10); + int res_ratio = (int)((((float)m.dmPelsWidth / m.dmPelsHeight) + 0.005f) * 100); - if (res_ratio == org_ratio) + if (abs(res_ratio - org_ratio) <= 5) { result = TRUE; out_res->cx = lowest.cx = m.dmPelsWidth;