Changeset 50613 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Feb 26, 2014 4:07:35 PM (11 years ago)
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/MouseImpl.cpp
r50592 r50613 156 156 * thus to the guest. 157 157 * @note all calls out of this object are made with no locks held! */ 158 HRESULT Mouse:: updateVMMDevMouseCaps(uint32_t fCapsAdded,159 uint32_t fCapsRemoved)158 HRESULT Mouse::i_updateVMMDevMouseCaps(uint32_t fCapsAdded, 159 uint32_t fCapsRemoved) 160 160 { 161 161 VMMDevMouseInterface *pVMMDev = mParent->getVMMDevMouseInterface(); … … 179 179 * @param absoluteSupported address of result variable 180 180 */ 181 STDMETHODIMP Mouse::COMGETTER(AbsoluteSupported) (BOOL *absoluteSupported) 182 { 183 if (!absoluteSupported) 184 return E_POINTER; 185 186 AutoCaller autoCaller(this); 187 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 188 189 *absoluteSupported = supportsAbs(); 181 HRESULT Mouse::getAbsoluteSupported(BOOL *aAbsoluteSupported) 182 { 183 *aAbsoluteSupported = i_supportsAbs(); 190 184 return S_OK; 191 185 } … … 198 192 * @param relativeSupported address of result variable 199 193 */ 200 STDMETHODIMP Mouse::COMGETTER(RelativeSupported) (BOOL *relativeSupported) 201 { 202 if (!relativeSupported) 203 return E_POINTER; 204 205 AutoCaller autoCaller(this); 206 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 207 208 *relativeSupported = supportsRel(); 194 HRESULT Mouse::getRelativeSupported(BOOL *aRelativeSupported) 195 { 196 197 *aRelativeSupported = i_supportsRel(); 209 198 return S_OK; 210 199 } … … 217 206 * @param multiTouchSupported address of result variable 218 207 */ 219 STDMETHODIMP Mouse::COMGETTER(MultiTouchSupported) (BOOL *multiTouchSupported) 220 { 221 if (!multiTouchSupported) 222 return E_POINTER; 223 224 AutoCaller autoCaller(this); 225 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 226 227 *multiTouchSupported = supportsMT(); 208 HRESULT Mouse::getMultiTouchSupported(BOOL *aMultiTouchSupported) 209 { 210 211 *aMultiTouchSupported = i_supportsMT(); 228 212 return S_OK; 229 213 } … … 236 220 * @param pfNeedsHostCursor address of result variable 237 221 */ 238 STDMETHODIMP Mouse::COMGETTER(NeedsHostCursor) (BOOL *pfNeedsHostCursor) 239 { 240 if (!pfNeedsHostCursor) 241 return E_POINTER; 242 243 AutoCaller autoCaller(this); 244 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 245 246 *pfNeedsHostCursor = guestNeedsHostCursor(); 222 HRESULT Mouse::getNeedsHostCursor(BOOL *aNeedsHostCursor) 223 { 224 225 *aNeedsHostCursor = i_guestNeedsHostCursor(); 247 226 return S_OK; 248 227 } … … 254 233 * held down from the format used by the front-end to the format used by PDM 255 234 * and the emulated pointing devices. */ 256 static uint32_t mouseButtonsToPDM(LONG buttonState)235 static uint32_t i_mouseButtonsToPDM(LONG buttonState) 257 236 { 258 237 uint32_t fButtons = 0; … … 270 249 } 271 250 272 STDMETHODIMP Mouse::COMGETTER(EventSource)(IEventSource ** aEventSource) 273 { 274 CheckComArgOutPointerValid(aEventSource); 275 276 AutoCaller autoCaller(this); 277 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 278 251 HRESULT Mouse::getEventSource(ComPtr<IEventSource> &aEventSource) 252 { 279 253 // no need to lock - lifetime constant 280 mEventSource.queryInterfaceTo(aEventSource); 281 254 mEventSource.queryInterfaceTo(aEventSource.asOutParam()); 282 255 return S_OK; 283 256 } … … 289 262 * @returns COM status code 290 263 */ 291 HRESULT Mouse:: reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,292 int32_t dw, uint32_t fButtons)264 HRESULT Mouse::i_reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz, 265 int32_t dw, uint32_t fButtons) 293 266 { 294 267 if (dx || dy || dz || dw || fButtons != mfLastButtons) … … 325 298 * @returns COM status code 326 299 */ 327 HRESULT Mouse:: reportAbsEventToMouseDev(int32_t x, int32_t y,328 int32_t dz, int32_t dw, uint32_t fButtons)300 HRESULT Mouse::i_reportAbsEventToMouseDev(int32_t x, int32_t y, 301 int32_t dz, int32_t dw, uint32_t fButtons) 329 302 { 330 303 if ( x < VMMDEV_MOUSE_RANGE_MIN … … 362 335 } 363 336 364 HRESULT Mouse:: reportMultiTouchEventToDevice(uint8_t cContacts,365 const uint64_t *pau64Contacts,366 uint32_t u32ScanTime)337 HRESULT Mouse::i_reportMultiTouchEventToDevice(uint8_t cContacts, 338 const uint64_t *pau64Contacts, 339 uint32_t u32ScanTime) 367 340 { 368 341 HRESULT hrc = S_OK; … … 407 380 * @returns COM status code 408 381 */ 409 HRESULT Mouse:: reportAbsEventToVMMDev(int32_t x, int32_t y)382 HRESULT Mouse::i_reportAbsEventToVMMDev(int32_t x, int32_t y) 410 383 { 411 384 VMMDevMouseInterface *pVMMDev = mParent->getVMMDevMouseInterface(); … … 433 406 * @returns COM status code 434 407 */ 435 HRESULT Mouse:: reportAbsEvent(int32_t x, int32_t y,436 int32_t dz, int32_t dw, uint32_t fButtons,437 bool fUsesVMMDevEvent)408 HRESULT Mouse::i_reportAbsEvent(int32_t x, int32_t y, 409 int32_t dz, int32_t dw, uint32_t fButtons, 410 bool fUsesVMMDevEvent) 438 411 { 439 412 HRESULT rc; … … 443 416 LONG cJiggle = 0; 444 417 445 if ( vmmdevCanAbs())418 if (i_vmmdevCanAbs()) 446 419 { 447 420 /* … … 450 423 if (x != mcLastX || y != mcLastY) 451 424 { 452 rc = reportAbsEventToVMMDev(x, y);425 rc = i_reportAbsEventToVMMDev(x, y); 453 426 cJiggle = !fUsesVMMDevEvent; 454 427 } 455 rc = reportRelEventToMouseDev(cJiggle, 0, dz, dw, fButtons);428 rc = i_reportRelEventToMouseDev(cJiggle, 0, dz, dw, fButtons); 456 429 } 457 430 else 458 rc = reportAbsEventToMouseDev(x, y, dz, dw, fButtons);431 rc = i_reportAbsEventToMouseDev(x, y, dz, dw, fButtons); 459 432 460 433 mcLastX = x; … … 463 436 } 464 437 465 void Mouse:: fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,466 LONG fButtons)438 void Mouse::i_fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw, 439 LONG fButtons) 467 440 { 468 441 /* If mouse button is pressed, we generate new event, to avoid reusable events coalescing and thus … … 489 462 } 490 463 491 void Mouse:: fireMultiTouchEvent(uint8_t cContacts,492 const LONG64 *paContacts,493 uint32_t u32ScanTime)464 void Mouse::i_fireMultiTouchEvent(uint8_t cContacts, 465 const LONG64 *paContacts, 466 uint32_t u32ScanTime) 494 467 { 495 468 com::SafeArray<SHORT> xPositions(cContacts); … … 528 501 * @param fButtons The mouse button state 529 502 */ 530 STDMETHODIMP Mouse::PutMouseEvent(LONG dx, LONG dy, LONG dz, LONG dw,531 LONG fButtons)503 HRESULT Mouse::putMouseEvent(LONG dx, LONG dy, LONG dz, LONG dw, 504 LONG aButtonState) 532 505 { 533 506 HRESULT rc; 534 507 uint32_t fButtonsAdj; 535 508 536 AutoCaller autoCaller(this);537 if (FAILED(autoCaller.rc())) return autoCaller.rc();538 509 LogRel3(("%s: dx=%d, dy=%d, dz=%d, dw=%d\n", __PRETTY_FUNCTION__, 539 510 dx, dy, dz, dw)); 540 511 541 fButtonsAdj = mouseButtonsToPDM(fButtons);512 fButtonsAdj = i_mouseButtonsToPDM(aButtonState); 542 513 /* Make sure that the guest knows that we are sending real movement 543 514 * events to the PS/2 device and not just dummy wake-up ones. */ 544 updateVMMDevMouseCaps(0, VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE);545 rc = reportRelEventToMouseDev(dx, dy, dz, dw, fButtonsAdj);546 547 fireMouseEvent(false, dx, dy, dz, dw, fButtons);515 i_updateVMMDevMouseCaps(0, VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE); 516 rc = i_reportRelEventToMouseDev(dx, dy, dz, dw, fButtonsAdj); 517 518 i_fireMouseEvent(false, dx, dy, dz, dw, aButtonState); 548 519 549 520 return rc; … … 565 536 * @returns COM status value 566 537 */ 567 HRESULT Mouse:: convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,568 bool *pfValid)538 HRESULT Mouse::i_convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj, 539 bool *pfValid) 569 540 { 570 541 AssertPtrReturn(pxAdj, E_POINTER); … … 629 600 * @param fButtons The mouse button state 630 601 */ 631 STDMETHODIMP Mouse::PutMouseEventAbsolute(LONG x, LONG y, LONG dz, LONG dw, 632 LONG fButtons) 633 { 634 AutoCaller autoCaller(this); 635 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 636 602 HRESULT Mouse::putMouseEventAbsolute(LONG x, LONG y, LONG dz, LONG dw, 603 LONG aButtonState) 604 { 637 605 LogRel3(("%s: x=%d, y=%d, dz=%d, dw=%d, fButtons=0x%x\n", 638 __PRETTY_FUNCTION__, x, y, dz, dw, fButtons));606 __PRETTY_FUNCTION__, x, y, dz, dw, aButtonState)); 639 607 640 608 int32_t xAdj, yAdj; … … 645 613 /** @note Or maybe not... races are pretty inherent in everything done in 646 614 * this object and not really bad as far as I can see. */ 647 HRESULT rc = convertDisplayRes(x, y, &xAdj, &yAdj, &fValid);615 HRESULT rc = i_convertDisplayRes(x, y, &xAdj, &yAdj, &fValid); 648 616 if (FAILED(rc)) return rc; 649 617 650 fButtonsAdj = mouseButtonsToPDM(fButtons);618 fButtonsAdj = i_mouseButtonsToPDM(aButtonState); 651 619 /* If we are doing old-style (IRQ-less) absolute reporting to the VMM 652 620 * device then make sure the guest is aware of it, so that it knows to 653 621 * ignore relative movement on the PS/2 device. */ 654 updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE, 0);622 i_updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE, 0); 655 623 if (fValid) 656 624 { 657 rc = reportAbsEvent(xAdj, yAdj, dz, dw, fButtonsAdj,658 RT_BOOL( mfVMMDevGuestCaps659 & VMMDEV_MOUSE_NEW_PROTOCOL));660 661 fireMouseEvent(true, x, y, dz, dw, fButtons);625 rc = i_reportAbsEvent(xAdj, yAdj, dz, dw, fButtonsAdj, 626 RT_BOOL( mfVMMDevGuestCaps 627 & VMMDEV_MOUSE_NEW_PROTOCOL)); 628 629 i_fireMouseEvent(true, x, y, dz, dw, aButtonState); 662 630 } 663 631 … … 674 642 * @param aScanTime Timestamp. 675 643 */ 676 STDMETHODIMP Mouse::PutEventMultiTouch(LONG aCount, 677 ComSafeArrayIn(LONG64, aContacts), 678 ULONG aScanTime) 679 { 680 AutoCaller autoCaller(this); 681 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 682 683 com::SafeArray <LONG64> arrayContacts(ComSafeArrayInArg(aContacts)); 644 HRESULT Mouse::putEventMultiTouch(LONG aCount, 645 const std::vector<LONG64> &aContacts, 646 ULONG aScanTime) 647 { 648 com::SafeArray <LONG64> arrayContacts(aContacts); 684 649 685 650 LogRel3(("%s: aCount %d(actual %d), aScanTime %u\n", … … 692 657 LONG64* paContacts = arrayContacts.raw(); 693 658 694 rc = putEventMultiTouch(aCount, paContacts, aScanTime);659 rc = i_putEventMultiTouch(aCount, paContacts, aScanTime); 695 660 } 696 661 else … … 710 675 * @param aScanTime Timestamp. 711 676 */ 712 STDMETHODIMP Mouse::PutEventMultiTouchString(LONG aCount,713 IN_BSTRaContacts,714 677 HRESULT Mouse::putEventMultiTouchString(LONG aCount, 678 const com::Utf8Str &aContacts, 679 ULONG aScanTime) 715 680 { 716 681 /** @todo implement: convert the string to LONG64 array and call putEventMultiTouch. */ … … 726 691 727 692 /* Used by PutEventMultiTouch and PutEventMultiTouchString. */ 728 HRESULT Mouse:: putEventMultiTouch(LONG aCount,729 LONG64 *paContacts,730 ULONG aScanTime)693 HRESULT Mouse::i_putEventMultiTouch(LONG aCount, 694 LONG64 *paContacts, 695 ULONG aScanTime) 731 696 { 732 697 if (aCount >= 256) … … 819 784 if (SUCCEEDED(rc)) 820 785 { 821 rc = reportMultiTouchEventToDevice(cContacts, cContacts? pau64Contacts: NULL, (uint32_t)aScanTime);786 rc = i_reportMultiTouchEventToDevice(cContacts, cContacts? pau64Contacts: NULL, (uint32_t)aScanTime); 822 787 823 788 /* Send the original contact information. */ 824 fireMultiTouchEvent(cContacts, cContacts? paContacts: NULL, (uint32_t)aScanTime);789 i_fireMultiTouchEvent(cContacts, cContacts? paContacts: NULL, (uint32_t)aScanTime); 825 790 } 826 791 … … 833 798 /** Does the guest currently rely on the host to draw the mouse cursor or 834 799 * can it switch to doing it itself in software? */ 835 bool Mouse:: guestNeedsHostCursor(void)800 bool Mouse::i_guestNeedsHostCursor(void) 836 801 { 837 802 return RT_BOOL(mfVMMDevGuestCaps & VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR); … … 841 806 /** Check what sort of reporting can be done using the devices currently 842 807 * enabled. Does not consider the VMM device. */ 843 void Mouse:: getDeviceCaps(bool *pfAbs, bool *pfRel, bool *pfMT)808 void Mouse::i_getDeviceCaps(bool *pfAbs, bool *pfRel, bool *pfMT) 844 809 { 845 810 bool fAbsDev = false; … … 869 834 870 835 /** Does the VMM device currently support absolute reporting? */ 871 bool Mouse:: vmmdevCanAbs(void)836 bool Mouse::i_vmmdevCanAbs(void) 872 837 { 873 838 bool fRelDev; 874 839 875 getDeviceCaps(NULL, &fRelDev, NULL);840 i_getDeviceCaps(NULL, &fRelDev, NULL); 876 841 return (mfVMMDevGuestCaps & VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE) 877 842 && fRelDev; … … 880 845 881 846 /** Does the VMM device currently support absolute reporting? */ 882 bool Mouse:: deviceCanAbs(void)847 bool Mouse::i_deviceCanAbs(void) 883 848 { 884 849 bool fAbsDev; 885 850 886 getDeviceCaps(&fAbsDev, NULL, NULL);851 i_getDeviceCaps(&fAbsDev, NULL, NULL); 887 852 return fAbsDev; 888 853 } … … 890 855 891 856 /** Can we currently send relative events to the guest? */ 892 bool Mouse:: supportsRel(void)857 bool Mouse::i_supportsRel(void) 893 858 { 894 859 bool fRelDev; 895 860 896 getDeviceCaps(NULL, &fRelDev, NULL);861 i_getDeviceCaps(NULL, &fRelDev, NULL); 897 862 return fRelDev; 898 863 } … … 900 865 901 866 /** Can we currently send absolute events to the guest? */ 902 bool Mouse:: supportsAbs(void)867 bool Mouse::i_supportsAbs(void) 903 868 { 904 869 bool fAbsDev; 905 870 906 getDeviceCaps(&fAbsDev, NULL, NULL);907 return fAbsDev || vmmdevCanAbs();871 i_getDeviceCaps(&fAbsDev, NULL, NULL); 872 return fAbsDev || i_vmmdevCanAbs(); 908 873 } 909 874 910 875 911 876 /** Can we currently send absolute events to the guest? */ 912 bool Mouse:: supportsMT(void)877 bool Mouse::i_supportsMT(void) 913 878 { 914 879 bool fMTDev; 915 880 916 getDeviceCaps(NULL, NULL, &fMTDev);881 i_getDeviceCaps(NULL, NULL, &fMTDev); 917 882 return fMTDev; 918 883 } … … 922 887 * enabled (including the VMM device) and notify the guest and the front-end. 923 888 */ 924 void Mouse:: sendMouseCapsNotifications(void)889 void Mouse::i_sendMouseCapsNotifications(void) 925 890 { 926 891 bool fAbsDev, fRelDev, fMTDev, fCanAbs, fNeedsHostCursor; … … 929 894 AutoReadLock aLock(this COMMA_LOCKVAL_SRC_POS); 930 895 931 getDeviceCaps(&fAbsDev, &fRelDev, &fMTDev);932 fCanAbs = supportsAbs();933 fNeedsHostCursor = guestNeedsHostCursor();896 i_getDeviceCaps(&fAbsDev, &fRelDev, &fMTDev); 897 fCanAbs = i_supportsAbs(); 898 fNeedsHostCursor = i_guestNeedsHostCursor(); 934 899 } 935 900 if (fAbsDev) 936 updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_HAS_ABS_DEV, 0);901 i_updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_HAS_ABS_DEV, 0); 937 902 else 938 updateVMMDevMouseCaps(0, VMMDEV_MOUSE_HOST_HAS_ABS_DEV);903 i_updateVMMDevMouseCaps(0, VMMDEV_MOUSE_HOST_HAS_ABS_DEV); 939 904 /** @todo this call takes the Console lock in order to update the cached 940 905 * callback data atomically. However I can't see any sign that the cached … … 948 913 * A virtual device is notifying us about its current state and capabilities 949 914 */ 950 DECLCALLBACK(void) Mouse:: mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT)915 DECLCALLBACK(void) Mouse::i_mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT) 951 916 { 952 917 PDRVMAINMOUSE pDrv = RT_FROM_MEMBER(pInterface, DRVMAINMOUSE, IConnector); … … 964 929 pDrv->u32DevCaps &= ~MOUSE_DEVCAP_MULTI_TOUCH; 965 930 966 pDrv->pMouse-> sendMouseCapsNotifications();931 pDrv->pMouse->i_sendMouseCapsNotifications(); 967 932 } 968 933 … … 971 936 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 972 937 */ 973 DECLCALLBACK(void *) Mouse:: drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)938 DECLCALLBACK(void *) Mouse::i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID) 974 939 { 975 940 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); … … 988 953 * @param pDrvIns The driver instance data. 989 954 */ 990 DECLCALLBACK(void) Mouse:: drvDestruct(PPDMDRVINS pDrvIns)955 DECLCALLBACK(void) Mouse::i_drvDestruct(PPDMDRVINS pDrvIns) 991 956 { 992 957 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns); … … 1012 977 * @copydoc FNPDMDRVCONSTRUCT 1013 978 */ 1014 DECLCALLBACK(int) Mouse:: drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)979 DECLCALLBACK(int) Mouse::i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 1015 980 { 1016 981 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); … … 1030 995 * IBase. 1031 996 */ 1032 pDrvIns->IBase.pfnQueryInterface = Mouse:: drvQueryInterface;1033 1034 pThis->IConnector.pfnReportModes = Mouse:: mouseReportModes;997 pDrvIns->IBase.pfnQueryInterface = Mouse::i_drvQueryInterface; 998 999 pThis->IConnector.pfnReportModes = Mouse::i_mouseReportModes; 1035 1000 1036 1001 /* … … 1097 1062 sizeof(DRVMAINMOUSE), 1098 1063 /* pfnConstruct */ 1099 Mouse:: drvConstruct,1064 Mouse::i_drvConstruct, 1100 1065 /* pfnDestruct */ 1101 Mouse:: drvDestruct,1066 Mouse::i_drvDestruct, 1102 1067 /* pfnRelocate */ 1103 1068 NULL, -
trunk/src/VBox/Main/src-client/VMMDevInterface.cpp
r50592 r50613 339 339 Mouse *pMouse = pConsole->getMouse(); 340 340 if (pMouse) /** @todo and if not? Can that actually happen? */ 341 pMouse-> onVMMDevGuestCapsChange(fNewCaps & VMMDEV_MOUSE_GUEST_MASK);341 pMouse->i_onVMMDevGuestCapsChange(fNewCaps & VMMDEV_MOUSE_GUEST_MASK); 342 342 } 343 343 -
trunk/src/VBox/Main/src-client/xpcom/module.cpp
r50592 r50613 78 78 NS_DECL_CLASSINFO(Keyboard) 79 79 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Keyboard, IKeyboard) 80 NS_DECL_CLASSINFO(Mouse)81 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Mouse, IMouse)82 80 NS_DECL_CLASSINFO(Display) 83 81 NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Display, IDisplay, IEventListener)
Note:
See TracChangeset
for help on using the changeset viewer.