1 | /*
|
---|
2 | * Copyright (C) 1991-1998 by LCS/Telegraphics
|
---|
3 | * Copyright (C) 2002 Patrik Stridvall
|
---|
4 | *
|
---|
5 | * This library is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU Lesser General Public
|
---|
7 | * License as published by the Free Software Foundation; either
|
---|
8 | * version 2.1 of the License, or (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This library is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
13 | * Lesser General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU Lesser General Public
|
---|
16 | * License along with this library; if not, write to the Free Software
|
---|
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
18 | */
|
---|
19 |
|
---|
20 | /*
|
---|
21 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
22 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
23 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
24 | * a choice of LGPL license versions is made available with the language indicating
|
---|
25 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
26 | * of the LGPL is applied is otherwise unspecified.
|
---|
27 | */
|
---|
28 |
|
---|
29 | #ifndef __WINE_PKTDEF_H
|
---|
30 | #define __WINE_PKTDEF_H
|
---|
31 |
|
---|
32 | /***********************************************************************
|
---|
33 | * How to use pktdef.h:
|
---|
34 | *
|
---|
35 | * 1. Include wintab.h
|
---|
36 | * 2. if using just one packet format:
|
---|
37 | * a. Define PACKETDATA and PACKETMODE as or'ed combinations of WTPKT bits
|
---|
38 | * (use the PK_* identifiers).
|
---|
39 | * b. Include pktdef.h.
|
---|
40 | * c. The generated structure typedef will be called PACKET. Use PACKETDATA
|
---|
41 | * and PACKETMODE to fill in the LOGCONTEXT structure.
|
---|
42 | * 3. If using multiple packet formats, for each one:
|
---|
43 | * a. Define PACKETNAME. Its text value will be a prefix for this packet's
|
---|
44 | * parameters and names.
|
---|
45 | * b. Define <PACKETNAME>PACKETDATA and <PACKETNAME>PACKETMODE similar to
|
---|
46 | * 2.a. above.
|
---|
47 | * c. Include pktdef.h.
|
---|
48 | * d. The generated structure typedef will be called
|
---|
49 | * <PACKETNAME>PACKET. Compare with 2.c. above and example #2 below.
|
---|
50 | * 4. If using extension packet data, do the following additional steps
|
---|
51 | * for each extension:
|
---|
52 | * a. Before including pktdef.h, define <PACKETNAME>PACKET<EXTENSION>
|
---|
53 | * as either PKEXT_ABSOLUTE or PKEXT_RELATIVE.
|
---|
54 | * b. The generated structure typedef will contain a field for the
|
---|
55 | * extension data.
|
---|
56 | * c. Scan the WTI_EXTENSION categories to find the extension's
|
---|
57 | * packet mask bit.
|
---|
58 | * d. OR the packet mask bit with <PACKETNAME>PACKETDATA and use the
|
---|
59 | * result in the lcPktData field of the LOGCONTEXT structure.
|
---|
60 | * e. If <PACKETNAME>PACKET<EXTENSION> was PKEXT_RELATIVE, OR the
|
---|
61 | * packet mask bit with <PACKETNAME>PACKETMODE and use the result
|
---|
62 | * in the lcPktMode field of the LOGCONTEXT structure.
|
---|
63 | *
|
---|
64 | *
|
---|
65 | * Example #1. -- single packet format
|
---|
66 | *
|
---|
67 | * #include <wintab.h>
|
---|
68 | * #define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
|
---|
69 | * #define PACKETMODE PK_BUTTONS /@ buttons relative mode @/
|
---|
70 | * #include <pktdef.h>
|
---|
71 | * ...
|
---|
72 | * lc.lcPktData = PACKETDATA;
|
---|
73 | * lc.lcPktMode = PACKETMODE;
|
---|
74 | *
|
---|
75 | * Example #2. -- multiple formats
|
---|
76 | *
|
---|
77 | * #include <wintab.h>
|
---|
78 | * #define PACKETNAME MOE
|
---|
79 | * #define MOEPACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
|
---|
80 | * #define MOEPACKETMODE PK_BUTTONS /@ buttons relative mode @/
|
---|
81 | * #include <pktdef.h>
|
---|
82 | * #define PACKETNAME LARRY
|
---|
83 | * #define LARRYPACKETDATA PK_Y | PK_Z | PK_BUTTONS /@ y, z, buttons @/
|
---|
84 | * #define LARRYPACKETMODE PK_BUTTONS /@ buttons relative mode @/
|
---|
85 | * #include <pktdef.h>
|
---|
86 | * #define PACKETNAME CURLY
|
---|
87 | * #define CURLYPACKETDATA PK_X | PK_Z | PK_BUTTONS /@ x, z, buttons @/
|
---|
88 | * #define CURLYPACKETMODE PK_BUTTONS /@ buttons relative mode @/
|
---|
89 | * #include <pktdef.h>
|
---|
90 | * ...
|
---|
91 | * lcMOE.lcPktData = MOEPACKETDATA;
|
---|
92 | * lcMOE.lcPktMode = MOEPACKETMODE;
|
---|
93 | * ...
|
---|
94 | * lcLARRY.lcPktData = LARRYPACKETDATA;
|
---|
95 | * lcLARRY.lcPktMode = LARRYPACKETMODE;
|
---|
96 | * ...
|
---|
97 | * lcCURLY.lcPktData = CURLYPACKETDATA;
|
---|
98 | * lcCURLY.lcPktMode = CURLYPACKETMODE;
|
---|
99 | *
|
---|
100 | * Example #3. -- extension packet data "XFOO".
|
---|
101 | *
|
---|
102 | * #include <wintab.h>
|
---|
103 | * #define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
|
---|
104 | * #define PACKETMODE PK_BUTTONS /@ buttons relative mode @/
|
---|
105 | * #define PACKETXFOO PKEXT_ABSOLUTE /@ XFOO absolute mode @/
|
---|
106 | * #include <pktdef.h>
|
---|
107 | * ...
|
---|
108 | * UINT ScanExts(UINT wTag)
|
---|
109 | * {
|
---|
110 | * UINT i;
|
---|
111 | * UINT wScanTag;
|
---|
112 | *
|
---|
113 | * /@ scan for wTag's info category. @/
|
---|
114 | * for (i = 0; WTInfo(WTI_EXTENSIONS + i, EXT_TAG, &wScanTag); i++) {
|
---|
115 | * if (wTag == wScanTag) {
|
---|
116 | * /@ return category offset from WTI_EXTENSIONS. @/
|
---|
117 | * return i;
|
---|
118 | * }
|
---|
119 | * }
|
---|
120 | * /@ return error code. @/
|
---|
121 | * return 0xFFFF;
|
---|
122 | * }
|
---|
123 | * ...
|
---|
124 | * lc.lcPktData = PACKETDATA;
|
---|
125 | * lc.lcPktMode = PACKETMODE;
|
---|
126 | * #ifdef PACKETXFOO
|
---|
127 | * categoryXFOO = ScanExts(WTX_XFOO);
|
---|
128 | * WTInfo(WTI_EXTENSIONS + categoryXFOO, EXT_MASK, &maskXFOO);
|
---|
129 | * lc.lcPktData |= maskXFOO;
|
---|
130 | * #if PACKETXFOO == PKEXT_RELATIVE
|
---|
131 | * lc.lcPktMode |= maskXFOO;
|
---|
132 | * #endif
|
---|
133 | * #endif
|
---|
134 | * WTOpen(hWnd, &lc, TRUE);
|
---|
135 | */
|
---|
136 |
|
---|
137 | #ifdef __cplusplus
|
---|
138 | extern "C" {
|
---|
139 | #endif /* defined(__cplusplus) */
|
---|
140 |
|
---|
141 | #ifndef PACKETNAME
|
---|
142 | /* if no packet name prefix */
|
---|
143 | # define __PFX(x) x
|
---|
144 | # define __IFX(x,y) x ## y
|
---|
145 | #else
|
---|
146 | /* add prefixes and infixes to packet format names */
|
---|
147 | # define __PFX(x) __PFX2(PACKETNAME,x)
|
---|
148 | # define __PFX2(p,x) __PFX3(p,x)
|
---|
149 | # define __PFX3(p,x) p ## x
|
---|
150 | # define __IFX(x,y) __IFX2(x,PACKETNAME,y)
|
---|
151 | # define __IFX2(x,i,y) __IFX3(x,i,y)
|
---|
152 | # define __IFX3(x,i,y) x ## i ## y
|
---|
153 | #endif
|
---|
154 |
|
---|
155 | #define __SFX2(x,s) __SFX3(x,s)
|
---|
156 | #define __SFX3(x,s) x ## s
|
---|
157 |
|
---|
158 | #define __TAG __IFX(tag,PACKET)
|
---|
159 | #define __TYPES \
|
---|
160 | __PFX(PACKET), * __IFX(P,PACKET), \
|
---|
161 | * __IFX(NP,PACKET), * __IFX(LP,PACKET)
|
---|
162 |
|
---|
163 | #define __DATA (__PFX(PACKETDATA))
|
---|
164 | #define __MODE (__PFX(PACKETMODE))
|
---|
165 | #define __EXT(x) __SFX2(__PFX(PACKET),x)
|
---|
166 |
|
---|
167 | typedef struct __TAG {
|
---|
168 | #if (__DATA & PK_CONTEXT)
|
---|
169 | HCTX pkContext;
|
---|
170 | #endif
|
---|
171 | #if (__DATA & PK_STATUS)
|
---|
172 | UINT pkStatus;
|
---|
173 | #endif
|
---|
174 | #if (__DATA & PK_TIME)
|
---|
175 | DWORD pkTime;
|
---|
176 | #endif
|
---|
177 | #if (__DATA & PK_CHANGED)
|
---|
178 | WTPKT pkChanged;
|
---|
179 | #endif
|
---|
180 | #if (__DATA & PK_SERIAL_NUMBER)
|
---|
181 | UINT pkSerialNumber;
|
---|
182 | #endif
|
---|
183 | #if (__DATA & PK_CURSOR)
|
---|
184 | UINT pkCursor;
|
---|
185 | #endif
|
---|
186 | #if (__DATA & PK_BUTTONS)
|
---|
187 | DWORD pkButtons;
|
---|
188 | #endif
|
---|
189 | #if (__DATA & PK_X)
|
---|
190 | LONG pkX;
|
---|
191 | #endif
|
---|
192 | #if (__DATA & PK_Y)
|
---|
193 | LONG pkY;
|
---|
194 | #endif
|
---|
195 | #if (__DATA & PK_Z)
|
---|
196 | LONG pkZ;
|
---|
197 | #endif
|
---|
198 | #if (__DATA & PK_NORMAL_PRESSURE)
|
---|
199 | # if (__MODE & PK_NORMAL_PRESSURE)
|
---|
200 | /* relative */
|
---|
201 | int pkNormalPressure;
|
---|
202 | # else
|
---|
203 | /* absolute */
|
---|
204 | UINT pkNormalPressure;
|
---|
205 | # endif
|
---|
206 | #endif
|
---|
207 | #if (__DATA & PK_TANGENT_PRESSURE)
|
---|
208 | # if (__MODE & PK_TANGENT_PRESSURE)
|
---|
209 | /* relative */
|
---|
210 | int pkTangentPressure;
|
---|
211 | # else
|
---|
212 | /* absolute */
|
---|
213 | UINT pkTangentPressure;
|
---|
214 | # endif
|
---|
215 | #endif
|
---|
216 | #if (__DATA & PK_ORIENTATION)
|
---|
217 | ORIENTATION pkOrientation;
|
---|
218 | #endif
|
---|
219 | #if (__DATA & PK_ROTATION)
|
---|
220 | ROTATION pkRotation; /* 1.1 */
|
---|
221 | #endif
|
---|
222 |
|
---|
223 | #ifndef NOWTEXTENSIONS
|
---|
224 | /* extensions begin here. */
|
---|
225 |
|
---|
226 | #if (__EXT(FKEYS) == PKEXT_RELATIVE) || (__EXT(FKEYS) == PKEXT_ABSOLUTE)
|
---|
227 | UINT pkFKeys;
|
---|
228 | #endif
|
---|
229 | #if (__EXT(TILT) == PKEXT_RELATIVE) || (__EXT(TILT) == PKEXT_ABSOLUTE)
|
---|
230 | TILT pkTilt;
|
---|
231 | #endif
|
---|
232 |
|
---|
233 | #endif
|
---|
234 |
|
---|
235 | } __TYPES;
|
---|
236 |
|
---|
237 | #undef PACKETNAME
|
---|
238 | #undef __TAG
|
---|
239 | #undef __TAG2
|
---|
240 | #undef __TYPES
|
---|
241 | #undef __TYPES2
|
---|
242 | #undef __DATA
|
---|
243 | #undef __MODE
|
---|
244 | #undef __PFX
|
---|
245 | #undef __PFX2
|
---|
246 | #undef __PFX3
|
---|
247 | #undef __IFX
|
---|
248 | #undef __IFX2
|
---|
249 | #undef __IFX3
|
---|
250 | #undef __SFX2
|
---|
251 | #undef __SFX3
|
---|
252 |
|
---|
253 | #ifdef __cplusplus
|
---|
254 | } /* extern "C" */
|
---|
255 | #endif /* defined(__cplusplus) */
|
---|
256 |
|
---|
257 | #endif /* defined(__WINE_PKTDEF_H */
|
---|