VirtualBox

Changeset 78784 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
May 27, 2019 2:16:41 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130873
Message:

API: add getVideoModeHint.
bugref:9472: API: let the GUI notice video mode hints from other sources.
This Display object API method lets a caller retrieve information about the
virtual monitor attached to a virtual display output, including the preferred
mode (was: last mode hint). The name is legacy and will be changed to
getMonitorInfo in 7.0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r78343 r78784  
    4242# include <VBox/vmm/vm.h>
    4343#endif
    44 #include <VBox/VMMDev.h>
    4544
    4645#ifdef VBOX_WITH_VIDEOHWACCEL
     
    19711970    }
    19721971
    1973     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1972    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    19741973
    19751974    if (aDisplay >= mcMonitors)
     
    20022001    }
    20032002
     2003    VMMDevDisplayDef d;
     2004    d.idDisplay     = aDisplay;
     2005    d.xOrigin       = aOriginX;
     2006    d.yOrigin       = aOriginY;
     2007    d.cx            = aWidth;
     2008    d.cy            = aHeight;
     2009    d.cBitsPerPixel = aBitsPerPixel;
     2010    d.fDisplayFlags = VMMDEV_DISPLAY_CX | VMMDEV_DISPLAY_CY | VMMDEV_DISPLAY_BPP;
     2011    if (!aEnabled)
     2012        d.fDisplayFlags |= VMMDEV_DISPLAY_DISABLED;
     2013    if (aChangeOrigin)
     2014        d.fDisplayFlags |= VMMDEV_DISPLAY_ORIGIN;
     2015    if (aDisplay == 0)
     2016        d.fDisplayFlags |= VMMDEV_DISPLAY_PRIMARY;
    20042017    /* We currently never suppress the VMMDev hint if the guest has requested
    20052018     * it.  Specifically the video graphics driver may not be responsible for
     
    20112024        PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
    20122025        if (pVMMDevPort)
    2013         {
    2014             VMMDevDisplayDef d;
    2015             d.idDisplay     = aDisplay;
    2016             d.xOrigin       = aOriginX;
    2017             d.yOrigin       = aOriginY;
    2018             d.cx            = aWidth;
    2019             d.cy            = aHeight;
    2020             d.cBitsPerPixel = aBitsPerPixel;
    2021             d.fDisplayFlags = VMMDEV_DISPLAY_CX | VMMDEV_DISPLAY_CY | VMMDEV_DISPLAY_BPP;
    2022             if (!aEnabled)
    2023                 d.fDisplayFlags |= VMMDEV_DISPLAY_DISABLED;
    2024             if (aChangeOrigin)
    2025                 d.fDisplayFlags |= VMMDEV_DISPLAY_ORIGIN;
    2026             if (aDisplay == 0)
    2027                 d.fDisplayFlags |= VMMDEV_DISPLAY_PRIMARY;
    2028 
    20292026            pVMMDevPort->pfnRequestDisplayChange(pVMMDevPort, 1, &d, false);
    2030         }
    2031     }
     2027    }
     2028    /* Remember the monitor information. */
     2029    maFramebuffers[aDisplay].monitorDesc = d;
     2030    return S_OK;
     2031}
     2032
     2033HRESULT Display::getVideoModeHint(ULONG cDisplay, BOOL *pfEnabled,
     2034                                  BOOL *pfChangeOrigin, LONG *pxOrigin, LONG *pyOrigin,
     2035                                  ULONG *pcx, ULONG *pcy, ULONG *pcBitsPerPixel)
     2036{
     2037    if (cDisplay >= mcMonitors)
     2038        return E_INVALIDARG;
     2039
     2040    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     2041    if (pfEnabled)
     2042        *pfEnabled      = !(  maFramebuffers[cDisplay].monitorDesc.fDisplayFlags
     2043                            & VMMDEV_DISPLAY_DISABLED);
     2044    if (pfChangeOrigin)
     2045        *pfChangeOrigin = RT_BOOL(  maFramebuffers[cDisplay].monitorDesc.fDisplayFlags
     2046                                  & VMMDEV_DISPLAY_ORIGIN);
     2047    if (pxOrigin)
     2048        *pxOrigin       = maFramebuffers[cDisplay].monitorDesc.xOrigin;
     2049    if (pyOrigin)
     2050        *pyOrigin       = maFramebuffers[cDisplay].monitorDesc.yOrigin;
     2051    if (pcx)
     2052        *pcx            = maFramebuffers[cDisplay].monitorDesc.cx;
     2053    if (pcy)
     2054        *pcy            = maFramebuffers[cDisplay].monitorDesc.cy;
     2055    if (pcBitsPerPixel)
     2056        *pcBitsPerPixel = maFramebuffers[cDisplay].monitorDesc.cBitsPerPixel;
    20322057    return S_OK;
    20332058}
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