From a35cd59a3fe8c9ce70408e1ef7ab3a42f3369872 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Mon, 29 Mar 2021 08:42:37 +0300 Subject: Default dialog buttons show key shortcut --- src/ui/util.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ui/util.c b/src/ui/util.c index 19fba3a4..08a04105 100644 --- a/src/ui/util.c +++ b/src/ui/util.c @@ -96,6 +96,9 @@ void toString_Sym(int key, int kmods, iString *str) { if (key == 0x20) { appendCStr_String(str, "Space"); } + else if (key == SDLK_ESCAPE) { + appendCStr_String(str, "Esc"); + } else if (key == SDLK_LEFT) { appendChar_String(str, 0x2190); } @@ -117,6 +120,9 @@ void toString_Sym(int key, int kmods, iString *str) { else if (key == SDLK_DELETE) { appendChar_String(str, 0x2326); /* Erase to the Right */ } + else if (key == SDLK_RETURN) { + appendChar_String(str, 0x21a9); /* Leftwards arrow with a hook */ + } else { appendCStr_String(str, SDL_GetKeyName(key)); } @@ -1631,6 +1637,7 @@ iWidget *makeDialogButtons_Widget(const iMenuItem *actions, size_t numActions) { } iLabelWidget *button = addChild_Widget(div, iClob(newKeyMods_LabelWidget(label, key, kmods, cmd))); + setFlags_Widget(as_Widget(button), alignLeft_WidgetFlag | drawKey_WidgetFlag, isDefault); setFont_LabelWidget(button, isDefault ? fonts[1] : fonts[0]); } return div; -- cgit v1.2.3