VirtualBox

Changeset 39066 in vbox


Ignore:
Timestamp:
Oct 20, 2011 10:09:47 PM (13 years ago)
Author:
vboxsync
Message:

FE/Qt: suppress resizing the view window on intermediary or redundant resize events from display.

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

Legend:

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

    r39065 r39066  
    841841    UIResizeEvent *pResizeEvent = static_cast<UIResizeEvent*>(pEvent);
    842842
     843    /** If only the pitch has changed (or nothing at all!) we only update the
     844     * framebuffer and don't touch the window.  This prevents unwanted resizes
     845     * when entering or exiting fullscreen on X.Org guests and when
     846     * re-attaching the framebuffer on a view switch. */
     847    bool fResize =    pResizeEvent->width() != frameBuffer()->width()
     848                   || pResizeEvent->height() != frameBuffer()->height();
     849
    843850    /* Perform framebuffer resize: */
    844851    frameBuffer()->resizeEvent(pResizeEvent);
    845852
    846     /* Reapply maximum size restriction for machine-view: */
    847     setMaximumSize(sizeHint());
    848 
    849     /* Perform machine-view resize: */
    850     resize(pResizeEvent->width(), pResizeEvent->height());
    851 
    852     /* May be we have to restrict minimum size? */
    853     maybeRestrictMinimumSize();
    854 
    855     /* Let our toplevel widget calculate its sizeHint properly: */
    856     QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
     853    if (fResize)
     854    {
     855        /* Reapply maximum size restriction for machine-view: */
     856        setMaximumSize(sizeHint());
     857
     858        /* Perform machine-view resize: */
     859        resize(pResizeEvent->width(), pResizeEvent->height());
     860
     861        /* May be we have to restrict minimum size? */
     862        maybeRestrictMinimumSize();
     863
     864        /* Let our toplevel widget calculate its sizeHint properly: */
     865        QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
    857866
    858867#ifdef Q_WS_MAC
    859     machineLogic()->updateDockIconSize(screenId(), pResizeEvent->width(), pResizeEvent->height());
     868        machineLogic()->updateDockIconSize(screenId(), pResizeEvent->width(), pResizeEvent->height());
    860869#endif /* Q_WS_MAC */
    861870
    862     /* Update machine-view sliders: */
    863     updateSliders();
    864 
    865     /* Normalize machine-window geometry: */
    866     if (!fFullscreenOrSeamless)
    867         normalizeGeometry(true /* Adjust Position? */);
     871        /* Update machine-view sliders: */
     872        updateSliders();
     873
     874        /* Normalize machine-window geometry: */
     875        if (!fFullscreenOrSeamless)
     876            normalizeGeometry(true /* Adjust Position? */);
     877    }
    868878
    869879    /* Report to the VM thread that we finished resizing: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r39023 r39066  
    222222        QString strHintSent = machine.GetExtraData(strKey);
    223223        if (!strHintSent.isEmpty())
    224             sltPerformGuestResize(guestSizeHint());
     224        {
     225            QSize hint = guestSizeHint();
     226            resize(hint);
     227            sltPerformGuestResize(hint);
     228        }
    225229    }
    226230}
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