VirtualBox

Ignore:
Timestamp:
Oct 2, 2015 2:40:28 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Mac OS X: Update IDisplay's viewport, e.g. 3D overlay, when moving VM window from Retina host-screen to non-Retina host-screen and at the end of to/from native full-screen transactions.

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

Legend:

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

    r57495 r58011  
    218218    frameBuffer()->performRescale();
    219219
    220     // TODO: How to make it work?
     220    /* Update console's display viewport and 3D overlay: */
     221    updateViewport();
     222}
     223
     224double UIMachineView::aspectRatio() const
     225{
     226    return frameBuffer() ? (double)(frameBuffer()->width()) / frameBuffer()->height() : 0;
     227}
     228
     229void UIMachineView::updateViewport()
     230{
    221231    display().ViewportChanged(screenId(), contentsX(), contentsY(), visibleWidth(), visibleHeight());
    222 }
    223 
    224 double UIMachineView::aspectRatio() const
    225 {
    226     return frameBuffer() ? (double)(frameBuffer()->width()) / frameBuffer()->height() : 0;
    227232}
    228233
     
    426431    viewport()->update();
    427432
    428     // TODO: How to make it work?
    429     display().ViewportChanged(screenId(), contentsX(), contentsY(), visibleWidth(), visibleHeight());
     433    /* Update console's display viewport and 3D overlay: */
     434    updateViewport();
    430435}
    431436
     
    480485    viewport()->update();
    481486
    482     // TODO: How to make it work?
    483     display().ViewportChanged(screenId(), contentsX(), contentsY(), visibleWidth(), visibleHeight());
     487    /* Update console's display viewport and 3D overlay: */
     488    updateViewport();
    484489}
    485490
     
    554559    , m_pFrameBuffer(0)
    555560    , m_previousState(KMachineState_Null)
     561#ifdef Q_WS_MAC
     562    , m_iHostScreenNumber(0)
     563#endif /* Q_WS_MAC */
    556564    , m_maxGuestSizePolicy(MaxGuestSizePolicy_Invalid)
    557565    , m_u64MaxGuestSize(0)
     
    12411249    QAbstractScrollArea::scrollContentsBy(dx, dy);
    12421250
    1243     display().ViewportChanged(screenId(),
    1244                               contentsX(), contentsY(),
    1245                               visibleWidth(), visibleHeight());
     1251    /* Update console's display viewport and 3D overlay: */
     1252    updateViewport();
    12461253}
    12471254
     
    13421349                    m_pFrameBuffer->viewportResized(pResizeEvent);
    13431350#endif /* VBOX_WITH_VIDEOHWACCEL */
    1344                 display().ViewportChanged(screenId(),
    1345                                           contentsX(), contentsY(),
    1346                                           visibleWidth(), visibleHeight());
     1351                /* Update console's display viewport and 3D overlay: */
     1352                updateViewport();
    13471353                break;
    13481354            }
     
    13581364            case QEvent::Move:
    13591365            {
    1360                 /* In some cases viewport resize-events can provoke the
    1361                  * machine-view position changes inside the machine-window.
    1362                  * We have to notify interested listeners like 3D service. */
    1363                 display().ViewportChanged(screenId(),
    1364                                           contentsX(), contentsY(),
    1365                                           visibleWidth(), visibleHeight());
     1366                /* Update console's display viewport and 3D overlay: */
     1367                updateViewport();
    13661368                break;
    13671369            }
     
    13941396            case QEvent::Move:
    13951397            {
    1396                 if (m_pFrameBuffer)
     1398                /* Get current host-screen number: */
     1399                const int iCurrentHostScreenNumber = vboxGlobal().screenNumber(this);
     1400                if (m_iHostScreenNumber != iCurrentHostScreenNumber)
    13971401                {
    1398                     /* Update backing-scale-factor for underlying frame-buffer: */
    1399                     m_pFrameBuffer->setBackingScaleFactor(darwinBackingScaleFactor(machineWindow()));
    1400                     /* Perform frame-buffer rescaling: */
    1401                     m_pFrameBuffer->performRescale();
     1402                    /* Recache current host screen: */
     1403                    m_iHostScreenNumber = iCurrentHostScreenNumber;
     1404
     1405                    /* Update frame-buffer arguments: */
     1406                    if (m_pFrameBuffer)
     1407                    {
     1408                        /* Update backing-scale-factor for underlying frame-buffer: */
     1409                        m_pFrameBuffer->setBackingScaleFactor(darwinBackingScaleFactor(machineWindow()));
     1410                        /* Perform frame-buffer rescaling: */
     1411                        m_pFrameBuffer->performRescale();
     1412                    }
     1413
     1414                    /* Update console's display viewport and 3D overlay: */
     1415                    updateViewport();
    14021416                }
    14031417                break;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r56704 r58011  
    108108    double aspectRatio() const;
    109109
     110    /** Updates console's display viewport.
     111      * @remarks Used to update 3D-service overlay viewport as well. */
     112    void updateViewport();
     113
    110114protected slots:
    111115
     
    181185    /** Returns the session's console reference. */
    182186    CConsole& console() const;
    183     /** Returns the display's display reference. */
     187    /** Returns the console's display reference. */
    184188    CDisplay& display() const;
    185189    /** Returns the console's guest reference. */
     
    349353    QSize m_sizeHintOverride;
    350354
     355#ifdef Q_WS_MAC
     356    /** Holds current host-screen number. */
     357    int m_iHostScreenNumber;
     358#endif /* Q_WS_MAC */
     359
    351360    /** The policy for calculating the maximum guest resolution which we wish
    352361     * to handle. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    r57591 r58011  
    8282        LogRel(("UIMachineWindowFullscreen::handleNativeNotification: "
    8383                "Native fullscreen mode entered, notifying listener...\n"));
     84        /* Update console's display viewport and 3D overlay: */
     85        machineView()->updateViewport();
    8486        emit sigNotifyAboutNativeFullscreenDidEnter();
    8587    }
     
    98100        LogRel(("UIMachineWindowFullscreen::handleNativeNotification: "
    99101                "Native fullscreen mode exited, notifying listener...\n"));
     102        /* Update console's display viewport and 3D overlay: */
     103        machineView()->updateViewport();
    100104        emit sigNotifyAboutNativeFullscreenDidExit();
    101105    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r57591 r58011  
    146146    frameBuffer()->performRescale();
    147147
    148     // TODO: How to make it work?
    149     display().ViewportChanged(screenId(), contentsX(), contentsY(), visibleWidth(), visibleHeight());
     148    /* Update console's display viewport and 3D overlay: */
     149    updateViewport();
    150150}
    151151
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