summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-29 08:42:37 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-29 08:43:04 +0300
commita35cd59a3fe8c9ce70408e1ef7ab3a42f3369872 (patch)
treefeac27aa0ce52f3008713550f479a63d347c6ab9
parent34d7ac2c5df7f2792d29fbbd9b58fed3783fdc6e (diff)
Default dialog buttons show key shortcut
-rw-r--r--src/ui/util.c7
1 files changed, 7 insertions, 0 deletions
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) {
96 if (key == 0x20) { 96 if (key == 0x20) {
97 appendCStr_String(str, "Space"); 97 appendCStr_String(str, "Space");
98 } 98 }
99 else if (key == SDLK_ESCAPE) {
100 appendCStr_String(str, "Esc");
101 }
99 else if (key == SDLK_LEFT) { 102 else if (key == SDLK_LEFT) {
100 appendChar_String(str, 0x2190); 103 appendChar_String(str, 0x2190);
101 } 104 }
@@ -117,6 +120,9 @@ void toString_Sym(int key, int kmods, iString *str) {
117 else if (key == SDLK_DELETE) { 120 else if (key == SDLK_DELETE) {
118 appendChar_String(str, 0x2326); /* Erase to the Right */ 121 appendChar_String(str, 0x2326); /* Erase to the Right */
119 } 122 }
123 else if (key == SDLK_RETURN) {
124 appendChar_String(str, 0x21a9); /* Leftwards arrow with a hook */
125 }
120 else { 126 else {
121 appendCStr_String(str, SDL_GetKeyName(key)); 127 appendCStr_String(str, SDL_GetKeyName(key));
122 } 128 }
@@ -1631,6 +1637,7 @@ iWidget *makeDialogButtons_Widget(const iMenuItem *actions, size_t numActions) {
1631 } 1637 }
1632 iLabelWidget *button = 1638 iLabelWidget *button =
1633 addChild_Widget(div, iClob(newKeyMods_LabelWidget(label, key, kmods, cmd))); 1639 addChild_Widget(div, iClob(newKeyMods_LabelWidget(label, key, kmods, cmd)));
1640 setFlags_Widget(as_Widget(button), alignLeft_WidgetFlag | drawKey_WidgetFlag, isDefault);
1634 setFont_LabelWidget(button, isDefault ? fonts[1] : fonts[0]); 1641 setFont_LabelWidget(button, isDefault ? fonts[1] : fonts[0]);
1635 } 1642 }
1636 return div; 1643 return div;