summaryrefslogtreecommitdiff
path: root/src/ui/util.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-03 11:03:47 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-03 11:58:51 +0200
commite0f586866ebafa296bda849b392d09fc2e14d487 (patch)
tree5536cf6f56f9c71db6b24cc185618387c35bdf4d /src/ui/util.c
parent76f9ab985c135c6f691276b4edd0c340a6bc2de1 (diff)
CapsLock as a modifier key; adding a modifier mapping table
IssueID #87
Diffstat (limited to 'src/ui/util.c')
-rw-r--r--src/ui/util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 5fb3e9f3..934a6d9b 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -89,6 +89,9 @@ void toString_Sym(int key, int kmods, iString *str) {
89 appendCStr_String(str, "Meta+"); 89 appendCStr_String(str, "Meta+");
90 } 90 }
91#endif 91#endif
92 if (kmods & KMOD_CAPS) {
93 appendCStr_String(str, "Caps+");
94 }
92 if (key == 0x20) { 95 if (key == 0x20) {
93 appendCStr_String(str, "Space"); 96 appendCStr_String(str, "Space");
94 } 97 }
@@ -120,7 +123,8 @@ void toString_Sym(int key, int kmods, iString *str) {
120 123
121iBool isMod_Sym(int key) { 124iBool isMod_Sym(int key) {
122 return key == SDLK_LALT || key == SDLK_RALT || key == SDLK_LCTRL || key == SDLK_RCTRL || 125 return key == SDLK_LALT || key == SDLK_RALT || key == SDLK_LCTRL || key == SDLK_RCTRL ||
123 key == SDLK_LGUI || key == SDLK_RGUI || key == SDLK_LSHIFT || key == SDLK_RSHIFT; 126 key == SDLK_LGUI || key == SDLK_RGUI || key == SDLK_LSHIFT || key == SDLK_RSHIFT ||
127 key == SDLK_CAPSLOCK;
124} 128}
125 129
126int normalizedMod_Sym(int key) { 130int normalizedMod_Sym(int key) {
@@ -132,7 +136,7 @@ int normalizedMod_Sym(int key) {
132} 136}
133 137
134int keyMods_Sym(int kmods) { 138int keyMods_Sym(int kmods) {
135 kmods &= (KMOD_SHIFT | KMOD_ALT | KMOD_CTRL | KMOD_GUI); 139 kmods &= (KMOD_SHIFT | KMOD_ALT | KMOD_CTRL | KMOD_GUI | KMOD_CAPS);
136 /* Don't treat left/right modifiers differently. */ 140 /* Don't treat left/right modifiers differently. */
137 if (kmods & KMOD_SHIFT) kmods |= KMOD_SHIFT; 141 if (kmods & KMOD_SHIFT) kmods |= KMOD_SHIFT;
138 if (kmods & KMOD_ALT) kmods |= KMOD_ALT; 142 if (kmods & KMOD_ALT) kmods |= KMOD_ALT;