VirtualBox

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


Ignore:
Timestamp:
Oct 25, 2011 2:03:49 PM (13 years ago)
Author:
vboxsync
Message:

FE/Qt: fix issues which appeared with scale view mode after we stopped re-creating the frame-buffer on view switches.

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

Legend:

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

    r39108 r39110  
    272272{
    273273    /* Prepare frame-buffer depending on render-mode: */
    274     switch (vboxGlobal().vmRenderMode())
     274    switch (getRenderMode())
    275275    {
    276276#ifdef VBOX_GUI_USE_QIMAGE
     
    923923}
    924924
     925VBoxDefs::RenderMode UIMachineView::getRenderMode() const
     926{
     927    if (visualStateType() != UIVisualStateType_Scale)
     928        return vboxGlobal().vmRenderMode();
     929    /* This part of the method is temporary since not all of our framebuffer
     930     * modes currently support scale view mode.  Once they do it will be
     931     * removed. */
     932    /** @note this could have been a mini-class which would be easier to
     933     * unit test. */
     934    /* Prepare frame-buffer depending on render-mode: */
     935    switch (vboxGlobal().vmRenderMode())
     936    {
     937#ifdef VBOX_GUI_USE_QUARTZ2D
     938        case VBoxDefs::Quartz2DMode:
     939            return VBoxDefs::Quartz2DMode;
     940#endif /* VBOX_GUI_USE_QUARTZ2D */
     941        default:
     942#ifdef VBOX_GUI_USE_QIMAGE
     943        case VBoxDefs::QImageMode:
     944            return VBoxDefs::QImageMode;
     945#endif /* VBOX_GUI_USE_QIMAGE */
     946        break;
     947    }
     948    AssertReleaseMsgFailed(("Scale-mode currently does NOT supporting render-mode %d\n", vboxGlobal().vmRenderMode()));
     949    qApp->exit(1);
     950}
     951
    925952bool UIMachineView::event(QEvent *pEvent)
    926953{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r39108 r39110  
    181181     * virtual monitor.  Used for storing monitor-specific extra data. */
    182182    QString makeExtraDataKeyPerMonitor(QString base) const;
     183    /** Returns the current rendering mode.
     184     * @note contains special case logic for scale mode. */
     185    VBoxDefs::RenderMode getRenderMode() const;
    183186
    184187    /* Cross-platforms event processors: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r39081 r39110  
    7676    saveMachineViewSettings();
    7777
     78    /* Disable scaling: */
     79    frameBuffer()->setScaledSize(QSize());
     80
    7881    /* Cleanup frame buffer: */
    7982    cleanupFrameBuffer();
     
    259262}
    260263
    261 void UIMachineViewScale::prepareFrameBuffer()
    262 {
    263     /* That method is partial copy-paste of UIMachineView::prepareFrameBuffer()
    264      * and its temporary here just because not all of our frame-buffers are currently supports scale-mode;
    265      * When all of our frame-buffers will be supporting scale-mode, method will be removed!
    266      * Here we are processing only these frame-buffer types, which knows scale-mode! */
    267 
    268     /* Prepare frame-buffer depending on render-mode: */
    269     switch (vboxGlobal().vmRenderMode())
    270     {
    271 #ifdef VBOX_GUI_USE_QUARTZ2D
    272         case VBoxDefs::Quartz2DMode:
    273             /* Indicate that we are doing all drawing stuff ourself: */
    274             viewport()->setAttribute(Qt::WA_PaintOnScreen);
    275             m_pFrameBuffer = new UIFrameBufferQuartz2D(this);
    276             break;
    277 #endif /* VBOX_GUI_USE_QUARTZ2D */
    278         default:
    279 #ifdef VBOX_GUI_USE_QIMAGE
    280         case VBoxDefs::QImageMode:
    281             m_pFrameBuffer = new UIFrameBufferQImage(this);
    282             break;
    283 #endif /* VBOX_GUI_USE_QIMAGE */
    284             AssertReleaseMsgFailed(("Scale-mode is currently NOT supporting that render-mode: %d\n", vboxGlobal().vmRenderMode()));
    285             LogRel(("Scale-mode is currently NOT supporting that render-mode: %d\n", vboxGlobal().vmRenderMode()));
    286             qApp->exit(1);
    287             break;
    288     }
    289 
    290     /* If frame-buffer was prepared: */
    291     if (m_pFrameBuffer)
    292     {
    293         /* Prepare display: */
    294         CDisplay display = session().GetConsole().GetDisplay();
    295         Assert(!display.isNull());
    296         m_pFrameBuffer->AddRef();
    297         display.SetFramebuffer(m_uScreenId, CFramebuffer(m_pFrameBuffer));
    298     }
    299 
    300     QSize size;
    301 #ifdef Q_WS_X11
    302     /* Processing pseudo resize-event to synchronize frame-buffer with stored
    303      * framebuffer size. On X11 this will be additional done when the machine
    304      * state was 'saved'. */
    305     if (session().GetMachine().GetState() == KMachineState_Saved)
    306         size = guestSizeHint();
    307 #endif /* Q_WS_X11 */
    308     /* If there is a preview image saved, we will resize the framebuffer to the
    309      * size of that image. */
    310     ULONG buffer = 0, width = 0, height = 0;
    311     CMachine machine = session().GetMachine();
    312     machine.QuerySavedScreenshotPNGSize(0, buffer, width, height);
    313     if (buffer > 0)
    314     {
    315         /* Init with the screenshot size */
    316         size = QSize(width, height);
    317         /* Try to get the real guest dimensions from the save state */
    318         ULONG guestWidth = 0, guestHeight = 0;
    319         machine.QuerySavedGuestSize(0, guestWidth, guestHeight);
    320         if (   guestWidth  > 0
    321             && guestHeight > 0)
    322             size = QSize(guestWidth, guestHeight);
    323     }
    324     /* If we have a valid size, resize the framebuffer. */
    325     if (   size.width() > 0
    326         && size.height() > 0)
    327     {
    328         UIResizeEvent event(FramebufferPixelFormat_Opaque, NULL, 0, 0, size.width(), size.height());
    329         frameBuffer()->resizeEvent(&event);
    330     }
    331 }
    332 
    333264void UIMachineViewScale::saveMachineViewSettings()
    334265{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h

    r39081 r39110  
    5656
    5757    /* Prepare helpers: */
    58     void prepareFrameBuffer();
     58    // void prepareFrameBuffer();
    5959    //void loadMachineViewSettings();
    6060
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