Changeset 40310 in vbox
- Timestamp:
- Mar 1, 2012 11:56:06 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VMMDev.h
r40213 r40310 317 317 | VMMDEV_MOUSE_HOST_RECHECKS_NEEDS_HOST_CURSOR \ 318 318 | VMMDEV_MOUSE_HOST_HAS_ABS_DEV) 319 /** @} */ 320 321 /** @name Absolute mouse reporting range 322 * @{ */ 323 /** @todo Should these be here? They are needed by both host and guest. */ 324 /** The minumum value our pointing device can return. */ 325 #define VMMDEV_MOUSE_RANGE_MIN 0 326 /** The maximum value our pointing device can return. */ 327 #define VMMDEV_MOUSE_RANGE_MAX 0xFFFF 328 /** The full range our pointing device can return. */ 329 #define VMMDEV_MOUSE_RANGE (VMMDEV_MOUSE_RANGE_MAX - VMMDEV_MOUSE_RANGE_MIN) 319 330 /** @} */ 320 331 -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c
r39353 r40310 390 390 391 391 392 enum393 {394 /** The minumum value our device can return */395 RANGE_MIN = 0,396 /** The maximum value our device can return */397 RANGE_MAX = 0xFFFF398 };399 400 401 392 #ifdef VBOXGUEST_WITH_INPUT_DRIVER 402 393 /** Calls the kernel IOCtl to report mouse status to the host on behalf of … … 476 467 ASMBitSet(g_pInputDevice->evbit, EV_SYN); 477 468 # endif 478 input_set_abs_params(g_pInputDevice, ABS_X, RANGE_MIN, RANGE_MAX, 0, 0); 479 input_set_abs_params(g_pInputDevice, ABS_Y, RANGE_MIN, RANGE_MAX, 0, 0); 469 input_set_abs_params(g_pInputDevice, ABS_X, VMMDEV_MOUSE_RANGE_MIN, 470 VMMDEV_MOUSE_RANGE_MAX, 0, 0); 471 input_set_abs_params(g_pInputDevice, ABS_Y, VMMDEV_MOUSE_RANGE_MIN, 472 VMMDEV_MOUSE_RANGE_MAX, 0, 0); 480 473 ASMBitSet(g_pInputDevice->keybit, BTN_MOUSE); 481 474 /** @todo this string should be in a header file somewhere. */ -
trunk/src/VBox/Additions/x11/vboxmouse/vboxmouse.c
r39811 r40310 63 63 #include "product-generated.h" 64 64 65 enum66 {67 /** The minumum value our device can return */68 RANGE_MIN = 0,69 /** The maximum value our device can return */70 RANGE_MAX = 0xFFFF71 };72 73 65 static void 74 66 VBoxReadInput(InputInfoPtr pInfo) … … 144 136 axis_labels[0], 145 137 # endif 146 RANGE_MIN /* min X */,RANGE_MAX /* max X */,138 VMMDEV_MOUSE_RANGE_MIN /* min X */, VMMDEV_MOUSE_RANGE_MAX /* max X */, 147 139 10000, 0, 10000 148 140 # if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 … … 155 147 axis_labels[1], 156 148 # endif 157 RANGE_MIN /* min Y */,RANGE_MAX /* max Y */,149 VMMDEV_MOUSE_RANGE_MIN /* min Y */, VMMDEV_MOUSE_RANGE_MAX /* max Y */, 158 150 10000, 0, 10000 159 151 # if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 -
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.