Fix clang format issues

This commit is contained in:
Andrew Lanzone 2025-06-07 22:51:29 -07:00
parent 0ca6bc012c
commit be32cbb413
23 changed files with 80 additions and 80 deletions

View File

@ -552,7 +552,8 @@ namespace MWGui
bool AlchemyWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) bool AlchemyWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{ {
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget(); MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
bool isFilterListOpen = focus != nullptr && focus->getParent() != nullptr && focus->getParent()->getParent() == mFilterValue; bool isFilterListOpen
= focus != nullptr && focus->getParent() != nullptr && focus->getParent()->getParent() == mFilterValue;
if (isFilterListOpen) if (isFilterListOpen)
{ {

View File

@ -91,8 +91,8 @@ namespace MWGui
{ {
onBackClicked(mBackButton); onBackClicked(mBackButton);
} }
else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && mOkButtonFocus) || else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && mOkButtonFocus)
(arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && !mOkButtonFocus)) || (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && !mOkButtonFocus))
{ {
mOkButtonFocus = !mOkButtonFocus; mOkButtonFocus = !mOkButtonFocus;
mOkButton->setStateSelected(mOkButtonFocus); mOkButton->setStateSelected(mOkButtonFocus);

View File

@ -86,8 +86,8 @@ namespace MWGui
{ {
onCancelButtonClicked(mCancelButton); onCancelButtonClicked(mCancelButton);
} }
else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && !mOkButtonFocus) || else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && !mOkButtonFocus)
(arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && mOkButtonFocus)) || (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && mOkButtonFocus))
{ {
mOkButtonFocus = !mOkButtonFocus; mOkButtonFocus = !mOkButtonFocus;
mOkButton->setStateSelected(mOkButtonFocus); mOkButton->setStateSelected(mOkButtonFocus);

View File

@ -127,8 +127,7 @@ namespace MWGui
if (!onTakeItem(item, count)) if (!onTakeItem(item, count))
return; return;
MWGui::InventoryWindow* inventoryWindow MWGui::InventoryWindow* inventoryWindow = MWBase::Environment::get().getWindowManager()->getInventoryWindow();
= MWBase::Environment::get().getWindowManager()->getInventoryWindow();
ItemModel* playerModel = inventoryWindow->getModel(); ItemModel* playerModel = inventoryWindow->getModel();
mModel->moveItem(item, count, playerModel); mModel->moveItem(item, count, playerModel);
@ -385,11 +384,9 @@ namespace MWGui
if (mDisposeCorpseButton->getVisible()) if (mDisposeCorpseButton->getVisible())
onDisposeCorpseButtonClicked(mDisposeCorpseButton); onDisposeCorpseButtonClicked(mDisposeCorpseButton);
} }
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK || else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK || arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP
arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT
arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT ||
arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
{ {
mItemView->onControllerButton(arg.button); mItemView->onControllerButton(arg.button);
} }

View File

@ -75,7 +75,8 @@ namespace MWGui
setVisible(buttonCount > 0); setVisible(buttonCount > 0);
} }
int ControllerButtonsOverlay::updateButton(MyGUI::TextBox* text, MyGUI::ImageBox* image, const std::string& buttonStr) int ControllerButtonsOverlay::updateButton(
MyGUI::TextBox* text, MyGUI::ImageBox* image, const std::string& buttonStr)
{ {
if (buttonStr.length() > 0) if (buttonStr.length() > 0)
{ {

View File

@ -603,8 +603,8 @@ namespace MWGui
void DialogueWindow::updateTopicsPane() void DialogueWindow::updateTopicsPane()
{ {
const std::string focusedTopic = const std::string focusedTopic
Settings::gui().mControllerMenus && mControllerFocus < mTopicsList->getItemCount() = Settings::gui().mControllerMenus && mControllerFocus < mTopicsList->getItemCount()
? mTopicsList->getItemNameAt(mControllerFocus) ? mTopicsList->getItemNameAt(mControllerFocus)
: ""; : "";
@ -931,7 +931,8 @@ namespace MWGui
{ {
mGoodbyeButton->setStateSelected(focused); mGoodbyeButton->setStateSelected(focused);
} }
else { else
{
std::string keyword = mTopicsList->getItemNameAt(mControllerFocus); std::string keyword = mTopicsList->getItemNameAt(mControllerFocus);
if (keyword.length() == 0) if (keyword.length() == 0)
return; return;

View File

@ -941,15 +941,19 @@ namespace MWGui
else if (mGuiMode == MWGui::GM_Companion && mDragAndDrop->mIsOnDragAndDrop) else if (mGuiMode == MWGui::GM_Companion && mDragAndDrop->mIsOnDragAndDrop)
{ {
// Drag and drop the item on the companion's window. // Drag and drop the item on the companion's window.
MWGui::CompanionWindow* companionWindow = MWGui::CompanionWindow* companionWindow = (MWGui::CompanionWindow*)MWBase::Environment::get()
(MWGui::CompanionWindow *)MWBase::Environment::get().getWindowManager()->getGuiModeWindows(mGuiMode).at(0); .getWindowManager()
->getGuiModeWindows(mGuiMode)
.at(0);
mDragAndDrop->drop(companionWindow->getModel(), companionWindow->getItemView()); mDragAndDrop->drop(companionWindow->getModel(), companionWindow->getItemView());
} }
else if (mGuiMode == MWGui::GM_Container && mDragAndDrop->mIsOnDragAndDrop) else if (mGuiMode == MWGui::GM_Container && mDragAndDrop->mIsOnDragAndDrop)
{ {
// Drag and drop the item on the container window. // Drag and drop the item on the container window.
MWGui::ContainerWindow* containerWindow = MWGui::ContainerWindow* containerWindow = (MWGui::ContainerWindow*)MWBase::Environment::get()
(MWGui::ContainerWindow *)MWBase::Environment::get().getWindowManager()->getGuiModeWindows(mGuiMode).at(0); .getWindowManager()
->getGuiModeWindows(mGuiMode)
.at(0);
mDragAndDrop->drop(containerWindow->getModel(), containerWindow->getItemView()); mDragAndDrop->drop(containerWindow->getModel(), containerWindow->getItemView());
} }
// GM_Barter is handled by onControllerButtonEvent. No other steps are necessary. // GM_Barter is handled by onControllerButtonEvent. No other steps are necessary.
@ -967,16 +971,20 @@ namespace MWGui
{ {
// Take all. Pass the button press to the container window and let it do the // Take all. Pass the button press to the container window and let it do the
// logic of taking all. // logic of taking all.
MWGui::ContainerWindow* containerWindow = MWGui::ContainerWindow* containerWindow = (MWGui::ContainerWindow*)MWBase::Environment::get()
(MWGui::ContainerWindow *)MWBase::Environment::get().getWindowManager()->getGuiModeWindows(mGuiMode).at(0); .getWindowManager()
->getGuiModeWindows(mGuiMode)
.at(0);
containerWindow->onControllerButtonEvent(arg); containerWindow->onControllerButtonEvent(arg);
} }
else if (mGuiMode == MWGui::GM_Barter) else if (mGuiMode == MWGui::GM_Barter)
{ {
// Offer. Pass the button press to the barter window and let it do the logic // Offer. Pass the button press to the barter window and let it do the logic
// of making an offer. // of making an offer.
MWGui::TradeWindow* tradeWindow = MWGui::TradeWindow* tradeWindow = (MWGui::TradeWindow*)MWBase::Environment::get()
(MWGui::TradeWindow*)MWBase::Environment::get().getWindowManager()->getGuiModeWindows(mGuiMode).at(1); .getWindowManager()
->getGuiModeWindows(mGuiMode)
.at(1);
tradeWindow->onControllerButtonEvent(arg); tradeWindow->onControllerButtonEvent(arg);
} }
} }

View File

@ -268,14 +268,14 @@ namespace MWGui
if (prevFocus >= 0 && prevFocus < mItemCount) if (prevFocus >= 0 && prevFocus < mItemCount)
{ {
ItemWidget* prev = (ItemWidget *)dragArea->getChildAt(prevFocus); ItemWidget* prev = (ItemWidget*)dragArea->getChildAt(prevFocus);
if (prev) if (prev)
prev->setControllerFocus(false); prev->setControllerFocus(false);
} }
if (mControllerActiveWindow && newFocus >= 0 && newFocus < mItemCount) if (mControllerActiveWindow && newFocus >= 0 && newFocus < mItemCount)
{ {
ItemWidget* focused = (ItemWidget *)dragArea->getChildAt(newFocus); ItemWidget* focused = (ItemWidget*)dragArea->getChildAt(newFocus);
if (focused) if (focused)
{ {
focused->setControllerFocus(true); focused->setControllerFocus(true);

View File

@ -496,7 +496,8 @@ namespace
MyGUI::Button* listItem = _list->getItemWidget(_list->getItemNameAt(i)); MyGUI::Button* listItem = _list->getItemWidget(_list->getItemNameAt(i));
if (listItem) if (listItem)
{ {
listItem->setTextColour(mButtons.size() == _selectedIndex ? MWGui::journalHeaderColour : MyGUI::Colour::Black); listItem->setTextColour(
mButtons.size() == _selectedIndex ? MWGui::journalHeaderColour : MyGUI::Colour::Black);
mButtons.push_back(listItem); mButtons.push_back(listItem);
} }
} }
@ -737,8 +738,10 @@ namespace
// Choose an index. Cyrillic capital A is a 0xd090 in UTF-8. // Choose an index. Cyrillic capital A is a 0xd090 in UTF-8.
// Words can not be started with characters 26 or 28. // Words can not be started with characters 26 or 28.
int russianOffset = 0xd090; int russianOffset = 0xd090;
if (mSelectedIndex >= 26) russianOffset++; if (mSelectedIndex >= 26)
if (mSelectedIndex >= 27) russianOffset++; // 27, not 28, because of skipping char 26 russianOffset++;
if (mSelectedIndex >= 27)
russianOffset++; // 27, not 28, because of skipping char 26
notifyIndexLinkClicked(isRussian ? mSelectedIndex + russianOffset : mSelectedIndex + 'A'); notifyIndexLinkClicked(isRussian ? mSelectedIndex + russianOffset : mSelectedIndex + 'A');
} }
return true; return true;
@ -776,7 +779,8 @@ namespace
notifyCancel(getWidget<MyGUI::Widget>(CancelBTN)); notifyCancel(getWidget<MyGUI::Widget>(CancelBTN));
mQuestMode = false; mQuestMode = false;
} }
else { else
{
// Show the quest overlay if viewing a journal entry or the topics // Show the quest overlay if viewing a journal entry or the topics
if (!mOptionsMode) if (!mOptionsMode)
notifyOptions(getWidget<MyGUI::Widget>(OptionsBTN)); notifyOptions(getWidget<MyGUI::Widget>(OptionsBTN));
@ -793,7 +797,8 @@ namespace
notifyCancel(getWidget<MyGUI::Widget>(CancelBTN)); notifyCancel(getWidget<MyGUI::Widget>(CancelBTN));
mQuestMode = false; mQuestMode = false;
} }
else { else
{
// Show the topics overlay if viewing a journal entry or the quest list // Show the topics overlay if viewing a journal entry or the quest list
if (!mOptionsMode) if (!mOptionsMode)
notifyOptions(getWidget<MyGUI::Widget>(OptionsBTN)); notifyOptions(getWidget<MyGUI::Widget>(OptionsBTN));

View File

@ -1440,14 +1440,12 @@ namespace MWGui
{ {
mNeedDoorMarkersUpdate = true; mNeedDoorMarkersUpdate = true;
mLocalMap->setViewOffset( mLocalMap->setViewOffset(
MyGUI::IntPoint( MyGUI::IntPoint(mLocalMap->getViewOffset().left + dx, mLocalMap->getViewOffset().top + dy));
mLocalMap->getViewOffset().left + dx, mLocalMap->getViewOffset().top + dy));
} }
else else
{ {
mGlobalMap->setViewOffset( mGlobalMap->setViewOffset(
MyGUI::IntPoint( MyGUI::IntPoint(mGlobalMap->getViewOffset().left + dx, mGlobalMap->getViewOffset().top + dy));
mGlobalMap->getViewOffset().left + dx, mGlobalMap->getViewOffset().top + dy));
} }
} }

View File

@ -469,8 +469,7 @@ namespace MWGui
onQuickKeyButtonClicked(mKey[mControllerFocus].button); onQuickKeyButtonClicked(mKey[mControllerFocus].button);
if (arg.button == SDL_CONTROLLER_BUTTON_B) if (arg.button == SDL_CONTROLLER_BUTTON_B)
onOkButtonClicked(mOkButton); onOkButtonClicked(mOkButton);
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
mControllerFocus = (mControllerFocus + 5) % 10; mControllerFocus = (mControllerFocus + 5) % 10;
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT) else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
{ {

View File

@ -142,8 +142,7 @@ namespace MWGui
bool Recharge::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) bool Recharge::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{ {
if ((arg.button == SDL_CONTROLLER_BUTTON_A && !mGemBox->getVisible()) if ((arg.button == SDL_CONTROLLER_BUTTON_A && !mGemBox->getVisible()) || arg.button == SDL_CONTROLLER_BUTTON_Y)
|| arg.button == SDL_CONTROLLER_BUTTON_Y)
{ {
onSelectItem(mGemIcon); onSelectItem(mGemIcon);
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click")); MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));

View File

@ -156,8 +156,7 @@ namespace MWGui
bool Repair::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) bool Repair::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{ {
if ((arg.button == SDL_CONTROLLER_BUTTON_A && !mToolBox->getVisible()) if ((arg.button == SDL_CONTROLLER_BUTTON_A && !mToolBox->getVisible()) || arg.button == SDL_CONTROLLER_BUTTON_Y)
|| arg.button == SDL_CONTROLLER_BUTTON_Y)
{ {
onSelectItem(mToolIcon); onSelectItem(mToolIcon);
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click")); MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));

View File

@ -542,7 +542,7 @@ namespace MWGui
{ {
if (arg.button == SDL_CONTROLLER_BUTTON_A) if (arg.button == SDL_CONTROLLER_BUTTON_A)
{ {
switch(mControllerFocus) switch (mControllerFocus)
{ {
case 0: case 0:
onNameClicked(mButtons[0]); onNameClicked(mButtons[0]);
@ -573,15 +573,13 @@ namespace MWGui
{ {
onOkClicked(mButtons[5]); onOkClicked(mButtons[5]);
} }
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
{ {
setControllerFocus(mButtons, mControllerFocus, false); setControllerFocus(mButtons, mControllerFocus, false);
mControllerFocus = wrap(mControllerFocus - 1, mButtons.size()); mControllerFocus = wrap(mControllerFocus - 1, mButtons.size());
setControllerFocus(mButtons, mControllerFocus, true); setControllerFocus(mButtons, mControllerFocus, true);
} }
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
{ {
setControllerFocus(mButtons, mControllerFocus, false); setControllerFocus(mButtons, mControllerFocus, false);
mControllerFocus = wrap(mControllerFocus + 1, mButtons.size()); mControllerFocus = wrap(mControllerFocus + 1, mButtons.size());

View File

@ -163,10 +163,11 @@ namespace MWGui
hour = 12; hour = 12;
ESM::EpochTimeStamp currentDate = timeManager.getEpochTimeStamp(); ESM::EpochTimeStamp currentDate = timeManager.getEpochTimeStamp();
std::string daysPassed = Misc::StringUtils::format("#{Calendar:day} %i", timeManager.getTimeStamp().getDay()); std::string daysPassed
= Misc::StringUtils::format("#{Calendar:day} %i", timeManager.getTimeStamp().getDay());
std::string_view formattedHour(pm ? "#{Calendar:pm}" : "#{Calendar:am}"); std::string_view formattedHour(pm ? "#{Calendar:pm}" : "#{Calendar:am}");
std::string autoFilename std::string autoFilename = Misc::StringUtils::format(
= Misc::StringUtils::format("%s - %i %s %i %s", daysPassed, currentDate.mDay, month, hour, formattedHour); "%s - %i %s %i %s", daysPassed, currentDate.mDay, month, hour, formattedHour);
mSaveNameEdit->setCaptionWithReplacing(autoFilename); mSaveNameEdit->setCaptionWithReplacing(autoFilename);
} }
@ -561,8 +562,8 @@ namespace MWGui
winMgr->setKeyFocusWidget(mSaveList); winMgr->setKeyFocusWidget(mSaveList);
winMgr->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false); winMgr->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
} }
else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && !mOkButtonFocus) || else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && !mOkButtonFocus)
(arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && mOkButtonFocus)) || (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && mOkButtonFocus))
{ {
mOkButtonFocus = !mOkButtonFocus; mOkButtonFocus = !mOkButtonFocus;
mOkButton->setStateSelected(mOkButtonFocus); mOkButton->setStateSelected(mOkButtonFocus);

View File

@ -13,8 +13,8 @@
#include <components/esm3/loadgmst.hpp> #include <components/esm3/loadgmst.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/inputmanager.hpp" #include "../mwbase/inputmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -550,10 +550,8 @@ namespace MWGui
if (prevFocus >= 0 && prevFocus < mButtons.size()) if (prevFocus >= 0 && prevFocus < mButtons.size())
{ {
MyGUI::TextBox* button = mButtons[prevFocus]; MyGUI::TextBox* button = mButtons[prevFocus];
if (button == mMagnitudeMinValue || if (button == mMagnitudeMinValue || button == mMagnitudeMaxValue || button == mDurationValue
button == mMagnitudeMaxValue || || button == mAreaValue)
button == mDurationValue ||
button == mAreaValue)
{ {
button->setTextColour(textColours.normal); button->setTextColour(textColours.normal);
} }
@ -566,10 +564,8 @@ namespace MWGui
if (newFocus >= 0 && newFocus < mButtons.size()) if (newFocus >= 0 && newFocus < mButtons.size())
{ {
MyGUI::TextBox* button = mButtons[newFocus]; MyGUI::TextBox* button = mButtons[newFocus];
if (button == mMagnitudeMinValue || if (button == mMagnitudeMinValue || button == mMagnitudeMaxValue || button == mDurationValue
button == mMagnitudeMaxValue || || button == mAreaValue)
button == mDurationValue ||
button == mAreaValue)
{ {
button->setTextColour(textColours.link); button->setTextColour(textColours.link);
} }
@ -744,7 +740,6 @@ namespace MWGui
mSuccessChance->setCaption(MyGUI::utility::toString(intChance)); mSuccessChance->setCaption(MyGUI::utility::toString(intChance));
} }
bool SpellCreationDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) bool SpellCreationDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{ {
if (arg.button == SDL_CONTROLLER_BUTTON_B) if (arg.button == SDL_CONTROLLER_BUTTON_B)
@ -761,7 +756,6 @@ namespace MWGui
return EffectEditorBase::onControllerButtonEvent(arg); return EffectEditorBase::onControllerButtonEvent(arg);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
EffectEditorBase::EffectEditorBase(Type type) EffectEditorBase::EffectEditorBase(Type type)

View File

@ -1,8 +1,8 @@
#ifndef MWGUI_SPELLCREATION_H #ifndef MWGUI_SPELLCREATION_H
#define MWGUI_SPELLCREATION_H #define MWGUI_SPELLCREATION_H
#include <memory>
#include <SDL.h> #include <SDL.h>
#include <memory>
#include <components/esm3/loadmgef.hpp> #include <components/esm3/loadmgef.hpp>
#include <components/esm3/loadspel.hpp> #include <components/esm3/loadspel.hpp>

View File

@ -95,7 +95,7 @@ namespace MWGui
void adjustSpellWidget(const Spell& spell, SpellModel::ModelIndex index, MyGUI::Widget* widget); void adjustSpellWidget(const Spell& spell, SpellModel::ModelIndex index, MyGUI::Widget* widget);
/// Keep a list of buttons for controller navigation and their index in the full list. /// Keep a list of buttons for controller navigation and their index in the full list.
std::vector<std::pair<Gui::SharedStateButton *, int>> mButtons; std::vector<std::pair<Gui::SharedStateButton*, int>> mButtons;
/// Keep a list of group offsets for controller navigation /// Keep a list of group offsets for controller navigation
std::vector<int> mGroupIndices; std::vector<int> mGroupIndices;

View File

@ -733,11 +733,9 @@ namespace MWGui
onFilterChanged(mFilterAll); onFilterChanged(mFilterAll);
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click")); MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
} }
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK || else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK || arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP
arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT
arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT ||
arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
{ {
mItemView->onControllerButton(arg.button); mItemView->onControllerButton(arg.button);
} }

View File

@ -898,7 +898,8 @@ namespace MWGui
int activeIndex = std::clamp(mActiveControllerWindows[mode], 0, (int)state.mWindows.size() - 1); int activeIndex = std::clamp(mActiveControllerWindows[mode], 0, (int)state.mWindows.size() - 1);
Log(Debug::Debug) << "Getting active controller window: mode=" << mode << ", " << state.mWindows.size() << " window(s), activeIndex=" << activeIndex; Log(Debug::Debug) << "Getting active controller window: mode=" << mode << ", " << state.mWindows.size()
<< " window(s), activeIndex=" << activeIndex;
// If the active window is no longer visible, find the next visible window. // If the active window is no longer visible, find the next visible window.
if (!state.mWindows[activeIndex]->isVisible()) if (!state.mWindows[activeIndex]->isVisible())
@ -1903,7 +1904,8 @@ namespace MWGui
{ {
// If using controller menus, don't persist changes to size of the stats or magic // If using controller menus, don't persist changes to size of the stats or magic
// windows. // windows.
if (Settings::gui().mControllerMenus && (window == (MyGUI::Window*)mStatsWindow || window == (MyGUI::Window*)mSpellWindow)) if (Settings::gui().mControllerMenus
&& (window == (MyGUI::Window*)mStatsWindow || window == (MyGUI::Window*)mSpellWindow))
return; return;
const auto it = mTrackedWindows.find(window); const auto it = mTrackedWindows.find(window);
@ -2616,7 +2618,8 @@ namespace MWGui
// setButtons will handle setting visibility based on if any buttons are defined. // setButtons will handle setting visibility based on if any buttons are defined.
mControllerButtonsOverlay->setButtons(topWin->getControllerButtons()); mControllerButtonsOverlay->setButtons(topWin->getControllerButtons());
if (getMode() == GM_Inventory) { if (getMode() == GM_Inventory)
{
mInventoryTabsOverlay->setVisible(true); mInventoryTabsOverlay->setVisible(true);
mInventoryTabsOverlay->setTab(mActiveControllerWindows[GM_Inventory]); mInventoryTabsOverlay->setTab(mActiveControllerWindows[GM_Inventory]);
} }

View File

@ -255,9 +255,7 @@ namespace MWInput
{ {
// When the inventory tooltip is visible, we don't actually want the A button to // When the inventory tooltip is visible, we don't actually want the A button to
// act like a mouse button; it should act normally. // act like a mouse button; it should act normally.
if (treatAsMouse if (treatAsMouse && arg.button == SDL_CONTROLLER_BUTTON_A && winMgr->getControllerTooltip())
&& arg.button == SDL_CONTROLLER_BUTTON_A
&& winMgr->getControllerTooltip())
treatAsMouse = false; treatAsMouse = false;
mGamepadGuiCursorEnabled = topWin->isGamepadCursorAllowed(); mGamepadGuiCursorEnabled = topWin->isGamepadCursorAllowed();