diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index ef6cf3293dc..744b161c696 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -212,7 +212,6 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe m_insert_emoji_action = GUI::CommonActions::make_insert_emoji_action([&](auto&) { auto emoji_input_dialog = GUI::EmojiInputDialog::construct(window()); - emoji_input_dialog->set_window_mode(GUI::WindowMode::Passive); if (emoji_input_dialog->exec() != GUI::EmojiInputDialog::ExecResult::OK) return; diff --git a/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp b/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp index 2a1ad4805b3..ac2443d7cc3 100644 --- a/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp +++ b/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp @@ -195,7 +195,6 @@ void ConnectionToWindowServer::key_down(i32 window_id, u32 code_point, u32 key, bool focused_widget_accepts_emoji_input = window->focused_widget() && window->focused_widget()->accepts_emoji_input(); if (!window->blocks_emoji_input() && focused_widget_accepts_emoji_input && (modifiers == (Mod_Ctrl | Mod_Alt)) && key == Key_Space) { auto emoji_input_dialog = EmojiInputDialog::construct(window); - emoji_input_dialog->set_window_mode(GUI::WindowMode::Passive); if (emoji_input_dialog->exec() != EmojiInputDialog::ExecResult::OK) return; key_event->m_key = Key_Invalid; diff --git a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp index 62d2c037416..d3e680f9d15 100644 --- a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp +++ b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp @@ -55,6 +55,7 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window) set_frameless(true); set_blocks_command_palette(true); set_blocks_emoji_input(true); + set_window_mode(GUI::WindowMode::CaptureInput); resize(400, 300); auto& scrollable_container = *main_widget.find_descendant_of_type_named("scrollable_container"sv); @@ -90,8 +91,13 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window) scrollable_container.horizontal_scrollbar().set_visible(false); update_displayed_emoji(); - on_active_window_change = [this](bool is_active_window) { - if (!is_active_window) + on_active_input_change = [this](bool is_active_input) { + if (!is_active_input) + close(); + }; + + on_input_preemption = [this](InputPreemptor preemptor) { + if (preemptor != InputPreemptor::ContextMenu) close(); }; diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 3d5352f2d84..653c52f30d9 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -779,7 +779,6 @@ void TextEditor::insert_emoji() return; auto emoji_input_dialog = EmojiInputDialog::construct(window()); - emoji_input_dialog->set_window_mode(GUI::WindowMode::Passive); if (emoji_input_dialog->exec() != EmojiInputDialog::ExecResult::OK) return;