1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:07:34 +00:00

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.
This commit is contained in:
Zaggy1024 2022-10-24 20:17:21 -05:00 committed by Sam Atkins
parent 967dfa7956
commit 7ce346e50e
19 changed files with 62 additions and 41 deletions

View file

@ -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