VirtualBox

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


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/src/VBox/Main/src-client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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;
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