diff options
author | Zyper <zyperpl@gmail.com> | 2019-12-17 12:57:58 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-17 21:21:24 +0100 |
commit | b185c7f58a7ec5a57f4b74242e9a9d0d6201fcf8 (patch) | |
tree | a9644ac7bdea83e7c74bf3eb2f6972c98958aba7 /Applications | |
parent | 7301db4f9aac78063736597cd0d316bcdd1a6488 (diff) | |
download | serenity-b185c7f58a7ec5a57f4b74242e9a9d0d6201fcf8.zip |
PaintBrush: Tools can receive KeyUp events
Diffstat (limited to 'Applications')
-rw-r--r-- | Applications/PaintBrush/PaintableWidget.cpp | 7 | ||||
-rw-r--r-- | Applications/PaintBrush/PaintableWidget.h | 1 | ||||
-rw-r--r-- | Applications/PaintBrush/Tool.h | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/Applications/PaintBrush/PaintableWidget.cpp b/Applications/PaintBrush/PaintableWidget.cpp index 33b57deeb9..41a523dd26 100644 --- a/Applications/PaintBrush/PaintableWidget.cpp +++ b/Applications/PaintBrush/PaintableWidget.cpp @@ -103,6 +103,13 @@ void PaintableWidget::keydown_event(GKeyEvent& event) GWidget::keydown_event(event); } +void PaintableWidget::keyup_event(GKeyEvent& event) +{ + if (m_tool) + m_tool->on_keyup(event); + GWidget::keyup_event(event); +} + void PaintableWidget::set_primary_color(Color color) { if (m_primary_color == color) diff --git a/Applications/PaintBrush/PaintableWidget.h b/Applications/PaintBrush/PaintableWidget.h index 73279b296e..bac6fb32b1 100644 --- a/Applications/PaintBrush/PaintableWidget.h +++ b/Applications/PaintBrush/PaintableWidget.h @@ -39,6 +39,7 @@ private: virtual void mouseup_event(GMouseEvent&) override; virtual void mousemove_event(GMouseEvent&) override; virtual void keydown_event(GKeyEvent&) override; + virtual void keyup_event(GKeyEvent&) override; RefPtr<GraphicsBitmap> m_bitmap; diff --git a/Applications/PaintBrush/Tool.h b/Applications/PaintBrush/Tool.h index 737c4aa942..b3cfca1bd1 100644 --- a/Applications/PaintBrush/Tool.h +++ b/Applications/PaintBrush/Tool.h @@ -14,6 +14,7 @@ public: virtual void on_contextmenu(GContextMenuEvent&) {} virtual void on_second_paint(GPaintEvent&) {} virtual void on_keydown(GKeyEvent&) {} + virtual void on_keyup(GKeyEvent&) {} void clear() { m_widget = nullptr; } void setup(PaintableWidget& widget) { m_widget = widget.make_weak_ptr(); } |