mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 10:41:36 +00:00
Force windows to exit when popping their GUI mode through Lua
This commit is contained in:
parent
6653502567
commit
989686500c
4 changed files with 10 additions and 4 deletions
|
@ -120,7 +120,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual void pushGuiMode(MWGui::GuiMode mode, const MWWorld::Ptr& arg) = 0;
|
virtual void pushGuiMode(MWGui::GuiMode mode, const MWWorld::Ptr& arg) = 0;
|
||||||
virtual void pushGuiMode(MWGui::GuiMode mode) = 0;
|
virtual void pushGuiMode(MWGui::GuiMode mode) = 0;
|
||||||
virtual void popGuiMode() = 0;
|
virtual void popGuiMode(bool forceExit = false) = 0;
|
||||||
|
|
||||||
virtual void removeGuiMode(MWGui::GuiMode mode) = 0;
|
virtual void removeGuiMode(MWGui::GuiMode mode) = 0;
|
||||||
///< can be anywhere in the stack
|
///< can be anywhere in the stack
|
||||||
|
|
|
@ -1303,7 +1303,7 @@ namespace MWGui
|
||||||
return mViewer->getCamera()->getCullMask();
|
return mViewer->getCamera()->getCullMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::popGuiMode()
|
void WindowManager::popGuiMode(bool forceExit)
|
||||||
{
|
{
|
||||||
if (mDragAndDrop && mDragAndDrop->mIsOnDragAndDrop)
|
if (mDragAndDrop && mDragAndDrop->mIsOnDragAndDrop)
|
||||||
{
|
{
|
||||||
|
@ -1313,6 +1313,12 @@ namespace MWGui
|
||||||
if (!mGuiModes.empty())
|
if (!mGuiModes.empty())
|
||||||
{
|
{
|
||||||
const GuiMode mode = mGuiModes.back();
|
const GuiMode mode = mGuiModes.back();
|
||||||
|
if (forceExit)
|
||||||
|
{
|
||||||
|
GuiModeState& state = mGuiModeStates[mode];
|
||||||
|
for (const auto& window : state.mWindows)
|
||||||
|
window->exit();
|
||||||
|
}
|
||||||
mKeyboardNavigation->saveFocus(mode);
|
mKeyboardNavigation->saveFocus(mode);
|
||||||
mGuiModes.pop_back();
|
mGuiModes.pop_back();
|
||||||
mGuiModeStates[mode].update(false);
|
mGuiModeStates[mode].update(false);
|
||||||
|
|
|
@ -150,7 +150,7 @@ namespace MWGui
|
||||||
|
|
||||||
void pushGuiMode(GuiMode mode, const MWWorld::Ptr& arg) override;
|
void pushGuiMode(GuiMode mode, const MWWorld::Ptr& arg) override;
|
||||||
void pushGuiMode(GuiMode mode) override;
|
void pushGuiMode(GuiMode mode) override;
|
||||||
void popGuiMode() override;
|
void popGuiMode(bool forceExit = false) override;
|
||||||
void removeGuiMode(GuiMode mode) override; ///< can be anywhere in the stack
|
void removeGuiMode(GuiMode mode) override; ///< can be anywhere in the stack
|
||||||
|
|
||||||
void goToJail(int days) override;
|
void goToJail(int days) override;
|
||||||
|
|
|
@ -255,7 +255,7 @@ namespace MWLua
|
||||||
// TODO: Maybe disallow opening/closing special modes (main menu, settings, loading screen)
|
// TODO: Maybe disallow opening/closing special modes (main menu, settings, loading screen)
|
||||||
// from player scripts. Add new Lua context "menu" that can do it.
|
// from player scripts. Add new Lua context "menu" that can do it.
|
||||||
for (unsigned i = stack.size() - common; i > 0; i--)
|
for (unsigned i = stack.size() - common; i > 0; i--)
|
||||||
windowManager->popGuiMode();
|
windowManager->popGuiMode(true);
|
||||||
if (common == newStack.size() && !newStack.empty() && arg.has_value())
|
if (common == newStack.size() && !newStack.empty() && arg.has_value())
|
||||||
windowManager->pushGuiMode(newStack.back(), ptr);
|
windowManager->pushGuiMode(newStack.back(), ptr);
|
||||||
for (unsigned i = common; i < newStack.size(); ++i)
|
for (unsigned i = common; i < newStack.size(); ++i)
|
||||||
|
|
Loading…
Reference in a new issue