VirtualBox

Ignore:
Timestamp:
Jan 26, 2015 8:38:30 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
97865
Message:

Devices/Graphics, Main: optionally send cursor integration toggle and guest cursor position information through the graphics device. X11/Linux Additions support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp

    r53530 r53966  
    581581
    582582
     583/**
     584 * Report the guest cursor position.  The host may wish to use this information
     585 * to re-position its own cursor (though this is currently unlikely).  The
     586 * current host cursor position is returned.
     587 * @param  pCtx             The context containing the heap used.
     588 * @param  fReportPosition  Are we reporting a position?
     589 * @param  x                Guest cursor X position.
     590 * @param  y                Guest cursor Y position.
     591 * @param  pxHost           Host cursor X position is stored here.  Optional.
     592 * @param  pyHost           Host cursor Y position is stored here.  Optional.
     593 * @returns  iprt status code.
     594 * @returns  VERR_NO_MEMORY      HGSMI heap allocation failed.
     595 */
     596RTDECL(int) VBoxHGSMICursorPosition(PHGSMIGUESTCOMMANDCONTEXT pCtx, bool fReportPosition, uint32_t x, uint32_t y,
     597                                    uint32_t *pxHost, uint32_t *pyHost)
     598{
     599    int rc = VINF_SUCCESS;
     600    VBVACURSORPOSITION *p;
     601    LogRelFlowFunc(("x=%u, y=%u\n", (unsigned)x, (unsigned)y));
     602
     603    /* Allocate the IO buffer. */
     604    p = (VBVACURSORPOSITION *)VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVACURSORPOSITION), HGSMI_CH_VBVA, VBVA_CURSOR_POSITION);
     605    if (p)
     606    {
     607        /* Prepare data to be sent to the host. */
     608        p->fReportPosition = fReportPosition ? 1 : 0;
     609        p->x = x;
     610        p->y = y;
     611        rc = VBoxHGSMIBufferSubmit(pCtx, p);
     612        if (RT_SUCCESS(rc))
     613        {
     614            if (pxHost)
     615                *pxHost = p->x;
     616            if (pyHost)
     617                *pyHost = p->y;
     618            LogRelFlowFunc(("return: x=%u, y=%u\n", (unsigned)x, (unsigned)y));
     619        }
     620        /* Free the IO buffer. */
     621        VBoxHGSMIBufferFree(pCtx, p);
     622    }
     623    else
     624        rc = VERR_NO_MEMORY;
     625    LogFunc(("rc = %d\n", rc));
     626    return rc;
     627}
     628
     629
    583630/** @todo Mouse pointer position to be read from VMMDev memory, address of the memory region
    584631 * can be queried from VMMDev via an IOCTL. This VMMDev memory region will contain
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