| 1294 | } |
| 1295 | |
| 1296 | KeyID MSWindowsKeyState::getIDForKey( |
| 1297 | deskflow::KeyMap::KeyItem &item, KeyButton button, UINT virtualKey, PBYTE keyState, HKL hkl |
| 1298 | ) const |
| 1299 | { |
| 1300 | WCHAR unicode[2]; |
| 1301 | int n = m_ToUnicodeEx(virtualKey, button, keyState, unicode, sizeof(unicode) / sizeof(unicode[0]), 0, hkl); |
| 1302 | KeyID id = static_cast<KeyID>(unicode[0]); |
| 1303 | |
| 1304 | switch (n) { |
| 1305 | case -1: { |
| 1306 | // dead key. add an space to the keyboard so we exit |
| 1307 | // the dead key mode and future calls to this function |
| 1308 | // with different modifiers are not affected. |
| 1309 | |
| 1310 | BYTE emptyState[256] = {}; |
| 1311 | n = m_ToUnicodeEx(VK_SPACE, 0, emptyState, unicode, sizeof(unicode) / sizeof(unicode[0]), 0, hkl); |
| 1312 | |
| 1313 | // as an alternative, we could use the returned |
| 1314 | // buffer in unicode to look at the dead key character |
| 1315 | // and not rely on getDeadKey to provide the mapping |
| 1316 | return deskflow::KeyMap::getDeadKey(id); |
| 1317 | } |
| 1318 | default: |
| 1319 | case 0: |
| 1320 | // unmapped |
| 1321 | return kKeyNone; |
| 1322 | |
| 1323 | case 1: |
| 1324 | return id; |
| 1325 | |
| 1326 | case 2: |
| 1327 | // left over dead key in buffer. this used to recurse, |
| 1328 | // but apparently this causes a stack overflow, so just |
| 1329 | // return no key instead. |
| 1330 | return kKeyNone; |
| 1331 | } |
| 1332 | } |
| 1333 | |
| 1334 | void MSWindowsKeyState::addKeyEntry(deskflow::KeyMap &keyMap, deskflow::KeyMap::KeyItem &item) |
| 1335 | { |
nothing calls this directly
no outgoing calls
no test coverage detected