VirtualBox

Changeset 27697 in vbox


Ignore:
Timestamp:
Mar 25, 2010 11:57:38 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59293
Message:

2d: more impl for the new way of mode change handling

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

Legend:

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

    r27682 r27697  
    41844184}
    41854185
     4186void VBoxQGLOverlay::updateAttachment(QWidget *pViewport, QObject *pPostEventObject)
     4187{
     4188    mCmdPipe.updatePostEventObject(pPostEventObject);
     4189    if (mpViewport != pViewport)
     4190    {
     4191        mpViewport = pViewport;
     4192        mpOverlayWgt = NULL;
     4193        mOverlayWidgetVisible = false;
     4194        initGl();
     4195        vboxDoCheckUpdateViewport();
     4196        mGlCurrent = false;
     4197    }
     4198}
     4199
    41864200int VBoxQGLOverlay::reset()
    41874201{
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h

    r27682 r27697  
    13031303    class VBoxVHWACommandElement * detachCmdList(class VBoxVHWACommandElement * pFirst2Free, VBoxVHWACommandElement * pLast2Free);
    13041304    void reset(class VBoxVHWACommandElement ** ppHead, class VBoxVHWACommandElement ** ppTail);
     1305    void updatePostEventObject(QObject *m_pObject) { m_pParent = m_pObject; }
    13051306private:
    13061307    RTCRITSECT mCritSect;
     
    16771678    }
    16781679
    1679     void updateViewport(QWidget *pViewport);
     1680    void updateAttachment(QWidget *pViewport, QObject *pPostEventObject);
    16801681
    16811682    int onVHWACommand (struct _VBOXVHWACMD * pCommand);
     
    18221823{
    18231824public:
     1825    VBoxOverlayFrameBuffer (V *pView, VBoxQGLOverlay *pOverlay, CSession * aSession)
     1826        : T (pView),
     1827          mpOverlay (pOverlay),
     1828          mpView (pView)
     1829    {}
     1830
    18241831    VBoxOverlayFrameBuffer (V *pView, QWidget *pWidget, CSession * aSession)
    18251832        : T (pView),
    1826           mOverlay (pWidget, pView, aSession),
     1833          mpOverlay (new VBoxQGLOverlay(pWidget, pView, aSession)),
    18271834          mpView (pView)
    18281835    {}
     
    18311838    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand)
    18321839    {
    1833         return mOverlay.onVHWACommand ((struct _VBOXVHWACMD*)pCommand);
     1840        return mpOverlay->onVHWACommand ((struct _VBOXVHWACMD*)pCommand);
    18341841    }
    18351842
    18361843    void doProcessVHWACommand (QEvent * pEvent)
    18371844    {
    1838         mOverlay.onVHWACommandEvent (pEvent);
     1845        mpOverlay->onVHWACommandEvent (pEvent);
    18391846    }
    18401847
     
    18441851                              BOOL *aFinished)
    18451852   {
    1846         if (mOverlay.onRequestResize (aScreenId, aPixelFormat,
     1853        if (mpOverlay->onRequestResize (aScreenId, aPixelFormat,
    18471854                aVRAM, aBitsPerPixel, aBytesPerLine,
    18481855                aWidth, aHeight,
     
    18601867                             ULONG aW, ULONG aH)
    18611868    {
    1862         if (mOverlay.onNotifyUpdate (aX, aY, aW, aH))
     1869        if (mpOverlay->onNotifyUpdate (aX, aY, aW, aH))
    18631870            return S_OK;
    18641871        return T::NotifyUpdate (aX, aY, aW, aH);
     
    18681875    {
    18691876        T::resizeEvent (re);
    1870         mOverlay.onResizeEventPostprocess (VBoxFBSizeInfo(re),
     1877        mpOverlay->onResizeEventPostprocess (VBoxFBSizeInfo(re),
    18711878                QPoint(mpView->contentsX(), mpView->contentsY()));
    18721879    }
     
    18741881    void viewportResized (QResizeEvent * re)
    18751882    {
    1876         mOverlay.onViewportResized (re);
     1883        mpOverlay->onViewportResized (re);
    18771884        T::viewportResized (re);
    18781885    }
     
    18801887    void viewportScrolled (int dx, int dy)
    18811888    {
    1882         mOverlay.onViewportScrolled (QPoint(mpView->contentsX(), mpView->contentsY()));
     1889        mpOverlay->onViewportScrolled (QPoint(mpView->contentsX(), mpView->contentsY()));
    18831890        T::viewportScrolled (dx, dy);
    18841891    }
    18851892private:
    1886     VBoxQGLOverlay mOverlay;
     1893    VBoxQGLOverlay *mpOverlay;
    18871894    V *mpView;
    18881895};
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r27683 r27697  
    488488        case VBoxDefs::QImageMode:
    489489# ifdef VBOX_WITH_VIDEOHWACCEL
    490             /* these two additional template args is a workaround to this [VBox|UI] duplication
    491              * @todo: they are to be removed once VBox stuff is gone */
    492             m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UIFrameBufferQImage, UIMachineView, UIResizeEvent>(this, viewport(), &machineWindowWrapper()->session()) : new UIFrameBufferQImage(this);
     490            if (m_fAccelerate2DVideo)
     491            {
     492                class VBoxQGLOverlay* pOverlay = uisession()->overlayForScreen(screenId());
     493                pOverlay->updateAttachment(viewport(), this);
     494                /* these two additional template args is a workaround to this [VBox|UI] duplication
     495                 * @todo: they are to be removed once VBox stuff is gone */
     496                m_pFrameBuffer = new VBoxOverlayFrameBuffer<UIFrameBufferQImage, UIMachineView, UIResizeEvent>(this, pOverlay, &machineWindowWrapper()->session());
     497            }
     498            else
     499                m_pFrameBuffer = new UIFrameBufferQImage(this);
    493500# else
    494501            m_pFrameBuffer = new UIFrameBufferQImage(this);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r27622 r27697  
    3636#include "VBoxProblemReporter.h"
    3737#include "UIFirstRunWzd.h"
     38#ifdef VBOX_WITH_VIDEOHWACCEL
     39# include "VBoxFBOverlay.h"
     40#endif
    3841
    3942#ifdef Q_WS_X11
     
    14881491}
    14891492
     1493#ifdef VBOX_WITH_VIDEOHWACCEL
     1494/* 2D video overlay state + API */
     1495class VBoxQGLOverlay* UISession::overlayForScreen(ulong screenId)
     1496{
     1497    /* durty hack to fill the list as needed */
     1498    if (m_OverlaysList.size() <= (int)screenId)
     1499    {
     1500        for (int i = m_OverlaysList.size(); i <= (int)screenId; ++i)
     1501            m_OverlaysList.append(new VBoxQGLOverlay((QWidget *)NULL, (QObject *)NULL, &m_session));
     1502    }
     1503    return m_OverlaysList.at((int)screenId);
     1504}
     1505#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r27376 r27697  
    140140    void setMouseIntegrated(bool fIsMouseIntegrated) { m_fIsMouseIntegrated = fIsMouseIntegrated; }
    141141
     142#ifdef VBOX_WITH_VIDEOHWACCEL
     143    /* 2D video overlay state + API */
     144    class VBoxQGLOverlay* overlayForScreen(ulong screenId);
     145#endif
     146
    142147signals:
    143148
     
    203208    UIMachineMenuBar *m_pMenuPool;
    204209
     210#ifdef VBOX_WITH_VIDEOHWACCEL
     211    /* 2D video overlay state + API
     212     * this does not get re-created on mode change
     213     * Each screen has its own Overlay state */
     214    QList<class VBoxQGLOverlay*> m_OverlaysList;
     215#endif
     216
    205217    /* Common variables: */
    206218    KMachineState m_machineState;
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