mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 21:19:40 +00:00
Fix non-top level Windows accepting key focus
This commit is contained in:
parent
8c0790580a
commit
842a42ee66
1 changed files with 6 additions and 6 deletions
|
@ -12,6 +12,11 @@
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool shouldAcceptKeyFocus(MyGUI::Widget* w)
|
||||||
|
{
|
||||||
|
return w && !w->castType<MyGUI::Window>(false) && w->getInheritedEnabled() && w->getInheritedVisible() && w->getVisible() && w->getEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
/// Recursively get all child widgets that accept keyboard input
|
/// Recursively get all child widgets that accept keyboard input
|
||||||
void getKeyFocusWidgets(MyGUI::Widget* parent, std::vector<MyGUI::Widget*>& results)
|
void getKeyFocusWidgets(MyGUI::Widget* parent, std::vector<MyGUI::Widget*>& results)
|
||||||
{
|
{
|
||||||
|
@ -24,18 +29,13 @@ void getKeyFocusWidgets(MyGUI::Widget* parent, std::vector<MyGUI::Widget*>& resu
|
||||||
MyGUI::Widget* w = enumerator.current();
|
MyGUI::Widget* w = enumerator.current();
|
||||||
if (!w->getVisible() || !w->getEnabled())
|
if (!w->getVisible() || !w->getEnabled())
|
||||||
continue;
|
continue;
|
||||||
if (w->getNeedKeyFocus())
|
if (w->getNeedKeyFocus() && shouldAcceptKeyFocus(w))
|
||||||
results.push_back(w);
|
results.push_back(w);
|
||||||
else
|
else
|
||||||
getKeyFocusWidgets(w, results);
|
getKeyFocusWidgets(w, results);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldAcceptKeyFocus(MyGUI::Widget* w)
|
|
||||||
{
|
|
||||||
return w && !w->castType<MyGUI::Window>(false) && w->getInheritedEnabled() && w->getInheritedVisible() && w->getVisible() && w->getEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
KeyboardNavigation::KeyboardNavigation()
|
KeyboardNavigation::KeyboardNavigation()
|
||||||
: mCurrentFocus(nullptr)
|
: mCurrentFocus(nullptr)
|
||||||
, mModalWindow(nullptr)
|
, mModalWindow(nullptr)
|
||||||
|
|
Loading…
Reference in a new issue