Don't ignore my own advice

Can't wait until MyGUI 3.2.2 is a build dependency, then we can use key focus events to handle the SDL text input.
new-script-api
scrawl 7 years ago
parent 1714271a76
commit 22929e53fa

@ -161,9 +161,9 @@ namespace MWGui
mPrevPageButton->setVisible(prevPageVisible); mPrevPageButton->setVisible(prevPageVisible);
if (focus == mNextPageButton && !nextPageVisible && prevPageVisible) if (focus == mNextPageButton && !nextPageVisible && prevPageVisible)
MyGUI::InputManager::getInstance().setKeyFocusWidget(mPrevPageButton); MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mPrevPageButton);
else if (focus == mPrevPageButton && !prevPageVisible && nextPageVisible) else if (focus == mPrevPageButton && !prevPageVisible && nextPageVisible)
MyGUI::InputManager::getInstance().setKeyFocusWidget(mNextPageButton); MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mNextPageButton);
if (mPages.empty()) if (mPages.empty())
return; return;

@ -112,7 +112,7 @@ void KeyboardNavigation::onFrame()
// workaround incorrect key focus resets (fix in MyGUI TBD) // workaround incorrect key focus resets (fix in MyGUI TBD)
if (!shouldAcceptKeyFocus(focus) && shouldAcceptKeyFocus(mCurrentFocus) && (!mModalWindow || isRootParent(mCurrentFocus, mModalWindow))) if (!shouldAcceptKeyFocus(focus) && shouldAcceptKeyFocus(mCurrentFocus) && (!mModalWindow || isRootParent(mCurrentFocus, mModalWindow)))
{ {
MyGUI::InputManager::getInstance().setKeyFocusWidget(mCurrentFocus); MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mCurrentFocus);
focus = mCurrentFocus; focus = mCurrentFocus;
} }
@ -136,12 +136,12 @@ void KeyboardNavigation::setDefaultFocus(MyGUI::Widget *window, MyGUI::Widget *d
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget(); MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
if (!focus || !shouldAcceptKeyFocus(focus)) if (!focus || !shouldAcceptKeyFocus(focus))
{ {
MyGUI::InputManager::getInstance().setKeyFocusWidget(defaultFocus); MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(defaultFocus);
} }
else else
{ {
if (!isRootParent(focus, window)) if (!isRootParent(focus, window))
MyGUI::InputManager::getInstance().setKeyFocusWidget(defaultFocus); MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(defaultFocus);
} }
} }

Loading…
Cancel
Save