From 29c7b342eb5162de5fba4ce1321053cbdd9691cb Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 25 Feb 2024 14:34:09 +0100 Subject: [PATCH] impr: Make file chooser filter bar be focused by default --- plugins/ui/include/popups/popup_file_chooser.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/ui/include/popups/popup_file_chooser.hpp b/plugins/ui/include/popups/popup_file_chooser.hpp index 90966b6fd..950bb1511 100644 --- a/plugins/ui/include/popups/popup_file_chooser.hpp +++ b/plugins/ui/include/popups/popup_file_chooser.hpp @@ -46,6 +46,11 @@ namespace hex::ui { void drawContent() override { bool doubleClicked = false; + if (m_justOpened) { + ImGui::SetKeyboardFocusHere(); + m_justOpened = false; + } + ImGui::PushItemWidth(-1); ImGuiExt::InputTextIcon("##search", ICON_VS_FILTER, m_filter); ImGui::PopItemWidth(); @@ -123,6 +128,7 @@ namespace hex::ui { std::function m_openCallback; std::vector m_validExtensions; bool m_multiple = false; + bool m_justOpened = true; }; class PopupNamedFileChooser : public PopupNamedFileChooserBase {