Ticket #953: Ticket#953_v2.patch
File Ticket#953_v2.patch, 2.5 KB (added by , 12 years ago) |
---|
-
ps/ConfigDB.cpp
284 284 ret.push_back(std::make_pair(it->first, it->second)); 285 285 } 286 286 287 bool isKeyAlreadyPresent = false; 287 288 for (int search_ns = ns; search_ns >= 0; search_ns--) 288 289 { 289 290 for (TConfigMap::iterator it = m_Map[search_ns].begin(); it != m_Map[search_ns].end(); ++it) 290 291 { 291 292 if (boost::algorithm::starts_with(it->first, prefix)) 292 ret.push_back(std::make_pair(it->first, it->second)); 293 { 294 isKeyAlreadyPresent = false; 295 for (int i = 0; i < ret.size(); i++) 296 { 297 if (ret[i].first == it->first) 298 { 299 isKeyAlreadyPresent = true; 300 break; 301 } 302 } 303 304 if (!isKeyAlreadyPresent) 305 { 306 ret.push_back(std::make_pair(it->first, it->second)); 307 } 308 } 293 309 } 294 310 } 295 311 -
ps/Hotkey.cpp
58 58 // The current pressed status of hotkeys 59 59 std::map<std::string, bool> g_HotkeyStatus; 60 60 61 // Delete multiple hotkey for same key combination 62 // Compare all keys require in requires if there is same combination already in use, delete other one 63 static void RemoveOverlapingHotKeys() 64 { 65 for (std::map<int, KeyMapping>::iterator itHkm = g_HotkeyMap.begin(); itHkm != g_HotkeyMap.end(); ++itHkm) 66 { 67 for (unsigned int kmi = 0; kmi < itHkm->second.size(); kmi++) 68 { 69 for (unsigned int kmj = 0; kmj < kmi; kmj++) 70 { 71 if (itHkm->second[kmi].requires.size() > 0 && 72 itHkm->second[kmi].requires.size() == itHkm->second[kmj].requires.size()) 73 { 74 bool match = false; 75 for (unsigned int i = 0; i < itHkm->second[kmi].requires.size(); i++) 76 { 77 for (unsigned int j = 0; j < itHkm->second[kmj].requires.size(); j++) 78 { 79 if (itHkm->second[kmi].requires[i].code == itHkm->second[kmj].requires[j].code) 80 { 81 match = true; 82 break; 83 } 84 } 85 86 if (!match) 87 { 88 break; 89 } 90 } 91 92 if (match) 93 { 94 itHkm->second.erase(itHkm->second.begin() + kmi); 95 kmi--; 96 break; 97 } 98 } 99 } 100 } 101 } 102 } 103 61 104 // Look up each key binding in the config file and set the mappings for 62 105 // all key combinations that trigger it. 63 106 static void LoadConfigBindings() … … 140 183 } 141 184 } 142 185 } 186 187 RemoveOverlapingHotKeys(); 143 188 } 144 189 145 190 void LoadHotkeys()