diff options
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibGUI/GlyphMapWidget.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/GlyphMapWidget.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp index b529f7c7df..2ae04e1325 100644 --- a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp +++ b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp @@ -182,8 +182,17 @@ int GlyphMapWidget::glyph_at_position_clamped(Gfx::IntPoint position) const return glyph; } +void GlyphMapWidget::context_menu_event(GUI::ContextMenuEvent& event) +{ + if (on_context_menu_request) + on_context_menu_request(event); +} + void GlyphMapWidget::mousedown_event(MouseEvent& event) { + if (event.button() == MouseButton::Secondary) + return; + if (auto maybe_glyph = glyph_at_position(event.position()); maybe_glyph.has_value()) { auto glyph = maybe_glyph.value(); if (event.shift()) @@ -196,6 +205,9 @@ void GlyphMapWidget::mousedown_event(MouseEvent& event) void GlyphMapWidget::mouseup_event(GUI::MouseEvent& event) { + if (event.button() == MouseButton::Secondary) + return; + if (!m_in_drag_select) return; auto constrained = event.position().constrained(widget_inner_rect()); diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.h b/Userland/Libraries/LibGUI/GlyphMapWidget.h index 66afecf806..d72a2345de 100644 --- a/Userland/Libraries/LibGUI/GlyphMapWidget.h +++ b/Userland/Libraries/LibGUI/GlyphMapWidget.h @@ -68,6 +68,7 @@ public: Function<void(int)> on_active_glyph_changed; Function<void(int)> on_glyph_double_clicked; + Function<void(ContextMenuEvent&)> on_context_menu_request; private: GlyphMapWidget(); @@ -79,6 +80,7 @@ private: virtual void keydown_event(KeyEvent&) override; virtual void resize_event(ResizeEvent&) override; virtual void did_change_font() override; + virtual void context_menu_event(ContextMenuEvent&) override; Gfx::IntRect get_outer_rect(int glyph) const; Optional<int> glyph_at_position(Gfx::IntPoint) const; |