VirtualBox

Changeset 41049 in vbox


Ignore:
Timestamp:
Apr 25, 2012 7:19:53 AM (12 years ago)
Author:
vboxsync
Message:

Main: query the guest screen info from saved state (xTracker 5820)

Location:
trunk/src/VBox
Files:
7 edited

Legend:

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

    r39451 r41049  
    438438        size = QSize(width, height);
    439439        /* Try to get the real guest dimensions from the save state */
    440         ULONG guestWidth = 0, guestHeight = 0;
    441         machine.QuerySavedGuestSize(0, guestWidth, guestHeight);
     440        ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
     441        BOOL fEnabled = true;
     442        machine.QuerySavedGuestScreenInfo(0, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
    442443        if (   guestWidth  > 0
    443444            && guestHeight > 0)
     
    724725    if (screenData.size() != 0)
    725726    {
    726         ULONG guestWidth = 0, guestHeight = 0;
    727         machine.QuerySavedGuestSize(0, guestWidth, guestHeight);
     727        ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
     728        BOOL fEnabled = true;
     729        machine.QuerySavedGuestScreenInfo(0, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
    728730        QImage shot = QImage::fromData(screenData.data(), screenData.size(), "PNG").scaled(guestWidth > 0 ? QSize(guestWidth, guestHeight) : guestSizeHint());
    729731        dimImage(shot);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r39110 r41049  
    102102    if (screenData.size() != 0)
    103103    {
    104         ULONG guestWidth = 0, guestHeight = 0;
    105         machine.QuerySavedGuestSize(0, guestWidth, guestHeight);
     104        ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
     105        BOOL fEnabled = true;
     106        machine.QuerySavedGuestScreenInfo(0, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
    106107        QImage shot = QImage::fromData(screenData.data(), screenData.size(), "PNG").scaled(guestWidth > 0 ? QSize(guestWidth, guestHeight) : guestSizeHint());
    107108        m_pPauseImage = new QImage(shot);
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r40539 r41049  
    37003700  <interface
    37013701    name="IMachine" extends="$unknown"
    3702     uuid="b0ce140d-02b6-469a-80f5-412ef8e1318e"
     3702    uuid="e7c78fee-f20d-4b4f-ac28-37af30d79ddf"
    37033703    wsmap="managed"
    37043704    >
     
    60516051    </method>
    60526052
    6053     <method name="querySavedGuestSize" const="yes">
     6053    <method name="querySavedGuestScreenInfo" const="yes">
    60546054      <desc>
    60556055        Returns the guest dimensions from the saved state.
     
    60606060        </desc>
    60616061      </param>
     6062      <param name="originX" type="unsigned long" dir="out">
     6063        <desc>
     6064          The X position of the guest monitor top left corner.
     6065        </desc>
     6066      </param>
     6067      <param name="originY" type="unsigned long" dir="out">
     6068        <desc>
     6069          The Y position of the guest monitor top left corner.
     6070        </desc>
     6071      </param>
    60626072      <param name="width" type="unsigned long" dir="out">
    60636073        <desc>
     
    60686078        <desc>
    60696079          Guest height at the time of the saved state was taken.
     6080        </desc>
     6081      </param>
     6082      <param name="enabled" type="boolean" dir="out">
     6083        <desc>
     6084          Whether the monitor is enabled in the guest.
    60706085        </desc>
    60716086      </param>
  • trunk/src/VBox/Main/include/DisplayUtils.h

    r35576 r41049  
    2424#define sSSMDisplayVer3 0x00010003
    2525
    26 int readSavedGuestSize(const Utf8Str &strStateFilePath, uint32_t u32ScreenId, uint32_t *pu32Width, uint32_t *pu32Height);
     26int readSavedGuestScreenInfo(const Utf8Str &strStateFilePath, uint32_t u32ScreenId,
     27                             uint32_t *pu32OriginX, uint32_t *pu32OriginY,
     28                             uint32_t *pu32Width, uint32_t *pu32Height, uint16_t *pu16Flags);
    2729
    2830int readSavedDisplayScreenshot(const Utf8Str &strStateFilePath, uint32_t u32Type, uint8_t **ppu8Data, uint32_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
  • trunk/src/VBox/Main/include/MachineImpl.h

    r40633 r41049  
    534534    STDMETHOD(GetStorageControllerByInstance(ULONG aInstance, IStorageController **storageController));
    535535    STDMETHOD(SetStorageControllerBootable)(IN_BSTR aName, BOOL fBootable);
    536     STDMETHOD(QuerySavedGuestSize)(ULONG aScreenId, ULONG *puWidth, ULONG *puHeight);
     536    STDMETHOD(QuerySavedGuestScreenInfo)(ULONG uScreenId, ULONG *puOriginX, ULONG *puOriginY, ULONG *puWidth, ULONG *puHeight, BOOL *pfEnabled);
    537537    STDMETHOD(QuerySavedThumbnailSize)(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight);
    538538    STDMETHOD(ReadSavedThumbnailToArray)(ULONG aScreenId, BOOL aBGR, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData));
  • trunk/src/VBox/Main/src-all/DisplayUtils.cpp

    r35576 r41049  
    2121#include <VBox/err.h>
    2222#include <VBox/vmm/ssm.h>
     23#include <VBox/VBoxVideo.h>
    2324
    2425int readSavedDisplayScreenshot(const Utf8Str &strStateFilePath, uint32_t u32Type, uint8_t **ppu8Data, uint32_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height)
     
    141142}
    142143
    143 int readSavedGuestSize(const Utf8Str &strStateFilePath, uint32_t u32ScreenId, uint32_t *pu32Width, uint32_t *pu32Height)
     144int readSavedGuestScreenInfo(const Utf8Str &strStateFilePath, uint32_t u32ScreenId,
     145                             uint32_t *pu32OriginX, uint32_t *pu32OriginY,
     146                             uint32_t *pu32Width, uint32_t *pu32Height, uint16_t *pu16Flags)
    144147{
    145148    LogFlowFunc(("u32ScreenId = %d [%s]\n", u32ScreenId, strStateFilePath.c_str()));
     
    151154        return VERR_NOT_SUPPORTED;
    152155    }
    153 
    154     uint32_t u32Width = 0;
    155     uint32_t u32Height = 0;
    156156
    157157    PSSMHANDLE pSSM;
     
    163163        if (RT_SUCCESS(vrc))
    164164        {
    165             /* Only the second version is supported. */
    166165            if (   uVersion == sSSMDisplayVer2
    167166                || uVersion == sSSMDisplayVer3)
     
    170169                SSMR3GetU32(pSSM, &cMonitors);
    171170                if (u32ScreenId > cMonitors)
    172                     vrc = -2;
     171                {
     172                    vrc = VERR_INVALID_PARAMETER;
     173                }
    173174                else
    174175                {
    175                     /* Skip all previous monitors and the first 3 entries. */
    176                     SSMR3Skip(pSSM, u32ScreenId * 5 * sizeof(uint32_t) + 3 * sizeof(uint32_t));
    177                     SSMR3GetU32(pSSM, &u32Width);
    178                     SSMR3GetU32(pSSM, &u32Height);
     176                    if (uVersion == sSSMDisplayVer2)
     177                    {
     178                        /* Skip all previous monitors, each 5 uint32_t, and the first 3 uint32_t entries. */
     179                        SSMR3Skip(pSSM, u32ScreenId * 5 * sizeof(uint32_t) + 3 * sizeof(uint32_t));
     180                        SSMR3GetU32(pSSM, pu32Width);
     181                        SSMR3GetU32(pSSM, pu32Height);
     182                        *pu32OriginX = 0;
     183                        *pu32OriginY = 0;
     184                        *pu16Flags = VBVA_SCREEN_F_ACTIVE;
     185                    }
     186                    else
     187                    {
     188                        Assert(uVersion == sSSMDisplayVer3);
     189                        /* Skip all previous monitors, each 8 uint32_t, and the first 3 uint32_t entries. */
     190                        SSMR3Skip(pSSM, u32ScreenId * 8 * sizeof(uint32_t) + 3 * sizeof(uint32_t));
     191                        SSMR3GetU32(pSSM, pu32Width);
     192                        SSMR3GetU32(pSSM, pu32Height);
     193                        SSMR3GetU32(pSSM, pu32OriginX);
     194                        SSMR3GetU32(pSSM, pu32OriginY);
     195                        uint32_t u32Flags = 0;
     196                        SSMR3GetU32(pSSM, &u32Flags);
     197                        *pu16Flags = (uint16_t)u32Flags;
     198                    }
    179199                }
    180200            }
     201            else
     202            {
     203                vrc = VERR_NOT_SUPPORTED;
     204            }
    181205        }
    182206
    183207        SSMR3Close(pSSM);
    184     }
    185 
    186     if (RT_SUCCESS(vrc))
    187     {
    188         *pu32Width = u32Width;
    189         *pu32Height = u32Height;
    190208    }
    191209
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r40538 r41049  
    58165816}
    58175817
    5818 STDMETHODIMP Machine::QuerySavedGuestSize(ULONG uScreenId, ULONG *puWidth, ULONG *puHeight)
     5818STDMETHODIMP Machine::QuerySavedGuestScreenInfo(ULONG uScreenId,
     5819                                                ULONG *puOriginX,
     5820                                                ULONG *puOriginY,
     5821                                                ULONG *puWidth,
     5822                                                ULONG *puHeight,
     5823                                                BOOL *pfEnabled)
    58195824{
    58205825    LogFlowThisFunc(("\n"));
    58215826
     5827    CheckComArgNotNull(puOriginX);
     5828    CheckComArgNotNull(puOriginY);
    58225829    CheckComArgNotNull(puWidth);
    58235830    CheckComArgNotNull(puHeight);
    5824 
     5831    CheckComArgNotNull(pfEnabled);
     5832
     5833    uint32_t u32OriginX= 0;
     5834    uint32_t u32OriginY= 0;
    58255835    uint32_t u32Width = 0;
    58265836    uint32_t u32Height = 0;
    5827 
    5828     int vrc = readSavedGuestSize(mSSData->strStateFilePath, uScreenId, &u32Width, &u32Height);
     5837    uint16_t u16Flags = 0;
     5838
     5839    int vrc = readSavedGuestScreenInfo(mSSData->strStateFilePath, uScreenId,
     5840                                       &u32OriginX, &u32OriginY, &u32Width, &u32Height, &u16Flags);
    58295841    if (RT_FAILURE(vrc))
    58305842        return setError(VBOX_E_IPRT_ERROR,
     
    58325844                        vrc);
    58335845
     5846    *puOriginX = u32OriginX;
     5847    *puOriginY = u32OriginY;
    58345848    *puWidth = u32Width;
    58355849    *puHeight = u32Height;
     5850    *pfEnabled = (u16Flags & VBVA_SCREEN_F_DISABLED) == 0;
    58365851
    58375852    return S_OK;
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