Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
3.9 KiB

  1. /****************************************************************************/
  2. // aimapi.h
  3. //
  4. // Input manager API include file
  5. //
  6. // Copyright(c) Microsoft, PictureTel 1993-1997
  7. // Copyright (c) 1997-1999 Microsoft Corporation
  8. /****************************************************************************/
  9. #ifndef _H_AIMAPI
  10. #define _H_AIMAPI
  11. /****************************************************************************/
  12. /* The maximum amount of time that we expect an injected event to take to */
  13. /* pass through USER, in units of 100ns */
  14. /****************************************************************************/
  15. #define IM_EVENT_PERCOLATE_TIME 300 * 10000
  16. /****************************************************************************/
  17. /* For managing our key state arrays. */
  18. /* */
  19. /* Note that the key state array only needs to have 256 elements for the */
  20. /* actual keys, but since we're using scan codes we lose the virtual keys */
  21. /* for the mouse button and the Toggles. Instead we put these states */
  22. /* at the end of the array using our own invented scan codes */
  23. /****************************************************************************/
  24. #define IM_KEY_STATE_SIZE 266
  25. #define IM_SC_LBUTTON 256
  26. #define IM_SC_RBUTTON 257
  27. #define IM_SC_MBUTTON 258
  28. #define IM_SC_CAPITAL 259
  29. #define IM_SC_NUMLOCK 260
  30. #define IM_SC_SCROLL 261
  31. #define IM_SC_RCONTROL 262
  32. #define IM_SC_RALT 263
  33. #define IM_SC_XBUTTON1 264
  34. #define IM_SC_XBUTTON2 265
  35. /****************************************************************************/
  36. /* These are the real scan codes for Control and ALT. */
  37. /****************************************************************************/
  38. #define IM_SC_LCONTROL 29
  39. #define IM_SC_LALT 56
  40. /****************************************************************************/
  41. /* Macro to convert from logical mouse co-ordinates to the full 16-bit */
  42. /* range co-ordinates expected from us. */
  43. /* */
  44. /* The macro below IS right! Consider a VGA screen. There are 640 */
  45. /* possible horizontal mouse positions, which we can look at as cells with */
  46. /* the mouse being at the centre of each, ie at co-ords 0.5, 1.5, ... */
  47. /* 638.5, 639.5. */
  48. /* */
  49. /* We want to scale this to the range 0 - 65535, so we need 640 cells, */
  50. /* 65536/640 wide (which is 1024). This gives the range of mouse positions */
  51. /* as 512, 1536, ... 65024. */
  52. /* */
  53. /* Hence we do the conversion by scaling the postion by 65536/640 and */
  54. /* adding on half the width of a cell */
  55. /* */
  56. /****************************************************************************/
  57. #define IM_MOUSEPOS_LOG_TO_OS_ABS(coord, size) \
  58. (((65536L * (UINT32)coord) + 32768L) / (UINT32)size)
  59. /****************************************************************************/
  60. /* Used to set and check values in key state arrays. */
  61. /****************************************************************************/
  62. #define IM_KEY_STATE_IS_UP(A) (!(A))
  63. #define IM_KEY_STATE_IS_DOWN(A) (A)
  64. #define IM_SET_KEY_DOWN(A) (A) = TRUE
  65. #define IM_SET_KEY_UP(A) (A) = FALSE
  66. #endif /* _H_AIMAPI */