2 * Copyright (C) 1991-1998 by LCS/Telegraphics
3 * Copyright (C) 2002 Patrik Stridvall
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef __WINE_PKTDEF_H
21 #define __WINE_PKTDEF_H
23 /***********************************************************************
24 * How to use pktdef.h:
27 * 2. if using just one packet format:
28 * a. Define PACKETDATA and PACKETMODE as or'ed combinations of WTPKT bits
29 * (use the PK_* identifiers).
30 * b. Include pktdef.h.
31 * c. The generated structure typedef will be called PACKET. Use PACKETDATA
32 * and PACKETMODE to fill in the LOGCONTEXT structure.
33 * 3. If using multiple packet formats, for each one:
34 * a. Define PACKETNAME. Its text value will be a prefix for this packet's
35 * parameters and names.
36 * b. Define <PACKETNAME>PACKETDATA and <PACKETNAME>PACKETMODE similar to
38 * c. Include pktdef.h.
39 * d. The generated structure typedef will be called
40 * <PACKETNAME>PACKET. Compare with 2.c. above and example #2 below.
41 * 4. If using extension packet data, do the following additional steps
43 * a. Before including pktdef.h, define <PACKETNAME>PACKET<EXTENSION>
44 * as either PKEXT_ABSOLUTE or PKEXT_RELATIVE.
45 * b. The generated structure typedef will contain a field for the
47 * c. Scan the WTI_EXTENSION categories to find the extension's
49 * d. OR the packet mask bit with <PACKETNAME>PACKETDATA and use the
50 * result in the lcPktData field of the LOGCONTEXT structure.
51 * e. If <PACKETNAME>PACKET<EXTENSION> was PKEXT_RELATIVE, OR the
52 * packet mask bit with <PACKETNAME>PACKETMODE and use the result
53 * in the lcPktMode field of the LOGCONTEXT structure.
56 * Example #1. -- single packet format
59 * #define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
60 * #define PACKETMODE PK_BUTTONS /@ buttons relative mode @/
63 * lc.lcPktData = PACKETDATA;
64 * lc.lcPktMode = PACKETMODE;
66 * Example #2. -- multiple formats
69 * #define PACKETNAME MOE
70 * #define MOEPACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
71 * #define MOEPACKETMODE PK_BUTTONS /@ buttons relative mode @/
73 * #define PACKETNAME LARRY
74 * #define LARRYPACKETDATA PK_Y | PK_Z | PK_BUTTONS /@ y, z, buttons @/
75 * #define LARRYPACKETMODE PK_BUTTONS /@ buttons relative mode @/
77 * #define PACKETNAME CURLY
78 * #define CURLYPACKETDATA PK_X | PK_Z | PK_BUTTONS /@ x, z, buttons @/
79 * #define CURLYPACKETMODE PK_BUTTONS /@ buttons relative mode @/
82 * lcMOE.lcPktData = MOEPACKETDATA;
83 * lcMOE.lcPktMode = MOEPACKETMODE;
85 * lcLARRY.lcPktData = LARRYPACKETDATA;
86 * lcLARRY.lcPktMode = LARRYPACKETMODE;
88 * lcCURLY.lcPktData = CURLYPACKETDATA;
89 * lcCURLY.lcPktMode = CURLYPACKETMODE;
91 * Example #3. -- extension packet data "XFOO".
94 * #define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
95 * #define PACKETMODE PK_BUTTONS /@ buttons relative mode @/
96 * #define PACKETXFOO PKEXT_ABSOLUTE /@ XFOO absolute mode @/
99 * UINT ScanExts(UINT wTag)
104 * /@ scan for wTag's info category. @/
105 * for (i = 0; WTInfo(WTI_EXTENSIONS + i, EXT_TAG, &wScanTag); i++) {
106 * if (wTag == wScanTag) {
107 * /@ return category offset from WTI_EXTENSIONS. @/
111 * /@ return error code. @/
115 * lc.lcPktData = PACKETDATA;
116 * lc.lcPktMode = PACKETMODE;
118 * categoryXFOO = ScanExts(WTX_XFOO);
119 * WTInfo(WTI_EXTENSIONS + categoryXFOO, EXT_MASK, &maskXFOO);
120 * lc.lcPktData |= maskXFOO;
121 * #if PACKETXFOO == PKEXT_RELATIVE
122 * lc.lcPktMode |= maskXFOO;
125 * WTOpen(hWnd, &lc, TRUE);
130 #endif /* defined(__cplusplus) */
133 /* if no packet name prefix */
135 # define __IFX(x,y) x ## y
137 /* add prefixes and infixes to packet format names */
138 # define __PFX(x) __PFX2(PACKETNAME,x)
139 # define __PFX2(p,x) __PFX3(p,x)
140 # define __PFX3(p,x) p ## x
141 # define __IFX(x,y) __IFX2(x,PACKETNAME,y)
142 # define __IFX2(x,i,y) __IFX3(x,i,y)
143 # define __IFX3(x,i,y) x ## i ## y
146 #define __SFX2(x,s) __SFX3(x,s)
147 #define __SFX3(x,s) x ## s
149 #define __TAG __IFX(tag,PACKET)
151 __PFX(PACKET), * __IFX(P,PACKET), \
152 * __IFX(NP,PACKET), * __IFX(LP,PACKET)
154 #define __DATA (__PFX(PACKETDATA))
155 #define __MODE (__PFX(PACKETMODE))
156 #define __EXT(x) __SFX2(__PFX(PACKET),x)
158 typedef struct __TAG {
159 #if (__DATA & PK_CONTEXT)
162 #if (__DATA & PK_STATUS)
165 #if (__DATA & PK_TIME)
168 #if (__DATA & PK_CHANGED)
171 #if (__DATA & PK_SERIAL_NUMBER)
174 #if (__DATA & PK_CURSOR)
177 #if (__DATA & PK_BUTTONS)
189 #if (__DATA & PK_NORMAL_PRESSURE)
190 # if (__MODE & PK_NORMAL_PRESSURE)
192 int pkNormalPressure;
195 UINT pkNormalPressure;
198 #if (__DATA & PK_TANGENT_PRESSURE)
199 # if (__MODE & PK_TANGENT_PRESSURE)
201 int pkTangentPressure;
204 UINT pkTangentPressure;
207 #if (__DATA & PK_ORIENTATION)
208 ORIENTATION pkOrientation;
210 #if (__DATA & PK_ROTATION)
211 ROTATION pkRotation; /* 1.1 */
214 #ifndef NOWTEXTENSIONS
215 /* extensions begin here. */
217 #if (__EXT(FKEYS) == PKEXT_RELATIVE) || (__EXT(FKEYS) == PKEXT_ABSOLUTE)
220 #if (__EXT(TILT) == PKEXT_RELATIVE) || (__EXT(TILT) == PKEXT_ABSOLUTE)
246 #endif /* defined(__cplusplus) */
248 #endif /* defined(__WINE_PKTDEF_H */