From 9c66a6a1475ff24dc37749f44fab874ed7a58661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Tue, 23 Jan 2024 17:49:53 +0100 Subject: [PATCH] Remove unused parameter of `SetWindowParams` function The `bool AllowResizing` parameter is only passed to other `SetWindowParams` functions but never used in the end, as whether or not resizing is allowed is separately determined based on the value of the `int FullscreenMode` parameter. --- src/engine/client.h | 2 +- src/engine/client/backend_sdl.cpp | 6 +++--- src/engine/client/backend_sdl.h | 2 +- src/engine/client/client.cpp | 12 ++++++------ src/engine/client/client.h | 2 +- src/engine/client/graphics_threaded.cpp | 4 ++-- src/engine/client/graphics_threaded.h | 4 ++-- src/engine/graphics.h | 2 +- src/game/client/components/menus_settings.cpp | 10 +++++----- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/engine/client.h b/src/engine/client.h index 41477c1f3..a0d7af1a1 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -174,7 +174,7 @@ public: // gfx virtual void SwitchWindowScreen(int Index) = 0; - virtual void SetWindowParams(int FullscreenMode, bool IsBorderless, bool AllowResizing) = 0; + virtual void SetWindowParams(int FullscreenMode, bool IsBorderless) = 0; virtual void ToggleWindowVSync() = 0; virtual void Notify(const char *pTitle, const char *pMessage) = 0; virtual void OnWindowResize() = 0; diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index ab5c402d9..05c6e5639 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -1459,7 +1459,7 @@ void CGraphicsBackend_SDL_GL::Maximize() // TODO: SDL } -void CGraphicsBackend_SDL_GL::SetWindowParams(int FullscreenMode, bool IsBorderless, bool AllowResizing) +void CGraphicsBackend_SDL_GL::SetWindowParams(int FullscreenMode, bool IsBorderless) { if(FullscreenMode > 0) { @@ -1574,7 +1574,7 @@ bool CGraphicsBackend_SDL_GL::ResizeWindow(int w, int h, int RefreshRate) { #ifdef CONF_FAMILY_WINDOWS // in windows make the window windowed mode first, this prevents strange window glitches (other games probably do something similar) - SetWindowParams(0, true, true); + SetWindowParams(0, true); #endif SDL_DisplayMode SetMode = {}; SDL_DisplayMode ClosestMode = {}; @@ -1586,7 +1586,7 @@ bool CGraphicsBackend_SDL_GL::ResizeWindow(int w, int h, int RefreshRate) #ifdef CONF_FAMILY_WINDOWS // now change it back to fullscreen, this will restore the above set state, bcs SDL saves fullscreen modes apart from other video modes (as of SDL 2.0.16) // see implementation of SDL_SetWindowDisplayMode - SetWindowParams(1, false, true); + SetWindowParams(1, false); #endif return true; } diff --git a/src/engine/client/backend_sdl.h b/src/engine/client/backend_sdl.h index 952ba052c..1b8cd9c73 100644 --- a/src/engine/client/backend_sdl.h +++ b/src/engine/client/backend_sdl.h @@ -250,7 +250,7 @@ public: void Minimize() override; void Maximize() override; - void SetWindowParams(int FullscreenMode, bool IsBorderless, bool AllowResizing) override; + void SetWindowParams(int FullscreenMode, bool IsBorderless) override; bool SetWindowScreen(int Index) override; bool UpdateDisplayMode(int Index) override; int GetWindowScreen() override; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 1ee31131a..863a013c4 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -3894,10 +3894,10 @@ void CClient::SwitchWindowScreen(int Index) // Todo SDL: remove this when fixed (changing screen when in fullscreen is bugged) if(g_Config.m_GfxFullscreen) { - SetWindowParams(0, g_Config.m_GfxBorderless, g_Config.m_GfxFullscreen != 3); + SetWindowParams(0, g_Config.m_GfxBorderless); if(Graphics()->SetWindowScreen(Index)) g_Config.m_GfxScreen = Index; - SetWindowParams(g_Config.m_GfxFullscreen, g_Config.m_GfxBorderless, g_Config.m_GfxFullscreen != 3); + SetWindowParams(g_Config.m_GfxFullscreen, g_Config.m_GfxBorderless); } else { @@ -3918,11 +3918,11 @@ void CClient::ConchainWindowScreen(IConsole::IResult *pResult, void *pUserData, pfnCallback(pResult, pCallbackUserData); } -void CClient::SetWindowParams(int FullscreenMode, bool IsBorderless, bool AllowResizing) +void CClient::SetWindowParams(int FullscreenMode, bool IsBorderless) { g_Config.m_GfxFullscreen = clamp(FullscreenMode, 0, 3); g_Config.m_GfxBorderless = (int)IsBorderless; - Graphics()->SetWindowParams(FullscreenMode, IsBorderless, AllowResizing); + Graphics()->SetWindowParams(FullscreenMode, IsBorderless); } void CClient::ConchainFullscreen(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData) @@ -3931,7 +3931,7 @@ void CClient::ConchainFullscreen(IConsole::IResult *pResult, void *pUserData, IC if(pSelf->Graphics() && pResult->NumArguments()) { if(g_Config.m_GfxFullscreen != pResult->GetInteger(0)) - pSelf->SetWindowParams(pResult->GetInteger(0), g_Config.m_GfxBorderless, pResult->GetInteger(0) != 3); + pSelf->SetWindowParams(pResult->GetInteger(0), g_Config.m_GfxBorderless); } else pfnCallback(pResult, pCallbackUserData); @@ -3943,7 +3943,7 @@ void CClient::ConchainWindowBordered(IConsole::IResult *pResult, void *pUserData if(pSelf->Graphics() && pResult->NumArguments()) { if(!g_Config.m_GfxFullscreen && (g_Config.m_GfxBorderless != pResult->GetInteger(0))) - pSelf->SetWindowParams(g_Config.m_GfxFullscreen, !g_Config.m_GfxBorderless, g_Config.m_GfxFullscreen != 3); + pSelf->SetWindowParams(g_Config.m_GfxFullscreen, !g_Config.m_GfxBorderless); } else pfnCallback(pResult, pCallbackUserData); diff --git a/src/engine/client/client.h b/src/engine/client/client.h index 30d7e6eaf..e4a9de3fe 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -460,7 +460,7 @@ public: // gfx void SwitchWindowScreen(int Index) override; - void SetWindowParams(int FullscreenMode, bool IsBorderless, bool AllowResizing) override; + void SetWindowParams(int FullscreenMode, bool IsBorderless) override; void ToggleWindowVSync() override; void Notify(const char *pTitle, const char *pMessage) override; void OnWindowResize() override; diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index 80aed3454..22f7a844d 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -2618,9 +2618,9 @@ void CGraphics_Threaded::WarnPngliteIncompatibleImages(bool Warn) m_WarnPngliteIncompatibleImages = Warn; } -void CGraphics_Threaded::SetWindowParams(int FullscreenMode, bool IsBorderless, bool AllowResizing) +void CGraphics_Threaded::SetWindowParams(int FullscreenMode, bool IsBorderless) { - m_pBackend->SetWindowParams(FullscreenMode, IsBorderless, AllowResizing); + m_pBackend->SetWindowParams(FullscreenMode, IsBorderless); CVideoMode CurMode; m_pBackend->GetCurrentVideoMode(CurMode, m_ScreenHiDPIScale, g_Config.m_GfxDesktopWidth, g_Config.m_GfxDesktopHeight, g_Config.m_GfxScreen); GotResized(CurMode.m_WindowWidth, CurMode.m_WindowHeight, CurMode.m_RefreshRate); diff --git a/src/engine/client/graphics_threaded.h b/src/engine/client/graphics_threaded.h index eea055232..ec47236d3 100644 --- a/src/engine/client/graphics_threaded.h +++ b/src/engine/client/graphics_threaded.h @@ -719,7 +719,7 @@ public: virtual void Minimize() = 0; virtual void Maximize() = 0; - virtual void SetWindowParams(int FullscreenMode, bool IsBorderless, bool AllowResizing) = 0; + virtual void SetWindowParams(int FullscreenMode, bool IsBorderless) = 0; virtual bool SetWindowScreen(int Index) = 0; virtual bool UpdateDisplayMode(int Index) = 0; virtual int GetWindowScreen() = 0; @@ -1235,7 +1235,7 @@ public: void Minimize() override; void Maximize() override; void WarnPngliteIncompatibleImages(bool Warn) override; - void SetWindowParams(int FullscreenMode, bool IsBorderless, bool AllowResizing) override; + void SetWindowParams(int FullscreenMode, bool IsBorderless) override; bool SetWindowScreen(int Index) override; void Move(int x, int y) override; void Resize(int w, int h, int RefreshRate) override; diff --git a/src/engine/graphics.h b/src/engine/graphics.h index 5d3da1e02..b319b3f91 100644 --- a/src/engine/graphics.h +++ b/src/engine/graphics.h @@ -275,7 +275,7 @@ public: int WindowHeight() const { return m_ScreenHeight / m_ScreenHiDPIScale; } virtual void WarnPngliteIncompatibleImages(bool Warn) = 0; - virtual void SetWindowParams(int FullscreenMode, bool IsBorderless, bool AllowResizing) = 0; + virtual void SetWindowParams(int FullscreenMode, bool IsBorderless) = 0; virtual bool SetWindowScreen(int Index) = 0; virtual bool SetVSync(bool State) = 0; virtual bool SetMultiSampling(uint32_t ReqMultiSamplingCount, uint32_t &MultiSamplingCountBackend) = 0; diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index ae153d4cc..29df771e2 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -1562,15 +1562,15 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) if(OldWindowMode != NewWindowMode) { if(NewWindowMode == 0) - Client()->SetWindowParams(0, false, true); + Client()->SetWindowParams(0, false); else if(NewWindowMode == 1) - Client()->SetWindowParams(0, true, true); + Client()->SetWindowParams(0, true); else if(NewWindowMode == 2) - Client()->SetWindowParams(3, false, false); + Client()->SetWindowParams(3, false); else if(NewWindowMode == 3) - Client()->SetWindowParams(2, false, true); + Client()->SetWindowParams(2, false); else if(NewWindowMode == 4) - Client()->SetWindowParams(1, false, true); + Client()->SetWindowParams(1, false); } if(Graphics()->GetNumScreens() > 1)