From 0e8ded37b93cdb2ea0fa76dbe82f013ff55bdb86 Mon Sep 17 00:00:00 2001 From: nmzik Date: Sat, 3 Oct 2026 17:54:06 +0200 Subject: [PATCH] window: ignore nonpositive resize dimensions --- src/graphics/presentation/window/window.cpp | 10 ++++++---- src/graphics/presentation/window/windowInternal.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/graphics/presentation/window/window.cpp b/src/graphics/presentation/window/window.cpp index 320563c5..1250e5e4 100644 --- a/src/graphics/presentation/window/window.cpp +++ b/src/graphics/presentation/window/window.cpp @@ -362,11 +362,13 @@ static void GameEventDidEnterForeground(WindowLoopState& game) { SetPause(game, false); } -void WindowContext::Resize(uint32_t new_width, uint32_t new_height) { - EXIT_IF(new_width == 0 || new_height == 0); +void WindowContext::Resize(int new_width, int new_height) { + if (new_width <= 0 || new_height <= 0) { + return; + } Common::LockGuard lock(mutex); - graphic_ctx.screen_width = new_width; - graphic_ctx.screen_height = new_height; + graphic_ctx.screen_width = static_cast(new_width); + graphic_ctx.screen_height = static_cast(new_height); } void WindowContext::ProcessWindowEvent(const SDL_WindowEvent& event) { diff --git a/src/graphics/presentation/window/windowInternal.h b/src/graphics/presentation/window/windowInternal.h index a0aa1b59..35c874ce 100644 --- a/src/graphics/presentation/window/windowInternal.h +++ b/src/graphics/presentation/window/windowInternal.h @@ -42,7 +42,7 @@ struct WindowContext { void RefreshSurfaceCapabilities(); void UpdateIcon(); void UpdateTitle(); - void Resize(uint32_t width, uint32_t height); + void Resize(int width, int height); void ProcessWindowEvent(const SDL_WindowEvent& event); void ProcessDisplayEvent(const SDL_DisplayEvent& event); void ProcessEvent(double time_seconds);