Changeset 45866 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 1, 2013 8:17:13 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp
r45833 r45866 393 393 * RAlt key event matching this LCtrl event (i.e. both key up or both key down) 394 394 * and if there is, we check whether the current layout has an AltGr key. We 395 * check this by comparing the translation of the 'A' virtual key with and 396 * without LCtrl and RAlt held down. In all layouts I checked without an AltGr 397 * key, the translation was the same, and in all with it was different. An 398 * alternative test would be to use GetKeyNameText() on the AltGr scan code. 399 * I feel marginally safer with the first test though. 395 * check this by looking to see if any of the number keys has a symbol 396 * associated when AltGr is pressed. Let's see how well this works! 400 397 */ 401 398 static bool isSyntheticLCtrl(MSG *pMsg) 402 399 { 403 400 MSG peekMsg; 404 BYTE auKeyStates[256] = { 0 }; 405 WORD achNoAltGr, achAltGr; 406 int cbToAscii; 401 BYTE auKeyStates[256] = 402 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0x80 }; 403 WORD ach; 404 unsigned i; 407 405 408 406 if ((pMsg->lParam & 0x01FF0000) >> 16 != 0x1d /* LCtrl */) … … 424 422 return false; 425 423 LogRel(("The next keyboard event is RAlt.\n")); 426 auKeyStates[VK_LCONTROL] = 0x80; 427 auKeyStates[VK_RMENU] = 0x80; 428 cbToAscii = ToAscii('A', 0, NULL, &achNoAltGr, 0); 429 if (!cbToAscii) 430 return false; /* Not expected! */ 431 LogRel(("Key A has an ASCII value attached.\n")); 432 if ( cbToAscii == ToAscii('A', 0, auKeyStates, &achAltGr, 0) 433 && (achNoAltGr == achAltGr)) 434 return false; 435 LogRel(("Key A has a different value when AltGr is down.\n")); 424 for (i = '0'; i <= '9'; ++i) 425 if (ToAscii(i, 0, auKeyStates, &ach, 0)) 426 break; 427 if (i > '9') 428 return false; 429 LogRel(("One of the number keys has an AltGr state.\n")); 436 430 return true; 437 431 }
Note:
See TracChangeset
for help on using the changeset viewer.