diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-23 19:52:18 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-23 19:52:18 +0200 |
commit | 4392413cd1520b11a5c9314dd2a291e8ca92a75d (patch) | |
tree | 0c296b6ea9047e7bb7c5401b4da29301896a06c8 | |
parent | 3cb50a4714b6836a1d32e383edc86b3557d861ea (diff) | |
download | serenity-4392413cd1520b11a5c9314dd2a291e8ca92a75d.zip |
LibGUI: Make window-parented actions actually scoped to the window
We were relying on Core::is<Window>() to tell us whether the parent
of an action is a window. This didn't work since we only saw a forward
declaration of GUI::Window in Action.cpp.
This is an unfortunate flaw in the is<T> pattern and we should solve
it somehow but not in this patch.
-rw-r--r-- | Libraries/LibGUI/Action.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Libraries/LibGUI/Action.cpp b/Libraries/LibGUI/Action.cpp index 701e3c9c33..8bb9ef7c88 100644 --- a/Libraries/LibGUI/Action.cpp +++ b/Libraries/LibGUI/Action.cpp @@ -29,6 +29,7 @@ #include <LibGUI/Application.h> #include <LibGUI/Button.h> #include <LibGUI/MenuItem.h> +#include <LibGUI/Window.h> namespace GUI { @@ -157,8 +158,9 @@ Action::Action(const StringView& text, const Shortcut& shortcut, RefPtr<Gfx::Bit m_scope = ShortcutScope::WindowLocal; } else { m_scope = ShortcutScope::ApplicationGlobal; - if (auto* app = Application::the()) + if (auto* app = Application::the()) { app->register_global_shortcut_action({}, *this); + } } } |