- see if this hotkey fix is ok for titi
This commit is contained in:
parent
8979219f43
commit
68d8ef11d8
|
@ -897,6 +897,14 @@ void MainWindow::eventKeyDown(SDL_KeyboardEvent key) {
|
||||||
if(program != NULL && program->isInSpecialKeyCaptureEvent() == false) {
|
if(program != NULL && program->isInSpecialKeyCaptureEvent() == false) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
vector<int> modifiersToCheck;
|
||||||
|
modifiersToCheck.push_back(KMOD_LCTRL);
|
||||||
|
modifiersToCheck.push_back(KMOD_RCTRL);
|
||||||
|
modifiersToCheck.push_back(KMOD_LALT);
|
||||||
|
modifiersToCheck.push_back(KMOD_RALT);
|
||||||
|
modifiersToCheck.push_back(KMOD_LSHIFT);
|
||||||
|
modifiersToCheck.push_back(KMOD_RSHIFT);
|
||||||
|
|
||||||
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
||||||
//if(key == configKeys.getCharKey("HotKeyShowDebug")) {
|
//if(key == configKeys.getCharKey("HotKeyShowDebug")) {
|
||||||
if(isKeyPressed(configKeys.getSDLKey("HotKeyShowDebug"),key) == true) {
|
if(isKeyPressed(configKeys.getSDLKey("HotKeyShowDebug"),key) == true) {
|
||||||
|
@ -924,12 +932,12 @@ void MainWindow::eventKeyDown(SDL_KeyboardEvent key) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else if(key == configKeys.getCharKey("ReloadINI")) {
|
//else if(key == configKeys.getCharKey("ReloadINI")) {
|
||||||
else if(isKeyPressed(configKeys.getSDLKey("ReloadINI"),key,false) == true) {
|
else if(isKeyPressed(configKeys.getSDLKey("ReloadINI"),key,modifiersToCheck) == true) {
|
||||||
Config &config = Config::getInstance();
|
Config &config = Config::getInstance();
|
||||||
config.reload();
|
config.reload();
|
||||||
}
|
}
|
||||||
//else if(key == configKeys.getCharKey("Screenshot")) {
|
//else if(key == configKeys.getCharKey("Screenshot")) {
|
||||||
else if(isKeyPressed(configKeys.getSDLKey("Screenshot"),key,false) == true) {
|
else if(isKeyPressed(configKeys.getSDLKey("Screenshot"),key,modifiersToCheck) == true) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Screenshot key pressed\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Screenshot key pressed\n");
|
||||||
|
|
||||||
string userData = Config::getInstance().getString("UserData_Root","");
|
string userData = Config::getInstance().getString("UserData_Root","");
|
||||||
|
|
|
@ -211,7 +211,9 @@ private:
|
||||||
static void toggleFullscreen();
|
static void toggleFullscreen();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input, vector<int> modifiersToCheck);
|
||||||
bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input, bool modifiersAllowed=true);
|
bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input, bool modifiersAllowed=true);
|
||||||
|
|
||||||
SDLKey extractKeyPressed(SDL_KeyboardEvent input);
|
SDLKey extractKeyPressed(SDL_KeyboardEvent input);
|
||||||
bool isAllowedInputTextKey(SDLKey key);
|
bool isAllowedInputTextKey(SDLKey key);
|
||||||
|
|
||||||
|
|
|
@ -703,6 +703,18 @@ MouseButton Window::getMouseButton(int sdlButton) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllowed) {
|
bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllowed) {
|
||||||
|
vector<int> modifiersToCheck;
|
||||||
|
if(modifiersAllowed == false) {
|
||||||
|
modifiersToCheck.push_back(KMOD_LCTRL);
|
||||||
|
modifiersToCheck.push_back(KMOD_RCTRL);
|
||||||
|
modifiersToCheck.push_back(KMOD_LALT);
|
||||||
|
modifiersToCheck.push_back(KMOD_RALT);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool result = isKeyPressed(compareKey, input, modifiersToCheck);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,vector<int> modifiersToCheck) {
|
||||||
Uint16 c = SDLK_UNKNOWN;
|
Uint16 c = SDLK_UNKNOWN;
|
||||||
//if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) {
|
//if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) {
|
||||||
if(input.keysym.unicode > 0) {
|
if(input.keysym.unicode > 0) {
|
||||||
|
@ -876,16 +888,16 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result == true && modifiersAllowed == false) {
|
if(result == true) {
|
||||||
//printf("input.keysym.mod = %d\n",input.keysym.mod);
|
//printf("input.keysym.mod = %d\n",input.keysym.mod);
|
||||||
|
|
||||||
if( (input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) ||
|
for(unsigned int i = 0; i < modifiersToCheck.size(); ++i) {
|
||||||
(input.keysym.mod & (KMOD_LALT | KMOD_RALT)) ||
|
if( (input.keysym.mod & modifiersToCheck[i])) {
|
||||||
(input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT))) {
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] result *WOULD HAVE BEEN TRUE* but is false due to: input.keysym.mod = %d modifiersToCheck[i] = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.mod,modifiersToCheck[i]);
|
||||||
//input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) {
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] result *WOULD HAVE BEEN TRUE* but is false due to: modifiersAllowed = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,modifiersAllowed,input.keysym.mod);
|
|
||||||
result = false;
|
result = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
string compareKeyName = SDL_GetKeyName(compareKey);
|
string compareKeyName = SDL_GetKeyName(compareKey);
|
||||||
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
||||||
|
|
Loading…
Reference in New Issue