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_WINTAB_H
21 #define __WINE_WINTAB_H
25 #endif /* defined(__cplusplus) */
27 /***********************************************************************
32 #define WT_DEFBASE 0x7FF0
33 #define WT_MAXOFFSET 0xF
35 #define _WT_PACKET(b) ((b)+0)
36 #define _WT_CTXOPEN(b) ((b)+1)
37 #define _WT_CTXCLOSE(b) ((b)+2)
38 #define _WT_CTXUPDATE(b) ((b)+3)
39 #define _WT_CTXOVERLAP(b) ((b)+4)
40 #define _WT_PROXIMITY(b) ((b)+5)
41 #define _WT_INFOCHANGE(b) ((b)+6)
42 #define _WT_CSRCHANGE(b) ((b)+7) /* 1.1 */
43 #define _WT_MAX(b) ((b)+WT_MAXOFFSET)
45 #define WT_PACKET _WT_PACKET(WT_DEFBASE)
46 #define WT_CTXOPEN _WT_CTXOPEN(WT_DEFBASE)
47 #define WT_CTXCLOSE _WT_CTXCLOSE(WT_DEFBASE)
48 #define WT_CTXUPDATE _WT_CTXUPDATE(WT_DEFBASE)
49 #define WT_CTXOVERLAP _WT_CTXOVERLAP(WT_DEFBASE)
50 #define WT_PROXIMITY _WT_PROXIMITY(WT_DEFBASE)
51 #define WT_INFOCHANGE _WT_INFOCHANGE(WT_DEFBASE)
52 #define WT_CSRCHANGE _WT_CSRCHANGE(WT_DEFBASE) /* 1.1 */
53 #define WT_MAX _WT_MAX(WT_DEFBASE)
57 /***********************************************************************
61 DECLARE_HANDLE(HMGR
); /* manager handle */
62 DECLARE_HANDLE(HCTX
); /* context handle */
63 DECLARE_HANDLE(HWTHOOK
); /* hook handle */
65 typedef DWORD WTPKT
; /* packet mask */
70 #define PK_CONTEXT 0x0001 /* reporting context */
71 #define PK_STATUS 0x0002 /* status bits */
72 #define PK_TIME 0x0004 /* time stamp */
73 #define PK_CHANGED 0x0008 /* change bit vector */
74 #define PK_SERIAL_NUMBER 0x0010 /* packet serial number */
75 #define PK_CURSOR 0x0020 /* reporting cursor */
76 #define PK_BUTTONS 0x0040 /* button information */
77 #define PK_X 0x0080 /* x axis */
78 #define PK_Y 0x0100 /* y axis */
79 #define PK_Z 0x0200 /* z axis */
80 #define PK_NORMAL_PRESSURE 0x0400 /* normal or tip pressure */
81 #define PK_TANGENT_PRESSURE 0x0800 /* tangential or barrel pressure */
82 #define PK_ORIENTATION 0x1000 /* orientation info: tilts */
83 #define PK_ROTATION 0x2000 /* rotation info; 1.1 */
87 typedef DWORD FIX32
; /* fixed-point arithmetic type */
91 #define INT(x) HIWORD(x)
92 #define FRAC(x) LOWORD(x)
94 #define CASTFIX32(x) ((FIX32)((x)*65536L))
96 #define ROUND(x) (INT(x) + (FRAC(x) > (WORD)0x8000))
98 #define FIX_MUL(c, a, b) \
99 (c = (((DWORD)FRAC(a) * FRAC(b)) >> 16) + \
100 (DWORD)INT(a) * FRAC(b) + \
101 (DWORD)INT(b) * FRAC(a) + \
102 ((DWORD)INT(a) * INT(b) << 16))
105 # define FIX_DIV_SC static
110 #define FIX_DIV(c, a, b) \
112 FIX_DIV_SC DWORD temp, rem, btemp; \
114 /* fraction done bytewise */ \
115 temp = ((a / b) << 16); \
118 if (INT(btemp) < 256) { \
123 temp += ((rem / btemp) << 8); \
126 temp += rem / btemp; \
132 /***********************************************************************
140 typedef struct tagAXIS
{
145 } AXIS
, *PAXIS
, *NPAXIS
, *LPAXIS
;
147 /* unit specifiers */
150 #define TU_CENTIMETERS 2
155 #ifndef NOWTSYSBUTTONS
157 /* system button assignment values */
158 #define SBN_NONE 0x00
159 #define SBN_LCLICK 0x01
160 #define SBN_LDBLCLICK 0x02
161 #define SBN_LDRAG 0x03
162 #define SBN_RCLICK 0x04
163 #define SBN_RDBLCLICK 0x05
164 #define SBN_RDRAG 0x06
165 #define SBN_MCLICK 0x07
166 #define SBN_MDBLCLICK 0x08
167 #define SBN_MDRAG 0x09
169 /* for Pen Windows */
170 #define SBN_PTCLICK 0x10
171 #define SBN_PTDBLCLICK 0x20
172 #define SBN_PTDRAG 0x30
173 #define SBN_PNCLICK 0x40
174 #define SBN_PNDBLCLICK 0x50
175 #define SBN_PNDRAG 0x60
176 #define SBN_P1CLICK 0x70
177 #define SBN_P1DBLCLICK 0x80
178 #define SBN_P1DRAG 0x90
179 #define SBN_P2CLICK 0xA0
180 #define SBN_P2DBLCLICK 0xB0
181 #define SBN_P2DRAG 0xC0
182 #define SBN_P3CLICK 0xD0
183 #define SBN_P3DBLCLICK 0xE0
184 #define SBN_P3DRAG 0xF0
188 #ifndef NOWTCAPABILITIES
190 /* hardware capabilities */
191 #define HWC_INTEGRATED 0x0001
192 #define HWC_TOUCH 0x0002
193 #define HWC_HARDPROX 0x0004
194 #define HWC_PHYSID_CURSORS 0x0008 /* 1.1 */
201 /* cursor capabilities */
202 #define CRC_MULTIMODE 0x0001 /* 1.1 */
203 #define CRC_AGGREGATE 0x0002 /* 1.1 */
204 #define CRC_INVERT 0x0004 /* 1.1 */
208 /* info categories */
209 #define WTI_INTERFACE 1
210 #define IFC_WINTABID 1
211 #define IFC_SPECVERSION 2
212 #define IFC_IMPLVERSION 3
213 #define IFC_NDEVICES 4
214 #define IFC_NCURSORS 5
215 #define IFC_NCONTEXTS 6
216 #define IFC_CTXOPTIONS 7
217 #define IFC_CTXSAVESIZE 8
218 #define IFC_NEXTENSIONS 9
219 #define IFC_NMANAGERS 10
227 #define STA_CONTEXTS 1
228 #define STA_SYSCTXS 2
229 #define STA_PKTRATE 3
230 #define STA_PKTDATA 4
231 #define STA_MANAGERS 5
233 #define STA_BUTTONUSE 7
234 #define STA_SYSBTNUSE 8
239 #ifndef NOWTDEFCONTEXT
241 #define WTI_DEFCONTEXT 3
242 #define WTI_DEFSYSCTX 4
243 #define WTI_DDCTXS 400 /* 1.1 */
244 #define WTI_DSCTXS 500 /* 1.1 */
246 #define CTX_OPTIONS 2
249 #define CTX_MSGBASE 5
251 #define CTX_PKTRATE 7
252 #define CTX_PKTDATA 8
253 #define CTX_PKTMODE 9
254 #define CTX_MOVEMASK 10
255 #define CTX_BTNDNMASK 11
256 #define CTX_BTNUPMASK 12
257 #define CTX_INORGX 13
258 #define CTX_INORGY 14
259 #define CTX_INORGZ 15
260 #define CTX_INEXTX 16
261 #define CTX_INEXTY 17
262 #define CTX_INEXTZ 18
263 #define CTX_OUTORGX 19
264 #define CTX_OUTORGY 20
265 #define CTX_OUTORGZ 21
266 #define CTX_OUTEXTX 22
267 #define CTX_OUTEXTY 23
268 #define CTX_OUTEXTZ 24
272 #define CTX_SYSMODE 28
273 #define CTX_SYSORGX 29
274 #define CTX_SYSORGY 30
275 #define CTX_SYSEXTX 31
276 #define CTX_SYSEXTY 32
277 #define CTX_SYSSENSX 33
278 #define CTX_SYSSENSY 34
285 #define WTI_DEVICES 100
287 #define DVC_HARDWARE 2
288 #define DVC_NCSRTYPES 3
289 #define DVC_FIRSTCSR 4
290 #define DVC_PKTRATE 5
291 #define DVC_PKTDATA 6
292 #define DVC_PKTMODE 7
293 #define DVC_CSRDATA 8
294 #define DVC_XMARGIN 9
295 #define DVC_YMARGIN 10
296 #define DVC_ZMARGIN 11
300 #define DVC_NPRESSURE 15
301 #define DVC_TPRESSURE 16
302 #define DVC_ORIENTATION 17
303 #define DVC_ROTATION 18 /* 1.1 */
304 #define DVC_PNPID 19 /* 1.1 */
311 #define WTI_CURSORS 200
314 #define CSR_PKTDATA 3
315 #define CSR_BUTTONS 4
316 #define CSR_BUTTONBITS 5
317 #define CSR_BTNNAMES 6
318 #define CSR_BUTTONMAP 7
319 #define CSR_SYSBTNMAP 8
320 #define CSR_NPBUTTON 9
321 #define CSR_NPBTNMARKS 10
322 #define CSR_NPRESPONSE 11
323 #define CSR_TPBUTTON 12
324 #define CSR_TPBTNMARKS 13
325 #define CSR_TPRESPONSE 14
326 #define CSR_PHYSID 15 /* 1.1 */
327 #define CSR_MODE 16 /* 1.1 */
328 #define CSR_MINPKTDATA 17 /* 1.1 */
329 #define CSR_MINBUTTONS 18 /* 1.1 */
330 #define CSR_CAPABILITIES 19 /* 1.1 */
335 #ifndef NOWTEXTENSIONS
337 #define WTI_EXTENSIONS 300
343 #define EXT_DEFAULT 6
344 #define EXT_DEFCONTEXT 7
345 #define EXT_DEFSYSCTX 8
346 #define EXT_CURSORS 9
347 #define EXT_MAX 109 /* Allow 100 cursors */
353 /***********************************************************************
358 #define LC_NAMELEN 40
360 typedef struct tagLOGCONTEXTA
{
361 char lcName
[LCNAMELEN
];
395 } LOGCONTEXTA
, *PLOGCONTEXTA
, *NPLOGCONTEXTA
, *LPLOGCONTEXTA
;
397 typedef struct tagLOGCONTEXTW
{
398 WCHAR lcName
[LCNAMELEN
];
432 } LOGCONTEXTW
, *PLOGCONTEXTW
, *NPLOGCONTEXTW
, *LPLOGCONTEXTW
;
434 DECL_WINELIB_TYPE_AW(LOGCONTEXT
)
435 DECL_WINELIB_TYPE_AW(PLOGCONTEXT
)
436 DECL_WINELIB_TYPE_AW(NPLOGCONTEXT
)
437 DECL_WINELIB_TYPE_AW(LPLOGCONTEXT
)
439 /* context option values */
440 #define CXO_SYSTEM 0x0001
441 #define CXO_PEN 0x0002
442 #define CXO_MESSAGES 0x0004
443 #define CXO_MARGIN 0x8000
444 #define CXO_MGNINSIDE 0x4000
445 #define CXO_CSRMESSAGES 0x0008 /* 1.1 */
447 /* context status values */
448 #define CXS_DISABLED 0x0001
449 #define CXS_OBSCURED 0x0002
450 #define CXS_ONTOP 0x0004
452 /* context lock values */
453 #define CXL_INSIZE 0x0001
454 #define CXL_INASPECT 0x0002
455 #define CXL_SENSITIVITY 0x0004
456 #define CXL_MARGIN 0x0008
457 #define CXL_SYSOUT 0x0010
459 /***********************************************************************
463 /* For packet structure definition, see pktdef.h */
465 /* packet status values */
466 #define TPS_PROXIMITY 0x0001
467 #define TPS_QUEUE_ERR 0x0002
468 #define TPS_MARGIN 0x0004
469 #define TPS_GRAB 0x0008
470 #define TPS_INVERT 0x0010 /* 1.1 */
472 typedef struct tagORIENTATION
{
476 } ORIENTATION
, *PORIENTATION
, *NPORIENTATION
, *LPORIENTATION
;
478 typedef struct tagROTATION
{ /* 1.1 */
482 } ROTATION
, *PROTATION
, *NPROTATION
, *LPROTATION
;
484 /* grandfather in obsolete member names. */
485 #define rotPitch roPitch
486 #define rotRoll roRoll
489 /* relative buttons */
494 /***********************************************************************
495 * DEVICE CONFIG CONSTANTS
501 #define WTDC_CANCEL 1
503 #define WTDC_RESTART 3
507 /***********************************************************************
513 #define WTH_PLAYBACK 1
516 #define WTHC_GETLPLPFN (-3)
517 #define WTHC_LPLPFNNEXT (-2)
518 #define WTHC_LPFNNEXT (-1)
519 #define WTHC_ACTION 0
520 #define WTHC_GETNEXT 1
525 /***********************************************************************
526 * PREFERENCE FUNCTION CONSTANTS
531 #define WTP_LPDEFAULT ((LPVOID)-1L)
532 #define WTP_DWDEFAULT ((DWORD)-1L)
536 /***********************************************************************
537 * EXTENSION TAGS AND CONSTANTS
540 #ifndef NOWTEXTENSIONS
542 /* constants for use with pktdef.h */
543 #define PKEXT_ABSOLUTE 1
544 #define PKEXT_RELATIVE 2
546 /* Extension tags. */
547 #define WTX_OBT 0 /* Out of bounds tracking */
548 #define WTX_FKEYS 1 /* Function keys */
549 #define WTX_TILT 2 /* Raw Cartesian tilt; 1.1 */
550 #define WTX_CSRMASK 3 /* select input by cursor type; 1.1 */
551 #define WTX_XBTNMASK 4 /* Extended button mask; 1.1 */
553 typedef struct tagXBTNMASK
{
558 typedef struct tagTILT
{ /* 1.1 */
565 /***********************************************************************
569 #ifndef NOWTCALLBACKS
571 #ifndef NOWTMANAGERFXNS
573 /* callback function types */
574 typedef BOOL (WINAPI
* WTENUMPROC
)(HCTX
, LPARAM
); /* changed CALLBACK->WINAPI, 1.1 */
575 typedef BOOL (WINAPI
* WTCONFIGPROC
)(HCTX
, HWND
);
576 typedef LRESULT (WINAPI
* WTHOOKPROC
)(int, WPARAM
, LPARAM
);
577 typedef WTHOOKPROC
*LPWTHOOKPROC
;
583 #ifndef NOWTFUNCTIONS
585 #ifndef NOWTBASICFXNS
586 /* BASIC FUNCTIONS */
588 #define ORD_WTInfoA 20
589 #define ORD_WTInfoW 1020
590 #define ORD_WTInfo WINELIB_NAME_AW(ORD_WTInfo)
591 #define ORD_WTOpenA 21
592 #define ORD_WTOpenW 1021
593 #define ORD_WTOpen WINELIB_NAME_AW(ORD_WTOpen)
594 #define ORD_WTClose 22
595 #define ORD_WTPacketsGet 23
596 #define ORD_WTPacket 24
598 UINT WINAPI
WTInfoA(UINT
, UINT
, LPVOID
);
599 UINT WINAPI
WTInfoW(UINT
, UINT
, LPVOID
);
600 #define WTInfo WINELIB_NAME_AW(WTInfo)
601 HCTX WINAPI
WTOpenA(HWND
, LPLOGCONTEXTA
, BOOL
);
602 HCTX WINAPI
WTOpenW(HWND
, LPLOGCONTEXTW
, BOOL
);
603 #define WTOpen WINELIB_NAME_AW(WTOpen)
604 BOOL WINAPI
WTClose(HCTX
);
605 int WINAPI
WTPacketsGet(HCTX
, int, LPVOID
);
606 BOOL WINAPI
WTPacket(HCTX
, UINT
, LPVOID
);
610 #ifndef NOWTVISIBILITYFXNS
611 /* VISIBILITY FUNCTIONS */
613 #define ORD_WTEnable 40
614 #define ORD_WTOverlap 41
616 BOOL WINAPI
WTEnable(HCTX
, BOOL
);
617 BOOL WINAPI
WTOverlap(HCTX
, BOOL
);
621 #ifndef NOWTCTXEDITFXNS
622 /* CONTEXT EDITING FUNCTIONS */
624 #define ORD_WTConfig 60
625 #define ORD_WTGetA 61
626 #define ORD_WTGetW 1061
627 #define ORD_WTGet WINELIB_NAME_AW(ORD_WTGet)
628 #define ORD_WTSetA 62
629 #define ORD_WTSetW 1062
630 #define ORD_WTSet WINELIB_NAME_AW(ORD_WTSet)
631 #define ORD_WTExtGet 63
632 #define ORD_WTExtSet 64
633 #define ORD_WTSave 65
634 #define ORD_WTRestore 66
636 BOOL WINAPI
WTConfig(HCTX
, HWND
);
637 BOOL WINAPI
WTGetA(HCTX
, LPLOGCONTEXTA
);
638 BOOL WINAPI
WTGetW(HCTX
, LPLOGCONTEXTW
);
639 #define WTGet WINELIB_NAME_AW(WTGet)
640 BOOL WINAPI
WTSetA(HCTX
, LPLOGCONTEXTA
);
641 BOOL WINAPI
WTSetW(HCTX
, LPLOGCONTEXTW
);
642 #define WTSet WINELIB_NAME_AW(WTSet)
643 BOOL WINAPI
WTExtGet(HCTX
, UINT
, LPVOID
);
644 BOOL WINAPI
WTExtSet(HCTX
, UINT
, LPVOID
);
645 BOOL WINAPI
WTSave(HCTX
, LPVOID
);
646 HCTX WINAPI
WTRestore(HWND
, LPVOID
, BOOL
);
650 #ifndef NOWTQUEUEFXNS
651 /* ADVANCED PACKET AND QUEUE FUNCTIONS */
653 #define ORD_WTPacketsPeek 80
654 #define ORD_WTDataGet 81
655 #define ORD_WTDataPeek 82
656 #define ORD_WTQueueSizeGet 84
657 #define ORD_WTQueueSizeSet 85
659 int WINAPI
WTPacketsPeek(HCTX
, int, LPVOID
);
660 int WINAPI
WTDataGet(HCTX
, UINT
, UINT
, int, LPVOID
, LPINT
);
661 int WINAPI
WTDataPeek(HCTX
, UINT
, UINT
, int, LPVOID
, LPINT
);
662 int WINAPI
WTQueueSizeGet(HCTX
);
663 BOOL WINAPI
WTQueueSizeSet(HCTX
, int);
668 /* MANAGER HANDLE FUNCTIONS */
670 #define ORD_WTMgrOpen 100
671 #define ORD_WTMgrClose 101
673 HMGR WINAPI
WTMgrOpen(HWND
, UINT
);
674 BOOL WINAPI
WTMgrClose(HMGR
);
678 #ifndef NOWTMGRCTXFXNS
679 /* MANAGER CONTEXT FUNCTIONS */
681 #define ORD_WTMgrContextEnum 120
682 #define ORD_WTMgrContextOwner 121
683 #define ORD_WTMgrDefContext 122
684 #define ORD_WTMgrDefContextEx 206
686 BOOL WINAPI
WTMgrContextEnum(HMGR
, WTENUMPROC
, LPARAM
);
687 HWND WINAPI
WTMgrContextOwner(HMGR
, HCTX
);
688 HCTX WINAPI
WTMgrDefContext(HMGR
, BOOL
);
689 HCTX WINAPI
WTMgrDefContextEx(HMGR
, UINT
, BOOL
); /* 1.1 */
693 #ifndef NOWTMGRCONFIGFXNS
694 /* MANAGER CONFIG BOX FUNCTIONS */
696 #define ORD_WTMgrDeviceConfig 140
698 UINT WINAPI
WTMgrDeviceConfig(HMGR
, UINT
, HWND
);
702 #ifndef NOWTMGRHOOKFXNS
703 /* MANAGER PACKET HOOK FUNCTIONS */
705 /* OBSOLETE IN WIN32! */
709 #ifndef NOWTMGRPREFFXNS
710 /* MANAGER PREFERENCE DATA FUNCTIONS */
712 #define ORD_WTMgrExt 180
713 #define ORD_WTMgrCsrEnable 181
714 #define ORD_WTMgrCsrButtonMap 182
715 #define ORD_WTMgrCsrPressureBtnMarks 183
716 #define ORD_WTMgrCsrPressureResponse 184
717 #define ORD_WTMgrCsrExt 185
719 BOOL WINAPI
WTMgrExt(HMGR
, UINT
, LPVOID
);
720 BOOL WINAPI
WTMgrCsrEnable(HMGR
, UINT
, BOOL
);
721 BOOL WINAPI
WTMgrCsrButtonMap(HMGR
, UINT
, LPBYTE
, LPBYTE
);
722 BOOL WINAPI
WTMgrCsrPressureBtnMarks(HMGR
, UINT
, DWORD
, DWORD
);
723 BOOL WINAPI
WTMgrCsrPressureResponse(HMGR
, UINT
, UINT
*, UINT
*);
724 BOOL WINAPI
WTMgrCsrExt(HMGR
, UINT
, UINT
, LPVOID
);
728 /***********************************************************************
729 * Win32 replacements for non-portable functions.
732 #ifndef NOWTQUEUEFXNS
733 /* ADVANCED PACKET AND QUEUE FUNCTIONS */
735 #define ORD_WTQueuePacketsEx 200
737 BOOL WINAPI
WTQueuePacketsEx(HCTX
, UINT
*, UINT
*);
741 #ifndef NOWTMGRCONFIGFXNS
742 /* MANAGER CONFIG BOX FUNCTIONS */
744 #define ORD_WTMgrConfigReplaceExA 202
745 #define ORD_WTMgrConfigReplaceExW 1202
746 #define ORD_WTMgrConfigReplaceEx WINELIB_NAME_AW(ORD_WTMgrConfigReplaceEx)
748 BOOL WINAPI
WTMgrConfigReplaceExA(HMGR
, BOOL
, LPSTR
, LPSTR
);
749 BOOL WINAPI
WTMgrConfigReplaceExW(HMGR
, BOOL
, LPWSTR
, LPSTR
);
750 #define WTMgrConfigReplaceEx WINELIB_NAME_AW(WTMgrConfigReplaceEx)
754 #ifndef NOWTMGRHOOKFXNS
755 /* MANAGER PACKET HOOK FUNCTIONS */
757 #define ORD_WTMgrPacketHookExA 203
758 #define ORD_WTMgrPacketHookExW 1203
759 #define ORD_WTMgrPacketHookEx WINELIB_NAME_AW(ORD_WTMgrPacketHookEx)
760 #define ORD_WTMgrPacketUnhook 204
761 #define ORD_WTMgrPacketHookNext 205
763 HWTHOOK WINAPI
WTMgrPacketHookExA(HMGR
, int, LPSTR
, LPSTR
);
764 HWTHOOK WINAPI
WTMgrPacketHookExW(HMGR
, int, LPWSTR
, LPSTR
);
765 #define WTMgrPacketHookEx WINELIB_NAME_AW(WTMgrPacketHookEx)
766 BOOL WINAPI
WTMgrPacketUnhook(HWTHOOK
);
767 LRESULT WINAPI
WTMgrPacketHookNext(HWTHOOK
, int, WPARAM
, LPARAM
);
771 #ifndef NOWTMGRPREFFXNS
772 /* MANAGER PREFERENCE DATA FUNCTIONS */
774 #define ORD_WTMgrCsrPressureBtnMarksEx 201
776 BOOL WINAPI
WTMgrCsrPressureBtnMarksEx(HMGR
, UINT
, UINT
*, UINT
*);
784 #endif /* defined(__cplusplus) */
786 #endif /* defined(__WINE_WINTAB_H */