Changeset 61954 in vbox
- Timestamp:
- Jun 30, 2016 10:51:51 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 108397
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r61945 r61954 467 467 bool fSentRESEND = false; 468 468 469 /* Send a dummy scan code (RESEND)to prevent the guest OS from recognizing469 /* Send a dummy modifier sequence to prevent the guest OS from recognizing 470 470 * a single key click (for ex., Alt) and performing an unwanted action 471 471 * (for ex., activating the menu) when we release all pressed keys below. 472 * Note, that it's just a guess that sending RESEND will give the desired 473 * effect :), but at least it works with NT and W2k guests. */ 472 * This is just a work-around and is likely to fail in some cases. We are 473 * not aware of any ideal solution. Historically we sent an 0xFE scan code, 474 * but this is a real key release code on Brazilian keyboards. */ 474 475 for (uint i = 0; i < SIZEOF_ARRAY (m_pressedKeys); i++) 475 476 { 476 if ( m_pressedKeys[i] & IsKeyPressed)477 if ((m_pressedKeys[i] & IsKeyPressed) || (m_pressedKeys[i] & IsExtKeyPressed)) 477 478 { 478 479 if (!fSentRESEND) 479 480 { 480 keyboard().PutScancode(0xFE); 481 LONG aCodes[] = { 0x1D, 0x2A, 0x38, 0x9D, 0xAA, 0xB8 }; 482 QVector <LONG> codes(RT_ELEMENTS(aCodes)); 483 for (unsigned i = 0; i < RT_ELEMENTS(aCodes); ++i) 484 codes[i] = aCodes[i]; 485 keyboard().PutScancodes(codes); 486 m_pressedKeys[0x1D] = m_pressedKeys[0x2A] = m_pressedKeys[0x38] = 0; 481 487 fSentRESEND = true; 482 488 } 483 keyboard().PutScancode(i | 0x80); 484 } 485 else if (m_pressedKeys[i] & IsExtKeyPressed) 486 { 487 if (!fSentRESEND) 488 { 489 keyboard().PutScancode(0xFE); 490 fSentRESEND = true; 491 } 492 QVector <LONG> codes(2); 493 codes[0] = 0xE0; 494 codes[1] = i | 0x80; 495 keyboard().PutScancodes(codes); 489 if (m_pressedKeys[i] & IsKeyPressed) 490 keyboard().PutScancode(i | 0x80); 491 else 492 { 493 QVector <LONG> codes(2); 494 codes[0] = 0xE0; 495 codes[1] = i | 0x80; 496 keyboard().PutScancodes(codes); 497 } 496 498 } 497 499 m_pressedKeys[i] = 0;
Note:
See TracChangeset
for help on using the changeset viewer.