diff options
author | Andreas Kling <kling@serenityos.org> | 2021-08-20 01:17:38 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-20 01:27:39 +0200 |
commit | 8fce5caa4938697734c855d2905d0c65073510f0 (patch) | |
tree | 43f0340d9d24c4b98e4a46505026db8ee43790db /Userland | |
parent | 20b104dead7d712b8f2f9c039e1bad76f76c7fb8 (diff) | |
download | serenity-8fce5caa4938697734c855d2905d0c65073510f0.zip |
LibGUI: Pass context menu events through normal event dispatch
Previously we'd synthesize an event and invoke context_menu_event()
directly. This prevented the event from bubbling even if ignored.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGUI/Widget.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index aa5689297d..52bb229f5c 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -303,6 +303,8 @@ void Widget::event(Core::Event& event) return handle_leave_event(event); case Event::EnabledChange: return change_event(static_cast<Event&>(event)); + case Event::ContextMenu: + return context_menu_event(static_cast<ContextMenuEvent&>(event)); default: return Core::Object::event(event); } @@ -313,7 +315,7 @@ void Widget::handle_keydown_event(KeyEvent& event) keydown_event(event); if (event.key() == KeyCode::Key_Menu) { ContextMenuEvent c_event(window_relative_rect().bottom_right(), screen_relative_rect().bottom_right()); - context_menu_event(c_event); + dispatch_event(c_event); } } @@ -420,7 +422,7 @@ void Widget::handle_mousedown_event(MouseEvent& event) mousedown_event(event); if (event.button() == MouseButton::Right) { ContextMenuEvent c_event(event.position(), screen_relative_rect().location().translated(event.position())); - context_menu_event(c_event); + dispatch_event(c_event); } } @@ -516,8 +518,9 @@ void Widget::mousewheel_event(MouseEvent& event) event.ignore(); } -void Widget::context_menu_event(ContextMenuEvent&) +void Widget::context_menu_event(ContextMenuEvent& event) { + event.ignore(); } void Widget::focusin_event(FocusEvent&) |