diff --git a/LibGUI/GButton.cpp b/LibGUI/GButton.cpp index c7e52028720..371d52c614c 100644 --- a/LibGUI/GButton.cpp +++ b/LibGUI/GButton.cpp @@ -3,6 +3,7 @@ #include #include #include +#include //#define GBUTTON_DEBUG @@ -158,3 +159,10 @@ void GButton::set_icon(RetainPtr&& icon) m_icon = move(icon); update(); } + +void GButton::keydown_event(GKeyEvent& event) +{ + if (event.key() == KeyCode::Key_Return) + click(); + GWidget::keydown_event(event); +} diff --git a/LibGUI/GButton.h b/LibGUI/GButton.h index 1175885edba..75e365580a6 100644 --- a/LibGUI/GButton.h +++ b/LibGUI/GButton.h @@ -49,6 +49,7 @@ protected: virtual void mousemove_event(GMouseEvent&) override; virtual void enter_event(CEvent&) override; virtual void leave_event(CEvent&) override; + virtual void keydown_event(GKeyEvent&) override; private: String m_caption;