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:
parent
21286aa376
commit
8ae193abe8
4 changed files with 16 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ namespace MWGui
|
|||
std::string_view getWindowIdForLua() const override { return "Inventory"; }
|
||||
|
||||
ControllerButtonStr* getControllerButtons() override;
|
||||
bool isControllerTooltipVisible();
|
||||
|
||||
protected:
|
||||
void onTitleDoubleClicked() override;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue