Changeset 40310 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Mar 1, 2012 11:56:06 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/MouseImpl.cpp
r40282 r40310 41 41 /** @} */ 42 42 43 /** @name Absolute mouse reporting range44 * @{ */45 enum46 {47 /** Lower end */48 MOUSE_RANGE_LOWER = 0,49 /** Higher end */50 MOUSE_RANGE_UPPER = 0xFFFF,51 /** Full range */52 MOUSE_RANGE = MOUSE_RANGE_UPPER - MOUSE_RANGE_LOWER53 };54 /** @} */55 43 56 44 /** … … 327 315 int32_t dz, int32_t dw, uint32_t fButtons) 328 316 { 329 if (mouseXAbs < MOUSE_RANGE_LOWER || mouseXAbs > MOUSE_RANGE_UPPER) 317 if ( mouseXAbs < VMMDEV_MOUSE_RANGE_MIN 318 || mouseXAbs > VMMDEV_MOUSE_RANGE_MAX) 330 319 return S_OK; 331 if (mouseYAbs < MOUSE_RANGE_LOWER || mouseYAbs > MOUSE_RANGE_UPPER) 320 if ( mouseYAbs < VMMDEV_MOUSE_RANGE_MIN 321 || mouseYAbs > VMMDEV_MOUSE_RANGE_MAX) 332 322 return S_OK; 333 323 if ( mouseXAbs != mcLastAbsX || mouseYAbs != mcLastAbsY … … 477 467 /** 478 468 * Convert an (X, Y) value pair in screen co-ordinates (starting from 1) to a 479 * value from MOUSE_RANGE_LOWER to MOUSE_RANGE_UPPER. Sets the optional480 * validity value to false if the pair is not on an active screen and to true481 * otherwise.469 * value from VMMDEV_MOUSE_RANGE_MIN to VMMDEV_MOUSE_RANGE_MAX. Sets the 470 * optional validity value to false if the pair is not on an active screen and 471 * to true otherwise. 482 472 * @note since guests with recent versions of X.Org use a different method 483 473 * to everyone else to map the valuator value to a screen pixel (they … … 501 491 * to compensate for differences in guest methods for mapping back to 502 492 * pixels */ 503 enum { ADJUST_RANGE = - 3 * MOUSE_RANGE / 4 };493 enum { ADJUST_RANGE = - 3 * VMMDEV_MOUSE_RANGE / 4 }; 504 494 505 495 if (pfValid) … … 509 499 ULONG displayWidth, displayHeight; 510 500 /* Takes the display lock */ 511 HRESULT rc = pDisplay->GetScreenResolution(0, &displayWidth, &displayHeight,512 NULL);501 HRESULT rc = pDisplay->GetScreenResolution(0, &displayWidth, 502 &displayHeight, NULL); 513 503 if (FAILED(rc)) 514 504 return rc; 515 505 516 *pcX = displayWidth ? (x * MOUSE_RANGE + ADJUST_RANGE) / (LONG) displayWidth: 0; 517 *pcY = displayHeight ? (y * MOUSE_RANGE + ADJUST_RANGE) / (LONG) displayHeight: 0; 506 *pcX = displayWidth ? (x * VMMDEV_MOUSE_RANGE + ADJUST_RANGE) 507 / (LONG) displayWidth: 0; 508 *pcY = displayHeight ? (y * VMMDEV_MOUSE_RANGE + ADJUST_RANGE) 509 / (LONG) displayHeight: 0; 518 510 } 519 511 else … … 522 514 /* Takes the display lock */ 523 515 pDisplay->getFramebufferDimensions(&x1, &y1, &x2, &y2); 524 *pcX = x1 < x2 ? ((x - x1) * MOUSE_RANGE + ADJUST_RANGE) / (x2 - x1) : 0; 525 *pcY = y1 < y2 ? ((y - y1) * MOUSE_RANGE + ADJUST_RANGE) / (y2 - y1) : 0; 526 if ( *pcX < MOUSE_RANGE_LOWER || *pcX > MOUSE_RANGE_UPPER 527 || *pcY < MOUSE_RANGE_LOWER || *pcY > MOUSE_RANGE_UPPER) 516 *pcX = x1 < x2 ? ((x - x1) * VMMDEV_MOUSE_RANGE + ADJUST_RANGE) 517 / (x2 - x1) : 0; 518 *pcY = y1 < y2 ? ((y - y1) * VMMDEV_MOUSE_RANGE + ADJUST_RANGE) 519 / (y2 - y1) : 0; 520 if ( *pcX < VMMDEV_MOUSE_RANGE_MIN || *pcX > VMMDEV_MOUSE_RANGE_MAX 521 || *pcY < VMMDEV_MOUSE_RANGE_MIN || *pcY > VMMDEV_MOUSE_RANGE_MAX) 528 522 if (pfValid) 529 523 *pfValid = false;
Note:
See TracChangeset
for help on using the changeset viewer.