From 08f7554e3886a10de130a8938e47b5c3b09c719a Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 4 Dec 2022 11:58:26 +0400 Subject: [PATCH 1/2] 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; From 9e77654ab4f54d4ff2478ac81d94f62886ab5e7d Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 5 Dec 2022 22:36:37 +0400 Subject: [PATCH 2/2] Add a hint about disabled resolution list in the Windowed Fullscreen mode --- apps/openmw/mwgui/settingswindow.cpp | 9 ++++++++ apps/openmw/mwgui/settingswindow.hpp | 2 ++ files/data/l10n/SettingsMenu/en.yaml | 1 + files/data/l10n/SettingsMenu/ru.yaml | 1 + .../data/mygui/openmw_settings_window.layout | 21 +++++++++++-------- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index cf487834b0..c06eb7ef7e 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -267,6 +267,7 @@ namespace MWGui getWidget(mWaterRainRippleDetail, "WaterRainRippleDetail"); getWidget(mPrimaryLanguage, "PrimaryLanguage"); getWidget(mSecondaryLanguage, "SecondaryLanguage"); + getWidget(mWindowModeHint, "WindowModeHint"); getWidget(mLightingMethodButton, "LightingMethodButton"); getWidget(mLightsResetButton, "LightsResetButton"); getWidget(mMaxLights, "MaxLights"); @@ -379,6 +380,8 @@ namespace MWGui mWindowBorderButton->setEnabled( windowMode != Settings::WindowMode::Fullscreen && windowMode != Settings::WindowMode::WindowedFullscreen); + mWindowModeHint->setVisible(windowMode == Settings::WindowMode::WindowedFullscreen); + mKeyboardSwitch->setStateSelected(true); mControllerSwitch->setStateSelected(false); @@ -566,9 +569,15 @@ namespace MWGui int index = static_cast(_sender->getIndexSelected()); if (index == static_cast(Settings::WindowMode::WindowedFullscreen)) + { mResolutionList->setEnabled(false); + mWindowModeHint->setVisible(true); + } else + { mResolutionList->setEnabled(true); + mWindowModeHint->setVisible(false); + } if (index == static_cast(Settings::WindowMode::Windowed)) mWindowBorderButton->setEnabled(true); diff --git a/apps/openmw/mwgui/settingswindow.hpp b/apps/openmw/mwgui/settingswindow.hpp index 2e567acfa3..f75e911633 100644 --- a/apps/openmw/mwgui/settingswindow.hpp +++ b/apps/openmw/mwgui/settingswindow.hpp @@ -43,6 +43,8 @@ namespace MWGui MyGUI::ComboBox* mPrimaryLanguage; MyGUI::ComboBox* mSecondaryLanguage; + MyGUI::Widget* mWindowModeHint; + // controls MyGUI::ScrollView* mControlsBox; MyGUI::Button* mResetControlsButton; diff --git a/files/data/l10n/SettingsMenu/en.yaml b/files/data/l10n/SettingsMenu/en.yaml index 3af577967e..fea8ae78b7 100644 --- a/files/data/l10n/SettingsMenu/en.yaml +++ b/files/data/l10n/SettingsMenu/en.yaml @@ -62,5 +62,6 @@ WaterShaderTextureQuality: "Texture quality" WindowBorder: "Window Border" WindowMode: "Window Mode" WindowModeFullscreen: "Fullscreen" +WindowModeHint: "Hint: the Windowed Fullscreen mode\nalways uses a native screen resolution." WindowModeWindowed: "Windowed" WindowModeWindowedFullscreen: "Windowed Fullscreen" diff --git a/files/data/l10n/SettingsMenu/ru.yaml b/files/data/l10n/SettingsMenu/ru.yaml index 422b00750f..fc9760c3d6 100644 --- a/files/data/l10n/SettingsMenu/ru.yaml +++ b/files/data/l10n/SettingsMenu/ru.yaml @@ -62,5 +62,6 @@ WaterShaderTextureQuality: "Качество текстуры воды" WindowBorder: "Рамка окна" WindowMode: "Режим окна" WindowModeFullscreen: "Полный экран" +WindowModeHint: "Подсказка: режим Оконный без полей\nвсегда использует родное разрешение экрана." WindowModeWindowed: "Оконный" WindowModeWindowedFullscreen: "Оконный без полей" diff --git a/files/data/mygui/openmw_settings_window.layout b/files/data/mygui/openmw_settings_window.layout index 9042a13546..0569751191 100644 --- a/files/data/mygui/openmw_settings_window.layout +++ b/files/data/mygui/openmw_settings_window.layout @@ -275,7 +275,7 @@ - + @@ -323,10 +323,13 @@ + + + - + - + @@ -338,18 +341,18 @@ - + - + - + - + @@ -359,11 +362,11 @@ - + - +