VirtualBox

Changeset 53965 in vbox


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

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

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/HGSMI/HGSMIChSetup.h

    r53528 r53965  
    5858/** monitor hotplug flag, should be accessed under VGAState::lock only */
    5959#define HGSMIHOSTFLAGS_HOTPLUG             0x20
     60/** Cursor capability state change flag, should be accessed under
     61 * VGAState::lock only.  @see VBVACONF32. */
     62#define HGSMIHOSTFLAGS_CURSOR_CAPABILITIES 0x40
    6063
    6164typedef struct _HGSMIHOSTFLAGS
  • trunk/include/VBox/VBoxVideo.h

    r53846 r53965  
    857857#define VBVA_CMDVBVA_CTL     18 /* G->H DMA command             */
    858858#define VBVA_QUERY_MODE_HINTS 19 /* Query most recent mode hints sent. */
     859/** Report the guest virtual desktop position and size for mapping host and
     860 * guest pointer positions. */
     861#define VBVA_REPORT_INPUT_MAPPING 20
     862/** Report the guest cursor position and query the host position. */
     863#define VBVA_CURSOR_POSITION 21
    859864
    860865/* host->guest commands */
     
    915920 * Set value to VERR_NOT_SUPPORTED before calling. */
    916921#define VBOX_VBVA_CONF32_MODE_HINT_REPORTING  2
     922/** Returns VINF_SUCCESS if the host can receive guest cursor information via
     923 * VBVA.  Set value to VERR_NOT_SUPPORTED before calling. */
     924#define VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING  3
     925/** Returns the currently available host cursor capabilities.  Available if
     926 * VBVACONF32::VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING returns success.
     927 * @see VMMDevReqMouseStatus::mouseFeatures. */
     928#define VBOX_VBVA_CONF32_CURSOR_CAPABILITIES  4
    917929
    918930typedef struct VBVACONF32
     
    10831095/** The guest can read video mode hints sent via VBVA. */
    10841096#define VBVACAPS_VIDEO_MODE_HINTS       0x00000004
     1097/** The guest can switch to a software cursor on demand. */
     1098#define VBVACAPS_DISABLE_CURSOR_INTEGRATION 0x00000008
    10851099typedef struct VBVACAPS
    10861100{
     
    11471161
    11481162#define VBVAMODEHINT_MAGIC UINT32_C(0x0801add9)
     1163
     1164/** Report the rectangle relative to which absolute pointer events should be
     1165 *  expressed.  This information remains valid until the next VBVA resize event
     1166 *  for any screen, at which time it is reset to the bounding rectangle of all
     1167 *  virtual screens.
     1168 *  @see VBVA_REPORT_INPUT_MAPPING. */
     1169typedef struct VBVAREPORTINPUTMAPPING
     1170{
     1171    int32_t x;    /**< Upper left X co-ordinate relative to the first screen. */
     1172    int32_t y;    /**< Upper left Y co-ordinate relative to the first screen. */
     1173    uint32_t cx;  /**< Rectangle width. */
     1174    uint32_t cy;  /**< Rectangle height. */
     1175} VBVAREPORTINPUTMAPPING;
     1176
     1177/** Report the guest cursor position and query the host one.  The host may wish
     1178 *  to use the guest information to re-position its own cursor (though this is
     1179 *  currently unlikely).
     1180 *  @see VBVA_CURSOR_POSITION */
     1181typedef struct VBVACURSORPOSITION
     1182{
     1183    uint32_t fReportPosition;  /**< Are we reporting a position? */
     1184    uint32_t x;                /**< Guest cursor X position */
     1185    uint32_t y;                /**< Guest cursor Y position */
     1186} VBVACURSORPOSITION;
    11491187
    11501188#pragma pack()
  • trunk/include/VBox/vmm/pdmifs.h

    r53528 r53965  
    680680                          uint32_t cBPP, uint32_t iDisplay, uint32_t dx,
    681681                          uint32_t dy, uint32_t fEnabled, uint32_t fNotifyGuest));
     682
     683    /**
     684     * Send the guest a notification about host cursor capabilities changes.
     685     *
     686     * @param   pInterface            Pointer to this interface.
     687     * @param   fCapabilitiesAdded    New supported capabilities.
     688     * @param   fCapabilitiesRemoved  No longer supported capabilities.
     689     * @thread  Any.
     690     */
     691    DECLR3CALLBACKMEMBER(void, pfnReportHostCursorCapabilities, (PPDMIDISPLAYPORT pInterface, uint32_t fCapabilitiesAdded,
     692                                                                 uint32_t fCapabilitiesRemoved));
     693
     694    /**
     695     * Tell the graphics device about the host cursor position.
     696     *
     697     * @param   pInterface  Pointer to this interface.
     698     * @param   x           X offset into the cursor range.
     699     * @param   y           Y offset into the cursor range.
     700     * @thread  Any.
     701     */
     702    DECLR3CALLBACKMEMBER(void, pfnReportHostCursorPosition, (PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y));
    682703} PDMIDISPLAYPORT;
    683704/** PDMIDISPLAYPORT interface ID. */
    684705#ifdef VBOX_WITH_VMSVGA
    685 #define PDMIDISPLAYPORT_IID                     "f7ed5b9a-3940-4862-9310-1de7e3d118a4"
     706#define PDMIDISPLAYPORT_IID                     "e8da6d7e-8490-11e4-91d8-ab609a010f13"
    686707#else
    687 #define PDMIDISPLAYPORT_IID                     "613ed6c0-817a-11e4-bc1e-931613071d2c"
     708#define PDMIDISPLAYPORT_IID                     "db067c60-8490-11e4-8424-032afeb83818"
    688709#endif
    689710
     
    849870     * @param   fRenderThreadMode   if true - the graphics device has a separate thread that does all rendering.
    850871     *                              This means that:
    851      *                              1. all pfnVBVAXxx callbacks (including the current pfnVBVAEnable call), except displayVBVAMousePointerShape
     872     *                              1. most pfnVBVAXxx callbacks (see the individual documentation for each one)
    852873     *                                 will be called in the context of the render thread rather than the emulation thread
    853874     *                              2. PDMIDISPLAYCONNECTOR implementor (i.e. DisplayImpl) must NOT notify crogl backend
     
    970991    uint32_t        cy;
    971992    /** @} */
     993
     994    /**
     995     * The guest display input mapping rectangle was updated.
     996     *
     997     * @param   pInterface  Pointer to this interface.
     998     * @param   xOrigin     Upper left X co-ordinate relative to the first screen.
     999     * @param   yOrigin     Upper left Y co-ordinate relative to the first screen.
     1000     * @param   cx          Rectangle width.
     1001     * @param   cy          Rectangle height.
     1002     * @thread  The emulation thread.
     1003     */
     1004    DECLR3CALLBACKMEMBER(void, pfnVBVAInputMappingUpdate,(PPDMIDISPLAYCONNECTOR pInterface, int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy));
    9721005} PDMIDISPLAYCONNECTOR;
    9731006/** PDMIDISPLAYCONNECTOR interface ID. */
    974 #define PDMIDISPLAYCONNECTOR_IID                "33a332b3-0850-4b0f-a697-dcc140bb2e05"
     1007#define PDMIDISPLAYCONNECTOR_IID                "e883a720-85fb-11e4-a307-0b06689c9661"
    9751008
    9761009
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r53782 r53965  
    60646064#endif
    60656065    pThis->IPort.pfnSendModeHint        = vbvaPortSendModeHint;
     6066    pThis->IPort.pfnReportHostCursorCapabilities
     6067                                        = vbvaPortReportHostCursorCapabilities;
     6068    pThis->IPort.pfnReportHostCursorPosition
     6069                                        = vbvaPortReportHostCursorPosition;
    60666070
    60676071#if defined(VBOX_WITH_HGSMI)
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r53788 r53965  
    557557    uint32_t                    fGuestCaps;
    558558    uint32_t                    fScanLineCfg;
    559     uint8_t                     Padding10[4];
     559    uint32_t                    fHostCursorCapabilities;
    560560#  else
    561561    uint8_t                     Padding10[14];
     
    692692                                       uint32_t dy, uint32_t fEnabled,
    693693                                       uint32_t fNotifyGuest);
     694DECLCALLBACK(void) vbvaPortReportHostCursorCapabilities(PPDMIDISPLAYPORT pInterface, uint32_t fCapabilitiesAdded,
     695                                                        uint32_t fCapabilitiesRemoved);
     696DECLCALLBACK(void) vbvaPortReportHostCursorPosition(PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y);
    694697
    695698# ifdef VBOX_WITH_VDMA
  • trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp

    r53813 r53965  
    8383    VBVAMOUSESHAPEINFO mouseShapeInfo;
    8484    bool fPaused;
     85    uint32_t xCursor;
     86    uint32_t yCursor;
    8587    VBVAMODEHINT aModeHints[VBOX_VIDEO_MAX_SCREENS];
    8688} VBVACONTEXT;
     
    21792181                pConf32->u32Value = 64*_1K;
    21802182            }
    2181             else if (pConf32->u32Index == VBOX_VBVA_CONF32_MODE_HINT_REPORTING)
     2183            else if (   pConf32->u32Index == VBOX_VBVA_CONF32_MODE_HINT_REPORTING
     2184                     || pConf32->u32Index == VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING)
    21822185            {
    21832186                pConf32->u32Value = VINF_SUCCESS;
     2187            }
     2188            else if (pConf32->u32Index == VBOX_VBVA_CONF32_CURSOR_CAPABILITIES)
     2189            {
     2190                pConf32->u32Value = pVGAState->fHostCursorCapabilities;
    21842191            }
    21852192            else
     
    24832490                Assert(pbHint - (uint8_t *)pvBuffer <= cbBuffer);
    24842491            }
     2492        } break;
     2493
     2494        case VBVA_REPORT_INPUT_MAPPING:
     2495        {
     2496            if (cbBuffer != sizeof(VBVAREPORTINPUTMAPPING))
     2497            {
     2498                rc = VERR_INVALID_PARAMETER;
     2499                break;
     2500            }
     2501            VBVAREPORTINPUTMAPPING *pReport = (VBVAREPORTINPUTMAPPING *)pvBuffer;
     2502            LogRelFlowFunc(("VBVA_REPORT_INPUT_MAPPING: x=%u, y=%u, cx=%u, cy=%u\n", (unsigned)pReport->x, (unsigned)pReport->y,
     2503                            (unsigned)pReport->cx, (unsigned)pReport->cy));
     2504            pVGAState->pDrv->pfnVBVAInputMappingUpdate(pVGAState->pDrv, pReport->x, pReport->y, pReport->cx, pReport->cy);
     2505        } break;
     2506
     2507        case VBVA_CURSOR_POSITION:
     2508        {
     2509            if (cbBuffer != sizeof(VBVACURSORPOSITION))
     2510            {
     2511                rc = VERR_INVALID_PARAMETER;
     2512                break;
     2513            }
     2514            VBVACURSORPOSITION *pReport
     2515                = (VBVACURSORPOSITION *)pvBuffer;
     2516            LogRelFlowFunc(("VBVA_CURSOR_POSITION: fReportPosition=%RTbool",
     2517                            RT_BOOL(pReport->fReportPosition)));
     2518            if (RT_BOOL(pReport->fReportPosition))
     2519                LogRelFlowFunc(("VBVA_CURSOR_POSITION: fReportPosition=true, x=%u, y=%u\n",
     2520                               (unsigned)pReport->x, (unsigned)pReport->y));
     2521            else
     2522                LogRelFlowFunc(("VBVA_CURSOR_POSITION: fReportPosition=false\n"));
     2523            pReport->x = pCtx->xCursor;
     2524            pReport->y = pCtx->yCursor;
    24852525        } break;
    24862526
     
    26222662}
    26232663
     2664DECLCALLBACK(void) vbvaPortReportHostCursorCapabilities(PPDMIDISPLAYPORT pInterface, uint32_t fCapabilitiesAdded,
     2665                                                        uint32_t fCapabilitiesRemoved)
     2666{
     2667    PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
     2668    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
     2669    AssertRC(rc);
     2670    pThis->fHostCursorCapabilities |= fCapabilitiesAdded;
     2671    pThis->fHostCursorCapabilities &= ~fCapabilitiesRemoved;
     2672    if (pThis->fGuestCaps & VBVACAPS_IRQ)
     2673        VBVARaiseIrqNoWait(pThis, HGSMIHOSTFLAGS_CURSOR_CAPABILITIES);
     2674    PDMCritSectLeave(&pThis->CritSect);
     2675}
     2676
     2677DECLCALLBACK(void) vbvaPortReportHostCursorPosition
     2678                       (PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y)
     2679{
     2680    PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
     2681    VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThis->pHGSMI);
     2682    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
     2683    AssertRC(rc);
     2684    pCtx->xCursor = x;
     2685    pCtx->yCursor = y;
     2686    PDMCritSectLeave(&pThis->CritSect);
     2687}
     2688
    26242689static HGSMICHANNELHANDLER sOldChannelHandler;
    26252690
     
    26532718             pCtx->fPaused = true;
    26542719             memset(pCtx->aModeHints, ~0, sizeof(*pCtx->aModeHints));
     2720             pVGAState->fHostCursorCapabilities = 0;
    26552721         }
    26562722     }
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r53851 r53965  
    124124    virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
    125125                                            int32_t *px2, int32_t *py2) = 0;
     126    virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved) = 0;
     127    virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y) = 0;
    126128};
    127129
     
    150152    void i_handleUpdateVMMDevSupportsGraphics(bool fSupportsGraphics);
    151153    void i_handleUpdateGuestVBVACapabilities(uint32_t fNewCapabilities);
     154    void i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy);
    152155#ifdef VBOX_WITH_VIDEOHWACCEL
    153156    int  i_handleVHWACommandProcess(PVBOXVHWACMD pCommand);
     
    200203    virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
    201204                                            int32_t *px2, int32_t *py2);
     205    virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved);
     206    virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y);
    202207
    203208    static const PDMDRVREG  DrvReg;
     
    333338                                                              const void *pvShape);
    334339    static DECLCALLBACK(void)  i_displayVBVAGuestCapabilityUpdate(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fCapabilities);
     340
     341    static DECLCALLBACK(void)  i_displayVBVAInputMappingUpdate(PPDMIDISPLAYCONNECTOR pInterface, int32_t xOrigin, int32_t yOrigin,
     342                                                               uint32_t cx, uint32_t cy);
    335343#endif
    336344
     
    362370
    363371    unsigned mcMonitors;
     372    /** Input mapping rectangle top left X relative to the first screen. */
     373    int32_t     xInputMappingOrigin;
     374    /** Input mapping rectangle top left Y relative to the first screen. */
     375    int32_t     yInputMappingOrigin;
     376    uint32_t    cxInputMapping;  /**< Input mapping rectangle width. */
     377    uint32_t    cyInputMapping;  /**< Input mapping rectangle height. */
    364378    DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
    365379    /** Does the VMM device have the "supports graphics" capability set?
     
    369383     *  Does not go into the saved state as it is refreshed on restore. */
    370384    uint32_t    mfGuestVBVACapabilities;
     385    /** Mirror of the current host cursor integration support capability.
     386     *  Does not go into the saved state as it is refreshed on restore. */
     387    uint32_t    mfHostSupportsCursorIntegration;
    371388
    372389    bool mfSourceBitmapEnabled;
  • trunk/src/VBox/Main/include/DisplayUtils.h

    r44529 r53965  
    2323#define sSSMDisplayVer2 0x00010002
    2424#define sSSMDisplayVer3 0x00010003
     25#define sSSMDisplayVer4 0x00010004
    2526
    2627int readSavedGuestScreenInfo(const Utf8Str &strStateFilePath, uint32_t u32ScreenId,
  • trunk/src/VBox/Main/include/MouseImpl.h

    r52934 r53965  
    104104    HRESULT i_reportMultiTouchEventToDevice(uint8_t cContacts, const uint64_t *pau64Contacts, uint32_t u32ScanTime);
    105105    HRESULT i_reportAbsEventToVMMDev(int32_t x, int32_t y);
    106     HRESULT i_reportAbsEvent(int32_t x, int32_t y, int32_t dz, int32_t dw,
    107                              uint32_t fButtons, bool fUsesVMMDevEvent);
     106    HRESULT i_reportAbsEventToInputDevices(int32_t x, int32_t y, int32_t dz, int32_t dw, uint32_t fButtons,
     107                                           bool fUsesVMMDevEvent);
     108    HRESULT i_reportAbsEventToDisplayDevice(int32_t x, int32_t y);
    108109    HRESULT i_convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
    109110                                 bool *pfValid);
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r53890 r53965  
    507507        SSMR3PutU32(pSSM, that->maFramebuffers[i].flags);
    508508    }
     509    SSMR3PutS32(pSSM, that->xInputMappingOrigin);
     510    SSMR3PutS32(pSSM, that->yInputMappingOrigin);
     511    SSMR3PutU32(pSSM, that->cxInputMapping);
     512    SSMR3PutU32(pSSM, that->cyInputMapping);
    509513}
    510514
     
    516520    if (!(   uVersion == sSSMDisplayVer
    517521          || uVersion == sSSMDisplayVer2
    518           || uVersion == sSSMDisplayVer3))
     522          || uVersion == sSSMDisplayVer3
     523          || uVersion == sSSMDisplayVer4))
    519524        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
    520525    Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
     
    531536        SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32InformationSize);
    532537        if (   uVersion == sSSMDisplayVer2
    533             || uVersion == sSSMDisplayVer3)
     538            || uVersion == sSSMDisplayVer3
     539            || uVersion == sSSMDisplayVer4)
    534540        {
    535541            uint32_t w;
     
    540546            that->maFramebuffers[i].h = h;
    541547        }
    542         if (uVersion == sSSMDisplayVer3)
     548        if (   uVersion == sSSMDisplayVer3
     549            || uVersion == sSSMDisplayVer4)
    543550        {
    544551            int32_t xOrigin;
     
    554561        }
    555562    }
     563    if (uVersion == sSSMDisplayVer4)
     564    {
     565        SSMR3GetS32(pSSM, &that->xInputMappingOrigin);
     566        SSMR3GetS32(pSSM, &that->yInputMappingOrigin);
     567        SSMR3GetU32(pSSM, &that->cxInputMapping);
     568        SSMR3GetU32(pSSM, &that->cyInputMapping);
     569    }
    556570
    557571    return VINF_SUCCESS;
     
    694708     * the framebuffer offset in the virtual desktop and the framebuffer flags.
    695709     */
    696     int rc = SSMR3RegisterExternal(pUVM, "DisplayData", 0, sSSMDisplayVer3,
     710    int rc = SSMR3RegisterExternal(pUVM, "DisplayData", 0, sSSMDisplayVer4,
    697711                                   mcMonitors * sizeof(uint32_t) * 8 + sizeof(uint32_t),
    698712                                   NULL, NULL, NULL,
     
    10821096}
    10831097
     1098void Display::i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy)
     1099{
     1100    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1101
     1102    xInputMappingOrigin = xOrigin;
     1103    yInputMappingOrigin = yOrigin;
     1104    cxInputMapping      = cx;
     1105    cyInputMapping      = cy;
     1106}
     1107
    10841108/**
    10851109 * Returns the upper left and lower right corners of the virtual framebuffer.
     
    11101134        y2 = mpDrv->IConnector.cy + (int32_t)maFramebuffers[0].yOrigin;
    11111135    }
    1112     for (unsigned i = 1; i < mcMonitors; ++i)
    1113     {
    1114         if (!maFramebuffers[i].fDisabled)
    1115         {
    1116             x1 = RT_MIN(x1, maFramebuffers[i].xOrigin);
    1117             y1 = RT_MIN(y1, maFramebuffers[i].yOrigin);
    1118             x2 = RT_MAX(x2,   maFramebuffers[i].xOrigin
    1119                             + (int32_t)maFramebuffers[i].w);
    1120             y2 = RT_MAX(y2,   maFramebuffers[i].yOrigin
    1121                             + (int32_t)maFramebuffers[i].h);
    1122         }
    1123     }
     1136    if (cxInputMapping && cyInputMapping)
     1137    {
     1138        x1 = xInputMappingOrigin;
     1139        y1 = yInputMappingOrigin;
     1140        x2 = xInputMappingOrigin + cxInputMapping;
     1141        y2 = xInputMappingOrigin + cyInputMapping;
     1142    }
     1143    else
     1144        for (unsigned i = 1; i < mcMonitors; ++i)
     1145        {
     1146            if (!maFramebuffers[i].fDisabled)
     1147            {
     1148                x1 = RT_MIN(x1, maFramebuffers[i].xOrigin);
     1149                y1 = RT_MIN(y1, maFramebuffers[i].yOrigin);
     1150                x2 = RT_MAX(x2, maFramebuffers[i].xOrigin + (int32_t)maFramebuffers[i].w);
     1151                y2 = RT_MAX(y2, maFramebuffers[i].yOrigin + (int32_t)maFramebuffers[i].h);
     1152            }
     1153        }
    11241154    *px1 = x1;
    11251155    *py1 = y1;
    11261156    *px2 = x2;
    11271157    *py2 = y2;
     1158}
     1159
     1160HRESULT Display::i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved)
     1161{
     1162    /* Do we need this to access mParent?  I presume that the safe VM pointer
     1163     * ensures that mpDrv will remain valid. */
     1164    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1165
     1166    Console::SafeVMPtr ptrVM(mParent);
     1167    if (!ptrVM.isOk())
     1168        return ptrVM.rc();
     1169    CHECK_CONSOLE_DRV(mpDrv);
     1170    alock.release();  /* Release before calling up for lock order reasons. */
     1171    mpDrv->pUpPort->pfnReportHostCursorCapabilities (mpDrv->pUpPort, fCapabilitiesAdded, fCapabilitiesRemoved);
     1172    if (   mfGuestVBVACapabilities & VBVACAPS_DISABLE_CURSOR_INTEGRATION
     1173        && !(mfGuestVBVACapabilities & VBVACAPS_IRQ))
     1174    {
     1175        HRESULT hrc = mParent->i_sendACPIMonitorHotPlugEvent();
     1176        if (FAILED(hrc))
     1177            return hrc;
     1178    }
     1179    return S_OK;
     1180}
     1181
     1182HRESULT Display::i_reportHostCursorPosition(int32_t x, int32_t y)
     1183{
     1184    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1185    uint32_t xAdj = (uint32_t)RT_MAX(x - xInputMappingOrigin, 0);
     1186    uint32_t yAdj = (uint32_t)RT_MAX(y - yInputMappingOrigin, 0);
     1187    xAdj = RT_MIN(xAdj, cxInputMapping);
     1188    yAdj = RT_MIN(yAdj, cyInputMapping);
     1189
     1190    Console::SafeVMPtr ptrVM(mParent);
     1191    if (!ptrVM.isOk())
     1192        return ptrVM.rc();
     1193    CHECK_CONSOLE_DRV(mpDrv);
     1194    alock.release();  /* Release before calling up for lock order reasons. */
     1195    mpDrv->pUpPort->pfnReportHostCursorPosition(mpDrv->pUpPort, xAdj, yAdj);
     1196    return S_OK;
    11281197}
    11291198
     
    38363905    pFBInfo->flags = pScreen->u16Flags;
    38373906
     3907    pThis->xInputMappingOrigin = 0;
     3908    pThis->yInputMappingOrigin = 0;
     3909    pThis->cxInputMapping = 0;
     3910    pThis->cyInputMapping = 0;
     3911
    38383912    if (fNewOrigin)
    38393913    {
     
    38963970    pThis->i_handleUpdateGuestVBVACapabilities(fCapabilities);
    38973971}
     3972
     3973DECLCALLBACK(void) Display::i_displayVBVAInputMappingUpdate(PPDMIDISPLAYCONNECTOR pInterface, int32_t xOrigin, int32_t yOrigin,
     3974                                                            uint32_t cx, uint32_t cy)
     3975{
     3976    LogFlowFunc(("\n"));
     3977
     3978    PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
     3979    Display *pThis = pDrv->pDisplay;
     3980
     3981    pThis->i_handleUpdateVBVAInputMapping(xOrigin, yOrigin, cx, cy);
     3982}
     3983
    38983984#endif /* VBOX_WITH_HGSMI */
    38993985
     
    39974083    pThis->IConnector.pfnVBVAMousePointerShape = Display::i_displayVBVAMousePointerShape;
    39984084    pThis->IConnector.pfnVBVAGuestCapabilityUpdate = Display::i_displayVBVAGuestCapabilityUpdate;
     4085    pThis->IConnector.pfnVBVAInputMappingUpdate = Display::i_displayVBVAInputMappingUpdate;
    39994086#endif
    40004087
  • trunk/src/VBox/Main/src-client/MouseImpl.cpp

    r52934 r53965  
    347347        return E_FAIL;  /* No assertion, as the front-ends can send events
    348348                         * at all sorts of inconvenient times. */
     349    DisplayMouseInterface *pDisplay = mParent->i_getDisplayMouseInterface();
     350    if (pDisplay == NULL)
     351        return E_FAIL;
    349352    PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
    350353    if (!pVMMDevPort)
     
    353356    int rc = pVMMDevPort->pfnUpdateMouseCapabilities(pVMMDevPort, fCapsAdded,
    354357                                                     fCapsRemoved);
    355     return RT_SUCCESS(rc) ? S_OK : E_FAIL;
     358    if (RT_FAILURE(rc))
     359        return E_FAIL;
     360    return pDisplay->i_reportHostCursorCapabilities(fCapsAdded, fCapsRemoved);
    356361}
    357362
     
    619624 * @returns   COM status code
    620625 */
    621 HRESULT Mouse::i_reportAbsEvent(int32_t x, int32_t y,
    622                                 int32_t dz, int32_t dw, uint32_t fButtons,
    623                                 bool fUsesVMMDevEvent)
     626HRESULT Mouse::i_reportAbsEventToInputDevices(int32_t x, int32_t y, int32_t dz, int32_t dw, uint32_t fButtons,
     627                                              bool fUsesVMMDevEvent)
    624628{
    625629    HRESULT rc;
     
    648652    return rc;
    649653}
     654
     655
     656/**
     657 * Send an absolute position event to the display device.
     658 * @note all calls out of this object are made with no locks held!
     659 * @param  x  Cursor X position in pixels relative to the first screen, where
     660 *            (1, 1) is the upper left corner.
     661 * @param  y  Cursor Y position in pixels relative to the first screen, where
     662 *            (1, 1) is the upper left corner.
     663 */
     664HRESULT Mouse::i_reportAbsEventToDisplayDevice(int32_t x, int32_t y)
     665{
     666    DisplayMouseInterface *pDisplay = mParent->i_getDisplayMouseInterface();
     667    ComAssertRet(pDisplay, E_FAIL);
     668
     669    if (x != mcLastX || y != mcLastY)
     670    {
     671        pDisplay->i_reportHostCursorPosition(x - 1, y - 1);
     672    }
     673    return S_OK;
     674}
     675
    650676
    651677void Mouse::i_fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
     
    838864    if (fValid)
    839865    {
    840         rc = i_reportAbsEvent(xAdj, yAdj, dz, dw, fButtonsAdj,
    841                               RT_BOOL(  mfVMMDevGuestCaps
    842                                       & VMMDEV_MOUSE_NEW_PROTOCOL));
     866        rc = i_reportAbsEventToInputDevices(xAdj, yAdj, dz, dw, fButtonsAdj,
     867                                            RT_BOOL(mfVMMDevGuestCaps & VMMDEV_MOUSE_NEW_PROTOCOL));
     868        if (FAILED(rc)) return rc;
    843869
    844870        i_fireMouseEvent(true, x, y, dz, dw, aButtonState);
    845871    }
     872    rc = i_reportAbsEventToDisplayDevice(x, y);
    846873
    847874    return rc;
  • trunk/src/VBox/Main/testcase/tstMouseImpl.cpp

    r52064 r53965  
    4444    virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
    4545                                            int32_t *px2, int32_t *py2);
     46    virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved)
     47    { return S_OK; }
     48    virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y) {}
    4649};
    4750
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