Follow-up on previous commit: Generalized the "Command" key support, it compiles on all platforms and somebody may want to plug a Mac keyboard in a PC :)

Added a "command" symbol in the fonts, so shortcuts that use this key can be displayed.
Fixed: In Keyboard settings, some very weird keys (Thinkpad "volume up") were displayed with a wrong number.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@806 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2009-05-14 18:42:03 +00:00
parent 2feab9d52c
commit 4a39819c86
4 changed files with 14 additions and 16 deletions

View File

@@ -318,11 +318,8 @@ word Key_modifiers(SDLMod mod)
modifiers|=MOD_SHIFT;
if (mod & (KMOD_ALT|KMOD_MODE))
modifiers|=MOD_ALT;
#if defined(__macosx__)
if (mod & (KMOD_META))
modifiers|=MOD_META;
#endif
return modifiers;
}
@@ -457,6 +454,12 @@ const char * Key_name(word Key)
strcat(buffer, "Alt+");
if (Key & MOD_SHIFT)
strcat(buffer, "Shift+");
if (Key & MOD_META)
strcat(buffer, "\201");
// Note: Apple's "command" character is not present in the ANSI table, so we
// recycled an ANSI value that doesn't have any displayable character
// associated.
Key=Key & ~(MOD_CTRL|MOD_ALT|MOD_SHIFT);
@@ -495,12 +498,12 @@ const char * Key_name(word Key)
return buffer;
}
if (Key & 0x8000)
if (Key & 0x800)
{
sprintf(buffer+strlen(buffer), "[%d]", Key & 0xFFF);
sprintf(buffer+strlen(buffer), "[%d]", Key & 0x7FF);
return buffer;
}
Key = Key & 0xFFF;
Key = Key & 0x7FF;
// Touches ASCII
if (Key>=' ' && Key < 127)
{