mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 03:32:35 +01:00
- 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) {
|
||||
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));
|
||||
//if(key == configKeys.getCharKey("HotKeyShowDebug")) {
|
||||
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(isKeyPressed(configKeys.getSDLKey("ReloadINI"),key,false) == true) {
|
||||
else if(isKeyPressed(configKeys.getSDLKey("ReloadINI"),key,modifiersToCheck) == true) {
|
||||
Config &config = Config::getInstance();
|
||||
config.reload();
|
||||
}
|
||||
//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");
|
||||
|
||||
string userData = Config::getInstance().getString("UserData_Root","");
|
||||
|
@ -211,7 +211,9 @@ private:
|
||||
static void toggleFullscreen();
|
||||
};
|
||||
|
||||
bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input, vector<int> modifiersToCheck);
|
||||
bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input, bool modifiersAllowed=true);
|
||||
|
||||
SDLKey extractKeyPressed(SDL_KeyboardEvent input);
|
||||
bool isAllowedInputTextKey(SDLKey key);
|
||||
|
||||
|
@ -703,6 +703,18 @@ MouseButton Window::getMouseButton(int sdlButton) {
|
||||
}
|
||||
|
||||
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;
|
||||
//if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) {
|
||||
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);
|
||||
|
||||
if( (input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) ||
|
||||
(input.keysym.mod & (KMOD_LALT | KMOD_RALT)) ||
|
||||
(input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT))) {
|
||||
//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);
|
||||
for(unsigned int i = 0; i < modifiersToCheck.size(); ++i) {
|
||||
if( (input.keysym.mod & modifiersToCheck[i])) {
|
||||
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]);
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
string compareKeyName = SDL_GetKeyName(compareKey);
|
||||
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
||||
|
Loading…
x
Reference in New Issue
Block a user