1 /**
2  * FreeRDP: A Remote Desktop Protocol Implementation
3  * Pointer Updates Interface API
4  *
5  * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef FREERDP_UPDATE_POINTER_H
21 #define FREERDP_UPDATE_POINTER_H
22 
23 #include <freerdp/types.h>
24 
25 #define PTR_MSG_TYPE_SYSTEM 0x0001
26 #define PTR_MSG_TYPE_POSITION 0x0003
27 #define PTR_MSG_TYPE_COLOR 0x0006
28 #define PTR_MSG_TYPE_CACHED 0x0007
29 #define PTR_MSG_TYPE_POINTER 0x0008
30 #define PTR_MSG_TYPE_POINTER_LARGE 0x0009
31 
32 #define SYSPTR_NULL 0x00000000
33 #define SYSPTR_DEFAULT 0x00007F00
34 
35 struct _POINTER_POSITION_UPDATE
36 {
37 	UINT32 xPos;
38 	UINT32 yPos;
39 };
40 typedef struct _POINTER_POSITION_UPDATE POINTER_POSITION_UPDATE;
41 
42 struct _POINTER_SYSTEM_UPDATE
43 {
44 	UINT32 type;
45 };
46 typedef struct _POINTER_SYSTEM_UPDATE POINTER_SYSTEM_UPDATE;
47 
48 struct _POINTER_COLOR_UPDATE
49 {
50 	UINT32 cacheIndex;
51 	UINT32 xPos;
52 	UINT32 yPos;
53 	UINT32 width;
54 	UINT32 height;
55 	UINT32 lengthAndMask;
56 	UINT32 lengthXorMask;
57 	BYTE* xorMaskData;
58 	BYTE* andMaskData;
59 };
60 typedef struct _POINTER_COLOR_UPDATE POINTER_COLOR_UPDATE;
61 
62 struct _POINTER_LARGE_UPDATE
63 {
64 	UINT16 xorBpp;
65 	UINT16 cacheIndex;
66 	UINT16 hotSpotX;
67 	UINT16 hotSpotY;
68 	UINT16 width;
69 	UINT16 height;
70 	UINT32 lengthAndMask;
71 	UINT32 lengthXorMask;
72 	BYTE* xorMaskData;
73 	BYTE* andMaskData;
74 };
75 typedef struct _POINTER_LARGE_UPDATE POINTER_LARGE_UPDATE;
76 
77 struct _POINTER_NEW_UPDATE
78 {
79 	UINT32 xorBpp;
80 	POINTER_COLOR_UPDATE colorPtrAttr;
81 };
82 typedef struct _POINTER_NEW_UPDATE POINTER_NEW_UPDATE;
83 
84 struct _POINTER_CACHED_UPDATE
85 {
86 	UINT32 cacheIndex;
87 };
88 typedef struct _POINTER_CACHED_UPDATE POINTER_CACHED_UPDATE;
89 
90 typedef BOOL (*pPointerPosition)(rdpContext* context,
91                                  const POINTER_POSITION_UPDATE* pointer_position);
92 typedef BOOL (*pPointerSystem)(rdpContext* context, const POINTER_SYSTEM_UPDATE* pointer_system);
93 typedef BOOL (*pPointerColor)(rdpContext* context, const POINTER_COLOR_UPDATE* pointer_color);
94 typedef BOOL (*pPointerNew)(rdpContext* context, const POINTER_NEW_UPDATE* pointer_new);
95 typedef BOOL (*pPointerCached)(rdpContext* context, const POINTER_CACHED_UPDATE* pointer_cached);
96 typedef BOOL (*pPointerLarge)(rdpContext* context, const POINTER_LARGE_UPDATE* pointer_large);
97 
98 struct rdp_pointer_update
99 {
100 	rdpContext* context;     /* 0 */
101 	UINT32 paddingA[16 - 1]; /* 1 */
102 
103 	pPointerPosition PointerPosition; /* 16 */
104 	pPointerSystem PointerSystem;     /* 17 */
105 	pPointerColor PointerColor;       /* 18 */
106 	pPointerNew PointerNew;           /* 19 */
107 	pPointerCached PointerCached;     /* 20 */
108 	pPointerLarge PointerLarge;       /* 21 */
109 	UINT32 paddingB[32 - 22];         /* 22 */
110 };
111 typedef struct rdp_pointer_update rdpPointerUpdate;
112 
113 #endif /* FREERDP_UPDATE_POINTER_H */
114