Changeset 53965 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Jan 26, 2015 8:37:10 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 97864
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r53890 r53965 507 507 SSMR3PutU32(pSSM, that->maFramebuffers[i].flags); 508 508 } 509 SSMR3PutS32(pSSM, that->xInputMappingOrigin); 510 SSMR3PutS32(pSSM, that->yInputMappingOrigin); 511 SSMR3PutU32(pSSM, that->cxInputMapping); 512 SSMR3PutU32(pSSM, that->cyInputMapping); 509 513 } 510 514 … … 516 520 if (!( uVersion == sSSMDisplayVer 517 521 || uVersion == sSSMDisplayVer2 518 || uVersion == sSSMDisplayVer3)) 522 || uVersion == sSSMDisplayVer3 523 || uVersion == sSSMDisplayVer4)) 519 524 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 520 525 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); … … 531 536 SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32InformationSize); 532 537 if ( uVersion == sSSMDisplayVer2 533 || uVersion == sSSMDisplayVer3) 538 || uVersion == sSSMDisplayVer3 539 || uVersion == sSSMDisplayVer4) 534 540 { 535 541 uint32_t w; … … 540 546 that->maFramebuffers[i].h = h; 541 547 } 542 if (uVersion == sSSMDisplayVer3) 548 if ( uVersion == sSSMDisplayVer3 549 || uVersion == sSSMDisplayVer4) 543 550 { 544 551 int32_t xOrigin; … … 554 561 } 555 562 } 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 } 556 570 557 571 return VINF_SUCCESS; … … 694 708 * the framebuffer offset in the virtual desktop and the framebuffer flags. 695 709 */ 696 int rc = SSMR3RegisterExternal(pUVM, "DisplayData", 0, sSSMDisplayVer 3,710 int rc = SSMR3RegisterExternal(pUVM, "DisplayData", 0, sSSMDisplayVer4, 697 711 mcMonitors * sizeof(uint32_t) * 8 + sizeof(uint32_t), 698 712 NULL, NULL, NULL, … … 1082 1096 } 1083 1097 1098 void 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 1084 1108 /** 1085 1109 * Returns the upper left and lower right corners of the virtual framebuffer. … … 1110 1134 y2 = mpDrv->IConnector.cy + (int32_t)maFramebuffers[0].yOrigin; 1111 1135 } 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 } 1124 1154 *px1 = x1; 1125 1155 *py1 = y1; 1126 1156 *px2 = x2; 1127 1157 *py2 = y2; 1158 } 1159 1160 HRESULT 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 1182 HRESULT 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; 1128 1197 } 1129 1198 … … 3836 3905 pFBInfo->flags = pScreen->u16Flags; 3837 3906 3907 pThis->xInputMappingOrigin = 0; 3908 pThis->yInputMappingOrigin = 0; 3909 pThis->cxInputMapping = 0; 3910 pThis->cyInputMapping = 0; 3911 3838 3912 if (fNewOrigin) 3839 3913 { … … 3896 3970 pThis->i_handleUpdateGuestVBVACapabilities(fCapabilities); 3897 3971 } 3972 3973 DECLCALLBACK(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 3898 3984 #endif /* VBOX_WITH_HGSMI */ 3899 3985 … … 3997 4083 pThis->IConnector.pfnVBVAMousePointerShape = Display::i_displayVBVAMousePointerShape; 3998 4084 pThis->IConnector.pfnVBVAGuestCapabilityUpdate = Display::i_displayVBVAGuestCapabilityUpdate; 4085 pThis->IConnector.pfnVBVAInputMappingUpdate = Display::i_displayVBVAInputMappingUpdate; 3999 4086 #endif 4000 4087 -
trunk/src/VBox/Main/src-client/MouseImpl.cpp
r52934 r53965 347 347 return E_FAIL; /* No assertion, as the front-ends can send events 348 348 * at all sorts of inconvenient times. */ 349 DisplayMouseInterface *pDisplay = mParent->i_getDisplayMouseInterface(); 350 if (pDisplay == NULL) 351 return E_FAIL; 349 352 PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort(); 350 353 if (!pVMMDevPort) … … 353 356 int rc = pVMMDevPort->pfnUpdateMouseCapabilities(pVMMDevPort, fCapsAdded, 354 357 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); 356 361 } 357 362 … … 619 624 * @returns COM status code 620 625 */ 621 HRESULT Mouse::i_reportAbsEvent(int32_t x, int32_t y, 622 int32_t dz, int32_t dw, uint32_t fButtons, 623 bool fUsesVMMDevEvent) 626 HRESULT Mouse::i_reportAbsEventToInputDevices(int32_t x, int32_t y, int32_t dz, int32_t dw, uint32_t fButtons, 627 bool fUsesVMMDevEvent) 624 628 { 625 629 HRESULT rc; … … 648 652 return rc; 649 653 } 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 */ 664 HRESULT 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 650 676 651 677 void Mouse::i_fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw, … … 838 864 if (fValid) 839 865 { 840 rc = i_reportAbsEvent (xAdj, yAdj, dz, dw, fButtonsAdj,841 RT_BOOL( mfVMMDevGuestCaps842 & 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; 843 869 844 870 i_fireMouseEvent(true, x, y, dz, dw, aButtonState); 845 871 } 872 rc = i_reportAbsEventToDisplayDevice(x, y); 846 873 847 874 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.