Changeset 35212 in vbox
- Timestamp:
- Dec 16, 2010 11:15:43 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
-
MouseImpl.cpp (modified) (4 diffs)
-
include/MouseImpl.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MouseImpl.cpp
r34835 r35212 442 442 /** 443 443 * Convert an (X, Y) value pair in screen co-ordinates (starting from 1) to a 444 * value from 0 to 0xffff. 444 * value from 0 to 0xffff. Sets the optional validity value to false if the 445 * pair is not on an active screen and to true otherwise. 445 446 * 446 447 * @returns COM status value 447 448 */ 448 HRESULT Mouse::convertDisplayRes(LONG x, LONG y, uint32_t *pcX, uint32_t *pcY) 449 HRESULT Mouse::convertDisplayRes(LONG x, LONG y, int32_t *pcX, int32_t *pcY, 450 bool *pfValid) 449 451 { 450 452 AssertPtrReturn(pcX, E_POINTER); 451 453 AssertPtrReturn(pcY, E_POINTER); 454 AssertPtrNullReturn(pfValid, E_POINTER); 452 455 Display *pDisplay = mParent->getDisplay(); 453 456 ComAssertRet(pDisplay, E_FAIL); 454 457 458 if (pfValid) 459 *pfValid = true; 455 460 if (!(mfVMMDevGuestCaps & VMMDEV_MOUSE_NEW_PROTOCOL)) 456 461 { … … 472 477 *pcX = x1 != x2 ? (x - 1 - x1) * 0xFFFF / (x2 - x1) : 0; 473 478 *pcY = y1 != y2 ? (y - 1 - y1) * 0xFFFF / (y2 - y1) : 0; 479 if (*pcX < 0 || *pcX > 0xFFFF || *pcY < 0 || *pcY > 0xFFFF) 480 if (pfValid) 481 *pfValid = false; 474 482 } 475 483 return S_OK; … … 501 509 __PRETTY_FUNCTION__, x, y, dz, dw, buttonState)); 502 510 503 uint32_t mouseXAbs, mouseYAbs, fButtons; 511 int32_t mouseXAbs, mouseYAbs; 512 uint32_t fButtons; 513 bool fValid; 504 514 505 515 /** @todo the front end should do this conversion to avoid races */ 506 516 /** @note Or maybe not... races are pretty inherent in everything done in 507 517 * this object and not really bad as far as I can see. */ 508 HRESULT rc = convertDisplayRes(x, y, &mouseXAbs, &mouseYAbs );518 HRESULT rc = convertDisplayRes(x, y, &mouseXAbs, &mouseYAbs, &fValid); 509 519 if (FAILED(rc)) return rc; 510 520 … … 521 531 * ignore relative movement on the PS/2 device. */ 522 532 updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE, 0); 523 rc = reportAbsEvent(mouseXAbs, mouseYAbs, dz, dw, fButtons, 524 RT_BOOL( mfVMMDevGuestCaps 525 & VMMDEV_MOUSE_NEW_PROTOCOL)); 533 if (fValid) 534 { 535 rc = reportAbsEvent(mouseXAbs, mouseYAbs, dz, dw, fButtons, 536 RT_BOOL( mfVMMDevGuestCaps 537 & VMMDEV_MOUSE_NEW_PROTOCOL)); 526 538 527 539 #ifndef VBOXBFE_WITHOUT_COM 528 mMouseEvent.reinit(VBoxEventType_OnGuestMouse, true, x, y, dz, dw, fButtons); 529 mMouseEvent.fire(0); 540 mMouseEvent.reinit(VBoxEventType_OnGuestMouse, true, x, y, dz, dw, 541 fButtons); 542 mMouseEvent.fire(0); 530 543 #endif 544 } 531 545 532 546 return rc; -
trunk/src/VBox/Main/include/MouseImpl.h
r33758 r35212 105 105 int32_t dz, int32_t dw, uint32_t fButtons, 106 106 bool fUsesVMMDevEvent); 107 HRESULT convertDisplayRes(LONG x, LONG y, uint32_t *pcX, uint32_t *pcY); 107 HRESULT convertDisplayRes(LONG x, LONG y, int32_t *pcX, int32_t *pcY, 108 bool *pfValid); 108 109 109 110 void getDeviceCaps(bool *pfAbs, bool *pfRel);
Note:
See TracChangeset
for help on using the changeset viewer.

