mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 09:04:30 +00:00
LibCore+LibGUI+WindowServer: Make events bubble up through ancestors
With this patch, CEvents no longer stop at the target object, but will bubble up the ancestor chain as long as CEvent::is_accepted() is false. To the set accepted flag, call CEvent::accept(). To clear the accepted flag, call CEvent::ignore(). Events start out in the accepted state, so if you want them to bubble up, you have to call ignore() on them. Using this mechanism, we now ignore non-tabbing keydown events in GWidget, causing them to bubble up through the widget's ancestors. :^)
This commit is contained in:
@@ -134,8 +134,11 @@ void GAbstractButton::leave_event(CEvent&)
|
||||
|
||||
void GAbstractButton::keydown_event(GKeyEvent& event)
|
||||
{
|
||||
if (event.key() == KeyCode::Key_Return)
|
||||
if (event.key() == KeyCode::Key_Return) {
|
||||
click();
|
||||
event.accept();
|
||||
return;
|
||||
}
|
||||
GWidget::keydown_event(event);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user