mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +00:00
GButton: Allow triggering a "click" by pressing Return when focused.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
|
||||
//#define GBUTTON_DEBUG
|
||||
|
||||
@@ -158,3 +159,10 @@ void GButton::set_icon(RetainPtr<GraphicsBitmap>&& icon)
|
||||
m_icon = move(icon);
|
||||
update();
|
||||
}
|
||||
|
||||
void GButton::keydown_event(GKeyEvent& event)
|
||||
{
|
||||
if (event.key() == KeyCode::Key_Return)
|
||||
click();
|
||||
GWidget::keydown_event(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user