summaryrefslogtreecommitdiff
path: root/Userland/DevTools
diff options
context:
space:
mode:
authorMarcus Nilsson <brainbomb@gmail.com>2021-06-02 22:44:52 +0200
committerLinus Groh <mail@linusgroh.de>2021-06-02 23:15:52 +0100
commit3931b292b051f4e5357e0847254b46e7bd4238c7 (patch)
treef0686d0e0607a623c45cb1d2abd7e72b42bf5684 /Userland/DevTools
parentb43dad1741aa7336434bfeef3eaf5c97770210c6 (diff)
downloadserenity-3931b292b051f4e5357e0847254b46e7bd4238c7.zip
HackStudio: Make locator lose focus on close
Make locator lose focus when pressing escape or by clicking in the editor area.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r--Userland/DevTools/HackStudio/Locator.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/Locator.cpp b/Userland/DevTools/HackStudio/Locator.cpp
index 44eba20f23..705fd23f07 100644
--- a/Userland/DevTools/HackStudio/Locator.cpp
+++ b/Userland/DevTools/HackStudio/Locator.cpp
@@ -103,9 +103,12 @@ Locator::Locator(Core::Object* parent)
m_textbox->on_change = [this] {
update_suggestions();
};
+
m_textbox->on_escape_pressed = [this] {
m_popup_window->hide();
+ m_textbox->set_focus(false);
};
+
m_textbox->on_up_pressed = [this] {
GUI::ModelIndex new_index = m_suggestion_view->selection().first();
if (new_index.is_valid())
@@ -138,6 +141,10 @@ Locator::Locator(Core::Object* parent)
open_suggestion(selected_index);
};
+ m_textbox->on_focusout = [&]() {
+ close();
+ };
+
m_popup_window = GUI::Window::construct(parent);
// FIXME: This is obviously not a tooltip window, but it's the closest thing to what we want atm.
m_popup_window->set_window_type(GUI::WindowType::Tooltip);