Changeset 45504 in vbox
- Timestamp:
- Apr 12, 2013 7:31:24 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r45368 r45504 800 800 break; 801 801 } 802 #elif defined(Q_WS_MAC) 803 case QEvent::WindowActivate: 804 { 805 /* If keyboard event handler is NOT currently installed; 806 * Or installed but NOT for that window: */ 802 #endif 803 default: 804 break; 805 } 806 } 807 808 else 809 810 /* Check if pWatchedObject object is view: */ 811 if (UIMachineView *pWatchedView = isItListenedView(pWatchedObject)) 812 { 813 /* Get corresponding screen index: */ 814 ulong uScreenId = m_views.key(pWatchedView); 815 NOREF(uScreenId); 816 /* Handle view events: */ 817 switch (pEvent->type()) 818 { 819 case QEvent::FocusIn: 820 { 821 #ifdef Q_WS_MAC 822 /* If keyboard-event handler is NOT currently installed; 823 * Or installed but NOT for that view: */ 807 824 if (m_iKeyboardGrabViewIndex != (int)uScreenId) 808 825 { 809 /* If keyboard 826 /* If keyboard-event handler is NOT currently installed: */ 810 827 if (m_iKeyboardGrabViewIndex == -1) 811 828 { 812 /* Install the keyboard 829 /* Install the keyboard-event handler: */ 813 830 darwinGrabKeyboardEvents(true); 814 831 } … … 816 833 m_iKeyboardGrabViewIndex = uScreenId; 817 834 } 818 break; 819 } 820 case QEvent::WindowDeactivate: 821 { 822 /* If keyboard event handler is installed exactly for that window: */ 823 if (m_iKeyboardGrabViewIndex == (int)uScreenId) 824 { 825 /* Remove the keyboard event handler: */ 826 darwinGrabKeyboardEvents(false); 827 /* Update the id: */ 828 m_iKeyboardGrabViewIndex = -1; 829 } 830 break; 831 } 832 #endif 833 default: 834 break; 835 } 836 } 837 838 else 839 840 /* Check if pWatchedObject object is view: */ 841 if (UIMachineView *pWatchedView = isItListenedView(pWatchedObject)) 842 { 843 /* Get corresponding screen index: */ 844 ulong uScreenId = m_views.key(pWatchedView); 845 NOREF(uScreenId); 846 /* Handle view events: */ 847 switch (pEvent->type()) 848 { 849 case QEvent::FocusIn: 835 #endif /* Q_WS_MAC */ 836 850 837 if (isSessionRunning()) 851 838 { … … 863 850 } 864 851 break; 852 } 865 853 case QEvent::FocusOut: 854 { 855 #ifdef Q_WS_MAC 856 /* If keyboard-event handler is installed for that view: */ 857 if (m_iKeyboardGrabViewIndex == (int)uScreenId) 858 { 859 /* Remove the keyboard-event handler: */ 860 darwinGrabKeyboardEvents(false); 861 /* Update the id: */ 862 m_iKeyboardGrabViewIndex = -1; 863 } 864 #endif /* Q_WS_MAC */ 865 866 866 /* Release keyboard: */ 867 867 if (isSessionRunning()) … … 870 870 releaseAllPressedKeys(true); 871 871 break; 872 } 872 873 case QEvent::KeyPress: 873 874 case QEvent::KeyRelease:
Note:
See TracChangeset
for help on using the changeset viewer.