VirtualBox

Ignore:
Timestamp:
Jun 3, 2013 12:24:48 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86173
Message:

FE/Qt: 6749: Frame-buffer interface cleanup/rework (part 3).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp

    r46342 r46359  
    4242    : m_pMachineView(pMachineView)
    4343    , m_width(0), m_height(0)
    44     , m_fIsDeleted(false)
    45 #if defined (Q_OS_WIN32)
     44    , m_fIsScheduledToDelete(false)
     45#ifdef Q_OS_WIN
    4646    , m_iRefCnt(0)
    47 #endif
     47#endif /* Q_OS_WIN */
    4848{
    4949    /* Assign mahine-view: */
     
    6464UIFrameBuffer::~UIFrameBuffer()
    6565{
     66    /* Deinitialize critical-section: */
    6667    RTCritSectDelete(&m_critSect);
     68
     69    /* Disconnect NotifyUpdate handler: */
     70    if (m_pMachineView)
     71        disconnect(this, SIGNAL(sigNotifyUpdate(int, int, int, int)),
     72                   m_pMachineView, SLOT(sltHandleNotifyUpdate(int, int, int, int)));
    6773}
    6874
     
    166172                                          BOOL *pbFinished)
    167173{
    168     if (m_fIsDeleted)
     174    /* Make sure frame-buffer is not yet scheduled for removal: */
     175    if (m_fIsScheduledToDelete)
    169176        return E_FAIL;
    170177
     178    /* Currently screen ID is not used: */
    171179    NOREF(uScreenId);
     180
     181    /* Mark request as not-yet-finished: */
    172182    *pbFinished = FALSE;
    173     lock(); /* See comment in setView(). */
     183
     184    /* See comment in setView(): */
     185    lock();
     186
     187    /* Widget resize is NOT thread safe and never will be,
     188     * We have to notify the machine-view with the async event to perform resize operation,
     189     * later it will be replaced with signal stuff. */
    174190    if (m_pMachineView)
    175191        QApplication::postEvent(m_pMachineView,
     
    178194                                                  uWidth, uHeight));
    179195    else
    180         /* Report to the VM thread that we finished resizing and rely on the
     196        /* Mark request as finished.
     197         * It is required to report to the VM thread that we finished resizing and rely on the
    181198         * synchronisation when the new view is attached. */
    182199        *pbFinished = TRUE;
    183     unlock();
    184 
    185     return S_OK;
    186 }
    187 
    188 STDMETHODIMP UIFrameBuffer::NotifyUpdate(ULONG uX, ULONG uY, ULONG uW, ULONG uH)
    189 {
     200
     201    /* Unlock thread finally: */
     202    unlock();
     203
     204    /* Confirm RequestResize: */
     205    return S_OK;
     206}
     207
     208STDMETHODIMP UIFrameBuffer::NotifyUpdate(ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight)
     209{
     210    /* Make sure frame-buffer is not yet scheduled for removal: */
     211    if (m_fIsScheduledToDelete)
     212        return E_FAIL;
     213
    190214    /* See comment in setView(): */
    191215    lock();
     
    194218     * So we have to notify the machine-view with the async signal to perform update operation. */
    195219    if (m_pMachineView)
    196         emit sigNotifyUpdate(uX, uY, uW, uH);
     220        emit sigNotifyUpdate(uX, uY, uWidth, uHeight);
    197221
    198222    /* Unlock thread finally: */
     
    346370    unlock();
    347371}
     372
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h

    r46293 r46359  
    118118    virtual ~UIFrameBuffer();
    119119
    120     void setDeleted(bool fIsDeleted) { m_fIsDeleted = fIsDeleted; }
     120    void setScheduledToDelete(bool fIsScheduledToDelete) { m_fIsScheduledToDelete = fIsScheduledToDelete; }
    121121
    122122    NS_DECL_ISUPPORTS
    123123
    124 #if defined (Q_OS_WIN32)
     124#ifdef Q_OS_WIN
    125125    STDMETHOD_(ULONG, AddRef)()
    126126    {
     
    135135        return cnt;
    136136    }
    137 #endif
     137#endif /* Q_OS_WIN */
    138138
    139139    VBOX_SCRIPTABLE_DISPATCH_IMPL(IFramebuffer)
     
    159159                              BOOL *pbFinished);
    160160
    161     STDMETHOD(NotifyUpdate) (ULONG uX, ULONG uY, ULONG uW, ULONG uH);
     161    STDMETHOD(NotifyUpdate) (ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight);
    162162
    163163    STDMETHOD(VideoModeSupported) (ULONG uWidth, ULONG uHeight, ULONG uBPP,
     
    214214
    215215    virtual void viewportScrolled(int /* iX */, int /* iY */) {}
    216 #endif
     216#endif /* VBOX_WITH_VIDEOHWACCEL */
    217217
    218218    virtual void setView(UIMachineView * pView);
     
    226226    QSize m_scaledSize;
    227227    int64_t m_WinId;
    228     bool m_fIsDeleted;
     228    bool m_fIsScheduledToDelete;
    229229
    230230    /* To avoid a seamless flicker,
     
    241241    QRegion m_asyncVisibleRegion;
    242242
    243 #if defined (Q_OS_WIN32)
    244243private:
    245244
     245#ifdef Q_OS_WIN
    246246    long m_iRefCnt;
    247 #endif
     247#endif /* Q_OS_WIN */
    248248};
    249249
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r46293 r46359  
    530530        {
    531531            /* Warn framebuffer about its no more necessary: */
    532             m_pFrameBuffer->setDeleted(true);
     532            m_pFrameBuffer->setScheduledToDelete(true);
    533533            /* Detach framebuffer from Display: */
    534534            CDisplay display = session().GetConsole().GetDisplay();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r45736 r46359  
    957957        {
    958958            /* Warn framebuffer about its no more necessary: */
    959             pFb->setDeleted(true);
     959            pFb->setScheduledToDelete(true);
    960960            /* Detach framebuffer from Display: */
    961961            CDisplay display = session().GetConsole().GetDisplay();
Note: See TracChangeset for help on using the changeset viewer.

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