summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint/Tools/Tool.cpp
diff options
context:
space:
mode:
authorZaggy1024 <zaggy1024@gmail.com>2022-10-24 20:17:21 -0500
committerSam Atkins <atkinssj@gmail.com>2022-11-14 16:08:11 +0000
commit7ce346e50e3a7b02934d3d95c09c6a8ff9608916 (patch)
tree4e5b124b35d9ba61b0b1d1e32ad9263c5fe6a4ec /Userland/Applications/PixelPaint/Tools/Tool.cpp
parent967dfa79563f5fa83aa27275bd57fc616a57ce55 (diff)
downloadserenity-7ce346e50e3a7b02934d3d95c09c6a8ff9608916.zip
PixelPaint: Allow keydown events to bubble from ImageEditor
Previously, all keydown KeyEvents were accepted, causing parent widgets not to receive them. With the addition of shortcut handling to keydown, shortcuts were not called when the ImageEditor was focused.
Diffstat (limited to 'Userland/Applications/PixelPaint/Tools/Tool.cpp')
-rw-r--r--Userland/Applications/PixelPaint/Tools/Tool.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/Userland/Applications/PixelPaint/Tools/Tool.cpp b/Userland/Applications/PixelPaint/Tools/Tool.cpp
index 86ea2160a9..57fc44b6ae 100644
--- a/Userland/Applications/PixelPaint/Tools/Tool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/Tool.cpp
@@ -23,28 +23,38 @@ void Tool::set_action(GUI::Action* action)
m_action = action;
}
-void Tool::on_keydown(GUI::KeyEvent& event)
+bool Tool::on_keydown(GUI::KeyEvent const& event)
{
switch (event.key()) {
case KeyCode::Key_LeftBracket:
- if (m_primary_slider)
+ if (m_primary_slider) {
m_primary_slider->decrease_slider_by(1);
+ return true;
+ }
break;
case KeyCode::Key_RightBracket:
- if (m_primary_slider)
+ if (m_primary_slider) {
m_primary_slider->increase_slider_by(1);
+ return true;
+ }
break;
case KeyCode::Key_LeftBrace:
- if (m_secondary_slider)
+ if (m_secondary_slider) {
m_secondary_slider->decrease_slider_by(1);
+ return true;
+ }
break;
case KeyCode::Key_RightBrace:
- if (m_secondary_slider)
+ if (m_secondary_slider) {
m_secondary_slider->increase_slider_by(1);
+ return true;
+ }
break;
default:
break;
}
+
+ return false;
}
Gfx::IntPoint Tool::editor_layer_location(Layer const& layer) const