Changeset 48504 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 17, 2013 3:02:04 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r48496 r48504 25 25 #include <QPainter> 26 26 #include <QTimer> 27 #include <QDateTime> 27 28 #ifdef Q_WS_MAC 28 29 # include <QMenuBar> … … 1010 1011 void UIMachineLogic::cleanupActionGroups() 1011 1012 { 1013 } 1014 1015 bool UIMachineLogic::eventFilter(QObject *pWatched, QEvent *pEvent) 1016 { 1017 /* Handle machine-window events: */ 1018 if (UIMachineWindow *pMachineWindow = qobject_cast<UIMachineWindow*>(pWatched)) 1019 { 1020 /* Make sure this window still registered: */ 1021 if (isMachineWindowsCreated() && m_machineWindowsList.contains(pMachineWindow)) 1022 { 1023 switch (pEvent->type()) 1024 { 1025 /* Handle *window activated* event: */ 1026 case QEvent::WindowActivate: 1027 { 1028 /* We should save current lock states as *previous* and 1029 * set current lock states to guest values we have, 1030 * As we have no ipc between threads of different VMs 1031 * we are using 300ms timer as lazy sync timout: */ 1032 QTimer::singleShot(300, this, SLOT(sltSwitchKeyboardLedsToGuestLeds())); 1033 break; 1034 } 1035 /* Handle *window deactivated* event: */ 1036 case QEvent::WindowDeactivate: 1037 { 1038 /* We should restore lock states to *previous* known: */ 1039 sltSwitchKeyboardLedsToPreviousLeds(); 1040 break; 1041 } 1042 /* Default: */ 1043 default: break; 1044 } 1045 } 1046 } 1047 /* Call to base-class: */ 1048 return QIWithRetranslateUI3<QObject>::eventFilter(pWatched, pEvent); 1012 1049 } 1013 1050 … … 2137 2174 #endif /* Q_WS_MAC */ 2138 2175 2176 void UIMachineLogic::sltSwitchKeyboardLedsToGuestLeds() 2177 { 2178 // /* Log statement (printf): */ 2179 // QString strDt = QDateTime::currentDateTime().toString("HH:mm:ss:zzz"); 2180 // printf("%s: UIMachineLogic: sltSwitchKeyboardLedsToGuestLeds called, machine name is {%s}\n", 2181 // strDt.toAscii().constData(), 2182 // session().GetMachine().GetName().toAscii().constData()); 2183 2184 /* Here we have to save current host LED lock states in UISession registry. 2185 * [void] uisession() -> setHostNumLock(), setHostCapsLock(), setHostScrollLock() can be used for that. */ 2186 2187 /* Here we have to update host LED lock states using values provided by UISession registry. 2188 * [bool] uisession() -> isNumLock(), isCapsLock(), isScrollLock() can be used for that. */ 2189 } 2190 2191 void UIMachineLogic::sltSwitchKeyboardLedsToPreviousLeds() 2192 { 2193 // /* Log statement (printf): */ 2194 // QString strDt = QDateTime::currentDateTime().toString("HH:mm:ss:zzz"); 2195 // printf("%s: UIMachineLogic: sltSwitchKeyboardLedsToPreviousLeds called, machine name is {%s}\n", 2196 // strDt.toAscii().constData(), 2197 // session().GetMachine().GetName().toAscii().constData()); 2198 2199 /* Here we have to restore host LED lock states from UISession registry. 2200 * [bool] uisession() -> isHostNumLock(), isHostCapsLock(), isHostScrollLock() can be used for that. */ 2201 } 2202 2139 2203 int UIMachineLogic::searchMaxSnapshotIndex(const CMachine &machine, 2140 2204 const CSnapshot &snapshot, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r48386 r48504 165 165 //virtual void cleanupSessionConnections() {} 166 166 //virtual void cleanupRequiredFeatures() {} 167 168 /* Handler: Event-filter stuff: */ 169 bool eventFilter(QObject *pWatched, QEvent *pEvent); 167 170 168 171 private slots: … … 222 225 #endif /* RT_OS_DARWIN */ 223 226 227 /* Handlers: Keyboard LEDs sync logic: */ 228 void sltSwitchKeyboardLedsToGuestLeds(); 229 void sltSwitchKeyboardLedsToPreviousLeds(); 230 224 231 private: 225 232 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r48314 r48504 99 99 , m_fCapsLock(false) 100 100 , m_fScrollLock(false) 101 , m_fHostNumLock(false) 102 , m_fHostCapsLock(false) 103 , m_fHostScrollLock(false) 101 104 , m_uNumLockAdaptionCnt(2) 102 105 , m_uCapsLockAdaptionCnt(2) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r47478 r48504 134 134 bool isCapsLock() const { return m_fCapsLock; } 135 135 bool isScrollLock() const { return m_fScrollLock; } 136 bool isHostNumLock() const { return m_fHostNumLock; } 137 bool isHostCapsLock() const { return m_fHostCapsLock; } 138 bool isHostScrollLock() const { return m_fHostScrollLock; } 139 void setHostNumLock(bool fHostNumLock) { m_fHostNumLock = fHostNumLock; } 140 void setHostCapsLock(bool fHostCapsLock) { m_fHostCapsLock = fHostCapsLock; } 141 void setHostScrollLock(bool fHostScrollLock) { m_fHostScrollLock = fHostScrollLock; } 136 142 uint numLockAdaptionCnt() const { return m_uNumLockAdaptionCnt; } 137 143 uint capsLockAdaptionCnt() const { return m_uCapsLockAdaptionCnt; } … … 300 306 bool m_fCapsLock : 1; 301 307 bool m_fScrollLock : 1; 308 bool m_fHostNumLock : 1; 309 bool m_fHostCapsLock : 1; 310 bool m_fHostScrollLock : 1; 302 311 uint m_uNumLockAdaptionCnt; 303 312 uint m_uCapsLockAdaptionCnt;
Note:
See TracChangeset
for help on using the changeset viewer.