Added additional windows modifier key checks for windows Qt GUI.
This commit is contained in:
parent
ddaa20f171
commit
96f4c6a712
|
@ -140,7 +140,7 @@ static void UpdateTopRider(void);
|
|||
static uint32 JSreturn = 0;
|
||||
|
||||
#include "keyscan.h"
|
||||
static uint8 g_keyState[SDL_NUM_SCANCODES];
|
||||
static uint8_t g_keyState[SDL_NUM_SCANCODES];
|
||||
static int keyModifier = 0;
|
||||
//static int DIPS = 0;
|
||||
|
||||
|
@ -1321,6 +1321,17 @@ UpdatePhysicalInput()
|
|||
//printf("SDL_Event.type: %i Keysym: %i ScanCode: %i\n",
|
||||
// event.type, event.key.keysym.sym, event.key.keysym.scancode );
|
||||
|
||||
#ifdef WIN32
|
||||
g_keyState[SDL_SCANCODE_LSHIFT] = win32GetKeyState( SDL_SCANCODE_LSHIFT );
|
||||
g_keyState[SDL_SCANCODE_RSHIFT] = win32GetKeyState( SDL_SCANCODE_RSHIFT );
|
||||
g_keyState[SDL_SCANCODE_LALT ] = win32GetKeyState( SDL_SCANCODE_LALT );
|
||||
g_keyState[SDL_SCANCODE_RALT ] = win32GetKeyState( SDL_SCANCODE_RALT );
|
||||
g_keyState[SDL_SCANCODE_LCTRL ] = win32GetKeyState( SDL_SCANCODE_LCTRL );
|
||||
g_keyState[SDL_SCANCODE_RCTRL ] = win32GetKeyState( SDL_SCANCODE_RCTRL );
|
||||
g_keyState[SDL_SCANCODE_LGUI ] = win32GetKeyState( SDL_SCANCODE_LGUI );
|
||||
g_keyState[SDL_SCANCODE_RGUI ] = win32GetKeyState( SDL_SCANCODE_RGUI );
|
||||
#endif
|
||||
|
||||
keyModifier = event.key.keysym.mod;
|
||||
|
||||
if ( (event.key.keysym.mod & KMOD_LSHIFT) == 0 )
|
||||
|
|
|
@ -1294,6 +1294,45 @@ int convKeyEvent2Sequence( QKeyEvent *event )
|
|||
return (m | k);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
uint8_t win32GetKeyState( unsigned int vkey )
|
||||
{
|
||||
uint8_t state = 0;
|
||||
|
||||
switch ( vkey )
|
||||
{
|
||||
case SDL_SCANCODE_LSHIFT:
|
||||
state = (keyBuf[VK_LSHIFT] & 0x80) ? 1 : 0;
|
||||
break;
|
||||
case SDL_SCANCODE_RSHIFT:
|
||||
state = (keyBuf[VK_RSHIFT] & 0x80) ? 1 : 0;
|
||||
break;
|
||||
case SDL_SCANCODE_LALT:
|
||||
state = (keyBuf[VK_LMENU] & 0x80) ? 1 : 0;
|
||||
break;
|
||||
case SDL_SCANCODE_RALT:
|
||||
state = (keyBuf[VK_RMENU] & 0x80) ? 1 : 0;
|
||||
break;
|
||||
case SDL_SCANCODE_LCTRL:
|
||||
state = (keyBuf[VK_LCONTROL] & 0x80) ? 1 : 0;
|
||||
break;
|
||||
case SDL_SCANCODE_RCTRL:
|
||||
state = (keyBuf[VK_RCONTROL] & 0x80) ? 1 : 0;
|
||||
break;
|
||||
case SDL_SCANCODE_LGUI:
|
||||
state = (keyBuf[VK_LWIN] & 0x80) ? 1 : 0;
|
||||
break;
|
||||
case SDL_SCANCODE_RGUI:
|
||||
state = (keyBuf[VK_RWIN] & 0x80) ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
state = 0;
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
#endif
|
||||
|
||||
int pushKeyEvent(QKeyEvent *event, int pressDown)
|
||||
{
|
||||
SDL_Event sdlev;
|
||||
|
|
|
@ -57,3 +57,7 @@ SDL_Keymod convQtKey2SDLModifier( Qt::KeyboardModifiers m );
|
|||
int convKeyEvent2Sequence( QKeyEvent *event );
|
||||
|
||||
int pushKeyEvent( QKeyEvent *event, int pressDown );
|
||||
|
||||
#ifdef WIN32
|
||||
uint8_t win32GetKeyState( unsigned int vkey );
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue