VirtualBox

Changeset 52752 in vbox


Ignore:
Timestamp:
Sep 15, 2014 3:15:38 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: Mac OS X: Runtime UI: Native full-screen: Active user-space change handler revalidating transient windows.

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  
    523523        UICocoaApplication::instance()->registerToNotificationOfWorkspace("NSWorkspaceDidActivateApplicationNotification", this,
    524524                                                                          UIMachineLogicFullscreen::nativeHandlerForApplicationActivation);
     525        UICocoaApplication::instance()->registerToNotificationOfWorkspace("NSWorkspaceActiveSpaceDidChangeNotification", this,
     526                                                                          UIMachineLogicFullscreen::nativeHandlerForActiveSpaceChange);
    525527    }
    526528
     
    619621        /* Unregister from native notifications: */
    620622        UICocoaApplication::instance()->unregisterFromNotificationOfWorkspace("NSWorkspaceDidActivateApplicationNotification", this);
     623        UICocoaApplication::instance()->unregisterFromNotificationOfWorkspace("NSWorkspaceActiveSpaceDidChangeNotification", this);
    621624    }
    622625#endif/* Q_WS_MAC */
     
    723726    {
    724727        /* We are hiding transient window if:
    725          * 1. application is inactive at all or
     728         * 1. primary window is not on active user-space
    726729         * 2. there is no fullscreen window or it's invalidated. */
    727         if (   !UICocoaApplication::instance()->isActive()
     730        if (   !darwinIsOnActiveSpace(machineWindows().first())
    728731            || m_fullscreenMachineWindows.isEmpty() || !m_invalidFullscreenMachineWindows.isEmpty())
    729732        {
     
    860863    /* Make sure we have BundleIdentifier key: */
    861864    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 */
     887void 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
     898void 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);
    892915}
    893916#endif /* Q_WS_MAC */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h

    r52705 r52752  
    142142    void revalidateNativeFullScreen();
    143143
     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
    144149    /** Mac OS X: Proxies native notification about active space change. */
    145     static void nativeHandlerForApplicationActivation(QObject *pObject, const QMap<QString, QString> &userInfo);
     150    static void nativeHandlerForActiveSpaceChange(QObject *pObject, const QMap<QString, QString> &userInfo);
    146151    /** Mac OS X: Handles native notification about active space change. */
    147     void nativeHandlerForApplicationActivation(const QMap<QString, QString> &userInfo);
     152    void nativeHandlerForActiveSpaceChange(const QMap<QString, QString> &userInfo);
    148153#endif /* Q_WS_MAC */
    149154
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette