VirtualBox

Changeset 38978 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Oct 12, 2011 1:33:28 PM (13 years ago)
Author:
vboxsync
Message:

FE/Qt: send guest size hints on fullscreen/seamless exit after the normal view window has been created

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp

    r38900 r38978  
    3333const char* VBoxDefs::GUI_LastWindowState_Max = "max";
    3434const char* VBoxDefs::GUI_LastGuestSizeHint = "GUI/LastGuestSizeHint";
     35const char* VBoxDefs::GUI_LastGuestSizeHintWasFullscreen = "GUI/LastGuestSizeHintWasFullscreen";
    3536const char* VBoxDefs::GUI_Toolbar = "GUI/Toolbar";
    3637const char* VBoxDefs::GUI_Statusbar = "GUI/Statusbar";
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h

    r38900 r38978  
    116116    static const char* GUI_Statusbar;
    117117    static const char* GUI_LastGuestSizeHint;
     118    static const char* GUI_LastGuestSizeHintWasFullscreen;
    118119    static const char* GUI_Fullscreen;
    119120    static const char* GUI_Seamless;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r38963 r38978  
    113113#endif /* VBOX_WITH_VIDEOHWACCEL */
    114114                                                       );
     115            pMachineView->m_fIsFullscreen = true;
    115116            break;
    116117        case UIVisualStateType_Seamless:
     
    121122#endif /* VBOX_WITH_VIDEOHWACCEL */
    122123                                                     );
     124            pMachineView->m_fIsFullscreen = true;
    123125            break;
    124126        case UIVisualStateType_Scale:
     
    160162    /* Send new size-hint to the guest: */
    161163    session().GetConsole().GetDisplay().SetVideoModeHint(newSize.width(), newSize.height(), 0, screenId());
     164    /* And track whether we have had a "normal" resize since the last
     165     * fullscreen resize hint was sent: */
     166    machine.SetExtraData(VBoxDefs::GUI_LastGuestSizeHintWasFullscreen,
     167                         m_fIsFullscreen ? "true" : "");
    162168}
    163169
     
    226232                             )
    227233    : QAbstractScrollArea(pMachineWindow->machineWindow())
     234    , m_fIsFullscreen(false)
    228235    , m_pMachineWindow(pMachineWindow)
    229236    , m_uScreenId(uScreenId)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r38957 r38978  
    7171    /* Utility signals: */
    7272    void resizeHintDone();
     73
     74private:
     75
     76    /** Is this a fullscreen-type view? */
     77    bool m_fIsFullscreen;
    7378
    7479protected slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp

    r38963 r38978  
    5252                    )
    5353    , m_bIsGuestAutoresizeEnabled(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->isChecked())
    54     , m_pSyncBlocker(0)
    5554{
    5655    /* Load machine view settings: */
     
    7271    prepareConsoleConnections();
    7372
    74     /* Prepare fullscreen: */
    75     prepareFullscreen();
    76 
    7773    /* Initialization: */
    7874    sltMachineStateChanged();
     
    8177UIMachineViewFullscreen::~UIMachineViewFullscreen()
    8278{
    83     /* Cleanup fullscreen: */
    84     cleanupFullscreen();
    85 
    8679    /* Cleanup frame buffer: */
    8780    cleanupFrameBuffer();
     
    153146            emit resizeHintDone();
    154147
    155             /* Unlock after processing guest resize event: */
    156             if (m_pSyncBlocker && m_pSyncBlocker->isRunning())
    157                 m_pSyncBlocker->quit();
    158 
    159148            pEvent->accept();
    160149            return true;
     
    181170                /* Send guest-resize hint only if top window resizing to required dimension: */
    182171                QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent);
     172                /** @todo why is this here?  If it is a workaround
     173                 * for some situation that should be documented. */
    183174                if (pResizeEvent->size() != workingArea().size())
    184175                    break;
     
    239230}
    240231
    241 void UIMachineViewFullscreen::prepareFullscreen()
    242 {
    243     /* Create sync-blocker: */
    244     m_pSyncBlocker = new UIMachineViewBlocker;
    245 }
    246 
    247 void UIMachineViewFullscreen::cleanupFullscreen()
    248 {
    249     /* If machine still running: */
    250     if (uisession()->isRunning())
    251     {
    252         /* And guest supports advanced graphics management which is enabled: */
    253         if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
    254         {
    255             /* Rollback seamless frame-buffer size to normal: */
    256             machineWindowWrapper()->machineWindow()->hide();
    257             sltPerformGuestResize(guestSizeHint());
    258             m_pSyncBlocker->exec();
    259 
    260             /* Request to delete sync-blocker: */
    261             m_pSyncBlocker->deleteLater();
    262         }
    263     }
    264 }
    265 
    266232void UIMachineViewFullscreen::setGuestAutoresizeEnabled(bool fEnabled)
    267233{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h

    r38947 r38978  
    5858    void prepareConnections();
    5959    void prepareConsoleConnections();
    60     void prepareFullscreen();
    6160
    6261    /* Cleanup routines: */
    63     void cleanupFullscreen();
    6462    //void cleanupConsoleConnections() {}
    6563    //void cleanupConnections() {}
     
    7876    /* Private variables: */
    7977    bool m_bIsGuestAutoresizeEnabled : 1;
    80     UIMachineViewBlocker *m_pSyncBlocker;
    8178
    8279    /* Friend classes: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r38963 r38978  
    8888    /* Check if we should restrict minimum size: */
    8989    maybeRestrictMinimumSize();
     90
     91    /* Resend the last resize hint if there was a fullscreen or
     92     * seamless transition previously.  If we were not in graphical
     93     * mode initially after the transition this happens when we
     94     * switch. */
     95    maybeResendResizeHint();
    9096}
    9197
     
    253259}
    254260
     261void UIMachineViewNormal::maybeResendResizeHint()
     262{
     263    if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
     264    {
     265        /* Get the current machine: */
     266        CMachine machine = session().GetMachine();
     267
     268        /* We send a guest size hint if needed to reverse a transition
     269         * to fullscreen or seamless. */
     270        QString strHintSent = machine.GetExtraData(VBoxDefs::GUI_LastGuestSizeHintWasFullscreen);
     271        if (!strHintSent.isEmpty())
     272            sltPerformGuestResize(guestSizeHint());
     273    }
     274}
     275
    255276void UIMachineViewNormal::saveMachineViewSettings()
    256277{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h

    r38962 r38978  
    6565    void prepareConsoleConnections();
    6666    //void loadMachineViewSettings();
     67    void maybeResendResizeHint();
    6768
    6869    /* Cleanup helpers: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r38963 r38978  
    5050#endif
    5151                    )
    52     , m_pSyncBlocker(0)
    5352{
    5453    /* Load machine view settings: */
     
    160159            /* Emit a signal about guest was resized: */
    161160            emit resizeHintDone();
    162 
    163             /* Unlock after processing guest resize event: */
    164             if (m_pSyncBlocker && m_pSyncBlocker->isRunning())
    165                 m_pSyncBlocker->quit();
    166161
    167162            pEvent->accept();
     
    251246    /* Set seamless feature flag to the guest: */
    252247    session().GetConsole().GetDisplay().SetSeamlessMode(true);
    253     /* Create sync-blocker: */
    254     m_pSyncBlocker = new UIMachineViewBlocker;
    255248}
    256249
     
    259252    /* If machine still running: */
    260253    if (uisession()->isRunning())
    261     {
    262254        /* Reset seamless feature flag of the guest: */
    263255        session().GetConsole().GetDisplay().SetSeamlessMode(false);
    264 
    265         /* Rollback seamless frame-buffer size to normal: */
    266         machineWindowWrapper()->machineWindow()->hide();
    267         sltPerformGuestResize(guestSizeHint());
    268         m_pSyncBlocker->exec();
    269 
    270         /* Delete sync-blocker: */
    271         m_pSyncBlocker->deleteLater();
    272     }
    273256}
    274257
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h

    r38947 r38978  
    8080    /* Private variables: */
    8181    QRegion m_lastVisibleRegion;
    82     UIMachineViewBlocker *m_pSyncBlocker;
    8382
    8483    /* Friend classes: */
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