diff --git a/apps/launcher/settingspage.cpp b/apps/launcher/settingspage.cpp
index 94a1a0b8a0..294c2c09f3 100644
--- a/apps/launcher/settingspage.cpp
+++ b/apps/launcher/settingspage.cpp
@@ -304,7 +304,9 @@ bool Launcher::SettingsPage::loadSettings()
loadSettingBool(Settings::gui().mColorTopicEnable, *changeDialogTopicsCheckBox);
showOwnedComboBox->setCurrentIndex(Settings::game().mShowOwned);
loadSettingBool(Settings::gui().mStretchMenuBackground, *stretchBackgroundCheckBox);
+ connect(controllerMenusCheckBox, &QCheckBox::toggled, this, &SettingsPage::slotControllerMenusToggled);
loadSettingBool(Settings::gui().mControllerMenus, *controllerMenusCheckBox);
+ loadSettingBool(Settings::gui().mControllerTooltips, *controllerMenuTooltipsCheckBox);
loadSettingBool(Settings::map().mAllowZooming, *useZoomOnMapCheckBox);
loadSettingBool(Settings::game().mGraphicHerbalism, *graphicHerbalismCheckBox);
scalingSpinBox->setValue(Settings::gui().mScalingFactor);
@@ -499,6 +501,7 @@ void Launcher::SettingsPage::saveSettings()
saveSettingInt(*showOwnedComboBox, Settings::game().mShowOwned);
saveSettingBool(*stretchBackgroundCheckBox, Settings::gui().mStretchMenuBackground);
saveSettingBool(*controllerMenusCheckBox, Settings::gui().mControllerMenus);
+ saveSettingBool(*controllerMenuTooltipsCheckBox, Settings::gui().mControllerTooltips);
saveSettingBool(*useZoomOnMapCheckBox, Settings::map().mAllowZooming);
saveSettingBool(*graphicHerbalismCheckBox, Settings::game().mGraphicHerbalism);
Settings::gui().mScalingFactor.set(scalingSpinBox->value());
@@ -557,6 +560,11 @@ void Launcher::SettingsPage::slotAnimSourcesToggled(bool checked)
}
}
+void Launcher::SettingsPage::slotControllerMenusToggled(bool checked)
+{
+ controllerMenuTooltipsCheckBox->setEnabled(checked);
+}
+
void Launcher::SettingsPage::slotPostProcessToggled(bool checked)
{
postprocessTransparentPostpassCheckBox->setEnabled(checked);
diff --git a/apps/launcher/settingspage.hpp b/apps/launcher/settingspage.hpp
index d2bb80d86a..2c6eca477a 100644
--- a/apps/launcher/settingspage.hpp
+++ b/apps/launcher/settingspage.hpp
@@ -34,6 +34,7 @@ namespace Launcher
void slotSkyBlendingToggled(bool checked);
void slotShadowDistLimitToggled(bool checked);
void slotDistantLandToggled(bool checked);
+ void slotControllerMenusToggled(bool checked);
private:
Config::GameSettings& mGameSettings;
diff --git a/apps/launcher/ui/settingspage.ui b/apps/launcher/ui/settingspage.ui
index e501ed156f..aace4b49c7 100644
--- a/apps/launcher/ui/settingspage.ui
+++ b/apps/launcher/ui/settingspage.ui
@@ -1408,6 +1408,19 @@
+ -
+
+
+ false
+
+
+ <html><head/><body><p>When using controller menus, make tooltips visible by default.</p></body></html>
+
+
+ Show Controller Tooltips By Default
+
+
+
-
diff --git a/apps/openmw/mwgui/itemview.cpp b/apps/openmw/mwgui/itemview.cpp
index 8b003b267d..0afb3d3d76 100644
--- a/apps/openmw/mwgui/itemview.cpp
+++ b/apps/openmw/mwgui/itemview.cpp
@@ -21,6 +21,7 @@ namespace MWGui
ItemView::ItemView()
: mScrollView(nullptr)
+ , mControllerActiveWindow(false)
{
}
@@ -189,12 +190,8 @@ namespace MWGui
{
mControllerActiveWindow = active;
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- if (winMgr->getControllerTooltip())
- {
- winMgr->setCursorActive(false);
- winMgr->setControllerTooltip(false);
- }
+ MWBase::Environment::get().getWindowManager()->setControllerTooltip(
+ active && Settings::gui().mControllerTooltips);
if (active)
updateControllerFocus(-1, mControllerFocus);
@@ -214,7 +211,6 @@ namespace MWGui
// Select the focused item, if any.
if (mControllerFocus >= 0 && mControllerFocus < mItemCount)
{
- MWBase::Environment::get().getWindowManager()->setControllerTooltip(false);
MyGUI::Widget* dragArea = mScrollView->getChildAt(0);
onSelectedItem(dragArea->getChildAt(mControllerFocus));
}
diff --git a/apps/openmw/mwgui/spellbuyingwindow.cpp b/apps/openmw/mwgui/spellbuyingwindow.cpp
index 5d25dc592c..e43bbfc497 100644
--- a/apps/openmw/mwgui/spellbuyingwindow.cpp
+++ b/apps/openmw/mwgui/spellbuyingwindow.cpp
@@ -149,11 +149,9 @@ namespace MWGui
mSpellButtons[0].first->setStateSelected(true);
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
+ winMgr->setControllerTooltip(Settings::gui().mControllerTooltips);
if (winMgr->getControllerTooltip())
- {
- winMgr->setCursorActive(false);
- winMgr->setControllerTooltip(false);
- }
+ MWBase::Environment::get().getInputManager()->warpMouseToWidget(mSpellButtons[0].first);
}
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the
diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp
index 7ea5118883..976c2eebd8 100644
--- a/apps/openmw/mwgui/spellcreationdialog.cpp
+++ b/apps/openmw/mwgui/spellcreationdialog.cpp
@@ -103,7 +103,6 @@ namespace MWGui
mControllerButtons.a = "#{sSelect}";
mControllerButtons.b = "#{sCancel}";
mControllerButtons.x = "#{sOk}";
- mControllerButtons.r3 = "#{sInfo}";
}
}
@@ -602,6 +601,7 @@ namespace MWGui
mControllerButtons.a = "#{sSelect}";
mControllerButtons.b = "#{sCancel}";
mControllerButtons.x = "#{sBuy}";
+ mControllerButtons.r3 = "#{sInfo}";
}
}
@@ -613,13 +613,6 @@ namespace MWGui
mPtr = actor;
mNameEdit->setCaption({});
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- if (Settings::gui().mControllerMenus && winMgr->getControllerTooltip())
- {
- winMgr->setCursorActive(false);
- winMgr->setControllerTooltip(false);
- }
-
startEditing();
}
@@ -850,7 +843,11 @@ namespace MWGui
mEffectFocus = 0;
mRightColumn = false;
if (mAvailableButtons.size() > 0)
+ {
mAvailableButtons[0]->setStateSelected(true);
+ if (MWBase::Environment::get().getWindowManager()->getControllerTooltip())
+ MWBase::Environment::get().getInputManager()->warpMouseToWidget(mAvailableButtons[0]);
+ }
}
}
@@ -1038,24 +1035,25 @@ namespace MWGui
bool EffectEditorBase::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{
+ MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
+
if (arg.button == SDL_CONTROLLER_BUTTON_A)
{
if (!mRightColumn && mAvailableFocus >= 0 && mAvailableFocus < static_cast(mAvailableButtons.size()))
{
onAvailableEffectClicked(mAvailableButtons[mAvailableFocus]);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
+ winMgr->playSound(ESM::RefId::stringRefId("Menu Click"));
}
else if (mRightColumn && mEffectFocus >= 0 && mEffectFocus < static_cast(mEffectButtons.size()))
{
onEditEffect(mEffectButtons[mEffectFocus].second);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
+ winMgr->playSound(ESM::RefId::stringRefId("Menu Click"));
}
}
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
{
// Toggle info tooltip
- MWBase::Environment::get().getWindowManager()->setControllerTooltip(
- !MWBase::Environment::get().getWindowManager()->getControllerTooltip());
+ winMgr->setControllerTooltip(!mRightColumn && !winMgr->getControllerTooltip());
}
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
{
@@ -1098,6 +1096,8 @@ namespace MWGui
mEffectButtons[mEffectFocus].first->setStateSelected(false);
if (mAvailableFocus >= 0 && mAvailableFocus < static_cast(mAvailableButtons.size()))
mAvailableButtons[mAvailableFocus]->setStateSelected(true);
+
+ winMgr->setControllerTooltip(Settings::gui().mControllerTooltips);
}
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && !mRightColumn && mEffectButtons.size() > 0)
{
@@ -1106,6 +1106,8 @@ namespace MWGui
mAvailableButtons[mAvailableFocus]->setStateSelected(false);
if (mEffectFocus >= 0 && mEffectFocus < static_cast(mEffectButtons.size()))
mEffectButtons[mEffectFocus].first->setStateSelected(true);
+
+ winMgr->setControllerTooltip(false);
}
// Scroll the list to keep the active item in view
@@ -1120,7 +1122,7 @@ namespace MWGui
if (!mRightColumn && mAvailableFocus >= 0 && mAvailableFocus < static_cast(mAvailableButtons.size()))
{
// Warp the mouse to the selected spell to show the tooltip
- if (MWBase::Environment::get().getWindowManager()->getControllerTooltip())
+ if (winMgr->getControllerTooltip())
MWBase::Environment::get().getInputManager()->warpMouseToWidget(mAvailableButtons[mAvailableFocus]);
}
diff --git a/apps/openmw/mwgui/spellview.cpp b/apps/openmw/mwgui/spellview.cpp
index 0265eea4cb..a3eef23092 100644
--- a/apps/openmw/mwgui/spellview.cpp
+++ b/apps/openmw/mwgui/spellview.cpp
@@ -32,6 +32,8 @@ namespace MWGui
: mScrollView(nullptr)
, mShowCostColumn(true)
, mHighlightSelected(true)
+ , mControllerActiveWindow(false)
+ , mControllerFocus(0)
{
}
@@ -94,7 +96,6 @@ namespace MWGui
mLines.clear();
mButtons.clear();
mGroupIndices.clear();
- mControllerTooltip = false;
while (mScrollView->getChildCount())
MyGUI::Gui::getInstance().destroyWidget(mScrollView->getChildAt(0));
@@ -231,6 +232,12 @@ namespace MWGui
height += lineHeight;
}
+ if (Settings::gui().mControllerMenus)
+ {
+ mControllerFocus = wrap(mControllerFocus, mButtons.size());
+ updateControllerFocus(-1, mControllerFocus);
+ }
+
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the
// scrollbar is hidden
mScrollView->setVisibleVScroll(false);
@@ -329,6 +336,13 @@ namespace MWGui
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
}
+ void SpellView::setActiveControllerWindow(bool active)
+ {
+ mControllerActiveWindow = active;
+ if (active)
+ update();
+ }
+
void SpellView::onControllerButton(const unsigned char button)
{
if (mButtons.empty())
@@ -348,9 +362,8 @@ namespace MWGui
else if (button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
{
// Toggle info tooltip
- mControllerTooltip = !mControllerTooltip;
- if (mControllerTooltip && mControllerFocus >= 0 && mControllerFocus < static_cast(mButtons.size()))
- MWBase::Environment::get().getInputManager()->warpMouseToWidget(mButtons[mControllerFocus].first);
+ MWBase::Environment::get().getWindowManager()->setControllerTooltip(
+ !MWBase::Environment::get().getWindowManager()->getControllerTooltip());
}
else if (button == SDL_CONTROLLER_BUTTON_DPAD_UP)
mControllerFocus--;
@@ -390,6 +403,8 @@ namespace MWGui
if (prevFocus != mControllerFocus)
updateControllerFocus(prevFocus, mControllerFocus);
+ else
+ updateControllerFocus(-1, mControllerFocus);
}
void SpellView::updateControllerFocus(int prevFocus, int newFocus)
@@ -404,7 +419,7 @@ namespace MWGui
prev->onMouseLostFocus(nullptr);
}
- if (newFocus >= 0 && newFocus < static_cast(mButtons.size()))
+ if (mControllerActiveWindow && newFocus >= 0 && newFocus < static_cast(mButtons.size()))
{
Gui::SharedStateButton* focused = mButtons[newFocus].first;
if (focused)
@@ -421,7 +436,7 @@ namespace MWGui
mScrollView->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (line - 5)));
}
- if (mControllerTooltip)
+ if (MWBase::Environment::get().getWindowManager()->getControllerTooltip())
MWBase::Environment::get().getInputManager()->warpMouseToWidget(focused);
}
}
diff --git a/apps/openmw/mwgui/spellview.hpp b/apps/openmw/mwgui/spellview.hpp
index 234ce08626..a2571cd822 100644
--- a/apps/openmw/mwgui/spellview.hpp
+++ b/apps/openmw/mwgui/spellview.hpp
@@ -57,6 +57,7 @@ namespace MWGui
void resetScrollbars();
+ void setActiveControllerWindow(bool active);
void onControllerButton(const unsigned char button);
private:
@@ -99,8 +100,8 @@ namespace MWGui
/// Keep a list of group offsets for controller navigation
std::vector mGroupIndices;
+ bool mControllerActiveWindow;
int mControllerFocus;
- bool mControllerTooltip;
void updateControllerFocus(int prevFocus, int newFocus);
void onSpellSelected(MyGUI::Widget* _sender);
diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp
index ea21a67423..c8d9b2acd9 100644
--- a/apps/openmw/mwgui/spellwindow.cpp
+++ b/apps/openmw/mwgui/spellwindow.cpp
@@ -323,10 +323,12 @@ namespace MWGui
MyGUI::Window* window = mMainWidget->castType();
window->setCoord(x, active ? y : viewSize.height + 1, width, height);
+
+ MWBase::Environment::get().getWindowManager()->setControllerTooltip(
+ active && Settings::gui().mControllerTooltips);
}
- if (active)
- mSpellView->update();
+ mSpellView->setActiveControllerWindow(active);
WindowBase::setActiveControllerWindow(active);
}
diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp
index 5447861ace..3d98e28bde 100644
--- a/apps/openmw/mwgui/windowmanagerimp.cpp
+++ b/apps/openmw/mwgui/windowmanagerimp.cpp
@@ -949,10 +949,16 @@ namespace MWGui
if (winCount == 0)
return;
- mActiveControllerWindows[mode] = std::clamp(activeIndex, 0, winCount - 1);
+ activeIndex = std::clamp(activeIndex, 0, winCount - 1);
+ mActiveControllerWindows[mode] = activeIndex;
+ // Set active window last so inactive windows don't stomp on changes it makes, e.g. to tooltips.
for (int i = 0; i < winCount; i++)
- mGuiModeStates[mode].mWindows[i]->setActiveControllerWindow(i == activeIndex);
+ {
+ if (i != activeIndex)
+ mGuiModeStates[mode].mWindows[i]->setActiveControllerWindow(false);
+ }
+ mGuiModeStates[mode].mWindows[activeIndex]->setActiveControllerWindow(true);
MWBase::Environment::get().getInputManager()->setGamepadGuiCursorEnabled(
mGuiModeStates[mode].mWindows[activeIndex]->isGamepadCursorAllowed());
@@ -1468,13 +1474,23 @@ namespace MWGui
if (mConsole && mConsole->isVisible())
mConsole->onOpen();
- if (Settings::gui().mControllerMenus && !mGuiModes.empty())
+ if (Settings::gui().mControllerMenus)
{
- // Re-apply any controller-specific window changes.
- const GuiMode mode = mGuiModes.back();
- int winCount = mGuiModeStates[mode].mWindows.size();
- for (int i = 0; i < winCount; i++)
- mGuiModeStates[mode].mWindows[i]->setActiveControllerWindow(i == mActiveControllerWindows[mode]);
+ if (mGuiModes.empty())
+ setControllerTooltip(false);
+ else
+ {
+ // Re-apply any controller-specific window changes.
+ const GuiMode mode = mGuiModes.back();
+ int winCount = mGuiModeStates[mode].mWindows.size();
+
+ for (int i = 0; i < winCount; i++)
+ {
+ if (i != mActiveControllerWindows[mode])
+ mGuiModeStates[mode].mWindows[i]->setActiveControllerWindow(false);
+ }
+ mGuiModeStates[mode].mWindows[mActiveControllerWindows[mode]]->setActiveControllerWindow(true);
+ }
}
}
diff --git a/apps/openmw/mwinput/controllermanager.cpp b/apps/openmw/mwinput/controllermanager.cpp
index 8a60ff0673..9962c639ad 100644
--- a/apps/openmw/mwinput/controllermanager.cpp
+++ b/apps/openmw/mwinput/controllermanager.cpp
@@ -32,6 +32,7 @@ namespace MWInput
, mGamepadGuiCursorEnabled(true)
, mGuiCursorEnabled(true)
, mJoystickLastUsed(false)
+ , mGamepadMousePressed(false)
{
if (!controllerBindingsFile.empty())
{
@@ -142,6 +143,7 @@ namespace MWInput
if (arg.button == SDL_CONTROLLER_BUTTON_A) // We'll pretend that A is left click.
{
bool mousePressSuccess = mMouseManager->injectMouseButtonPress(SDL_BUTTON_LEFT);
+ mGamepadMousePressed = true;
if (MyGUI::InputManager::getInstance().getMouseFocusWidget())
{
MyGUI::Button* b
@@ -186,12 +188,13 @@ namespace MWInput
mJoystickLastUsed = true;
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
{
- if (mGamepadGuiCursorEnabled)
+ if (mGamepadGuiCursorEnabled && (!Settings::gui().mControllerMenus || mGamepadMousePressed))
{
// Temporary mouse binding until keyboard controls are available:
if (arg.button == SDL_CONTROLLER_BUTTON_A) // We'll pretend that A is left click.
{
bool mousePressSuccess = mMouseManager->injectMouseButtonRelease(SDL_BUTTON_LEFT);
+ mGamepadMousePressed = false;
if (mBindingsManager->isDetectingBindingState()) // If the player just triggered binding, don't let
// button release bind.
return;
diff --git a/apps/openmw/mwinput/controllermanager.hpp b/apps/openmw/mwinput/controllermanager.hpp
index 596a9ef465..670a3c846f 100644
--- a/apps/openmw/mwinput/controllermanager.hpp
+++ b/apps/openmw/mwinput/controllermanager.hpp
@@ -62,6 +62,7 @@ namespace MWInput
bool mGamepadGuiCursorEnabled;
bool mGuiCursorEnabled;
bool mJoystickLastUsed;
+ bool mGamepadMousePressed;
};
}
#endif
diff --git a/components/settings/categories/gui.hpp b/components/settings/categories/gui.hpp
index 139d55d9c8..aea288ca65 100644
--- a/components/settings/categories/gui.hpp
+++ b/components/settings/categories/gui.hpp
@@ -26,6 +26,7 @@ namespace Settings
SettingValue mTooltipDelay{ mIndex, "GUI", "tooltip delay", makeMaxSanitizerFloat(0) };
SettingValue mStretchMenuBackground{ mIndex, "GUI", "stretch menu background" };
SettingValue mControllerMenus{ mIndex, "GUI", "controller menus" };
+ SettingValue mControllerTooltips{ mIndex, "GUI", "controller tooltips" };
SettingValue mSubtitles{ mIndex, "GUI", "subtitles" };
SettingValue mHitFader{ mIndex, "GUI", "hit fader" };
SettingValue mWerewolfOverlay{ mIndex, "GUI", "werewolf overlay" };
diff --git a/files/lang/launcher_de.ts b/files/lang/launcher_de.ts
index c4af468e8c..fe36e91646 100644
--- a/files/lang/launcher_de.ts
+++ b/files/lang/launcher_de.ts
@@ -1455,5 +1455,13 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
Enable Controller Menus
+
+ <html><head/><body><p>When using controller menus, make tooltips visible by default.</p></body></html>
+
+
+
+ Show Controller Tooltips By Default
+
+
diff --git a/files/lang/launcher_en.ts b/files/lang/launcher_en.ts
index 5c24c3fa7d..4097d29dd2 100644
--- a/files/lang/launcher_en.ts
+++ b/files/lang/launcher_en.ts
@@ -1455,5 +1455,13 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
Enable Controller Menus
+
+ <html><head/><body><p>When using controller menus, make tooltips visible by default.</p></body></html>
+
+
+
+ Show Controller Tooltips By Default
+
+
diff --git a/files/lang/launcher_fr.ts b/files/lang/launcher_fr.ts
index 413a207abe..3d2363130e 100644
--- a/files/lang/launcher_fr.ts
+++ b/files/lang/launcher_fr.ts
@@ -1458,5 +1458,13 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
<html><head/><body><p>Make it easier to use game menus with a controller.</p></body></html>
<html><head/><body><p>Faciliter l'utilisation des menus de jeu avec une manette.</p></body></html>
+
+ <html><head/><body><p>When using controller menus, make tooltips visible by default.</p></body></html>
+ <html><head/><body><p>Lorsque vous utilisez les menus du contrôleur, rendez les info-bulles visibles par défaut.</p></body></html>
+
+
+ Show Controller Tooltips By Default
+ Afficher les info-bulles du contrôleur par défaut
+
diff --git a/files/lang/launcher_ru.ts b/files/lang/launcher_ru.ts
index 189f8fdaee..cd6768942f 100644
--- a/files/lang/launcher_ru.ts
+++ b/files/lang/launcher_ru.ts
@@ -1470,5 +1470,13 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
Enable Controller Menus
+
+ <html><head/><body><p>When using controller menus, make tooltips visible by default.</p></body></html>
+
+
+
+ Show Controller Tooltips By Default
+
+
diff --git a/files/lang/launcher_sv.ts b/files/lang/launcher_sv.ts
index 11623ceb5a..63912de9e1 100644
--- a/files/lang/launcher_sv.ts
+++ b/files/lang/launcher_sv.ts
@@ -1474,5 +1474,13 @@ de ordinarie fonterna i Morrowind. Bocka denna ruta om du ändå föredrar ordin
Enable Controller Menus
Aktivera handkontrollmenyer
+
+ <html><head/><body><p>When using controller menus, make tooltips visible by default.</p></body></html>
+ <html><head/><body><p>När du använder kontrollmenyer, synliggör verktygstips som standard.</p></body></html>
+
+
+ Show Controller Tooltips By Default
+ Visa verktygstips för kontrollenheter som standard
+
diff --git a/files/settings-default.cfg b/files/settings-default.cfg
index 6a0701803b..16dc7b78ff 100644
--- a/files/settings-default.cfg
+++ b/files/settings-default.cfg
@@ -204,6 +204,9 @@ stretch menu background = false
# Make menus easier to navigate with a controller.
controller menus = false
+# When true, you do not need to press R3 to show tooltips.
+controller tooltips = false
+
# Subtitles for NPC spoken dialog and some sound effects.
subtitles = false