Changeset 52512 in vbox
- Timestamp:
- Aug 28, 2014 12:05:12 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r52478 r52512 32 32 #include "QIMenu.h" 33 33 #ifdef Q_WS_MAC 34 # include "UICocoaApplication.h" 34 35 # include "UIExtraDataManager.h" 35 36 # include "VBoxUtils.h" … … 511 512 512 513 #ifdef Q_WS_MAC 514 /* For ML and next: */ 515 if (vboxGlobal().osRelease() > MacOSXRelease_Lion) 516 { 517 /* Register to native notifications: */ 518 UICocoaApplication::instance()->registerToNotificationOfWorkspace("NSWorkspaceDidActivateApplicationNotification", this, 519 UIMachineLogicFullscreen::nativeHandlerForApplicationActivation); 520 } 521 513 522 /* We have to make sure that we are getting the front most process. 514 523 * This is necessary for Qt versions > 4.3.3: */ … … 599 608 return; 600 609 610 #ifdef Q_WS_MAC 611 /* For ML and next: */ 612 if (vboxGlobal().osRelease() > MacOSXRelease_Lion) 613 { 614 /* Unregister from native notifications: */ 615 UICocoaApplication::instance()->unregisterFromNotificationOfWorkspace("NSWorkspaceDidActivateApplicationNotification", this); 616 } 617 #endif/* Q_WS_MAC */ 618 601 619 /* Mark machine-window(s) destroyed: */ 602 620 setMachineWindowsCreated(false); … … 688 706 689 707 /* Get screen ID: */ 690 ulong uScreenID = pMachineWindow->screenId();708 const ulong uScreenID = pMachineWindow->screenId(); 691 709 LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: For machine-window #%d.\n", 692 710 (int)uScreenID)); … … 695 713 if (uScreenID != 0 && !screensHaveSeparateSpaces()) 696 714 { 697 /* If there is no fullscreen window or it's invalidated: */ 698 if (m_fullscreenMachineWindows.isEmpty() || !m_invalidFullscreenMachineWindows.isEmpty()) 715 /* We are hiding transient window if: 716 * 1. application is inactive at all or 717 * 2. there is no fullscreen window or it's invalidated. */ 718 if ( !UICocoaApplication::instance()->isActive() 719 || m_fullscreenMachineWindows.isEmpty() || !m_invalidFullscreenMachineWindows.isEmpty()) 699 720 { 700 721 LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: " … … 794 815 revalidateNativeFullScreen(pMachineWindow); 795 816 } 817 818 /* static */ 819 void UIMachineLogicFullscreen::nativeHandlerForApplicationActivation(QObject *pObject, const QMap<QString, QString> &userInfo) 820 { 821 /* Handle arrived notification: */ 822 UIMachineLogicFullscreen *pLogic = qobject_cast<UIMachineLogicFullscreen*>(pObject); 823 AssertPtrReturnVoid(pLogic); 824 { 825 /* Redirect arrived notification: */ 826 pLogic->nativeHandlerForApplicationActivation(userInfo); 827 } 828 } 829 830 void UIMachineLogicFullscreen::nativeHandlerForApplicationActivation(const QMap<QString, QString> &userInfo) 831 { 832 /* Make sure we have BundleIdentifier key: */ 833 AssertReturnVoid(userInfo.contains("BundleIdentifier")); 834 835 /* On VirtualBox activation: */ 836 if (userInfo.value("BundleIdentifier") == "org.virtualbox.app.VirtualBox") 837 { 838 LogRel(("UIMachineLogicFullscreen::nativeHandlerForApplicationActivation: BundleIdentifier = %s\n", 839 userInfo.value("BundleIdentifier").toAscii().constData())); 840 841 /* Make sure all the transient machine-windows updated: */ 842 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 843 if (pMachineWindow->screenId() != 0 && !screensHaveSeparateSpaces()) 844 { 845 /* If there is no fullscreen window or it's invalidated: */ 846 if (m_fullscreenMachineWindows.isEmpty() || !m_invalidFullscreenMachineWindows.isEmpty()) 847 { 848 LogRel(("UIMachineLogicFullscreen::nativeHandlerForApplicationActivation: " 849 "Ask transient machine-window #%d to hide.\n", (int)pMachineWindow->screenId())); 850 851 pMachineWindow->hide(); 852 } 853 /* If there is valid fullscreen window: */ 854 else 855 { 856 LogRel(("UIMachineLogicFullscreen::nativeHandlerForApplicationActivation: " 857 "Ask transient machine-window #%d to show/normalize.\n", (int)pMachineWindow->screenId())); 858 859 /* Make sure window have proper geometry and shown: */ 860 pMachineWindow->showInNecessaryMode(); 861 } 862 } 863 } 864 } 796 865 #endif /* Q_WS_MAC */ 797 866 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
r52300 r52512 139 139 /** Mac OS X: Revalidates 'fullscreen' mode for all windows. */ 140 140 void revalidateNativeFullScreen(); 141 142 /** Mac OS X: Proxies native notification about active space change. */ 143 static void nativeHandlerForApplicationActivation(QObject *pObject, const QMap<QString, QString> &userInfo); 144 /** Mac OS X: Handles native notification about active space change. */ 145 void nativeHandlerForApplicationActivation(const QMap<QString, QString> &userInfo); 141 146 #endif /* Q_WS_MAC */ 142 147
Note:
See TracChangeset
for help on using the changeset viewer.