From 3323127db0c23ae2ca8e9e84e14d0b8e6612e683 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Wed, 15 Mar 2023 19:45:21 -0400 Subject: [PATCH] LibGUI: Allow blocking modals and popups to handle their own shortcuts Since ef7d9c0, shortcut propagation was blocked for blocking modals and popups. This however is an issue as some blocking modals (like FilePicker) use shortcuts. This patch allows propagation of shortcuts but only until the current window. --- Userland/Libraries/LibGUI/Window.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index bdbcd951b89..ef2da2f1cc0 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -528,12 +528,11 @@ void Window::handle_key_event(KeyEvent& event) if (event.is_accepted()) return; - if (is_blocking() || is_popup()) - return; - // Only process shortcuts if this is a keydown event. - if (event.type() == Event::KeyDown) - propagate_shortcuts(event, nullptr, PropagationLimit::Application); + if (event.type() == Event::KeyDown) { + auto const boundary = (is_blocking() || is_popup()) ? ShortcutPropagationBoundary::Window : ShortcutPropagationBoundary::Application; + propagate_shortcuts(event, nullptr, boundary); + } } void Window::handle_resize_event(ResizeEvent& event)