1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-05 03:43:09 +00:00

Fix issue when selecting an inventory item with the tooltip visible

This commit is contained in:
Andrew Lanzone 2025-06-02 00:11:01 -07:00
parent 21286aa376
commit 8ae193abe8
4 changed files with 16 additions and 0 deletions

View file

@ -880,6 +880,11 @@ namespace MWGui
return osg::Vec2f(normalisedX * float(viewport.width - 1), (1.0 - normalisedY) * float(viewport.height - 1));
}
bool InventoryWindow::isControllerTooltipVisible()
{
return mItemView->isControllerTooltipVisible();
}
ControllerButtonStr* InventoryWindow::getControllerButtons()
{
switch (mGuiMode)

View file

@ -68,6 +68,7 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "Inventory"; }
ControllerButtonStr* getControllerButtons() override;
bool isControllerTooltipVisible();
protected:
void onTitleDoubleClicked() override;

View file

@ -35,6 +35,7 @@ namespace MWGui
void setActiveControllerWindow(bool active);
int getControllerFocus() { return mControllerFocus; }
int getItemCount() { return mItemCount; }
bool isControllerTooltipVisible() { return mControllerTooltip; }
void onControllerButton(const unsigned char button);
private:

View file

@ -16,6 +16,7 @@
#include "../mwbase/luamanager.hpp"
#include "../mwbase/statemanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwgui/inventorywindow.hpp"
#include "actions.hpp"
#include "bindingsmanager.hpp"
@ -252,6 +253,14 @@ namespace MWInput
MWGui::WindowBase* topWin = winMgr->getActiveControllerWindow();
if (topWin)
{
// When the inventory tooltip is visible, we don't actually want the A button to
// act like a mouse button; it should act normally.
if (treatAsMouse
&& arg.button == SDL_CONTROLLER_BUTTON_A
&& (MWGui::InventoryWindow *)topWin == winMgr->getInventoryWindow()
&& ((MWGui::InventoryWindow *)topWin)->isControllerTooltipVisible())
treatAsMouse = false;
mGamepadGuiCursorEnabled = topWin->isGamepadCursorAllowed();
// Fall through to mouse click