From 08f7554e3886a10de130a8938e47b5c3b09c719a Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 4 Dec 2022 11:58:26 +0400 Subject: [PATCH] Improve window mode change (feature #7087) --- CHANGELOG.md | 1 + apps/openmw/mwgui/settingswindow.cpp | 22 +++++++++++++++++++++- apps/openmw/mwgui/settingswindow.hpp | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eb66475bb..408a8ebfee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ Feature #6983: PCVisionBonus script functions Feature #6995: Localize the "show effect duration" option Feature #7058: Implement TestModels (T3D) console command + Feature #7087: Block resolution change in the Windowed Fullscreen mode 0.48.0 ------ diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index bc2d9a2d78..cf487834b0 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -564,7 +564,18 @@ namespace MWGui if (pos == MyGUI::ITEM_NONE) return; - Settings::Manager::setInt("window mode", "Video", static_cast(_sender->getIndexSelected())); + int index = static_cast(_sender->getIndexSelected()); + if (index == static_cast(Settings::WindowMode::WindowedFullscreen)) + mResolutionList->setEnabled(false); + else + mResolutionList->setEnabled(true); + + if (index == static_cast(Settings::WindowMode::Windowed)) + mWindowBorderButton->setEnabled(true); + else + mWindowBorderButton->setEnabled(false); + + Settings::Manager::setInt("window mode", "Video", index); apply(); } @@ -644,6 +655,12 @@ namespace MWGui apply(); } + void SettingsWindow::onResChange(int width, int height) + { + center(); + highlightCurrentResolution(); + } + void SettingsWindow::onSliderChangePosition(MyGUI::ScrollBar* scroller, size_t pos) { if (getSettingType(scroller) == "Slider") @@ -839,6 +856,9 @@ namespace MWGui mWindowBorderButton->setEnabled(false); } + + if (index == static_cast(Settings::WindowMode::WindowedFullscreen)) + mResolutionList->setEnabled(false); } void SettingsWindow::layoutControlsBox() diff --git a/apps/openmw/mwgui/settingswindow.hpp b/apps/openmw/mwgui/settingswindow.hpp index 576ba2c627..2e567acfa3 100644 --- a/apps/openmw/mwgui/settingswindow.hpp +++ b/apps/openmw/mwgui/settingswindow.hpp @@ -20,7 +20,7 @@ namespace MWGui void updateWindowModeSettings(); - void onResChange(int, int) override { center(); } + void onResChange(int, int) override; protected: MyGUI::TabControl* mSettingsTab;