- Timestamp:
- Mar 15, 2023 12:06:02 PM (23 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r98501 r98983 204 204 { 205 205 /* Do NOT capture the keyboard if it is already captured: */ 206 if (m_f IsKeyboardCaptured)206 if (m_fKeyboardCaptured) 207 207 { 208 208 /* Make sure the right screen had captured the keyboard: */ … … 236 236 { 237 237 /* Do NOT capture the keyboard if it is already captured: */ 238 if (m_f IsKeyboardCaptured)238 if (m_fKeyboardCaptured) 239 239 return true; 240 240 … … 326 326 327 327 /* Store new keyboard-captured state value: */ 328 m_f IsKeyboardCaptured = true;328 m_fKeyboardCaptured = true; 329 329 330 330 /* Notify all the listeners: */ … … 340 340 { 341 341 /* Do NOT release the keyboard if it is already released: */ 342 if (!m_f IsKeyboardCaptured)342 if (!m_fKeyboardCaptured) 343 343 { 344 344 /* If a delayed capture is scheduled then cancel it: */ … … 396 396 397 397 /* Store new keyboard-captured state value: */ 398 m_f IsKeyboardCaptured = false;398 m_fKeyboardCaptured = false; 399 399 400 400 /* Notify all the listeners: */ … … 454 454 if (aReleaseHostKey) 455 455 { 456 m_ bIsHostComboPressed = false;456 m_fHostComboPressed = false; 457 457 m_pressedHostComboKeys.clear(); 458 458 } … … 476 476 int UIKeyboardHandler::state() const 477 477 { 478 return (m_f IsKeyboardCaptured ? UIKeyboardStateType_KeyboardCaptured : 0) |479 (m_ bIsHostComboPressed ? UIKeyboardStateType_HostKeyPressed : 0) |478 return (m_fKeyboardCaptured ? UIKeyboardStateType_KeyboardCaptured : 0) | 479 (m_fHostComboPressed ? UIKeyboardStateType_HostKeyPressed : 0) | 480 480 (m_fHostKeyComboPressInserted ? UIKeyboardStateType_HostKeyPressedInsertion : 0); 481 481 } … … 793 793 * shortcuts for example). So send it directly to the window with the 794 794 * special flag in the reserved area of lParam (to avoid recursion). */ 795 if (!fResult && m_f IsKeyboardCaptured)795 if (!fResult && m_fKeyboardCaptured) 796 796 { 797 797 ::SendMessage(pMsg->hwnd, pMsg->message, … … 906 906 void UIKeyboardHandler::sltMachineStateChanged() 907 907 { 908 /* Get machine state: */ 909 KMachineState state = uimachine()->machineState(); 908 /* Get previous and cached machine states: */ 909 const KMachineState enmPreviousState = uimachine()->machineStatePrevious(); 910 const KMachineState enmState = uimachine()->machineState(); 911 912 /* Notify all the listeners that machine state was [de]initialized: */ 913 if ( enmPreviousState == KMachineState_Null 914 || enmState == KMachineState_Null) 915 emit sigStateChange(state()); 916 910 917 /* Handle particular machine states: */ 911 switch ( state)918 switch (enmState) 912 919 { 913 920 case KMachineState_Paused: … … 952 959 * if we are not in paused VM state already: */ 953 960 if (machineLogic()->activeMachineWindow() && 954 state != KMachineState_Paused &&955 state != KMachineState_TeleportingPausedVM)961 enmState != KMachineState_Paused && 962 enmState != KMachineState_TeleportingPausedVM) 956 963 UINotificationMessage::forgetAboutPausedVMInput(); 957 964 } … … 972 979 , m_pMachineLogic(pMachineLogic) 973 980 , m_iKeyboardCaptureViewIndex(-1) 974 , m_f IsKeyboardCaptured(false)975 , m_ bIsHostComboPressed(false)981 , m_fKeyboardCaptured(false) 982 , m_fHostComboPressed(false) 976 983 , m_bIsHostComboAlone(false) 977 984 , m_bIsHostComboProcessed(false) … … 1211 1218 QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent); 1212 1219 1213 if (m_ bIsHostComboPressed && pEvent->type() == QEvent::KeyPress)1220 if (m_fHostComboPressed && pEvent->type() == QEvent::KeyPress) 1214 1221 { 1215 1222 /* Passing F1-F12 keys to the guest: */ … … 1237 1244 actionPool()->processHotKey(QKeySequence(pKeyEvent->key())); 1238 1245 } 1239 else if (!m_ bIsHostComboPressed && pEvent->type() == QEvent::KeyRelease)1246 else if (!m_fHostComboPressed && pEvent->type() == QEvent::KeyRelease) 1240 1247 { 1241 1248 /* Show a possible warning on key release which seems to be more expected by the end user: */ … … 1354 1361 * captured, but is being released under the capture. Detect this situation 1355 1362 * and do not pass on the key press to the virtual machine. */ 1356 /** @todo r=bird: Why do this complicated test before the simple m_f IsKeyboardCaptured one? */1363 /** @todo r=bird: Why do this complicated test before the simple m_fKeyboardCaptured one? */ 1357 1364 uint8_t what_pressed = (event.flags & 0x01) 1358 1365 && (event.vkCode != VK_RSHIFT) … … 1366 1373 return false; 1367 1374 1368 if (!m_f IsKeyboardCaptured)1375 if (!m_fKeyboardCaptured) 1369 1376 return false; 1370 1377 … … 1413 1420 * to the host when the user forgets the Host Key. Note that it's always possible 1414 1421 * to send C-A-D to the guest using the Host+Del combination: */ 1415 if (isSessionRunning() && m_f IsKeyboardCaptured)1422 if (isSessionRunning() && m_fKeyboardCaptured) 1416 1423 { 1417 1424 releaseKeyboard(); … … 1463 1470 1464 1471 /* Update keyboard-captured flag: */ 1465 if (m_f IsKeyboardCaptured)1472 if (m_fKeyboardCaptured) 1466 1473 m_pressedKeys[uScan] |= IsKbdCaptured; 1467 1474 else … … 1490 1497 if (isHostComboStateChanged) 1491 1498 { 1492 if (!m_ bIsHostComboPressed)1493 { 1494 m_ bIsHostComboPressed = true;1499 if (!m_fHostComboPressed) 1500 { 1501 m_fHostComboPressed = true; 1495 1502 m_bIsHostComboAlone = true; 1496 1503 m_bIsHostComboProcessed = false; … … 1501 1508 else 1502 1509 { 1503 if (m_ bIsHostComboPressed)1510 if (m_fHostComboPressed) 1504 1511 { 1505 1512 if (m_bIsHostComboAlone) … … 1523 1530 void UIKeyboardHandler::keyEventHandleHostComboRelease(ulong uScreenId) 1524 1531 { 1525 if (m_ bIsHostComboPressed)1526 { 1527 m_ bIsHostComboPressed = false;1532 if (m_fHostComboPressed) 1533 { 1534 m_fHostComboPressed = false; 1528 1535 /* Capturing/releasing keyboard/mouse if necessary: */ 1529 1536 if (m_bIsHostComboAlone && !m_bIsHostComboProcessed) … … 1532 1539 { 1533 1540 bool ok = true; 1534 if (!m_f IsKeyboardCaptured)1541 if (!m_fKeyboardCaptured) 1535 1542 { 1536 1543 /* Temporarily disable auto-capture that will take place after … … 1552 1559 || !uimachine()->isMouseIntegrated(); 1553 1560 1554 if (m_f IsKeyboardCaptured)1561 if (m_fKeyboardCaptured) 1555 1562 { 1556 1563 releaseKeyboard(); … … 1596 1603 if (!m_pressedHostComboKeys.contains(iKey)) 1597 1604 m_pressedHostComboKeys.insert(iKey, uScan); 1598 else if (m_ bIsHostComboPressed)1605 else if (m_fHostComboPressed) 1599 1606 return true; 1600 1607 } … … 1620 1627 1621 1628 /* Check if currently pressed/released key had changed host-combo state: */ 1622 const bool isHostComboStateChanged = (!m_ bIsHostComboPressed && fIsFullHostComboPresent) ||1623 ( m_ bIsHostComboPressed && !fIsFullHostComboPresent);1629 const bool isHostComboStateChanged = (!m_fHostComboPressed && fIsFullHostComboPresent) || 1630 ( m_fHostComboPressed && !fIsFullHostComboPresent); 1624 1631 1625 1632 #ifdef VBOX_WS_WIN 1626 if (m_ bIsHostComboPressed || isHostComboStateChanged)1633 if (m_fHostComboPressed || isHostComboStateChanged) 1627 1634 { 1628 1635 /* Currently this is used in winKeyboardEvent() only: */ 1629 m_fIsHostkeyInCapture = m_f IsKeyboardCaptured;1636 m_fIsHostkeyInCapture = m_fKeyboardCaptured; 1630 1637 } 1631 1638 #endif /* VBOX_WS_WIN */ … … 1644 1651 uint uCodesCount = 0; 1645 1652 uint8_t uWhatPressed = fFlags & KeyExtended ? IsExtKeyPressed : IsKeyPressed; 1646 if ((!m_ bIsHostComboPressed && !isHostComboStateChanged) ||1647 ( m_ bIsHostComboPressed && isHostComboStateChanged) ||1653 if ((!m_fHostComboPressed && !isHostComboStateChanged) || 1654 ( m_fHostComboPressed && isHostComboStateChanged) || 1648 1655 (!(fFlags & KeyPressed) && (m_pressedKeys[uScan] & uWhatPressed))) 1649 1656 { … … 1698 1705 else 1699 1706 { 1700 if (m_ bIsHostComboPressed)1707 if (m_fHostComboPressed) 1701 1708 m_bIsHostComboAlone = true; 1702 1709 } … … 1720 1727 1721 1728 /* If full host-key sequence was just finalized: */ 1722 if (isHostComboStateChanged && m_ bIsHostComboPressed)1729 if (isHostComboStateChanged && m_fHostComboPressed) 1723 1730 { 1724 1731 /* We have to make guest to release pressed keys from the host-combination: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
r98500 r98983 96 96 97 97 /* Some getters required by side-code: */ 98 bool isHostKeyPressed() const { return m_ bIsHostComboPressed; }98 bool isHostKeyPressed() const { return m_fHostComboPressed; } 99 99 #ifdef VBOX_WS_MAC 100 100 bool isHostKeyAlone() const { return m_bIsHostComboAlone; } … … 201 201 QMap<int, uint8_t> m_pressedHostComboKeys; 202 202 203 bool m_f IsKeyboardCaptured : 1;204 bool m_ bIsHostComboPressed : 1;203 bool m_fKeyboardCaptured : 1; 204 bool m_fHostComboPressed : 1; 205 205 bool m_bIsHostComboAlone : 1; 206 206 bool m_bIsHostComboProcessed : 1; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98967 r98983 324 324 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->setChecked(fServerEnabled); 325 325 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->blockSignals(false); 326 } 327 328 KMachineState UIMachine::machineStatePrevious() const 329 { 330 return uisession()->machineStatePrevious(); 326 331 } 327 332 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98940 r98983 232 232 /** @name Machine-state stuff. 233 233 ** @{ */ 234 /** Returns previous machine state. */ 235 KMachineState machineStatePrevious() const; 234 236 /** Returns cached machine state. */ 235 237 KMachineState machineState() const;
Note:
See TracChangeset
for help on using the changeset viewer.