Commit 3c232989 authored by Sam Lantinga's avatar Sam Lantinga

Added Wacom API headers.

FIXME: Dynamically load the Wacom API functions from wintab32.dll

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403175
parent 4dd047e9
......@@ -32,11 +32,6 @@
#include "SDL_vkeys.h"
#include "../../events/SDL_events_c.h"
#include <wintab.h>
#define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_CURSOR)
#define PACKETMODE 0
#include <pktdef.h>
/*#define WMMSG_DEBUG*/
#ifdef WMMSG_DEBUG
#include <stdio.h>
......@@ -152,17 +147,15 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
/* checking where the proximity message showed up */
int h_context = LOWORD(lParam);
LPPOINT point;
POINT point;
GetCursorPos(&point);
ScreenToClient(hwnd, &point);
/* are we in proximity or out of proximity */
if (h_context == 0) {
SDL_SendProximity(tablet, (int) (&point->x),
(int) (&point->y), SDL_PROXIMITYOUT);
SDL_SendProximity(tablet, point.x, point.y, SDL_PROXIMITYOUT);
} else {
SDL_SendProximity(tablet, (int) (&point->x),
(int) (&point->y), SDL_PROXIMITYIN);
SDL_SendProximity(tablet, point.x, point.y, SDL_PROXIMITYIN);
}
}
break;
......@@ -222,7 +215,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
int i;
int size = 0;
const RAWMOUSE *raw_mouse = NULL;
LPPOINT point;
POINT point;
USHORT flags;
/* we're collecting data from the mouse */
......@@ -249,11 +242,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* if the message was sent by a tablet we have to send also pressure */
if (i == tablet) {
SDL_SendMouseMotion(index, 0, (int) (&point->x),
(int) (&point->y), pressure);
SDL_SendMouseMotion(index, 0, point.x, point.y, pressure);
} else {
SDL_SendMouseMotion(index, 0, (int) (&point->x),
(int) (&point->y), 0);
SDL_SendMouseMotion(index, 0, point.x, point.y, 0);
}
/* we're sending mouse buttons messages to check up if sth changed */
if (flags & RI_MOUSE_BUTTON_1_DOWN) {
......
......@@ -54,20 +54,26 @@ WIN_InitKeyboard(_THIS)
/* Make sure the alpha scancodes are correct. T isn't usually remapped */
if (MapVirtualKey('T', MAPVK_VK_TO_VSC) != alpha_scancodes['T' - 'A']) {
printf
("Fixing alpha scancode map, assuming US QWERTY layout!\nPlease send the following 26 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n");
#if 0
printf("Fixing alpha scancode map, assuming US QWERTY layout!\nPlease send the following 26 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n");
#endif
for (i = 0; i < SDL_arraysize(alpha_scancodes); ++i) {
alpha_scancodes[i] = MapVirtualKey('A' + i, MAPVK_VK_TO_VSC);
#if 0
printf("%d = %d\n", i, alpha_scancodes[i]);
#endif
}
}
if (MapVirtualKey(VK_NUMPAD0, MAPVK_VK_TO_VSC) != keypad_scancodes[0]) {
printf
("Fixing keypad scancode map!\nPlease send the following 10 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n");
#if 0
printf("Fixing keypad scancode map!\nPlease send the following 10 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n");
#endif
for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) {
keypad_scancodes[i] =
MapVirtualKey(VK_NUMPAD0 + i, MAPVK_VK_TO_VSC);
#if 0
printf("%d = %d\n", i, keypad_scancodes[i]);
#endif
}
}
......
......@@ -33,11 +33,6 @@
#include "../../events/SDL_mouse_c.h"
#include <wintab.h>
#define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_CURSOR)
#define PACKETMODE 0
#include <pktdef.h>
extern HANDLE *mice;
extern int total_mice;
extern int tablet;
......
......@@ -31,8 +31,6 @@
#include "SDL_d3drender.h"
#include "SDL_gdirender.h"
#include <wintab.h>
/* Initialization/Query functions */
static int WIN_VideoInit(_THIS);
static void WIN_VideoQuit(_THIS);
......
......@@ -37,6 +37,11 @@
#include "d3d9.h"
#endif
#include "wactab/wintab.h"
#define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_CURSOR)
#define PACKETMODE 0
#include "wactab/pktdef.h"
#include "SDL_win32events.h"
#include "SDL_win32gamma.h"
#include "SDL_win32keyboard.h"
......
......@@ -37,13 +37,6 @@
/* This is included after SDL_win32video.h, which includes windows.h */
#include "SDL_syswm.h"
#include <wintab.h>
/* we're telling wintab that we want to receive movement, button events and pressure information in packets */
#define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_CURSOR)
#define PACKETMODE 0
#include <pktdef.h>
extern HCTX *g_hCtx; /* the table of tablet event contexts, each windows has to have it's own tablet context */
int highestId = 0; /* the highest id of the tablet context */
......
/* -------------------------------- pktdef.h -------------------------------- */
/* Combined 16 & 32-bit version. */
/*------------------------------------------------------------------------------
The text and information contained in this file may be freely used,
copied, or distributed without compensation or licensing restrictions.
This file is copyright 1991-1998 by LCS/Telegraphics.
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
How to use pktdef.h:
1. Include wintab.h
2. if using just one packet format:
a. Define PACKETDATA and PACKETMODE as or'ed combinations of WTPKT bits
(use the PK_* identifiers).
b. Include pktdef.h.
c. The generated structure typedef will be called PACKET. Use PACKETDATA
and PACKETMODE to fill in the LOGCONTEXT structure.
3. If using multiple packet formats, for each one:
a. Define PACKETNAME. Its text value will be a prefix for this packet's
parameters and names.
b. Define <PACKETNAME>PACKETDATA and <PACKETNAME>PACKETMODE similar to
2.a. above.
c. Include pktdef.h.
d. The generated structure typedef will be called
<PACKETNAME>PACKET. Compare with 2.c. above and example #2 below.
4. If using extension packet data, do the following additional steps
for each extension:
a. Before including pktdef.h, define <PACKETNAME>PACKET<EXTENSION>
as either PKEXT_ABSOLUTE or PKEXT_RELATIVE.
b. The generated structure typedef will contain a field for the
extension data.
c. Scan the WTI_EXTENSION categories to find the extension's
packet mask bit.
d. OR the packet mask bit with <PACKETNAME>PACKETDATA and use the
result in the lcPktData field of the LOGCONTEXT structure.
e. If <PACKETNAME>PACKET<EXTENSION> was PKEXT_RELATIVE, OR the
packet mask bit with <PACKETNAME>PACKETMODE and use the result
in the lcPktMode field of the LOGCONTEXT structure.
Example #1. -- single packet format
#include <wintab.h>
#define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
#define PACKETMODE PK_BUTTONS /@ buttons relative mode @/
#include <pktdef.h>
...
lc.lcPktData = PACKETDATA;
lc.lcPktMode = PACKETMODE;
Example #2. -- multiple formats
#include <wintab.h>
#define PACKETNAME MOE
#define MOEPACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
#define MOEPACKETMODE PK_BUTTONS /@ buttons relative mode @/
#include <pktdef.h>
#define PACKETNAME LARRY
#define LARRYPACKETDATA PK_Y | PK_Z | PK_BUTTONS /@ y, z, buttons @/
#define LARRYPACKETMODE PK_BUTTONS /@ buttons relative mode @/
#include <pktdef.h>
#define PACKETNAME CURLY
#define CURLYPACKETDATA PK_X | PK_Z | PK_BUTTONS /@ x, z, buttons @/
#define CURLYPACKETMODE PK_BUTTONS /@ buttons relative mode @/
#include <pktdef.h>
...
lcMOE.lcPktData = MOEPACKETDATA;
lcMOE.lcPktMode = MOEPACKETMODE;
...
lcLARRY.lcPktData = LARRYPACKETDATA;
lcLARRY.lcPktMode = LARRYPACKETMODE;
...
lcCURLY.lcPktData = CURLYPACKETDATA;
lcCURLY.lcPktMode = CURLYPACKETMODE;
Example #3. -- extension packet data "XFOO".
#include <wintab.h>
#define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
#define PACKETMODE PK_BUTTONS /@ buttons relative mode @/
#define PACKETXFOO PKEXT_ABSOLUTE /@ XFOO absolute mode @/
#include <pktdef.h>
...
UINT ScanExts(UINT wTag)
{
UINT i;
UINT wScanTag;
/@ scan for wTag's info category. @/
for (i = 0; WTInfo(WTI_EXTENSIONS + i, EXT_TAG, &wScanTag); i++) {
if (wTag == wScanTag) {
/@ return category offset from WTI_EXTENSIONS. @/
return i;
}
}
/@ return error code. @/
return 0xFFFF;
}
...
lc.lcPktData = PACKETDATA;
lc.lcPktMode = PACKETMODE;
#ifdef PACKETXFOO
categoryXFOO = ScanExts(WTX_XFOO);
WTInfo(WTI_EXTENSIONS + categoryXFOO, EXT_MASK, &maskXFOO);
lc.lcPktData |= maskXFOO;
#if PACKETXFOO == PKEXT_RELATIVE
lc.lcPktMode |= maskXFOO;
#endif
#endif
WTOpen(hWnd, &lc, TRUE);
------------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef PACKETNAME
/* if no packet name prefix */
#define __PFX(x) x
#define __IFX(x,y) x ## y
#else
/* add prefixes and infixes to packet format names */
#define __PFX(x) __PFX2(PACKETNAME,x)
#define __PFX2(p,x) __PFX3(p,x)
#define __PFX3(p,x) p ## x
#define __IFX(x,y) __IFX2(x,PACKETNAME,y)
#define __IFX2(x,i,y) __IFX3(x,i,y)
#define __IFX3(x,i,y) x ## i ## y
#endif
#define __SFX2(x,s) __SFX3(x,s)
#define __SFX3(x,s) x ## s
#define __TAG __IFX(tag,PACKET)
#define __TYPES __PFX(PACKET), * __IFX(P,PACKET), NEAR * __IFX(NP,PACKET), \
FAR * __IFX(LP,PACKET)
#define __DATA (__PFX(PACKETDATA))
#define __MODE (__PFX(PACKETMODE))
#define __EXT(x) __SFX2(__PFX(PACKET),x)
typedef struct __TAG {
#if (__DATA & PK_CONTEXT)
HCTX pkContext;
#endif
#if (__DATA & PK_STATUS)
UINT pkStatus;
#endif
#if (__DATA & PK_TIME)
DWORD pkTime;
#endif
#if (__DATA & PK_CHANGED)
WTPKT pkChanged;
#endif
#if (__DATA & PK_SERIAL_NUMBER)
UINT pkSerialNumber;
#endif
#if (__DATA & PK_CURSOR)
UINT pkCursor;
#endif
#if (__DATA & PK_BUTTONS)
DWORD pkButtons;
#endif
#if (__DATA & PK_X)
LONG pkX;
#endif
#if (__DATA & PK_Y)
LONG pkY;
#endif
#if (__DATA & PK_Z)
LONG pkZ;
#endif
#if (__DATA & PK_NORMAL_PRESSURE)
#if (__MODE & PK_NORMAL_PRESSURE)
/* relative */
int pkNormalPressure;
#else
/* absolute */
UINT pkNormalPressure;
#endif
#endif
#if (__DATA & PK_TANGENT_PRESSURE)
#if (__MODE & PK_TANGENT_PRESSURE)
/* relative */
int pkTangentPressure;
#else
/* absolute */
UINT pkTangentPressure;
#endif
#endif
#if (__DATA & PK_ORIENTATION)
ORIENTATION pkOrientation;
#endif
#if (__DATA & PK_ROTATION)
ROTATION pkRotation; /* 1.1 */
#endif
#ifndef NOWTEXTENSIONS
/* extensions begin here. */
#if (__EXT(FKEYS) == PKEXT_RELATIVE) || (__EXT(FKEYS) == PKEXT_ABSOLUTE)
UINT pkFKeys;
#endif
#if (__EXT(TILT) == PKEXT_RELATIVE) || (__EXT(TILT) == PKEXT_ABSOLUTE)
TILT pkTilt;
#endif
#if (__EXT(EXPKEYS) == PKEXT_RELATIVE) || (__EXT(EXPKEYS) == PKEXT_ABSOLUTE)
WORD pkExpKeys[4]; /* 1.3 */
#endif
#endif
} __TYPES ;
#undef PACKETNAME
#undef __TAG
#undef __TAG2
#undef __TYPES
#undef __TYPES2
#undef __DATA
#undef __MODE
#undef __PFX
#undef __PFX2
#undef __PFX3
#undef __IFX
#undef __IFX2
#undef __IFX3
#undef __SFX2
#undef __SFX3
#ifdef __cplusplus
}
#endif /* __cplusplus */
This diff is collapsed.
/* ------------------------------- wintabx.h -------------------------------- */
/* Combined 16 & 32-bit version. */
/*------------------------------------------------------------------------------
The text and information contained in this file may be freely used,
copied, or distributed without compensation or licensing restrictions.
This file is copyright 1991-1998 by LCS/Telegraphics.
------------------------------------------------------------------------------*/
#ifndef _INC_WINTABX /* prevent multiple includes */
#define _INC_WINTABX
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* prototype for wintabx.lib. */
#define _UnlinkWinTab _UnlinkWintab
#ifdef WIN32
extern WINAPI _UnlinkWintab(void);
#else
extern FAR _UnlinkWintab(void);
#endif
/****** Wintab message crackers ***********************************************/
#ifndef HANDLE_MSG
#define HANDLE_MSG(hwnd, message, fn) \
case (message): return HANDLE_##message((hwnd), (wParam), (lParam), (fn))
#endif
/* void Cls_OnWintabPacket(HWND hwnd, HCTX hCtx, UINT sn) */
#define HANDLE_WT_PACKET(hwnd, wParam, lParam, fn) \
((fn)((hwnd), (HCTX)(lParam), (UINT)(wParam)), 0L)
#define FORWARD__WT_PACKET(hwnd, bs, hCtx, sn, fn) \
(void)(fn)((hwnd), _WT_PACKET(bs), (WPARAM)(UINT)(sn), (LPARAM)(HCTX)(hCtx))
#define FORWARD_WT_PACKET(hwnd, hCtx, sn, fn) \
FORWARD__WT_PACKET(hwnd, WT_DEFBASE, hCtx, sn, fn)
/* void Cls_OnWintabCtxOpen(HWND hwnd, HCTX hCtx, UINT sf) */
#define HANDLE_WT_CTXOPEN(hwnd, wParam, lParam, fn) \
((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L)
#define FORWARD__WT_CTXOPEN(hwnd, bs, hCtx, sf, fn) \
(void)(fn)((hwnd), _WT_CTXOPEN(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf))
#define FORWARD_WT_CTXOPEN(hwnd, hCtx, sf, fn) \
FORWARD__WT_CTXOPEN(hwnd, WT_DEFBASE, hCtx, sf, fn)
/* void Cls_OnWintabCtxClose(HWND hwnd, HCTX hCtx, UINT sf) */
#define HANDLE_WT_CTXCLOSE(hwnd, wParam, lParam, fn) \
((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L)
#define FORWARD__WT_CTXCLOSE(hwnd, bs, hCtx, sf, fn) \
(void)(fn)((hwnd), _WT_CTXCLOSE(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf))
#define FORWARD_WT_CTXCLOSE(hwnd, hCtx, sf, fn) \
FORWARD__WT_CTXCLOSE(hwnd, WT_DEFBASE, hCtx, sf, fn)
/* void Cls_OnWintabCtxUpdate(HWND hwnd, HCTX hCtx, UINT sf) */
#define HANDLE_WT_CTXUPDATE(hwnd, wParam, lParam, fn) \
((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L)
#define FORWARD__WT_CTXUPDATE(hwnd, bs, hCtx, sf, fn) \
(void)(fn)((hwnd), _WT_CTXUPDATE(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf))
#define FORWARD_WT_CTXUPDATE(hwnd, hCtx, sf, fn) \
FORWARD__WT_CTXUPDATE(hwnd, WT_DEFBASE, hCtx, sf, fn)
/* void Cls_OnWintabCtxOverlap(HWND hwnd, HCTX hCtx, UINT sf) */
#define HANDLE_WT_CTXOVERLAP(hwnd, wParam, lParam, fn) \
((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L)
#define FORWARD__WT_CTXOVERLAP(hwnd, bs, hCtx, sf, fn) \
(void)(fn)((hwnd), _WT_CTXOVERLAP(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf))
#define FORWARD_WT_CTXOVERLAP(hwnd, hCtx, sf, fn) \
FORWARD__WT_CTXOVERLAP(hwnd, WT_DEFBASE, hCtx, sf, fn)
/* void Cls_OnWintabProximity(HWND hwnd, HCTX hCtx, BOOL cp, BOOL hp) */
#define HANDLE_WT_PROXIMITY(hwnd, wParam, lParam, fn) \
((fn)((hwnd), (HCTX)(wParam), (BOOL)LOWORD(lParam), (BOOL)HIWORD(lParam)), 0L)
#define FORWARD__WT_PROXIMITY(hwnd, bs, hCtx, cp, hp, fn) \
(void)(fn)((hwnd), _WT_PROXIMITY(bs), (WPARAM)(HCTX)(hCtx), MAKELPARAM((cp), (hp))
#define FORWARD_WT_PROXIMITY(hwnd, hCtx, sf, fn) \
FORWARD__WT_PROXIMITY(hwnd, WT_DEFBASE, hCtx, cp, hp, fn)
/* void Cls_OnWintabInfoChange(HWND hwnd, HMGR hMgr, UINT c, UINT i) */
#define HANDLE_WT_INFOCHANGE(hwnd, wParam, lParam, fn) \
((fn)((hwnd), (HMGR)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
#define FORWARD__WT_INFOCHANGE(hwnd, bs, hMgr, cp, hp, fn) \
(void)(fn)((hwnd), _WT_INFOCHANGE(bs), (WPARAM)(HMGR)(hMgr), MAKELPARAM((c), (i))
#define FORWARD_WT_INFOCHANGE(hwnd, hMgr, sf, fn) \
FORWARD__WT_INFOCHANGE(hwnd, WT_DEFBASE, hMgr, cp, hp, fn)
/****** Alternate porting layer macros ****************************************/
#define GET_WT_PACKET_HCTX(wp, lp) ((HCTX)lp)
#define GET_WT_PACKET_SERIAL(wp, lp) (wp)
#define GET_WT_PACKET_MPS(h, s) \
(s), (LPARAM)(h)
#define GET_WT_CTXOPEN_HCTX(wp, lp) ((HCTX)wp)
#define GET_WT_CTXOPEN_STATUS(wp, lp) ((UINT)lp)
#define GET_WT_CTXOPEN_MPS(h, s) \
(WPARAM)(h), (LPARAM)(s)
#define GET_WT_CTXCLOSE_HCTX(wp, lp) ((HCTX)wp)
#define GET_WT_CTXCLOSE_STATUS(wp, lp) ((UINT)lp)
#define GET_WT_CTXCLOSE_MPS(h, s) \
(WPARAM)(h), (LPARAM)(s)
#define GET_WT_CTXUPDATE_HCTX(wp, lp) ((HCTX)wp)
#define GET_WT_CTXUPDATE_STATUS(wp, lp) ((UINT)lp)
#define GET_WT_CTXUPDATE_MPS(h, s) \
(WPARAM)(h), (LPARAM)(s)
#define GET_WT_CTXOVERLAP_HCTX(wp, lp) ((HCTX)wp)
#define GET_WT_CTXOVERLAP_STATUS(wp, lp) ((UINT)lp)
#define GET_WT_CTXOVERLAP_MPS(h, s) \
(WPARAM)(h), (LPARAM)(s)
#define GET_WT_PROXIMITY_HCTX(wp, lp) ((HCTX)wp)
#define GET_WT_PROXIMITY_CTXPROX(wp, lp) LOWORD(lp)
#define GET_WT_PROXIMITY_HARDPROX(wp, lp) HIWORD(lp)
#define GET_WT_PROXIMITY_MPS(h, fc, fh) \
(WPARAM)(h), MAKELONG(fc, fh)
#define GET_WT_INFOCHANGE_HMGR(wp, lp) ((HMGR)wp)
#define GET_WT_INFOCHANGE_CATEGORY(wp, lp) LOWORD(lp)
#define GET_WT_INFOCHANGE_INDEX(wp, lp) HIWORD(lp)
#define GET_WT_INFOCHANGE_MPS(h, c, i) \
(WPARAM)(h), MAKELONG(c, i)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* #define _INC_WINTABX */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment