Changeset 47795 in vbox
- Timestamp:
- Aug 16, 2013 10:28:44 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/MouseImpl.cpp
r47774 r47795 712 712 ComAssertRet(pDisplay, E_FAIL); 713 713 714 HRESULT rc = S_OK; 714 /* Touch events are mapped to the primary monitor, because the emulated USB 715 * touchscreen device is associated with one (normally the primary) screen in the guest. 716 */ 717 ULONG uScreenId = 0; 718 719 ULONG cWidth = 0; 720 ULONG cHeight = 0; 721 LONG xOrigin = 0; 722 LONG yOrigin = 0; 723 HRESULT rc = pDisplay->getScreenResolution(uScreenId, &cWidth, &cHeight, NULL, &xOrigin, &yOrigin); 724 ComAssertComRCRetRC(rc); 715 725 716 726 uint64_t* pau64Contacts = NULL; … … 724 734 if (pau64Contacts) 725 735 { 726 int32_t x1, y1, x2, y2; 727 /* Takes the display lock */ 728 pDisplay->getFramebufferDimensions(&x1, &y1, &x2, &y2); 736 int32_t x1 = xOrigin; 737 int32_t y1 = yOrigin; 738 int32_t x2 = x1 + cWidth; 739 int32_t y2 = y1 + cHeight; 740 741 LogRel3(("%s: screen %d,%d %d,%d\n", 742 __FUNCTION__, x1, y1, x2, y2)); 729 743 730 744 LONG i; … … 742 756 __FUNCTION__, i, x, y, contactId, fInContact, fInRange)); 743 757 744 /* Framebufferdimensions are 0,0 width, height, that is x2,y2 are exclusive,758 /* Screen dimensions are 0,0 width, height, that is x2,y2 are exclusive, 745 759 * while coords are inclusive. 746 760 */ 747 int32_t xAdj = x1 < x2 ? ((x - 1 - x1) * VMMDEV_MOUSE_RANGE) 748 / (x2 - x1) : 0; 749 int32_t yAdj = y1 < y2 ? ((y - 1 - y1) * VMMDEV_MOUSE_RANGE) 750 / (y2 - y1) : 0; 761 if (x < x1 || x >= x2 || y < y1 || y >= y2) 762 { 763 /* Out of range. Skip the contact. */ 764 continue; 765 } 766 767 int32_t xAdj = x1 < x2? ((x - 1 - x1) * VMMDEV_MOUSE_RANGE) / (x2 - x1) : 0; 768 int32_t yAdj = y1 < y2? ((y - 1 - y1) * VMMDEV_MOUSE_RANGE) / (y2 - y1) : 0; 751 769 752 770 bool fValid = ( xAdj >= VMMDEV_MOUSE_RANGE_MIN
Note:
See TracChangeset
for help on using the changeset viewer.