Changeset 26650 in vbox for trunk/src/VBox/Main
- Timestamp:
- Feb 19, 2010 1:42:35 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MouseImpl.cpp
r26638 r26650 46 46 } DRVMAINMOUSE, *PDRVMAINMOUSE; 47 47 48 /** Converts a PDMIMOUSECONNECTOR pointer to a DRVMAINMOUSE pointer. */49 #define PPDMIMOUSECONNECTOR_2_MAINMOUSE(pInterface) ( (PDRVMAINMOUSE) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINMOUSE, IConnector)) )50 48 51 49 // constructor / destructor … … 403 401 LONG buttonState) 404 402 { 405 HRESULT rc = S_OK;406 407 403 AutoCaller autoCaller(this); 408 404 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 414 410 415 411 uint32_t mouseXAbs; 416 rc = convertDisplayWidth(x, &mouseXAbs);412 HRESULT rc = convertDisplayWidth(x, &mouseXAbs); 417 413 ComAssertComRCRet(rc, rc); 418 414 if (mouseXAbs > 0xffff) 419 415 mouseXAbs = mLastAbsX; 416 420 417 uint32_t mouseYAbs; 421 418 rc = convertDisplayHeight(y, &mouseYAbs); … … 423 420 if (mouseYAbs > 0xffff) 424 421 mouseYAbs = mLastAbsY; 422 425 423 uint32_t fButtons = mouseButtonsToPDM(buttonState); 424 426 425 /* Older guest additions rely on a small phony movement event on the 427 426 * PS/2 device to notice absolute events. */ … … 435 434 rc = getVMMDevMouseCaps(&mouseCaps); 436 435 ComAssertComRCRet(rc, rc); 436 437 437 /* 438 438 * This method being called implies that the host wants … … 449 449 fNeedsJiggle = !(mouseCaps & VMMDEV_MOUSE_GUEST_USES_VMMDEV); 450 450 } 451 ComAssertComRCRet (rc, rc); 451 ComAssertComRCRet(rc, rc); 452 452 453 mLastAbsX = mouseXAbs; 453 454 mLastAbsY = mouseYAbs; 455 454 456 if (!(uDevCaps & MOUSE_DEVCAP_ABSOLUTE)) 455 457 { … … 460 462 * the way. */ 461 463 if (fNeedsJiggle || fButtons != mLastButtons || dz || dw) 464 { 462 465 rc = reportRelEventToMouseDev(fNeedsJiggle ? 1 : 0, 0, dz, dw, 463 466 fButtons); 464 ComAssertComRCRet (rc, rc); 467 ComAssertComRCRet(rc, rc); 468 } 465 469 } 466 470 mLastButtons = fButtons; … … 471 475 ///////////////////////////////////////////////////////////////////////////// 472 476 473 /** 474 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 475 */ 476 DECLCALLBACK(void *) Mouse::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID) 477 { 478 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 479 PDRVMAINMOUSE pDrv = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE); 480 481 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase); 482 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUSECONNECTOR, &pDrv->IConnector); 483 return NULL; 484 } 485 486 487 /** 488 * Destruct a mouse driver instance. 489 * 490 * @returns VBox status. 491 * @param pDrvIns The driver instance data. 492 */ 493 DECLCALLBACK(void) Mouse::drvDestruct(PPDMDRVINS pDrvIns) 494 { 495 PDRVMAINMOUSE pData = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE); 496 LogFlow(("Mouse::drvDestruct: iInstance=%d\n", pDrvIns->iInstance)); 497 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns); 498 499 if (pData->pMouse) 500 { 501 AutoWriteLock mouseLock(pData->pMouse COMMA_LOCKVAL_SRC_POS); 502 pData->pMouse->mpDrv = NULL; 503 } 504 } 505 506 507 DECLCALLBACK(void) Mouse::mouseAbsModeChange (PPDMIMOUSECONNECTOR pInterface, bool fAbs) 508 { 509 PDRVMAINMOUSE pDrv = PPDMIMOUSECONNECTOR_2_MAINMOUSE (pInterface); 510 if (fAbs) 477 478 /** 479 * @interface_method_impl{PDMIMOUSECONNECTOR,pfnAbsModeChange} 480 */ 481 DECLCALLBACK(void) Mouse::mouseAbsModeChange(PPDMIMOUSECONNECTOR pInterface, bool fEnabled) 482 { 483 PDRVMAINMOUSE pDrv = RT_FROM_MEMBER(pInterface, DRVMAINMOUSE, IConnector); 484 if (fEnabled) 511 485 pDrv->pMouse->uDevCaps |= MOUSE_DEVCAP_ABSOLUTE; 512 486 else 513 487 pDrv->pMouse->uDevCaps &= ~MOUSE_DEVCAP_ABSOLUTE; 488 514 489 /** @todo we have to hack around the fact that VMMDev may not be 515 490 * initialised too close to startup. The real fix is to change the … … 523 498 rc = pDrv->pMouse->getVMMDevMouseCaps(&fMouseCaps); 524 499 AssertComRCReturnVoid(rc); 525 pDrv->pMouse->getParent()->onMouseCapabilityChange (fAbs, fMouseCaps & VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR); 500 pDrv->pMouse->getParent()->onMouseCapabilityChange(fEnabled, fMouseCaps & VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR); 501 } 502 503 504 /** 505 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 506 */ 507 DECLCALLBACK(void *) Mouse::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID) 508 { 509 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 510 PDRVMAINMOUSE pDrv = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE); 511 512 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase); 513 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUSECONNECTOR, &pDrv->IConnector); 514 return NULL; 515 } 516 517 518 /** 519 * Destruct a mouse driver instance. 520 * 521 * @returns VBox status. 522 * @param pDrvIns The driver instance data. 523 */ 524 DECLCALLBACK(void) Mouse::drvDestruct(PPDMDRVINS pDrvIns) 525 { 526 PDRVMAINMOUSE pData = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE); 527 LogFlow(("Mouse::drvDestruct: iInstance=%d\n", pDrvIns->iInstance)); 528 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns); 529 530 if (pData->pMouse) 531 { 532 AutoWriteLock mouseLock(pData->pMouse COMMA_LOCKVAL_SRC_POS); 533 pData->pMouse->mpDrv = NULL; 534 } 526 535 } 527 536
Note:
See TracChangeset
for help on using the changeset viewer.