Changeset 89935 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Jun 29, 2021 6:38:48 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/KeyboardImpl.cpp
r85300 r89935 296 296 HRESULT Keyboard::releaseKeys() 297 297 { 298 std::vector<LONG> scancodes; 299 scancodes.resize(1); 300 scancodes[0] = 0xFC; /* Magic scancode, see PS/2 and USB keyboard devices. */ 301 return putScancodes(scancodes, NULL); 298 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 299 300 /* Release all keys on the active keyboard in order to start with a clean slate. 301 * Note that this should mirror the logic in Keyboard::putScancodes() when choosing 302 * which keyboard to send the release event to. 303 */ 304 PPDMIKEYBOARDPORT pUpPort = NULL; 305 for (int i = KEYBOARD_MAX_DEVICES - 1; i >= 0 ; --i) 306 { 307 if (mpDrv[i] && (mpDrv[i]->u32DevCaps & KEYBOARD_DEVCAP_ENABLED)) 308 { 309 pUpPort = mpDrv[i]->pUpPort; 310 break; 311 } 312 } 313 314 if (pUpPort) 315 { 316 int rc = pUpPort->pfnReleaseKeys(pUpPort); 317 if (RT_FAILURE(rc)) 318 AssertMsgFailed(("Failed to release keys on all keyboards! rc=%Rrc\n", rc)); 319 } 320 321 return S_OK; 302 322 } 303 323 … … 352 372 { 353 373 PDRVMAINKEYBOARD pDrv = RT_FROM_MEMBER(pInterface, DRVMAINKEYBOARD, IConnector); 374 375 // Before activating a different keyboard, release all keys on the currently active one. 376 if (fActive) 377 pDrv->pKeyboard->releaseKeys(); 378 354 379 if (fActive) 355 380 pDrv->u32DevCaps |= KEYBOARD_DEVCAP_ENABLED;
Note:
See TracChangeset
for help on using the changeset viewer.