Changeset 37348 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 7, 2011 1:26:46 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 72112
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r37322 r37348 485 485 case XFocusIn: 486 486 { 487 if ( uisession()->isRunning())487 if (isSessionRunning()) 488 488 { 489 489 if (VBoxGlobal::qtRTVersion() < ((4 << 16) | (5 << 8) | 0)) … … 494 494 captureKeyboard(uScreenId); 495 495 /* Reset the single-time disable capture flag: */ 496 if ( uisession()->isAutoCaptureDisabled())497 uisession()->setAutoCaptureDisabled(false);496 if (isAutoCaptureDisabled()) 497 setAutoCaptureDisabled(false); 498 498 } 499 499 else … … 608 608 for (int i = 0; i < theListOfViewIds.size(); ++i) 609 609 { 610 if ( m_views[theListOfViewIds[i]]->hasFocus())610 if (viewHasFocus(theListOfViewIds[i])) 611 611 { 612 612 /* Capture keyboard: */ 613 613 #ifdef Q_WS_WIN 614 if (! uisession()->isAutoCaptureDisabled() && m_globalSettings.autoCapture() &&614 if (!isAutoCaptureDisabled() && autoCaptureSetGlobally() && 615 615 GetAncestor(m_views[theListOfViewIds[i]]->winId(), GA_ROOT) == GetForegroundWindow()) 616 616 #else /* Q_WS_WIN */ 617 if (! uisession()->isAutoCaptureDisabled() && m_globalSettings.autoCapture())617 if (!isAutoCaptureDisabled() && autoCaptureSetGlobally()) 618 618 #endif /* !Q_WS_WIN */ 619 619 captureKeyboard(theListOfViewIds[i]); 620 620 /* Reset the single-time disable capture flag: */ 621 if ( uisession()->isAutoCaptureDisabled())622 uisession()->setAutoCaptureDisabled(false);621 if (isAutoCaptureDisabled()) 622 setAutoCaptureDisabled(false); 623 623 break; 624 624 } … … 827 827 { 828 828 case QEvent::FocusIn: 829 if ( uisession()->isRunning())829 if (isSessionRunning()) 830 830 { 831 831 /* Capture keyboard: */ 832 832 #ifdef Q_WS_WIN 833 if (! uisession()->isAutoCaptureDisabled() && m_globalSettings.autoCapture() &&833 if (!isAutoCaptureDisabled() && autoCaptureSetGlobally() && 834 834 GetAncestor(pWatchedView->winId(), GA_ROOT) == GetForegroundWindow()) 835 835 #else /* Q_WS_WIN */ 836 if (! uisession()->isAutoCaptureDisabled() && m_globalSettings.autoCapture())836 if (!isAutoCaptureDisabled() && autoCaptureSetGlobally()) 837 837 #endif /* !Q_WS_WIN */ 838 838 captureKeyboard(uScreenId); 839 839 /* Reset the single-time disable capture flag: */ 840 if ( uisession()->isAutoCaptureDisabled())841 uisession()->setAutoCaptureDisabled(false);840 if (isAutoCaptureDisabled()) 841 setAutoCaptureDisabled(false); 842 842 } 843 843 break; 844 844 case QEvent::FocusOut: 845 845 /* Release keyboard: */ 846 if ( uisession()->isRunning())846 if (isSessionRunning()) 847 847 releaseKeyboard(); 848 848 /* And all pressed keys: */ … … 1128 1128 * to the host when the user forgets the Host Key. Note that it's always possible 1129 1129 * to send C-A-D to the guest using the Host+Del combination: */ 1130 if ( uisession()->isRunning() && m_fIsKeyboardCaptured)1130 if (isSessionRunning() && m_fIsKeyboardCaptured) 1131 1131 { 1132 1132 releaseKeyboard(); … … 1207 1207 m_bIsHostComboAlone = true; 1208 1208 m_bIsHostComboProcessed = false; 1209 if ( uisession()->isRunning())1209 if (isSessionRunning()) 1210 1210 saveKeyStates(); 1211 1211 } … … 1241 1241 if (m_bIsHostComboAlone && !m_bIsHostComboProcessed) 1242 1242 { 1243 if ( uisession()->isRunning())1243 if (isSessionRunning()) 1244 1244 { 1245 1245 bool ok = true; … … 1249 1249 * this dialog is dismissed because the capture state is to be 1250 1250 * defined by the dialog result itself: */ 1251 uisession()->setAutoCaptureDisabled(true);1251 setAutoCaptureDisabled(true); 1252 1252 bool fIsAutoConfirmed = false; 1253 1253 ok = vboxProblem().confirmInputCapture(&fIsAutoConfirmed); 1254 1254 if (fIsAutoConfirmed) 1255 uisession()->setAutoCaptureDisabled(false);1255 setAutoCaptureDisabled(false); 1256 1256 /* Otherwise, the disable flag will be reset in the next 1257 1257 * machine-view's focus-in event (since may happen asynchronously … … 1280 1280 } 1281 1281 } 1282 if ( uisession()->isRunning())1282 if (isSessionRunning()) 1283 1283 sendChangedKeyStates(); 1284 1284 } … … 1613 1613 } 1614 1614 1615 bool UIKeyboardHandler::isAutoCaptureDisabled() 1616 { 1617 return uisession()->isAutoCaptureDisabled(); 1618 } 1619 1620 void UIKeyboardHandler::setAutoCaptureDisabled(bool fIsAutoCaptureDisabled) 1621 { 1622 uisession()->setAutoCaptureDisabled(fIsAutoCaptureDisabled); 1623 } 1624 1625 bool UIKeyboardHandler::autoCaptureSetGlobally() 1626 { 1627 return m_globalSettings.autoCapture(); 1628 } 1629 1630 bool UIKeyboardHandler::viewHasFocus(ulong uScreenId) 1631 { 1632 return m_views[uScreenId]->hasFocus(); 1633 } 1634 1635 bool UIKeyboardHandler::isSessionRunning() 1636 { 1637 return uisession()->isRunning(); 1638 } 1639 1615 1640 UIMachineWindow* UIKeyboardHandler::isItListenedWindow(QObject *pWatchedObject) const 1616 1641 { … … 1646 1671 return pResultView; 1647 1672 } 1648 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
r37322 r37348 137 137 void saveKeyStates(); 138 138 void sendChangedKeyStates(); 139 bool isAutoCaptureDisabled(); 140 void setAutoCaptureDisabled(bool fIsAutoCaptureDisabled); 141 bool autoCaptureSetGlobally(); 142 bool viewHasFocus(ulong uScreenId); 143 bool isSessionRunning(); 139 144 140 145 UIMachineWindow* isItListenedWindow(QObject *pWatchedObject) const;
Note:
See TracChangeset
for help on using the changeset viewer.