mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-25 03:40:40 +00:00
Workaround to make sure message box remains on top (Fixes #4298)
This commit is contained in:
parent
e2e48e0a50
commit
2caaa48b91
@ -207,8 +207,6 @@ namespace MWGui
|
|||||||
, mMessageBoxManager(parMessageBoxManager)
|
, mMessageBoxManager(parMessageBoxManager)
|
||||||
, mButtonPressed(-1)
|
, mButtonPressed(-1)
|
||||||
{
|
{
|
||||||
setVisible(true);
|
|
||||||
|
|
||||||
int textPadding = 10; // padding between text-widget and main-widget
|
int textPadding = 10; // padding between text-widget and main-widget
|
||||||
int textButtonPadding = 10; // padding between the text-widget und the button-widget
|
int textButtonPadding = 10; // padding between the text-widget und the button-widget
|
||||||
int buttonLeftPadding = 10; // padding between the buttons if horizontal
|
int buttonLeftPadding = 10; // padding between the buttons if horizontal
|
||||||
@ -358,7 +356,11 @@ namespace MWGui
|
|||||||
mMessageWidget->setCoord(messageWidgetCoord);
|
mMessageWidget->setCoord(messageWidgetCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set key focus to "Ok" button
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
MyGUI::Widget* InteractiveMessageBox::getDefaultKeyFocus()
|
||||||
|
{
|
||||||
std::vector<std::string> keywords { "sOk", "sYes" };
|
std::vector<std::string> keywords { "sOk", "sYes" };
|
||||||
for(std::vector<MyGUI::Button*>::const_iterator button = mButtons.begin(); button != mButtons.end(); ++button)
|
for(std::vector<MyGUI::Button*>::const_iterator button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||||
{
|
{
|
||||||
@ -366,11 +368,11 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
if(Misc::StringUtils::ciEqual(MyGUI::LanguageManager::getInstance().replaceTags("#{" + keyword + "}"), (*button)->getCaption()))
|
if(Misc::StringUtils::ciEqual(MyGUI::LanguageManager::getInstance().replaceTags("#{" + keyword + "}"), (*button)->getCaption()))
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(*button);
|
return *button;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveMessageBox::mousePressed (MyGUI::Widget* pressed)
|
void InteractiveMessageBox::mousePressed (MyGUI::Widget* pressed)
|
||||||
|
@ -28,6 +28,8 @@ namespace MWGui
|
|||||||
bool createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons);
|
bool createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||||
bool isInteractiveMessageBox ();
|
bool isInteractiveMessageBox ();
|
||||||
|
|
||||||
|
const InteractiveMessageBox* getInteractiveMessageBox() const { return mInterMessageBoxe; }
|
||||||
|
|
||||||
/// Remove all message boxes
|
/// Remove all message boxes
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
@ -77,6 +79,8 @@ namespace MWGui
|
|||||||
void mousePressed (MyGUI::Widget* _widget);
|
void mousePressed (MyGUI::Widget* _widget);
|
||||||
int readPressedButton ();
|
int readPressedButton ();
|
||||||
|
|
||||||
|
MyGUI::Widget* getDefaultKeyFocus() override;
|
||||||
|
|
||||||
virtual bool exit() { return false; }
|
virtual bool exit() { return false; }
|
||||||
|
|
||||||
bool mMarkedToDelete;
|
bool mMarkedToDelete;
|
||||||
|
@ -874,6 +874,22 @@ namespace MWGui
|
|||||||
window->onFrame(frameDuration);
|
window->onFrame(frameDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure message boxes are always in front
|
||||||
|
// This is an awful workaround for a series of awfully interwoven issues that couldn't be worked around
|
||||||
|
// in a better way because of an impressive number of even more awfully interwoven issues.
|
||||||
|
if (mMessageBoxManager && mMessageBoxManager->isInteractiveMessageBox() && mCurrentModals.back() != mMessageBoxManager->getInteractiveMessageBox())
|
||||||
|
{
|
||||||
|
std::vector<WindowModal*>::iterator found = std::find(mCurrentModals.begin(), mCurrentModals.end(), mMessageBoxManager->getInteractiveMessageBox());
|
||||||
|
if (found != mCurrentModals.end())
|
||||||
|
{
|
||||||
|
WindowModal* msgbox = *found;
|
||||||
|
std::swap(*found, mCurrentModals.back());
|
||||||
|
MyGUI::InputManager::getInstance().addWidgetModal(msgbox->mMainWidget);
|
||||||
|
mKeyboardNavigation->setModalWindow(msgbox->mMainWidget);
|
||||||
|
mKeyboardNavigation->setDefaultFocus(msgbox->mMainWidget, msgbox->getDefaultKeyFocus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!mCurrentModals.empty())
|
if (!mCurrentModals.empty())
|
||||||
mCurrentModals.back()->onFrame(frameDuration);
|
mCurrentModals.back()->onFrame(frameDuration);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user