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.

194 lines
7.9 KiB

  1. /****************************************************************************/
  2. // acmafn.h
  3. //
  4. // Cursor Manager API prototypes
  5. //
  6. // Copyright (c) Microsoft 1996 - 1999
  7. /****************************************************************************/
  8. void RDPCALL CM_Init(void);
  9. void RDPCALL CM_UpdateShm(void);
  10. BOOL RDPCALL CM_PartyJoiningShare(LOCALPERSONID locPersonID,
  11. unsigned oldShareSize);
  12. void RDPCALL CMEnumCMCaps(LOCALPERSONID, UINT_PTR, PTS_CAPABILITYHEADER);
  13. void RDPCALL CM_SendCursorMovedPacket(PPDU_PACKAGE_INFO);
  14. BOOL RDPCALL CMSendCachedCursor(unsigned, PPDU_PACKAGE_INFO);
  15. BOOL RDPCALL CMSendCursorShape(PPDU_PACKAGE_INFO);
  16. BOOL RDPCALL CMSendSystemCursor(UINT32, PPDU_PACKAGE_INFO);
  17. BOOL RDPCALL CMSendColorBitmapCursor(PCM_CURSORSHAPE, unsigned,
  18. PPDU_PACKAGE_INFO);
  19. void RDPCALL CMGetColorCursorDetails(
  20. PCM_CURSORSHAPE pCursor,
  21. PUINT16_UA pcxWidth,
  22. PUINT16_UA pcyHeight,
  23. PUINT16_UA pxHotSpot,
  24. PUINT16_UA pyHotSpot,
  25. PBYTE pANDMask,
  26. PUINT16_UA pcbANDMask,
  27. PBYTE pXORBitmap,
  28. PUINT16_UA pcbXORBitmap);
  29. #ifdef __cplusplus
  30. /****************************************************************************/
  31. /* CM_Term() */
  32. /* */
  33. /* Terminates the Cursor Manager. */
  34. /****************************************************************************/
  35. void RDPCALL CM_Term(void)
  36. {
  37. }
  38. /****************************************************************************/
  39. /* CM_PartyLeftShare() */
  40. /* */
  41. /* Cursor Manager function called when a party has left the share. */
  42. /* */
  43. /* PARAMETERS: */
  44. /* locPersonID - local person ID of remote person leaving the share. */
  45. /* newShareSize - the number of the parties now in the share (ie excludes */
  46. /* the leaving party). */
  47. /****************************************************************************/
  48. void RDPCALL SHCLASS CM_PartyLeftShare(
  49. LOCALPERSONID locPersonID,
  50. unsigned newShareSize)
  51. {
  52. if (locPersonID != SC_LOCAL_PERSON_ID) {
  53. // Do any cleanup required (none at present).
  54. }
  55. }
  56. /****************************************************************************/
  57. // CM_Periodic
  58. //
  59. // Called during output processing to send cursor packets if need be.
  60. /****************************************************************************/
  61. _inline void RDPCALL CM_Periodic(PPDU_PACKAGE_INFO pPkgInfo)
  62. {
  63. // Check to see if the cursor has changed at all.
  64. if (!cmNeedToSendCursorShape &&
  65. m_pShm->cm.cmCursorStamp == cmLastCursorStamp &&
  66. m_pShm->cm.cmHidden == cmCursorHidden)
  67. return;
  68. // Save the 'hidden' state.
  69. cmCursorHidden = m_pShm->cm.cmHidden;
  70. // We have output to send, so set a reschedule regardless of whether we
  71. // succeed.
  72. SCH_ContinueScheduling(SCH_MODE_NORMAL);
  73. // Send the cursor, or a null cursor if the cursor is hidden.
  74. if (!cmCursorHidden) {
  75. if (CMSendCursorShape(pPkgInfo)) {
  76. cmLastCursorStamp = m_pShm->cm.cmCursorStamp;
  77. cmNeedToSendCursorShape = FALSE;
  78. }
  79. else {
  80. // We failed to send the bitmap cursor, so we just exit without
  81. // updating cmLastCursorSent. We will attempt to send it again
  82. // on the next call to CM_Periodic.
  83. }
  84. }
  85. else {
  86. // If cursor is hidden, send null cursor. No need to update
  87. // cmLastCursorStamp since hidden state is separate from stamping.
  88. CMSendSystemCursor(TS_SYSPTR_NULL, pPkgInfo);
  89. }
  90. }
  91. /****************************************************************************/
  92. /* API FUNCTION: CM_GetCursorPos */
  93. /* */
  94. /* Returns CM's idea of the cursor position */
  95. /****************************************************************************/
  96. _inline PPOINTL RDPCALL CM_GetCursorPos()
  97. {
  98. return &m_pShm->cm.cmCursorPos;
  99. }
  100. /****************************************************************************/
  101. /* API FUNCTION: CM_CursorMoved */
  102. /****************************************************************************/
  103. _inline BOOLEAN RDPCALL CM_CursorMoved(void)
  104. {
  105. return m_pShm->cm.cmCursorMoved;
  106. }
  107. /****************************************************************************/
  108. /* API FUNCTION: CM_ClearCursorMoved */
  109. /****************************************************************************/
  110. _inline void RDPCALL CM_ClearCursorMoved(void)
  111. {
  112. m_pShm->cm.cmCursorMoved = FALSE;
  113. }
  114. /****************************************************************************/
  115. /* API FUNCTION: CM_IsCursorVisible */
  116. /* */
  117. /* Returns CM's idea of the cursor visibility */
  118. /****************************************************************************/
  119. _inline BOOLEAN RDPCALL CM_IsCursorVisible(void)
  120. {
  121. return !cmCursorHidden;
  122. }
  123. /****************************************************************************/
  124. /* FUNCTION: CMGetCursorShape */
  125. /* */
  126. /* Returns a pointer to a CM_CURSORSHAPE structure that defines the bit */
  127. /* definition of the currently displayed cursor. */
  128. /* */
  129. /* The PCM_CURSORSHAPE returned is passed back to CMGetColorCursorDetails */
  130. /* to retrieve the specific details. */
  131. /* */
  132. /* PARAMETERS: */
  133. /* ppCursorShape - pointer to a PCM_CURSORSHAPE variable that receives the */
  134. /* pointer to the CM_CURSORSHAPE structure */
  135. /* pcbCursorDataSize - pointer to a unsigned variable that receives the size*/
  136. /* in bytes of the CM_CURSORSHAPE structure */
  137. /* */
  138. /* RETURNS: Success TRUE/FALSE */
  139. /****************************************************************************/
  140. __inline BOOL RDPCALL CMGetCursorShape(
  141. PCM_CURSORSHAPE *ppCursorShape,
  142. PUINT pcbCursorDataSize)
  143. {
  144. /************************************************************************/
  145. /* Check that a cursor has been written to shared memory - may happen */
  146. /* on start-up before the display driver has written a cursor - or if */
  147. /* the display driver is not working. */
  148. /************************************************************************/
  149. if (m_pShm->cm.cmCursorShapeData.hdr.cBitsPerPel != 0)
  150. {
  151. *ppCursorShape = (PCM_CURSORSHAPE)&(m_pShm->cm.cmCursorShapeData);
  152. *pcbCursorDataSize = CURSORSHAPE_SIZE(&m_pShm->cm.cmCursorShapeData);
  153. return TRUE;
  154. }
  155. else
  156. {
  157. return FALSE;
  158. }
  159. }
  160. #endif // __cplusplus