VirtualBox

Ignore:
Timestamp:
Nov 6, 2013 6:02:27 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
90457
Message:

FE/Qt: 7069: Fixing machine-window artifacts on VM boot.

File:
1 edited

Legend:

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

    r49184 r49401  
    219219                                           int iWidth, int iHeight)
    220220{
     221    // TODO: Move to appropriate place!
    221222    /* Some situations require frame-buffer resize-events to be ignored at all,
    222223     * leaving machine-window, machine-view and frame-buffer sizes preserved: */
     
    224225        return;
    225226
    226     /* If only the pitch has changed (or nothing at all!) we only update the
    227      * frame-buffer and don't touch the window.  This prevents unwanted resizes
    228      * when entering or exiting fullscreen on X.Org guests and when
    229      * re-attaching the frame-buffer on a view switch. */
    230     bool fResize =    (ulong)iWidth != frameBuffer()->width()
    231                    || (ulong)iHeight != frameBuffer()->height();
    232 
    233227    /* If machine-window is visible: */
    234228    if (uisession()->isScreenVisible(m_uScreenId))
    235229    {
    236         /* Apply current window size to frame-buffer: */
     230        // TODO: Move to appropriate place!
     231        /* Adjust 'scale' mode for current machine-view size: */
    237232        if (visualStateType() == UIVisualStateType_Scale)
    238233            frameBuffer()->setScaledSize(size());
    239234
    240         /* Compose guest resize-event: */
    241         UIResizeEvent resizeEvent(iPixelFormat, pVRAM,
    242                                   iBitsPerPixel, iBytesPerLine,
    243                                   iWidth, iHeight);
    244 
    245         /* Perform frame-buffer resize if parent window is visible: */
     235        /* Is there a proposal for frame-buffer resize? */
     236        bool fResizeProposed = (ulong)iWidth != frameBuffer()->width() ||
     237                               (ulong)iHeight != frameBuffer()->height();
     238
     239        /* Perform frame-buffer mode-change: */
     240        UIResizeEvent resizeEvent(iPixelFormat, pVRAM, iBitsPerPixel, iBytesPerLine, iWidth, iHeight);
    246241        frameBuffer()->resizeEvent(&resizeEvent);
    247     }
    248 
    249     /* If resize actually happens and machine-window is visible: */
    250     if (fResize && uisession()->isScreenVisible(m_uScreenId))
    251     {
    252         /* Scale-mode doesn't need this: */
    253         if (visualStateType() != UIVisualStateType_Scale)
    254         {
    255             /* Reapply maximum size restriction for machine-view: */
    256             setMaximumSize(sizeHint());
    257 
    258             /* Disable the resize hint override hack: */
    259             m_sizeHintOverride = QSize(-1, -1);
    260 
    261             /* Perform machine-view resize: */
    262             resize(iWidth, iHeight);
    263         }
    264 
    265         /* Let our toplevel widget calculate its sizeHint properly: */
    266         QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
     242
     243        /* Was framebuffer actually resized? */
     244        if (fResizeProposed)
     245        {
     246            /* Scale-mode doesn't need this.. */
     247            if (visualStateType() != UIVisualStateType_Scale)
     248            {
     249                /* Adjust maximum-size restriction for machine-view: */
     250                setMaximumSize(sizeHint());
     251
     252                /* Disable the resize hint override hack: */
     253                m_sizeHintOverride = QSize(-1, -1);
     254
     255                /* Force machine-window update own layout: */
     256                QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
     257
     258                /* Update machine-view sliders: */
     259                updateSliders();
     260
     261                /* By some reason Win host forgets to update machine-window central-widget
     262                 * after main-layout was updated, let's do it for all the hosts: */
     263                machineWindow()->centralWidget()->update();
     264
     265                /* Normalize machine-window geometry: */
     266                if (visualStateType() == UIVisualStateType_Normal)
     267                    machineWindow()->normalizeGeometry(true /* adjust position */);
     268            }
    267269
    268270#ifdef Q_WS_MAC
    269         machineLogic()->updateDockIconSize(screenId(), iWidth, iHeight);
     271            /* Update MacOS X dock icon size: */
     272            machineLogic()->updateDockIconSize(screenId(), iWidth, iHeight);
    270273#endif /* Q_WS_MAC */
    271 
    272         /* Scale-mode doesn't need this: */
    273         if (visualStateType() != UIVisualStateType_Scale)
    274         {
    275             /* Update machine-view sliders: */
    276             updateSliders();
    277 
    278             /* Normalize machine-window geometry: */
    279             if (visualStateType() == UIVisualStateType_Normal)
    280                 machineWindow()->normalizeGeometry(true /* adjust position */);
    281274        }
    282275    }
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