Bug fix for Qt GUI mac OSX command and control key mappings.

This commit is contained in:
mbudd02 2022-02-28 20:29:56 -05:00
parent 6d74be0b21
commit 4d6d060757
1 changed files with 34 additions and 12 deletions

View File

@ -59,9 +59,9 @@ static uint32_t MetaKeyCodeR = VK_RWIN;
#elif defined(__APPLE__) #elif defined(__APPLE__)
static uint32_t ShiftKeyCodeR = 0x003C; static uint32_t ShiftKeyCodeR = 0x003C;
static uint32_t CtrlKeyCodeR = 0x0036; static uint32_t CtrlKeyCodeR = 0x003E;
static uint32_t AltKeyCodeR = 0x003D; static uint32_t AltKeyCodeR = 0x003D;
static uint32_t MetaKeyCodeR = 0x003B; static uint32_t MetaKeyCodeR = 0x0036;
#else #else
static uint32_t ShiftKeyCodeR = 0xffe2; static uint32_t ShiftKeyCodeR = 0xffe2;
@ -143,16 +143,7 @@ SDL_Scancode convQtKey2SDLScanCode(Qt::Key q, uint32_t nativeVirtualKey)
} }
break; break;
case Key_Control: case Key_Control:
if ( nativeVirtualKey == CtrlKeyCodeR ) #ifdef __APPLE__
{
s = SDL_SCANCODE_RCTRL;
}
else
{
s = SDL_SCANCODE_LCTRL;
}
break;
case Key_Meta:
if ( nativeVirtualKey == MetaKeyCodeR ) if ( nativeVirtualKey == MetaKeyCodeR )
{ {
s = SDL_SCANCODE_RGUI; s = SDL_SCANCODE_RGUI;
@ -161,6 +152,37 @@ SDL_Scancode convQtKey2SDLScanCode(Qt::Key q, uint32_t nativeVirtualKey)
{ {
s = SDL_SCANCODE_LGUI; s = SDL_SCANCODE_LGUI;
} }
#else
if ( nativeVirtualKey == CtrlKeyCodeR )
{
s = SDL_SCANCODE_RCTRL;
}
else
{
s = SDL_SCANCODE_LCTRL;
}
#endif
break;
case Key_Meta:
#ifdef __APPLE__
if ( nativeVirtualKey == CtrlKeyCodeR )
{
s = SDL_SCANCODE_RCTRL;
}
else
{
s = SDL_SCANCODE_LCTRL;
}
#else
if ( nativeVirtualKey == MetaKeyCodeR )
{
s = SDL_SCANCODE_RGUI;
}
else
{
s = SDL_SCANCODE_LGUI;
}
#endif
break; break;
case Key_Alt: case Key_Alt:
if ( nativeVirtualKey == AltKeyCodeR ) if ( nativeVirtualKey == AltKeyCodeR )