1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

Spreadsheet+LibGUI: Set EmojiInputDialog as a CaptureInput modal

This has two advantages: First the picker no longer changes the active
window state of its parent. Visually this is an additional hint that the
dialog is "fragile" and will close on loss of focus. Second, because
it contains a search box, its own input won't be preempted by global
application shortcuts when typing (pending #15129). This is a problem
in apps like PixelPaint which use shortcuts without modifiers.
This commit is contained in:
thankyouverycool 2022-09-09 07:47:25 -04:00 committed by Tim Flynn
parent 2f6fd56631
commit b70e4e9909
4 changed files with 8 additions and 5 deletions

View file

@ -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<GUI::ScrollableContainerWidget>("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();
};