aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/gwin_button.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gwin/gwin_button.c b/src/gwin/gwin_button.c
index 8a178b72..854f540b 100644
--- a/src/gwin/gwin_button.c
+++ b/src/gwin/gwin_button.c
@@ -50,6 +50,24 @@
}
#endif
+#if GINPUT_NEED_KEYBOARD
+ static void _keyboardEvent(GWidgetObject* gw, GEventKeyboard* pke)
+ {
+ // ENTER and SPACE keys to press the button
+ if (pke->c[0] == GKEY_ENTER || pke->c[0] == GKEY_SPACE) {
+
+ // Press or release event?
+ if (pke->keystate & GKEYSTATE_KEYUP) {
+ gw->g.flags &= ~GBUTTON_FLG_PRESSED;
+ } else {
+ gw->g.flags |= GBUTTON_FLG_PRESSED;
+ }
+ }
+
+ _gwinUpdate((GHandle)gw);
+ }
+#endif
+
#if GINPUT_NEED_TOGGLE
// A toggle off has occurred
static void ButtonToggleOff(GWidgetObject *gw, uint16_t role) {
@@ -97,7 +115,7 @@ static const gwidgetVMT buttonVMT = {
#endif
#if GINPUT_NEED_KEYBOARD
{
- 0 // Process keyboard events
+ _keyboardEvent // Process keyboard events
},
#endif
#if GINPUT_NEED_TOGGLE