From 1074c399f37be9c2e56215f7defaa1aa2eed125b Mon Sep 17 00:00:00 2001 From: faxe1008 Date: Sat, 16 Apr 2022 21:31:12 +0200 Subject: LibGUI: Close CommandPalette on active window change This patch makes CommandPalette be closed whenever the focus shifts from the dialog. It is closer to other non-serenity implementations of the CommandPalette and other modal dialogs in the system. --- Userland/Libraries/LibGUI/CommandPalette.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Userland/Libraries/LibGUI') diff --git a/Userland/Libraries/LibGUI/CommandPalette.cpp b/Userland/Libraries/LibGUI/CommandPalette.cpp index 81b502e400..41e6e6908e 100644 --- a/Userland/Libraries/LibGUI/CommandPalette.cpp +++ b/Userland/Libraries/LibGUI/CommandPalette.cpp @@ -217,6 +217,11 @@ CommandPalette::CommandPalette(GUI::Window& parent_window, ScreenPosition screen }; m_text_box->set_focus(true); + + on_active_window_change = [this](bool is_active_window) { + if (!is_active_window) + close(); + }; } void CommandPalette::collect_actions(GUI::Window& parent_window) -- cgit v1.2.3