From de3dde721140d6767a04e6a0d8836f2dac44463c Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 15 Feb 2016 14:08:13 +0000 Subject: [PATCH] Allow widgets to be selected by pressing Return, as well as Space. --- src/system/widgets.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/system/widgets.c b/src/system/widgets.c index 01a35e6..f19a76f 100644 --- a/src/system/widgets.c +++ b/src/system/widgets.c @@ -236,18 +236,20 @@ static void handleKeyboard(void) { Widget *old; - if (app.keyboard[SDL_SCANCODE_SPACE]) + if (app.keyboard[SDL_SCANCODE_SPACE] ||app.keyboard[SDL_SCANCODE_RETURN]) { if (selectedWidget != NULL && selectedWidget->type == WT_BUTTON) { playSound(SND_GUI_SELECT); old = selectedWidget; selectedWidget->action(); + if (old == selectedWidget) { selectedWidget = NULL; } - app.keyboard[SDL_SCANCODE_SPACE] = 0; + + app.keyboard[SDL_SCANCODE_SPACE] = app.keyboard[SDL_SCANCODE_RETURN] = 0; } } }