Fix guess best scale prompt showing up even when it guesses the default

Also fix a few warnings.
This commit is contained in:
Tamás Bálint Misius 2023-10-14 15:36:25 +02:00
parent 04b8378de4
commit 8534be2bf9
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 5 additions and 4 deletions

View File

@ -388,9 +388,10 @@ int Main(int argc, char *argv[])
engine.TouchUI = prefs.Get("TouchUI", DEFAULT_TOUCH_UI); engine.TouchUI = prefs.Get("TouchUI", DEFAULT_TOUCH_UI);
if (Client::Ref().IsFirstRun() && FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsNone) if (Client::Ref().IsFirstRun() && FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsNone)
{ {
windowFrameOps.scale = GuessBestScale(); auto guessed = GuessBestScale();
if (windowFrameOps.scale) if (windowFrameOps.scale != guessed)
{ {
windowFrameOps.scale = guessed;
prefs.Set("Scale", windowFrameOps.scale); prefs.Set("Scale", windowFrameOps.scale);
showLargeScreenDialog = true; showLargeScreenDialog = true;
} }

View File

@ -46,8 +46,8 @@ void SetTextInputRect(int x, int y, int w, int h)
SDL_Rect rect; SDL_Rect rect;
#if SDL_VERSION_ATLEAST(2, 0, 18) #if SDL_VERSION_ATLEAST(2, 0, 18)
int wx, wy, wwx, why; int wx, wy, wwx, why;
SDL_RenderLogicalToWindow(sdl_renderer, x, y, &wx, &wy); SDL_RenderLogicalToWindow(sdl_renderer, float(x), float(y), &wx, &wy);
SDL_RenderLogicalToWindow(sdl_renderer, x + w, y + h, &wwx, &why); SDL_RenderLogicalToWindow(sdl_renderer, float(x + w), float(y + h), &wwx, &why);
rect.x = wx; rect.x = wx;
rect.y = wy; rect.y = wy;
rect.w = wwx - wx; rect.w = wwx - wx;