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.

Location:
trunk/src/VBox/Additions/common/VBoxVideo
Files:
2 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
  • trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp

    r53530 r53966  
    280280}
    281281
     282
     283/** Report the rectangle relative to which absolute pointer events should be
     284 *  expressed.  This information remains valid until the next VBVA resize event
     285 *  for any screen, at which time it is reset to the bounding rectangle of all
     286 *  virtual screens.
     287 * @param  pCtx      The context containing the heap to use.
     288 * @param  cOriginX  Upper left X co-ordinate relative to the first screen.
     289 * @param  cOriginY  Upper left Y co-ordinate relative to the first screen.
     290 * @param  cWidth    Rectangle width.
     291 * @param  cHeight   Rectangle height.
     292 * @returns  iprt status code.
     293 * @returns  VERR_NO_MEMORY      HGSMI heap allocation failed.
     294 */
     295RTDECL(int)      VBoxHGSMIUpdateInputMapping(PHGSMIGUESTCOMMANDCONTEXT pCtx, int32_t  cOriginX, int32_t  cOriginY,
     296                                             uint32_t cWidth, uint32_t cHeight)
     297{
     298    int rc = VINF_SUCCESS;
     299    VBVAREPORTINPUTMAPPING *p;
     300    LogRelFlowFunc(("cOriginX=%u, cOriginY=%u, cWidth=%u, cHeight=%u\n",
     301                    (unsigned)cOriginX, (unsigned)cOriginX,
     302                    (unsigned)cWidth, (unsigned)cHeight));
     303
     304    /* Allocate the IO buffer. */
     305    p = (VBVAREPORTINPUTMAPPING *)VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAREPORTINPUTMAPPING), HGSMI_CH_VBVA,
     306                                                       VBVA_REPORT_INPUT_MAPPING);
     307    if (p)
     308    {
     309        /* Prepare data to be sent to the host. */
     310        p->x  = cOriginX;
     311        p->y  = cOriginY;
     312        p->cx = cWidth;
     313        p->cy = cHeight;
     314        rc = VBoxHGSMIBufferSubmit(pCtx, p);
     315        /* Free the IO buffer. */
     316        VBoxHGSMIBufferFree(pCtx, p);
     317    }
     318    else
     319        rc = VERR_NO_MEMORY;
     320    LogFunc(("rc = %d\n", rc));
     321    return rc;
     322}
     323
     324
    282325/**
    283326 * Get most recent video mode hints.
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