mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +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:
parent
2f6fd56631
commit
b70e4e9909
Notes:
sideshowbarker
2024-07-17 07:19:00 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/b70e4e9909 Pull-request: https://github.com/SerenityOS/serenity/pull/15175 Reviewed-by: https://github.com/trflynn89 ✅
4 changed files with 8 additions and 5 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue