Changeset 52752 in vbox
- Timestamp:
- Sep 15, 2014 3:15:38 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
r52730 r52752 523 523 UICocoaApplication::instance()->registerToNotificationOfWorkspace("NSWorkspaceDidActivateApplicationNotification", this, 524 524 UIMachineLogicFullscreen::nativeHandlerForApplicationActivation); 525 UICocoaApplication::instance()->registerToNotificationOfWorkspace("NSWorkspaceActiveSpaceDidChangeNotification", this, 526 UIMachineLogicFullscreen::nativeHandlerForActiveSpaceChange); 525 527 } 526 528 … … 619 621 /* Unregister from native notifications: */ 620 622 UICocoaApplication::instance()->unregisterFromNotificationOfWorkspace("NSWorkspaceDidActivateApplicationNotification", this); 623 UICocoaApplication::instance()->unregisterFromNotificationOfWorkspace("NSWorkspaceActiveSpaceDidChangeNotification", this); 621 624 } 622 625 #endif/* Q_WS_MAC */ … … 723 726 { 724 727 /* We are hiding transient window if: 725 * 1. application is inactive at all or728 * 1. primary window is not on active user-space 726 729 * 2. there is no fullscreen window or it's invalidated. */ 727 if ( ! UICocoaApplication::instance()->isActive()730 if ( !darwinIsOnActiveSpace(machineWindows().first()) 728 731 || m_fullscreenMachineWindows.isEmpty() || !m_invalidFullscreenMachineWindows.isEmpty()) 729 732 { … … 860 863 /* Make sure we have BundleIdentifier key: */ 861 864 AssertReturnVoid(userInfo.contains("BundleIdentifier")); 862 863 /* On VirtualBox activation: */ 864 if (userInfo.value("BundleIdentifier") == "org.virtualbox.app.VirtualBox") 865 { 866 LogRel(("UIMachineLogicFullscreen::nativeHandlerForApplicationActivation: BundleIdentifier = %s\n", 867 userInfo.value("BundleIdentifier").toAscii().constData())); 868 869 /* Make sure all the transient machine-windows updated: */ 870 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 871 if (pMachineWindow->screenId() != 0 && !screensHaveSeparateSpaces()) 872 { 873 /* If there is no fullscreen window or it's invalidated: */ 874 if (m_fullscreenMachineWindows.isEmpty() || !m_invalidFullscreenMachineWindows.isEmpty()) 875 { 876 LogRel(("UIMachineLogicFullscreen::nativeHandlerForApplicationActivation: " 877 "Ask transient machine-window #%d to hide.\n", (int)pMachineWindow->screenId())); 878 879 pMachineWindow->hide(); 880 } 881 /* If there is valid fullscreen window: */ 882 else 883 { 884 LogRel(("UIMachineLogicFullscreen::nativeHandlerForApplicationActivation: " 885 "Ask transient machine-window #%d to show/normalize.\n", (int)pMachineWindow->screenId())); 886 887 /* Make sure window have proper geometry and shown: */ 888 pMachineWindow->showInNecessaryMode(); 889 } 890 } 891 } 865 /* Skip other applications: */ 866 if (userInfo.value("BundleIdentifier") != "org.virtualbox.app.VirtualBox") 867 return; 868 869 /* Skip if 'screen have separate spaces': */ 870 if (screensHaveSeparateSpaces()) 871 return; 872 873 /* Skip if there is another than needed user-space is active: */ 874 if (!darwinIsOnActiveSpace(machineWindows().first())) 875 return; 876 877 LogRel(("UIMachineLogicFullscreen::nativeHandlerForApplicationActivation: " 878 "Full-screen application activated.\n")); 879 880 /* Revalidate full-screen mode for transient machine-window(s): */ 881 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 882 if (pMachineWindow->screenId() > 0) 883 revalidateNativeFullScreen(pMachineWindow); 884 } 885 886 /* static */ 887 void UIMachineLogicFullscreen::nativeHandlerForActiveSpaceChange(QObject *pObject, const QMap<QString, QString> &userInfo) 888 { 889 /* Handle arrived notification: */ 890 UIMachineLogicFullscreen *pLogic = qobject_cast<UIMachineLogicFullscreen*>(pObject); 891 AssertPtrReturnVoid(pLogic); 892 { 893 /* Redirect arrived notification: */ 894 pLogic->nativeHandlerForActiveSpaceChange(userInfo); 895 } 896 } 897 898 void UIMachineLogicFullscreen::nativeHandlerForActiveSpaceChange(const QMap<QString, QString>&) 899 { 900 /* Skip if 'screen have separate spaces': */ 901 if (screensHaveSeparateSpaces()) 902 return; 903 904 /* Skip if there is another than needed user-space is active: */ 905 if (!darwinIsOnActiveSpace(machineWindows().first())) 906 return; 907 908 LogRel(("UIMachineLogicFullscreen::nativeHandlerForActiveSpaceChange: " 909 "Full-screen user-space activated.\n")); 910 911 /* Revalidate full-screen mode for transient machine-window(s): */ 912 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 913 if (pMachineWindow->screenId() > 0) 914 revalidateNativeFullScreen(pMachineWindow); 892 915 } 893 916 #endif /* Q_WS_MAC */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
r52705 r52752 142 142 void revalidateNativeFullScreen(); 143 143 144 /** Mac OS X: Proxies native notification about application activation. */ 145 static void nativeHandlerForApplicationActivation(QObject *pObject, const QMap<QString, QString> &userInfo); 146 /** Mac OS X: Handles native notification about application activation. */ 147 void nativeHandlerForApplicationActivation(const QMap<QString, QString> &userInfo); 148 144 149 /** Mac OS X: Proxies native notification about active space change. */ 145 static void nativeHandlerForA pplicationActivation(QObject *pObject, const QMap<QString, QString> &userInfo);150 static void nativeHandlerForActiveSpaceChange(QObject *pObject, const QMap<QString, QString> &userInfo); 146 151 /** Mac OS X: Handles native notification about active space change. */ 147 void nativeHandlerForA pplicationActivation(const QMap<QString, QString> &userInfo);152 void nativeHandlerForActiveSpaceChange(const QMap<QString, QString> &userInfo); 148 153 #endif /* Q_WS_MAC */ 149 154
Note:
See TracChangeset
for help on using the changeset viewer.