VirtualBox

Changeset 98688 in vbox


Ignore:
Timestamp:
Feb 22, 2023 2:55:12 PM (22 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: A fix for machine-view framebuffer prepare procedure; Restore stored sizes only if there is actually something to restore, i.e. VM is in one of saved states.

File:
1 edited

Legend:

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

    r98683 r98688  
    12661266    QSize size;
    12671267    {
     1268        /* Acquire actual machine state to be sure: */
     1269        KMachineState enmActualState = KMachineState_Null;
     1270        uimachine()->acquireLiveMachineState(enmActualState);
     1271
    12681272#ifdef VBOX_WS_X11
    12691273        // WORKAROUND:
    1270         // Processing pseudo resize-event to synchronize frame-buffer with stored framebuffer size.
    1271         // On X11 this have to be additionally done when the machine state was 'saved'.
    1272         KMachineState enmActualState = KMachineState_Null;
    1273         uimachine()->acquireLiveMachineState(enmActualState);
     1274        // No idea why this was required for X11 before.
     1275        // Currently I don't see a reason why I should keep it.
     1276# if 0
    12741277        if (enmActualState == KMachineState_Saved || enmActualState == KMachineState_AbortedSaved)
    12751278            size = storedGuestScreenSizeHint();
     1279# endif
    12761280#endif /* VBOX_WS_X11 */
    12771281
    1278         /* If there is a preview image saved,
    1279          * we will resize the framebuffer to the size of that image: */
    1280         ULONG uWidth = 0, uHeight = 0;
    1281         QVector<KBitmapFormat> formats = machine().QuerySavedScreenshotInfo(0, uWidth, uHeight);
    1282         if (formats.size() > 0)
    1283         {
    1284             /* Init with the screenshot size: */
    1285             size = QSize(uWidth, uHeight);
    1286             /* Try to get the real guest dimensions from the save-state: */
    1287             ULONG uGuestOriginX = 0, uGuestOriginY = 0, uGuestWidth = 0, uGuestHeight = 0;
    1288             BOOL fEnabled = true;
    1289             machine().QuerySavedGuestScreenInfo(m_uScreenId, uGuestOriginX, uGuestOriginY, uGuestWidth, uGuestHeight, fEnabled);
    1290             if (uGuestWidth  > 0 && uGuestHeight > 0)
    1291                 size = QSize(uGuestWidth, uGuestHeight);
     1282        /* If there is a preview image saved, we will resize the framebuffer to the size of that image: */
     1283        if (enmActualState == KMachineState_Saved || enmActualState == KMachineState_AbortedSaved)
     1284        {
     1285            ULONG uWidth = 0, uHeight = 0;
     1286            QVector<KBitmapFormat> formats = machine().QuerySavedScreenshotInfo(0, uWidth, uHeight);
     1287            if (formats.size() > 0)
     1288            {
     1289                /* Init with the screenshot size: */
     1290                size = QSize(uWidth, uHeight);
     1291                /* Try to get the real guest dimensions from the save-state: */
     1292                ULONG uGuestOriginX = 0, uGuestOriginY = 0, uGuestWidth = 0, uGuestHeight = 0;
     1293                BOOL fEnabled = true;
     1294                machine().QuerySavedGuestScreenInfo(m_uScreenId, uGuestOriginX, uGuestOriginY, uGuestWidth, uGuestHeight, fEnabled);
     1295                if (uGuestWidth  > 0 && uGuestHeight > 0)
     1296                    size = QSize(uGuestWidth, uGuestHeight);
     1297            }
    12921298        }
    12931299
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