1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-01 18:39:42 +00:00

Improve post-process HUD search field usability (0.48.0)

This commit is contained in:
Alexei Kotov 2023-02-11 03:12:17 +03:00
parent 1dc71a133e
commit 3ab719f5a6

View file

@ -9,6 +9,8 @@
#include <components/fx/widgets.hpp> #include <components/fx/widgets.hpp>
#include <components/fx/technique.hpp> #include <components/fx/technique.hpp>
#include <components/misc/utf8stream.hpp>
#include <components/widgets/box.hpp> #include <components/widgets/box.hpp>
#include "../mwrender/postprocessor.hpp" #include "../mwrender/postprocessor.hpp"
@ -396,9 +398,15 @@ namespace MWGui
if (!technique) if (!technique)
continue; continue;
if (!technique->getHidden() && !processor->isTechniqueEnabled(technique) && name.find(mFilter->getCaption()) != std::string::npos) if (!technique->getHidden() && !processor->isTechniqueEnabled(technique))
{
std::string lowerName = Utf8Stream::lowerCaseUtf8(name);
std::string lowerCaption = mFilter->getCaption();
lowerCaption = Utf8Stream::lowerCaseUtf8(lowerCaption);
if (lowerName.find(lowerCaption) != std::string::npos)
mInactiveList->addItem(name, technique); mInactiveList->addItem(name, technique);
} }
}
for (auto technique : processor->getTechniques()) for (auto technique : processor->getTechniques())
{ {
@ -408,6 +416,10 @@ namespace MWGui
auto tryFocus = [this](ListWrapper* widget, const std::string& hint) auto tryFocus = [this](ListWrapper* widget, const std::string& hint)
{ {
MyGUI::Widget* oldFocus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
if (oldFocus == mFilter)
return;
size_t index = widget->findItemIndexWith(hint); size_t index = widget->findItemIndexWith(hint);
if (index != MyGUI::ITEM_NONE) if (index != MyGUI::ITEM_NONE)