From 8534be2bf9e561e7871e28f5afb7edb29e97f944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Sat, 14 Oct 2023 15:36:25 +0200 Subject: [PATCH] Fix guess best scale prompt showing up even when it guesses the default Also fix a few warnings. --- src/PowderToy.cpp | 5 +++-- src/PowderToySDL.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/PowderToy.cpp b/src/PowderToy.cpp index 0a0470eff..42b364699 100644 --- a/src/PowderToy.cpp +++ b/src/PowderToy.cpp @@ -388,9 +388,10 @@ int Main(int argc, char *argv[]) engine.TouchUI = prefs.Get("TouchUI", DEFAULT_TOUCH_UI); if (Client::Ref().IsFirstRun() && FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsNone) { - windowFrameOps.scale = GuessBestScale(); - if (windowFrameOps.scale) + auto guessed = GuessBestScale(); + if (windowFrameOps.scale != guessed) { + windowFrameOps.scale = guessed; prefs.Set("Scale", windowFrameOps.scale); showLargeScreenDialog = true; } diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp index d5a0483c3..d82aa3f41 100644 --- a/src/PowderToySDL.cpp +++ b/src/PowderToySDL.cpp @@ -46,8 +46,8 @@ void SetTextInputRect(int x, int y, int w, int h) SDL_Rect rect; #if SDL_VERSION_ATLEAST(2, 0, 18) int wx, wy, wwx, why; - SDL_RenderLogicalToWindow(sdl_renderer, x, y, &wx, &wy); - SDL_RenderLogicalToWindow(sdl_renderer, x + w, y + h, &wwx, &why); + SDL_RenderLogicalToWindow(sdl_renderer, float(x), float(y), &wx, &wy); + SDL_RenderLogicalToWindow(sdl_renderer, float(x + w), float(y + h), &wwx, &why); rect.x = wx; rect.y = wy; rect.w = wwx - wx;