From 3eec24b2a63fb07ac40edcc033f2f0b74d15a0cc Mon Sep 17 00:00:00 2001 From: Andrew Lanzone Date: Sat, 24 May 2025 20:08:45 -0700 Subject: [PATCH] Limit the size of controller-focused inventory windows on large screens --- apps/openmw/mwgui/inventorywindow.cpp | 8 +++++++- apps/openmw/mwgui/mapwindow.cpp | 9 ++++++++- apps/openmw/mwgui/spellwindow.cpp | 9 ++++++++- apps/openmw/mwgui/statswindow.cpp | 9 ++++++++- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 6b5bbde324..5258c12db5 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -1010,9 +1010,15 @@ namespace MWGui if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Inventory) { + // Fill the screen, or limit to a certain size on large screens. MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize(); + int width = std::min(viewSize.width, 2200); + int height = std::min(viewSize.height - 48 - 48, 1200); + int x = (viewSize.width - width) / 2; + int y = (viewSize.height - height) / 2; + MyGUI::Window* window = mMainWidget->castType(); - window->setCoord(0, active ? 48 : viewSize.height + 49, viewSize.width, viewSize.height - 48 - 48); + window->setCoord(x, active ? y : viewSize.height + 1, width, height); adjustPanes(); updatePreviewSize(); diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index ce3524d052..9c43b44572 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -1415,9 +1415,16 @@ namespace MWGui void MapWindow::setActiveControllerWindow(bool active) { + // Fill the screen, or limit to a certain size on large screens. Size chosen to + // show the entire local map without scrolling. MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize(); + int width = std::min(viewSize.width, 1552); + int height = std::min(viewSize.height - 48 - 48, 1572); + int x = (viewSize.width - width) / 2; + int y = (viewSize.height - height) / 2; + MyGUI::Window* window = mMainWidget->castType(); - window->setCoord(0, active ? 48 : viewSize.height + 49, viewSize.width, viewSize.height - 48 - 48); + window->setCoord(x, active ? y : viewSize.height + 1, width, height); WindowBase::setActiveControllerWindow(active); } diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index fb61b59ed9..fbeb6f35c3 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -281,9 +281,16 @@ namespace MWGui void SpellWindow::setActiveControllerWindow(bool active) { + // Fill the screen, or limit to a certain size on large screens. Size chosen to + // match the size of the stats window. MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize(); + int width = std::min(viewSize.width, 600); + int height = std::min(viewSize.height - 48 - 48, 750); + int x = (viewSize.width - width) / 2; + int y = (viewSize.height - height) / 2; + MyGUI::Window* window = mMainWidget->castType(); - window->setCoord(0, active ? 48 : viewSize.height + 49, viewSize.width, viewSize.height - 48 - 48); + window->setCoord(x, active ? y : viewSize.height + 1, width, height); WindowBase::setActiveControllerWindow(active); } diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index e67417f60e..9971b15799 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -740,9 +740,16 @@ namespace MWGui void StatsWindow::setActiveControllerWindow(bool active) { + // Fill the screen, or limit to a certain size on large screens. Size chosen to + // show all stats. MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize(); + int width = std::min(viewSize.width, 600); + int height = std::min(viewSize.height - 48 - 48, 750); + int x = (viewSize.width - width) / 2; + int y = (viewSize.height - height) / 2; + MyGUI::Window* window = mMainWidget->castType(); - window->setCoord(0, active ? 48 : viewSize.height + 49, viewSize.width, viewSize.height - 48 - 48); + window->setCoord(x, active ? y : viewSize.height + 1, width, height); onWindowResize(window);