VirtualBox

Changeset 51248 in vbox


Ignore:
Timestamp:
May 13, 2014 4:34:19 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: Mac OS X: Runtime UI: Native Full Screen: Handle NSWindowDidFailToEnterFullScreenNotification for native full screen fallback needs.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm

    r50491 r51248  
    191191
    192192    /* Define known notification names: */
    193     NSString *spstrWillEnterFullscreenNotification = @"NSWindowWillEnterFullScreenNotification";
    194     NSString *spstrDidEnterFullscreenNotification  = @"NSWindowDidEnterFullScreenNotification";
    195     NSString *spstrWillExitFullscreenNotification  = @"NSWindowWillExitFullScreenNotification";
    196     NSString *spstrDidExitFullscreenNotification   = @"NSWindowDidExitFullScreenNotification";
     193    NSString *spstrWillEnterFullscreenNotification      = @"NSWindowWillEnterFullScreenNotification";
     194    NSString *spstrDidEnterFullscreenNotification       = @"NSWindowDidEnterFullScreenNotification";
     195    NSString *spstrWillExitFullscreenNotification       = @"NSWindowWillExitFullScreenNotification";
     196    NSString *spstrDidExitFullscreenNotification        = @"NSWindowDidExitFullScreenNotification";
     197    NSString *spstrDidFailToEnterFullScreenNotification = @"NSWindowDidFailToEnterFullScreenNotification";
    197198
    198199    /* Redirect known notifications to UICocoaApplication instance: */
     
    200201        || [pstrName isEqualToString :spstrDidEnterFullscreenNotification]
    201202        || [pstrName isEqualToString :spstrWillExitFullscreenNotification]
    202         || [pstrName isEqualToString :spstrDidExitFullscreenNotification])
     203        || [pstrName isEqualToString :spstrDidExitFullscreenNotification]
     204        || [pstrName isEqualToString :spstrDidFailToEnterFullScreenNotification])
    203205        UICocoaApplication::instance()->nativeNotificationProxy(pstrName, [notification object]);
    204206}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r51247 r51248  
    163163    /* Remove machine-window from corresponding set: */
    164164    bool fResult = m_fullscreenMachineWindows.remove(pMachineWindow);
    165     AssertReturnVoid(fResult && !m_fullscreenMachineWindows.contains(pMachineWindow));
    166     Q_UNUSED(fResult);
     165    AssertReturnVoid(!m_fullscreenMachineWindows.contains(pMachineWindow));
     166
     167    /* We have same signal if window did fail to enter native fullscreen.
     168     * In that case window missed in m_fullscreenMachineWindows,
     169     * ignore this signal silently: */
     170    if (!fResult)
     171        return;
    167172
    168173    /* If that window was invalidated: */
     
    210215}
    211216
     217void UIMachineLogicFullscreen::sltHandleNativeFullscreenFailToEnter()
     218{
     219    /* Make sure this method is only used for ML and next: */
     220    AssertReturnVoid(vboxGlobal().osRelease() > MacOSXRelease_Lion);
     221
     222    /* Get sender machine-window: */
     223    UIMachineWindow *pMachineWindow = qobject_cast<UIMachineWindow*>(sender());
     224    AssertReturnVoid(pMachineWindow);
     225
     226    /* Make sure this window is not registered somewhere: */
     227    AssertReturnVoid(!m_fullscreenMachineWindows.remove(pMachineWindow));
     228    AssertReturnVoid(!m_invalidFullscreenMachineWindows.remove(pMachineWindow));
     229
     230    /* If there are 'fullscreen' windows: */
     231    if (!m_fullscreenMachineWindows.isEmpty())
     232    {
     233        LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenFailToEnter: "
     234                "Machine-window #%d failed to enter native fullscreen, asking others to exit...\n",
     235                (int)pMachineWindow->screenId()));
     236
     237        /* Ask window(s) to exit 'fullscreen' mode: */
     238        emit sigNotifyAboutNativeFullscreenShouldBeExited();
     239    }
     240    /* If there are no 'fullscreen' windows: */
     241    else
     242    {
     243        LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenFailToEnter: "
     244                "Machine-window #%d failed to enter native fullscreen, requesting change visual-state to normal...\n",
     245                (int)pMachineWindow->screenId()));
     246
     247        /* Ask session to change 'fullscreen' mode to 'normal': */
     248        uisession()->setRequestedVisualState(UIVisualStateType_Normal);
     249    }
     250}
     251
    212252void UIMachineLogicFullscreen::sltChangeVisualStateToNormal()
    213253{
     
    252292        /* Ask window(s) to exit 'fullscreen' mode: */
    253293        emit sigNotifyAboutNativeFullscreenShouldBeExited();
     294    }
     295}
     296
     297void UIMachineLogicFullscreen::sltCheckForRequestedVisualStateType()
     298{
     299    /* Do not try to change visual-state type if machine was not started yet: */
     300    if (!uisession()->isRunning() && !uisession()->isPaused())
     301        return;
     302
     303    /* Check requested visual-state types: */
     304    switch (uisession()->requestedVisualState())
     305    {
     306        /* If 'normal' visual-state type is requested: */
     307        case UIVisualStateType_Normal:
     308        {
     309            LogRel(("UIMachineLogicFullscreen::sltCheckForRequestedVisualStateType: "
     310                    "Going 'normal' as requested...\n"));
     311            uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
     312            uisession()->changeVisualState(UIVisualStateType_Normal);
     313            break;
     314        }
     315        default:
     316            break;
    254317    }
    255318}
     
    450513                    this, SLOT(sltHandleNativeFullscreenDidExit()),
    451514                    Qt::QueuedConnection);
     515            connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenFailToEnter()),
     516                    this, SLOT(sltHandleNativeFullscreenFailToEnter()),
     517                    Qt::QueuedConnection);
    452518        }
    453519        /* Revalidate 'fullscreen' windows: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h

    r50681 r51248  
    6767    /** Mac OS X: Handles native notification about 'fullscreen' exited. */
    6868    void sltHandleNativeFullscreenDidExit();
     69    /** Mac OS X: Handles native notification about 'fullscreen' fail to enter. */
     70    void sltHandleNativeFullscreenFailToEnter();
    6971
    7072    /** Mac OS X: Requests visual-state change from 'fullscreen' to 'normal' (window). */
     
    7476    /** Mac OS X: Requests visual-state change from 'fullscreen' to 'scale'. */
    7577    void sltChangeVisualStateToScale();
     78
     79    /** Mac OS X: Checks if some visual-state type was requested. */
     80    void sltCheckForRequestedVisualStateType();
    7681#endif /* RT_OS_DARWIN */
    7782
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    r51054 r51248  
    9292                "Native fullscreen mode exited, notifying listener...\n"));
    9393        emit sigNotifyAboutNativeFullscreenDidExit();
     94    }
     95    /* Handle 'NSWindowDidFailToEnterFullScreenNotification' notification: */
     96    else if (strNativeNotificationName == "NSWindowDidFailToEnterFullScreenNotification")
     97    {
     98        /* Mark window transition complete: */
     99        m_fIsInFullscreenTransition = false;
     100        LogRel(("UIMachineWindowFullscreen::handleNativeNotification: "
     101                "Native fullscreen mode fail to enter, notifying listener...\n"));
     102        emit sigNotifyAboutNativeFullscreenFailToEnter();
    94103    }
    95104}
     
    216225                                                                     UIMachineWindow::handleNativeNotification);
    217226        UICocoaApplication::instance()->registerToNativeNotification("NSWindowDidExitFullScreenNotification", this,
     227                                                                     UIMachineWindow::handleNativeNotification);
     228        UICocoaApplication::instance()->registerToNativeNotification("NSWindowDidFailToEnterFullScreenNotification", this,
    218229                                                                     UIMachineWindow::handleNativeNotification);
    219230    }
     
    281292        UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowWillExitFullScreenNotification", this);
    282293        UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowDidExitFullScreenNotification", this);
     294        UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowDidFailToEnterFullScreenNotification", this);
    283295    }
    284296#endif /* Q_WS_MAC */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h

    r50816 r51248  
    4141    /** Mac OS X: Notifies listener about native 'fullscreen' exited. */
    4242    void sigNotifyAboutNativeFullscreenDidExit();
     43    /** Mac OS X: Notifies listener about native 'fullscreen' fail to enter. */
     44    void sigNotifyAboutNativeFullscreenFailToEnter();
    4345#endif /* RT_OS_DARWIN */
    4446
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