VirtualBox

Changeset 6842 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Feb 7, 2008 11:25:50 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27961
Message:

Additions/common: added a call to wait for a display change request from the host

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp

    r6714 r6842  
    2222#include <iprt/string.h>
    2323#include <iprt/mem.h>
     24#include <iprt/assert.h>
    2425
    2526#include "VBGLR3Internal.h"
     
    146147    return rc;
    147148}
     149
     150/**
     151 * Wait for a display change request event from the host.  These events must have been
     152 * activated previously using VbglR3CtlFilterMask.
     153 *
     154 * @returns IPRT status value
     155 * @param   pcx       on success, where to return the requested display width.  0 means no
     156 *                    change.
     157 * @param   pcy       on success, where to return the requested display height.  0 means no
     158 *                    change.
     159 * @param   pcBits    on success, where to return the requested bits per pixel.  0 means no
     160 *                    change.
     161 * @param   piDisplay on success, where to return the index of the display to be changed.
     162 */
     163VBGLR3DECL(int) VbglR3DisplayChangeWaitEvent(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits,
     164                                             uint32_t *piDisplay)
     165{
     166    VBoxGuestWaitEventInfo waitEvent;
     167    int rc;
     168
     169#ifndef VBOX_VBGLR3_XFREE86
     170    AssertPtrReturn(pcx, VERR_INVALID_PARAMETER);
     171    AssertPtrReturn(pcy, VERR_INVALID_PARAMETER);
     172    AssertPtrReturn(pcBits, VERR_INVALID_PARAMETER);
     173    AssertPtrReturn(piDisplay, VERR_INVALID_PARAMETER);
     174#endif
     175    waitEvent.u32TimeoutIn = RT_INDEFINITE_WAIT;
     176    waitEvent.u32EventMaskIn = VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST;
     177    rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_WAITEVENT, &waitEvent, sizeof(waitEvent));
     178    if (RT_SUCCESS(rc))
     179    {
     180        /* did we get the right event? */
     181        if (waitEvent.u32EventFlagsOut & VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST)
     182        {
     183            VMMDevDisplayChangeRequest2 Req = { { 0 } };
     184            vmmdevInitRequest(&Req.header, VMMDevReq_GetDisplayChangeRequest2);
     185            Req.eventAck = VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST;
     186            int rc = vbglR3GRPerform(&Req.header);
     187            if (RT_SUCCESS(rc))
     188                rc = Req.header.rc;
     189            if (RT_SUCCESS(rc))
     190            {
     191                *pcx = Req.xres;
     192                *pcy = Req.yres;
     193                *pcBits = Req.bpp;
     194                *piDisplay = Req.display;
     195            }
     196        }
     197        else
     198            rc = VERR_TRY_AGAIN;
     199    }
     200    return rc;
     201}
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