diff options
-rw-r--r-- | ChangeLog | 38 | ||||
-rw-r--r-- | README.win32 | 50 | ||||
-rw-r--r-- | acconfig.h | 1 | ||||
-rw-r--r-- | config.h.win32.in | 1 | ||||
-rw-r--r-- | configure.in | 37 | ||||
-rw-r--r-- | gdk/Makefile.am | 3 | ||||
-rw-r--r-- | gdk/win32/Makefile.am | 13 | ||||
-rw-r--r-- | gdk/win32/gdkevents-win32.c | 2 | ||||
-rw-r--r-- | gdk/win32/gdkinput-win32.c | 498 | ||||
-rw-r--r-- | gdk/win32/gdkinput-win32.h | 7 | ||||
-rw-r--r-- | gdk/win32/gdkinput.c | 17 | ||||
-rw-r--r-- | gdk/win32/gdkmain-win32.c | 4 | ||||
-rw-r--r-- | gdk/win32/pktdef.h | 233 | ||||
-rw-r--r-- | gdk/win32/wintab.h | 863 |
14 files changed, 1402 insertions, 365 deletions
@@ -1,3 +1,41 @@ +2007-01-19 Tor Lillqvist <tml@novell.com> + + Build Wintab support always on Windows. Don't require the Wintab + SDK. + + * configure.in: Drop the --with-wintab option. Drop the + HAVE_WINTAB feature test macro and Automake variable. + + * acconfig.h + * config.h.win32.in: Drop HAVE_WINTAB. + + * gdk/win32/gdkevents-win32.c + * gdk/win32/gdkinput.c + * gdk/win32/gdkinput-win32.h + * gdk/win32/gdkinput-win32.c + * gdk/win32/gdkmain-win32.c: Make HAVE_WINTAB ifdef blocks + unconditional. + + * gdk/win32/gdkinput-win32.c (_gdk_input_wintab_init_check): Try + to load wintab32.dll dynamically here. If it is found look up the + handful Wintab functions we use. + (rest of file): Use these function pointers instead of calling the + functions from wntab32x.lib. The code in wntab32x.lib did the same + thing anyway: tried to load wintab32.dll, and looked up the + addresses of the actual functions from it. + + * gdk/Makefile.am + * gdk/win32/Makefile.am: Drop the libwntab32x hacks. + + * gdk/win32/wintab.h + * gdk/win32/pktdef.h: New files. Copied from the Wintab + SDK. Copyright blurb says: "The text and information contained in + this file may be freely used, copied, or distributed without + compensation or licensing restrictions." + + * README.win32: Update a bit. Remove the text about the Wintab + SDK. + 2007-01-18 Tor Lillqvist <tml@novell.com> * gdk-pixbuf/Makefile.am diff --git a/README.win32 b/README.win32 index 6aa13c78a0..60817e500e 100644 --- a/README.win32 +++ b/README.win32 @@ -19,25 +19,21 @@ There are two ways to build GTK+ for win32. Makefiles (which use libtool and gcc to do the compilation). I use this myself, but it can be hard to setup correctly. -Personally I run configure with: -CC='gcc -mpentium -fnative-struct' CPPFLAGS='-I/target/include' CFLAGS=-O2 LDFLAGS='-L/target/lib' ./configure --disable-static --prefix=/target --with-gdktarget=win32 --with-wintab=/src/wtkit126 --with-ie55=/src/workshop/ie55_lib --host=i386-pc-mingw32 - -Then, in theory, you can just say "make", like on Unix. In reality, -there are a few hickups that require manual intervention, and it's -best to run make separately in each subdirectory. At least for me, -when libtool creates an .exe file, it puts the real .exe in the .libs -directory, and leaves a wrapper .exe in the work directory. For some -reason that wrapper doesn't work for me, it doesn't do anything. So, I -always do a "cp .libs/*.exe ." after running a make that has produced -some exes. - -Another issue is with the gdk-pixbuf.loaders file. It's probably best -to do a "make install" in the gdk-pixbuf directory, and let that set -up a mostly correct gdk-pixbuf.loaders in the target directory. Then -copy that back to the source directory. It's needed in gtk/stock-icons +Note that I first always edit the ltmain.sh file like this: +sed -e 's/need_relink=yes/need_relink=no # no way --tml/' <ltmain.sh >ltmain.temp && mv ltmain.temp ltmain.sh + +Personally I run configure with something like: +CC='gcc -mtune=pentium3 -mthreads' CPPFLAGS='-I/opt/gnuwin32/include -I/opt/gnu/include -I/opt/misc/include' CFLAGS=-g LIBS=-lintl LDFLAGS='-L/opt/gnuwin32/lib -L/opt/gnu/lib -L/opt/misc/lib' ./configure --prefix=c:/devel/target/HEAD --with-gdktarget=win32 --enable-maintainer-mode --enable-debug=yes --enable-explicit-deps=no --with-included-loaders=png,bmp,gif,ico,jpeg,tiff,xpm + +Then you should just be able to run "make", like on Unix. + +An issue is with the gdk-pixbuf.loaders file. It's probably best to do +a "make install" in the gdk-pixbuf directory, and let that set up a +mostly correct gdk-pixbuf.loaders in the target directory. Then copy +that back to the source directory. It's needed in gtk/stock-icons where make runs gdk-pixbuf-csource. -Etc, you get the idea. It can be a bit of a pain. +Etc, you get the idea. 2) Use the Microsoft compiler, cl and Make, nmake. Say nmake -f makefile.msc in gdk and gtk. Be prepared to manually edit various @@ -72,22 +68,8 @@ all. Possible ways to fix this are being investigated. Wintab ====== -The tablet support uses the Wintab API. The Wintab development kit can -be downloaded from http://www.pointing.com. Pass the --with-wintab -flag to configure if you use that. If you use nmake and you don't care -for Wintab, undefine HAVE_WINTAB in config.h.win32 and remove -references to the wntab32x library from the makefile before building. - -ActiveIMM -========= - -If you want to build a GTK+ that supports ActiveIMM (the Input Method -Manager for non-EastAsia locales that can be used on Win9x/NT4), you -need the dimm.h header file. That is somewhat difficult to find, but -http://msdn.microsoft.com/downloads/samples/internet/wizard/ seems to -be a good place to look nowadays. If you use "autoconfiscated" build, -pass the --with-ie55 flag to configure specifying the location of the -ie55_lib directory created by downloading the IE5.5 headers and libs -from the above URL. +The tablet support uses the Wintab API. Unfortunately it seems that +only Wacom tablet software comes with the required wintab32.dll +nowadays. --Tor Lillqvist <tml@iki.fi> diff --git a/acconfig.h b/acconfig.h index 3136ab436e..cbd75b1992 100644 --- a/acconfig.h +++ b/acconfig.h @@ -33,7 +33,6 @@ #undef HAVE_SYS_TIME_H #undef HAVE_XFREE_XINERAMA #undef HAVE_XINERAMA -#undef HAVE_WINTAB #undef HAVE_XCONVERTCASE #undef HAVE_XFT diff --git a/config.h.win32.in b/config.h.win32.in index f5d7ed9c90..202a10cfda 100644 --- a/config.h.win32.in +++ b/config.h.win32.in @@ -40,7 +40,6 @@ #endif /* _MSC_VER */ /* #undef HAVE_XFREE_XINERAMA */ /* #undef HAVE_XINERAMA */ -#define HAVE_WINTAB 1 /* #undef HAVE_XCONVERTCASE */ /* #undef HAVE_XFT */ diff --git a/configure.in b/configure.in index 2a349648bd..69f012199e 100644 --- a/configure.in +++ b/configure.in @@ -211,9 +211,6 @@ AC_ARG_ENABLE(visibility, AC_ARG_WITH(xinput, [AC_HELP_STRING([--with-xinput=@<:@no/yes@:>@], [support XInput])]) -AC_ARG_WITH(wintab, - [AC_HELP_STRING([--with-wintab=DIRECTORY], - [use Wintab API with win32 backend])]) if test "$platform_win32" = yes; then gdktarget=win32 else @@ -568,33 +565,6 @@ AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H)) AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H)) AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H)) -if test "${with_wintab+set}" = set && test $with_wintab != no; then - AC_MSG_CHECKING([for wintab.h]) - saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -I$with_wintab/include" - AC_TRY_COMPILE([#include <windows.h> -#include <wintab.h>], - [], - [AC_MSG_RESULT(yes) - AC_MSG_CHECKING([for wntab32x.lib]) - if test -f $with_wintab/lib/i386/wntab32x.lib ; then - AC_MSG_RESULT(yes) - have_wintab=yes - AC_DEFINE(HAVE_WINTAB) - WINTAB_LIB="$with_wintab/lib/i386/wntab32x.lib" - AC_SUBST(WINTAB_LIB) - else - AC_MSG_RESULT(no) - CFLAGS="$saved_cflags" - have_wintab=no - fi - ], - [AC_MSG_RESULT(no) - CFLAGS="$saved_cflags" - have_wintab=no]) -fi -AM_CONDITIONAL(HAVE_WINTAB, test x$have_wintab = xyes) - saved_cflags="$CFLAGS" saved_ldflags="$LDFLAGS" @@ -1341,13 +1311,6 @@ else fi if test "x$gdktarget" = "xwin32"; then - # We start off with the libraries from Pango - - if test x$have_wintab = xyes; then - GDK_WIN32_EXTRA_CFLAGS="-I $with_wintab/include" - AC_SUBST(GDK_WIN32_EXTRA_CFLAGS) - fi - GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -user32 -limm32 -lshell32 -lole32 -Wl,-luuid" AM_CONDITIONAL(USE_WIN32, true) else diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 5a69f3d771..d84c9b3d6d 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -159,9 +159,6 @@ libgdk_win32_2_0_la_LIBADD = win32/libgdk-win32.la $(GDK_DEP_LIBS) \ $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la libgdk_win32_2_0_la_DEPENDENCIES = win32/libgdk-win32.la win32/rc/gdk-win32-res.o gdk.def libgdk_win32_2_0_la_LDFLAGS = -Wl,win32/rc/gdk-win32-res.o -export-symbols $(srcdir)/gdk.def $(LDADD) -if HAVE_WINTAB -libgdk_win32_2_0_la_LDFLAGS += -Wl,win32/libwntab32x.a -endif if OS_WIN32 install-def-file: gdk.def diff --git a/gdk/win32/Makefile.am b/gdk/win32/Makefile.am index 05c9d2a788..bf29c72455 100644 --- a/gdk/win32/Makefile.am +++ b/gdk/win32/Makefile.am @@ -15,15 +15,6 @@ INCLUDES = \ LDADDS = $(GDK_DEP_LIBS) -if HAVE_WINTAB -libwntab32x_a = libwntab32x.a - -libwntab32x.a: $(WINTAB_LIB) - cp $< $@ -endif - -noinst_DATA = $(libwntab32x_a) - noinst_LTLIBRARIES = libgdk-win32.la SUBDIRS=rc @@ -63,7 +54,9 @@ libgdk_win32_la_SOURCES = \ gdkwin32.h \ gdkwin32id.c \ gdkwindow-win32.c \ - gdkwindow-win32.h + gdkwindow-win32.h \ + wintab.h \ + pktdef.h libgdkinclude_HEADERS = \ gdkwin32.h diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index b2eb25528d..ab8ee9c2df 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -3442,7 +3442,6 @@ gdk_event_translate (MSG *msg, } break; -#ifdef HAVE_WINTAB case WM_ACTIVATE: /* Bring any tablet contexts to the top of the overlap order when * one of our windows is activated. @@ -3483,7 +3482,6 @@ gdk_event_translate (MSG *msg, else gdk_event_free (event); break; -#endif } done: diff --git a/gdk/win32/gdkinput-win32.c b/gdk/win32/gdkinput-win32.c index 357037577d..9407e054ac 100644 --- a/gdk/win32/gdkinput-win32.c +++ b/gdk/win32/gdkinput-win32.c @@ -1,6 +1,6 @@ /* GDK - The GIMP Drawing Kit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * Copyright (C) 1998-2002 Tor Lillqvist + * Copyright (C) 1998-2007 Tor Lillqvist * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -37,8 +37,6 @@ #include "gdkprivate-win32.h" #include "gdkinput-win32.h" -#ifdef HAVE_WINTAB - #define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION) #define PACKETMODE (PK_BUTTONS) #include <pktdef.h> @@ -47,37 +45,35 @@ #define PROXIMITY_OUT_DELAY 200 /* In milliseconds, see set_ignore_core */ -#endif - -#if defined(HAVE_WINTAB) || defined(HAVE_WHATEVER_OTHER) -#define HAVE_SOME_XINPUT -#endif - #define TWOPI (2.*G_PI) /* Forward declarations */ -#ifdef HAVE_WINTAB - static GdkDevicePrivate *gdk_input_find_dev_from_ctx (HCTX hctx, UINT id); static GList *wintab_contexts = NULL; static GdkWindow *wintab_window = NULL; -#endif /* HAVE_WINTAB */ - -#ifdef HAVE_SOME_XINPUT - static GdkWindow *x_grab_window = NULL; /* Window that currently holds * the extended inputs grab */ static GdkEventMask x_grab_mask; static gboolean x_grab_owner_events; -#endif /* HAVE_SOME_XINPUT */ +typedef UINT (WINAPI *t_WTInfoA) (UINT a, UINT b, LPVOID c); +typedef BOOL (WINAPI *t_WTEnable) (HCTX a, BOOL b); +typedef HCTX (WINAPI *t_WTOpenA) (HWND a, LPLOGCONTEXTA b, BOOL c); +typedef BOOL (WINAPI *t_WTOverlap) (HCTX a, BOOL b); +typedef BOOL (WINAPI *t_WTPacket) (HCTX a, UINT b, LPVOID c); +typedef int (WINAPI *t_WTQueueSizeSet) (HCTX a, int b); -#ifdef HAVE_WINTAB +static t_WTInfoA p_WTInfoA; +static t_WTEnable p_WTEnable; +static t_WTOpenA p_WTOpenA; +static t_WTOverlap p_WTOverlap; +static t_WTPacket p_WTPacket; +static t_WTQueueSizeSet p_WTQueueSizeSet; static GdkDevicePrivate * gdk_input_find_dev_from_ctx (HCTX hctx, @@ -209,6 +205,7 @@ _gdk_input_wintab_init_check (void) int devix, cursorix; char devname[100], csrname[100]; BOOL defcontext_done; + HMODULE wintab32; if (wintab_initialized) return; @@ -217,244 +214,261 @@ _gdk_input_wintab_init_check (void) wintab_contexts = NULL; - if (!_gdk_input_ignore_wintab && - WTInfo (0, 0, NULL)) - { - WTInfo (WTI_INTERFACE, IFC_SPECVERSION, &specversion); - GDK_NOTE (INPUT, g_print ("Wintab interface version %d.%d\n", - HIBYTE (specversion), LOBYTE (specversion))); - WTInfo (WTI_INTERFACE, IFC_NDEVICES, &ndevices); - WTInfo (WTI_INTERFACE, IFC_NCURSORS, &ncursors); + if (_gdk_input_ignore_wintab) + return; + + if ((wintab32 = LoadLibrary ("wintab32.dll")) == NULL) + return; + + if ((p_WTInfoA = (t_WTInfoA) GetProcAddress (wintab32, "WTInfoA")) == NULL) + return; + if ((p_WTEnable = (t_WTEnable) GetProcAddress (wintab32, "WTEnable")) == NULL) + return; + if ((p_WTOpenA = (t_WTOpenA) GetProcAddress (wintab32, "WTOpenA")) == NULL) + return; + if ((p_WTOverlap = (t_WTOverlap) GetProcAddress (wintab32, "WTOverlap")) == NULL) + return; + if ((p_WTPacket = (t_WTPacket) GetProcAddress (wintab32, "WTPacket")) == NULL) + return; + if ((p_WTQueueSizeSet = (t_WTQueueSizeSet) GetProcAddress (wintab32, "WTQueueSizeSet")) == NULL) + return; + + if (!(*p_WTInfoA) (0, 0, NULL)) + return; + + (*p_WTInfoA) (WTI_INTERFACE, IFC_SPECVERSION, &specversion); + GDK_NOTE (INPUT, g_print ("Wintab interface version %d.%d\n", + HIBYTE (specversion), LOBYTE (specversion))); + (*p_WTInfoA) (WTI_INTERFACE, IFC_NDEVICES, &ndevices); + (*p_WTInfoA) (WTI_INTERFACE, IFC_NCURSORS, &ncursors); #if DEBUG_WINTAB - GDK_NOTE (INPUT, g_print ("NDEVICES: %d, NCURSORS: %d\n", - ndevices, ncursors)); + GDK_NOTE (INPUT, g_print ("NDEVICES: %d, NCURSORS: %d\n", + ndevices, ncursors)); #endif - /* Create a dummy window to receive wintab events */ - wa.wclass = GDK_INPUT_OUTPUT; - wa.event_mask = GDK_ALL_EVENTS_MASK; - wa.width = 2; - wa.height = 2; - wa.x = -100; - wa.y = -100; - wa.window_type = GDK_WINDOW_TOPLEVEL; - if ((wintab_window = gdk_window_new (NULL, &wa, GDK_WA_X|GDK_WA_Y)) == NULL) - { - g_warning ("gdk_input_wintab_init: gdk_window_new failed"); - return; - } - g_object_ref (wintab_window); + /* Create a dummy window to receive wintab events */ + wa.wclass = GDK_INPUT_OUTPUT; + wa.event_mask = GDK_ALL_EVENTS_MASK; + wa.width = 2; + wa.height = 2; + wa.x = -100; + wa.y = -100; + wa.window_type = GDK_WINDOW_TOPLEVEL; + if ((wintab_window = gdk_window_new (NULL, &wa, GDK_WA_X|GDK_WA_Y)) == NULL) + { + g_warning ("gdk_input_wintab_init: gdk_window_new failed"); + return; + } + g_object_ref (wintab_window); - for (devix = 0; devix < ndevices; devix++) - { - LOGCONTEXT lc; - - /* We open the Wintab device (hmm, what if there are several?) as a - * system pointing device, i.e. it controls the normal Windows - * cursor. This seems much more natural. - */ + for (devix = 0; devix < ndevices; devix++) + { + LOGCONTEXT lc; + + /* We open the Wintab device (hmm, what if there are several?) as a + * system pointing device, i.e. it controls the normal Windows + * cursor. This seems much more natural. + */ - WTInfo (WTI_DEVICES + devix, DVC_NAME, devname); + (*p_WTInfoA) (WTI_DEVICES + devix, DVC_NAME, devname); - WTInfo (WTI_DEVICES + devix, DVC_NCSRTYPES, &ncsrtypes); - WTInfo (WTI_DEVICES + devix, DVC_FIRSTCSR, &firstcsr); - WTInfo (WTI_DEVICES + devix, DVC_HARDWARE, &hardware); - WTInfo (WTI_DEVICES + devix, DVC_X, &axis_x); - WTInfo (WTI_DEVICES + devix, DVC_Y, &axis_y); - WTInfo (WTI_DEVICES + devix, DVC_NPRESSURE, &axis_npressure); - WTInfo (WTI_DEVICES + devix, DVC_ORIENTATION, axis_or); - - defcontext_done = FALSE; - if (HIBYTE (specversion) > 1 || LOBYTE (specversion) >= 1) - { - /* Try to get device-specific default context */ - /* Some drivers, e.g. Aiptek, don't provide this info */ - if (WTInfo (WTI_DSCTXS + devix, 0, &lc) > 0) - defcontext_done = TRUE; + (*p_WTInfoA) (WTI_DEVICES + devix, DVC_NCSRTYPES, &ncsrtypes); + (*p_WTInfoA) (WTI_DEVICES + devix, DVC_FIRSTCSR, &firstcsr); + (*p_WTInfoA) (WTI_DEVICES + devix, DVC_HARDWARE, &hardware); + (*p_WTInfoA) (WTI_DEVICES + devix, DVC_X, &axis_x); + (*p_WTInfoA) (WTI_DEVICES + devix, DVC_Y, &axis_y); + (*p_WTInfoA) (WTI_DEVICES + devix, DVC_NPRESSURE, &axis_npressure); + (*p_WTInfoA) (WTI_DEVICES + devix, DVC_ORIENTATION, axis_or); + + defcontext_done = FALSE; + if (HIBYTE (specversion) > 1 || LOBYTE (specversion) >= 1) + { + /* Try to get device-specific default context */ + /* Some drivers, e.g. Aiptek, don't provide this info */ + if ((*p_WTInfoA) (WTI_DSCTXS + devix, 0, &lc) > 0) + defcontext_done = TRUE; #if DEBUG_WINTAB - if (defcontext_done) - GDK_NOTE (INPUT, (g_print("Using device-specific default context\n"))); - else - GDK_NOTE (INPUT, (g_print("Note: Driver did not provide device specific default context info despite claiming to support version 1.1\n"))); + if (defcontext_done) + GDK_NOTE (INPUT, (g_print("Using device-specific default context\n"))); + else + GDK_NOTE (INPUT, (g_print("Note: Driver did not provide device specific default context info despite claiming to support version 1.1\n"))); #endif - } + } - if (!defcontext_done) - WTInfo (WTI_DEFSYSCTX, 0, &lc); + if (!defcontext_done) + (*p_WTInfoA) (WTI_DEFSYSCTX, 0, &lc); #if DEBUG_WINTAB - GDK_NOTE (INPUT, (g_print("Default context:\n"), print_lc(&lc))); + GDK_NOTE (INPUT, (g_print("Default context:\n"), print_lc(&lc))); #endif - lc.lcOptions |= CXO_MESSAGES; - lc.lcStatus = 0; - lc.lcMsgBase = WT_DEFBASE; - lc.lcPktRate = 50; - lc.lcPktData = PACKETDATA; - lc.lcPktMode = PACKETMODE; - lc.lcMoveMask = PACKETDATA; - lc.lcBtnUpMask = lc.lcBtnDnMask = ~0; - lc.lcOutOrgX = axis_x.axMin; - lc.lcOutOrgY = axis_y.axMin; - lc.lcOutExtX = axis_x.axMax - axis_x.axMin; - lc.lcOutExtY = axis_y.axMax - axis_y.axMin; - lc.lcOutExtY = -lc.lcOutExtY; /* We want Y growing downward */ + lc.lcOptions |= CXO_MESSAGES; + lc.lcStatus = 0; + lc.lcMsgBase = WT_DEFBASE; + lc.lcPktRate = 50; + lc.lcPktData = PACKETDATA; + lc.lcPktMode = PACKETMODE; + lc.lcMoveMask = PACKETDATA; + lc.lcBtnUpMask = lc.lcBtnDnMask = ~0; + lc.lcOutOrgX = axis_x.axMin; + lc.lcOutOrgY = axis_y.axMin; + lc.lcOutExtX = axis_x.axMax - axis_x.axMin; + lc.lcOutExtY = axis_y.axMax - axis_y.axMin; + lc.lcOutExtY = -lc.lcOutExtY; /* We want Y growing downward */ #if DEBUG_WINTAB - GDK_NOTE (INPUT, (g_print("context for device %d:\n", devix), - print_lc(&lc))); + GDK_NOTE (INPUT, (g_print("context for device %d:\n", devix), + print_lc(&lc))); #endif - hctx = g_new (HCTX, 1); - if ((*hctx = WTOpen (GDK_WINDOW_HWND (wintab_window), &lc, TRUE)) == NULL) - { - g_warning ("gdk_input_wintab_init: WTOpen failed"); - return; - } - GDK_NOTE (INPUT, g_print ("opened Wintab device %d %p\n", - devix, *hctx)); - - wintab_contexts = g_list_append (wintab_contexts, hctx); + hctx = g_new (HCTX, 1); + if ((*hctx = (*p_WTOpenA) (GDK_WINDOW_HWND (wintab_window), &lc, TRUE)) == NULL) + { + g_warning ("gdk_input_wintab_init: WTOpen failed"); + return; + } + GDK_NOTE (INPUT, g_print ("opened Wintab device %d %p\n", + devix, *hctx)); + + wintab_contexts = g_list_append (wintab_contexts, hctx); #if 0 - WTEnable (*hctx, TRUE); + (*p_WTEnable) (*hctx, TRUE); #endif - WTOverlap (*hctx, TRUE); + (*p_WTOverlap) (*hctx, TRUE); #if DEBUG_WINTAB - GDK_NOTE (INPUT, (g_print("context for device %d after WTOpen:\n", devix), - print_lc(&lc))); + GDK_NOTE (INPUT, (g_print("context for device %d after WTOpen:\n", devix), + print_lc(&lc))); #endif - /* Increase packet queue size to reduce the risk of lost packets */ - /* According to the specs, if the function fails we must try again */ - /* with a smaller queue size */ - GDK_NOTE (INPUT, g_print("Attempting to increase queue size\n")); - for (i = 128; i >= 1; i >>= 1) + /* Increase packet queue size to reduce the risk of lost packets. + * According to the specs, if the function fails we must try again + * with a smaller queue size. + */ + GDK_NOTE (INPUT, g_print("Attempting to increase queue size\n")); + for (i = 128; i >= 1; i >>= 1) + { + if ((*p_WTQueueSizeSet) (*hctx, i)) { - if (WTQueueSizeSet(*hctx, i)) - { - GDK_NOTE (INPUT, g_print("Queue size set to %d\n", i)); - break; - } + GDK_NOTE (INPUT, g_print("Queue size set to %d\n", i)); + break; } - if (!i) - GDK_NOTE (INPUT, g_print("Whoops, no queue size could be set\n")); - for (cursorix = firstcsr; cursorix < firstcsr + ncsrtypes; cursorix++) + } + if (!i) + GDK_NOTE (INPUT, g_print("Whoops, no queue size could be set\n")); + for (cursorix = firstcsr; cursorix < firstcsr + ncsrtypes; cursorix++) + { + active = FALSE; + (*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_ACTIVE, &active); + if (!active) + continue; + gdkdev = g_object_new (GDK_TYPE_DEVICE, NULL); + (*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_NAME, csrname); + gdkdev->info.name = g_strconcat (devname, " ", csrname, NULL); + gdkdev->info.source = GDK_SOURCE_PEN; + gdkdev->info.mode = GDK_MODE_SCREEN; + gdkdev->info.has_cursor = TRUE; + gdkdev->hctx = *hctx; + gdkdev->cursor = cursorix; + (*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_PKTDATA, &gdkdev->pktdata); + gdkdev->info.num_axes = 0; + if (gdkdev->pktdata & PK_X) + gdkdev->info.num_axes++; + if (gdkdev->pktdata & PK_Y) + gdkdev->info.num_axes++; + if (gdkdev->pktdata & PK_NORMAL_PRESSURE) + gdkdev->info.num_axes++; + /* The wintab driver for the Wacom ArtPad II reports + * PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't + * actually sense tilt. Catch this by noticing that the + * orientation axis's azimuth resolution is zero. + */ + if ((gdkdev->pktdata & PK_ORIENTATION) + && axis_or[0].axResolution == 0) + gdkdev->pktdata &= ~PK_ORIENTATION; + + if (gdkdev->pktdata & PK_ORIENTATION) + gdkdev->info.num_axes += 2; /* x and y tilt */ + (*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_NPBTNMARKS, &gdkdev->npbtnmarks); + gdkdev->info.axes = g_new (GdkDeviceAxis, gdkdev->info.num_axes); + gdkdev->axes = g_new (GdkAxisInfo, gdkdev->info.num_axes); + gdkdev->last_axis_data = g_new (gint, gdkdev->info.num_axes); + + k = 0; + if (gdkdev->pktdata & PK_X) + { + gdkdev->axes[k].xresolution = + gdkdev->axes[k].resolution = axis_x.axResolution / 65535.; + gdkdev->axes[k].xmin_value = + gdkdev->axes[k].min_value = axis_x.axMin; + gdkdev->axes[k].xmax_value = + gdkdev->axes[k].max_value = axis_x.axMax; + gdkdev->info.axes[k].use = GDK_AXIS_X; + gdkdev->info.axes[k].min = axis_x.axMin; + gdkdev->info.axes[k].max = axis_x.axMax; + k++; + } + if (gdkdev->pktdata & PK_Y) + { + gdkdev->axes[k].xresolution = + gdkdev->axes[k].resolution = axis_y.axResolution / 65535.; + gdkdev->axes[k].xmin_value = + gdkdev->axes[k].min_value = axis_y.axMin; + gdkdev->axes[k].xmax_value = + gdkdev->axes[k].max_value = axis_y.axMax; + gdkdev->info.axes[k].use = GDK_AXIS_Y; + gdkdev->info.axes[k].min = axis_y.axMin; + gdkdev->info.axes[k].max = axis_y.axMax; + k++; + } + if (gdkdev->pktdata & PK_NORMAL_PRESSURE) + { + gdkdev->axes[k].xresolution = + gdkdev->axes[k].resolution = axis_npressure.axResolution / 65535.; + gdkdev->axes[k].xmin_value = + gdkdev->axes[k].min_value = axis_npressure.axMin; + gdkdev->axes[k].xmax_value = + gdkdev->axes[k].max_value = axis_npressure.axMax; + gdkdev->info.axes[k].use = GDK_AXIS_PRESSURE; + /* GIMP seems to expect values in the range 0-1 */ + gdkdev->info.axes[k].min = 0.0; /*axis_npressure.axMin;*/ + gdkdev->info.axes[k].max = 1.0; /*axis_npressure.axMax;*/ + k++; + } + if (gdkdev->pktdata & PK_ORIENTATION) { - active = FALSE; - WTInfo (WTI_CURSORS + cursorix, CSR_ACTIVE, &active); - if (!active) - continue; - gdkdev = g_object_new (GDK_TYPE_DEVICE, NULL); - WTInfo (WTI_CURSORS + cursorix, CSR_NAME, csrname); - gdkdev->info.name = g_strconcat (devname, " ", csrname, NULL); - gdkdev->info.source = GDK_SOURCE_PEN; - gdkdev->info.mode = GDK_MODE_SCREEN; - gdkdev->info.has_cursor = TRUE; - gdkdev->hctx = *hctx; - gdkdev->cursor = cursorix; - WTInfo (WTI_CURSORS + cursorix, CSR_PKTDATA, &gdkdev->pktdata); - gdkdev->info.num_axes = 0; - if (gdkdev->pktdata & PK_X) - gdkdev->info.num_axes++; - if (gdkdev->pktdata & PK_Y) - gdkdev->info.num_axes++; - if (gdkdev->pktdata & PK_NORMAL_PRESSURE) - gdkdev->info.num_axes++; - /* The wintab driver for the Wacom ArtPad II reports - * PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't - * actually sense tilt. Catch this by noticing that the - * orientation axis's azimuth resolution is zero. - */ - if ((gdkdev->pktdata & PK_ORIENTATION) - && axis_or[0].axResolution == 0) - gdkdev->pktdata &= ~PK_ORIENTATION; - - if (gdkdev->pktdata & PK_ORIENTATION) - gdkdev->info.num_axes += 2; /* x and y tilt */ - WTInfo (WTI_CURSORS + cursorix, CSR_NPBTNMARKS, &gdkdev->npbtnmarks); - gdkdev->info.axes = g_new (GdkDeviceAxis, gdkdev->info.num_axes); - gdkdev->axes = g_new (GdkAxisInfo, gdkdev->info.num_axes); - gdkdev->last_axis_data = g_new (gint, gdkdev->info.num_axes); + GdkAxisUse axis; - k = 0; - if (gdkdev->pktdata & PK_X) + gdkdev->orientation_axes[0] = axis_or[0]; + gdkdev->orientation_axes[1] = axis_or[1]; + for (axis = GDK_AXIS_XTILT; axis <= GDK_AXIS_YTILT; axis++) { + /* Wintab gives us aximuth and altitude, which + * we convert to x and y tilt in the -1000..1000 range + */ gdkdev->axes[k].xresolution = - gdkdev->axes[k].resolution = axis_x.axResolution / 65535.; + gdkdev->axes[k].resolution = 1000; gdkdev->axes[k].xmin_value = - gdkdev->axes[k].min_value = axis_x.axMin; + gdkdev->axes[k].min_value = -1000; gdkdev->axes[k].xmax_value = - gdkdev->axes[k].max_value = axis_x.axMax; - gdkdev->info.axes[k].use = GDK_AXIS_X; - gdkdev->info.axes[k].min = axis_x.axMin; - gdkdev->info.axes[k].max = axis_x.axMax; + gdkdev->axes[k].max_value = 1000; + gdkdev->info.axes[k].use = axis; + gdkdev->info.axes[k].min = -1000; + gdkdev->info.axes[k].max = 1000; k++; } - if (gdkdev->pktdata & PK_Y) - { - gdkdev->axes[k].xresolution = - gdkdev->axes[k].resolution = axis_y.axResolution / 65535.; - gdkdev->axes[k].xmin_value = - gdkdev->axes[k].min_value = axis_y.axMin; - gdkdev->axes[k].xmax_value = - gdkdev->axes[k].max_value = axis_y.axMax; - gdkdev->info.axes[k].use = GDK_AXIS_Y; - gdkdev->info.axes[k].min = axis_y.axMin; - gdkdev->info.axes[k].max = axis_y.axMax; - k++; - } - if (gdkdev->pktdata & PK_NORMAL_PRESSURE) - { - gdkdev->axes[k].xresolution = - gdkdev->axes[k].resolution = axis_npressure.axResolution / 65535.; - gdkdev->axes[k].xmin_value = - gdkdev->axes[k].min_value = axis_npressure.axMin; - gdkdev->axes[k].xmax_value = - gdkdev->axes[k].max_value = axis_npressure.axMax; - gdkdev->info.axes[k].use = GDK_AXIS_PRESSURE; - /* GIMP seems to expect values in the range 0-1 */ - gdkdev->info.axes[k].min = 0.0; /*axis_npressure.axMin;*/ - gdkdev->info.axes[k].max = 1.0; /*axis_npressure.axMax;*/ - k++; - } - if (gdkdev->pktdata & PK_ORIENTATION) - { - GdkAxisUse axis; - - gdkdev->orientation_axes[0] = axis_or[0]; - gdkdev->orientation_axes[1] = axis_or[1]; - for (axis = GDK_AXIS_XTILT; axis <= GDK_AXIS_YTILT; axis++) - { - /* Wintab gives us aximuth and altitude, which - * we convert to x and y tilt in the -1000..1000 range - */ - gdkdev->axes[k].xresolution = - gdkdev->axes[k].resolution = 1000; - gdkdev->axes[k].xmin_value = - gdkdev->axes[k].min_value = -1000; - gdkdev->axes[k].xmax_value = - gdkdev->axes[k].max_value = 1000; - gdkdev->info.axes[k].use = axis; - gdkdev->info.axes[k].min = -1000; - gdkdev->info.axes[k].max = 1000; - k++; - } - } - gdkdev->info.num_keys = 0; - gdkdev->info.keys = NULL; - GDK_NOTE (INPUT, - g_print ("device: (%d) %s axes: %d\n", - cursorix, - gdkdev->info.name, - gdkdev->info.num_axes)); - for (i = 0; i < gdkdev->info.num_axes; i++) - GDK_NOTE (INPUT, - g_print ("... axis %d: %d--%d@%d (%d--%d@%d)\n", - i, - gdkdev->axes[i].xmin_value, - gdkdev->axes[i].xmax_value, - gdkdev->axes[i].xresolution, - gdkdev->axes[i].min_value, - gdkdev->axes[i].max_value, - gdkdev->axes[i].resolution)); - _gdk_input_devices = g_list_append (_gdk_input_devices, - gdkdev); } + gdkdev->info.num_keys = 0; + gdkdev->info.keys = NULL; + GDK_NOTE (INPUT, g_print ("device: (%d) %s axes: %d\n", + cursorix, + gdkdev->info.name, + gdkdev->info.num_axes)); + for (i = 0; i < gdkdev->info.num_axes; i++) + GDK_NOTE (INPUT, g_print ("... axis %d: %d--%d@%d (%d--%d@%d)\n", + i, + gdkdev->axes[i].xmin_value, + gdkdev->axes[i].xmax_value, + gdkdev->axes[i].xresolution, + gdkdev->axes[i].min_value, + gdkdev->axes[i].max_value, + gdkdev->axes[i].resolution)); + _gdk_input_devices = g_list_append (_gdk_input_devices, + gdkdev); } } } @@ -481,8 +495,6 @@ decode_tilt (gint *axis_data, axis_data[1] = sin (az) * cos (el) * 1000; } -#endif /* HAVE_WINTAB */ - static void gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev, GdkInputWindow *input_window, @@ -654,8 +666,6 @@ get_modifier_key_state (void) return state; } -#ifdef HAVE_WINTAB - static guint ignore_core_timer = 0; static gboolean @@ -693,14 +703,12 @@ set_ignore_core (gboolean ignore) ignore_core_timer = gdk_threads_add_timeout (PROXIMITY_OUT_DELAY, ignore_core_timefunc, NULL); } -#endif /* HAVE_WINTAB */ gboolean _gdk_input_other_event (GdkEvent *event, MSG *msg, GdkWindow *window) { -#ifdef HAVE_WINTAB GdkDisplay *display; GdkWindowObject *obj, *grab_obj; GdkInputWindow *input_window; @@ -732,7 +740,7 @@ _gdk_input_other_event (GdkEvent *event, if (msg->message == WT_PACKET) { - if (!WTPacket ((HCTX) msg->lParam, msg->wParam, &packet)) + if (!(*p_WTPacket) ((HCTX) msg->lParam, msg->wParam, &packet)) return FALSE; } @@ -742,7 +750,8 @@ _gdk_input_other_event (GdkEvent *event, { case WT_PACKET: /* Don't produce any button or motion events while a window is being - * moved or resized, see bug #151090. */ + * moved or resized, see bug #151090. + */ if (_sizemove_in_progress) { GDK_NOTE (EVENTS_OR_INPUT, g_print ("... ignored when moving/sizing\n")); @@ -830,7 +839,7 @@ _gdk_input_other_event (GdkEvent *event, /* Now we can check if the window wants the event, and * propagate if necessary. */ - dijkstra: + loop: if (!GDK_WINDOW_IMPL_WIN32 (obj->impl)->extension_events_selected || !(obj->extension_events & masktest)) { @@ -860,7 +869,7 @@ _gdk_input_other_event (GdkEvent *event, y = pt.y; GDK_NOTE (EVENTS_OR_INPUT, g_print ("... propagating to %p %+d%+d\n", GDK_WINDOW_HWND (window), x, y)); - goto dijkstra; + goto loop; } input_window = _gdk_input_window_find (window); @@ -993,7 +1002,6 @@ _gdk_input_other_event (GdkEvent *event, "in" : "out"))); return TRUE; } -#endif return FALSE; } @@ -1001,11 +1009,9 @@ gboolean _gdk_input_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev) { -#ifdef HAVE_SOME_XINPUT GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl); impl->extension_events_selected = TRUE; -#endif return TRUE; } @@ -1014,11 +1020,9 @@ gboolean _gdk_input_disable_window (GdkWindow *window, GdkDevicePrivate *gdkdev) { -#ifdef HAVE_SOME_XINPUT GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl); impl->extension_events_selected = FALSE; -#endif return TRUE; } @@ -1030,7 +1034,6 @@ _gdk_input_grab_pointer (GdkWindow *window, GdkWindow *confine_to, guint32 time) { -#ifdef HAVE_SOME_XINPUT GdkInputWindow *input_window, *new_window; gboolean need_ungrab; GdkDevicePrivate *gdkdev; @@ -1115,7 +1118,6 @@ _gdk_input_grab_pointer (GdkWindow *window, tmp_list = tmp_list->next; } } -#endif return GDK_GRAB_SUCCESS; } @@ -1123,7 +1125,6 @@ _gdk_input_grab_pointer (GdkWindow *window, void _gdk_input_ungrab_pointer (guint32 time) { -#ifdef HAVE_SOME_XINPUT GdkInputWindow *input_window; GdkDevicePrivate *gdkdev; GList *tmp_list; @@ -1156,7 +1157,6 @@ _gdk_input_ungrab_pointer (guint32 time) } } x_grab_window = NULL; -#endif } gboolean @@ -1220,7 +1220,6 @@ gdk_device_get_state (GdkDevice *device, } } -#ifdef HAVE_WINTAB void _gdk_input_set_tablet_active (void) { @@ -1240,11 +1239,10 @@ _gdk_input_set_tablet_active (void) while (tmp_list) { hctx = (HCTX *) (tmp_list->data); - WTOverlap (*hctx, TRUE); + (*p_WTOverlap) (*hctx, TRUE); tmp_list = tmp_list->next; } } -#endif /* HAVE_WINTAB */ void _gdk_input_init (GdkDisplay *display) @@ -1253,7 +1251,6 @@ _gdk_input_init (GdkDisplay *display) _gdk_input_devices = NULL; _gdk_init_input_core (display); -#ifdef HAVE_WINTAB #ifdef WINTAB_NO_LAZY_INIT /* Normally, Wintab is only initialized when the application performs * an action that requires it, such as enabling extended input events @@ -1261,7 +1258,6 @@ _gdk_input_init (GdkDisplay *display) */ _gdk_input_wintab_init_check (); #endif /* WINTAB_NO_LAZY_INIT */ -#endif /* HAVE_WINTAB */ _gdk_input_devices = g_list_append (_gdk_input_devices, display->core_pointer); } diff --git a/gdk/win32/gdkinput-win32.h b/gdk/win32/gdkinput-win32.h index 4da256f1ab..10dd368701 100644 --- a/gdk/win32/gdkinput-win32.h +++ b/gdk/win32/gdkinput-win32.h @@ -27,9 +27,8 @@ #ifndef __GDK_INPUT_WIN32_H__ #define __GDK_INPUT_WIN32_H__ -#ifdef HAVE_WINTAB +#include <windows.h> #include <wintab.h> -#endif typedef struct _GdkAxisInfo GdkAxisInfo; typedef struct _GdkDevicePrivate GdkDevicePrivate; @@ -85,7 +84,6 @@ struct _GdkDevicePrivate gint *last_axis_data; gint last_buttons; -#ifdef HAVE_WINTAB /* WINTAB stuff: */ HCTX hctx; /* Cursor number */ @@ -96,7 +94,6 @@ struct _GdkDevicePrivate UINT npbtnmarks[2]; /* Azimuth and altitude axis */ AXIS orientation_axes[2]; -#endif }; struct _GdkInputWindow @@ -166,9 +163,7 @@ gboolean _gdk_device_get_history (GdkDevice *device, GdkTimeCoord ***events, gint *n_events); -#ifdef HAVE_WINTAB void _gdk_input_wintab_init_check (void); void _gdk_input_set_tablet_active (void); -#endif /* HAVE_WINTAB */ #endif /* __GDK_INPUT_WIN32_H__ */ diff --git a/gdk/win32/gdkinput.c b/gdk/win32/gdkinput.c index a2c71bb85c..61a2aa7086 100644 --- a/gdk/win32/gdkinput.c +++ b/gdk/win32/gdkinput.c @@ -37,16 +37,6 @@ #include "gdkinput.h" #include "gdkprivate.h" -/* When ther necessary stuff is in - * gdkinput.h, gdkinternals.h and - * gdkprivate.h, these includes shouldn't be here. - */ - -#include <windows.h> -#ifdef HAVE_WINTAB -#include <wintab.h> -#endif - #include "gdkinput-win32.h" static GdkDeviceAxis gdk_input_core_axes[] = { @@ -119,18 +109,14 @@ gdk_device_get_type (void) GList * gdk_devices_list (void) { -#ifdef HAVE_WINTAB _gdk_input_wintab_init_check (); -#endif /* HAVE_WINTAB */ return _gdk_input_devices; } GList * gdk_display_list_devices (GdkDisplay *dpy) { -#ifdef HAVE_WINTAB _gdk_input_wintab_init_check (); -#endif /* HAVE_WINTAB */ return _gdk_input_devices; } @@ -276,9 +262,8 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask, if (mask != 0) { -#ifdef HAVE_WINTAB _gdk_input_wintab_init_check (); -#endif /* HAVE_WINTAB */ + iw = g_new(GdkInputWindow,1); iw->window = window; diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c index d38db8c1a5..b4fb0e317c 100644 --- a/gdk/win32/gdkmain-win32.c +++ b/gdk/win32/gdkmain-win32.c @@ -79,12 +79,10 @@ _gdk_windowing_init (void) { gchar buf[10]; -#ifdef HAVE_WINTAB if (getenv ("GDK_IGNORE_WINTAB") != NULL) _gdk_input_ignore_wintab = TRUE; else if (getenv ("GDK_USE_WINTAB") != NULL) _gdk_input_ignore_wintab = FALSE; -#endif if (gdk_synchronize) GdiSetBatchLimit (1); @@ -862,11 +860,9 @@ _gdk_win32_message_to_string (UINT msg) CASE (WM_PENWINFIRST); CASE (WM_PENWINLAST); CASE (WM_APP); -#ifdef HAVE_WINTAB CASE (WT_PACKET); CASE (WT_CSRCHANGE); CASE (WT_PROXIMITY); -#endif #undef CASE default: if (msg >= WM_HANDHELDFIRST && msg <= WM_HANDHELDLAST) diff --git a/gdk/win32/pktdef.h b/gdk/win32/pktdef.h new file mode 100644 index 0000000000..b8695f0ecd --- /dev/null +++ b/gdk/win32/pktdef.h @@ -0,0 +1,233 @@ +/* -------------------------------- 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 +#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 */ diff --git a/gdk/win32/wintab.h b/gdk/win32/wintab.h new file mode 100644 index 0000000000..04b8825e7a --- /dev/null +++ b/gdk/win32/wintab.h @@ -0,0 +1,863 @@ +/* -------------------------------- wintab.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_WINTAB /* prevent multiple includes */ +#define _INC_WINTAB + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* -------------------------------------------------------------------------- */ +/* Messages */ +#ifndef NOWTMESSAGES + + #define WT_DEFBASE 0x7FF0 + #define WT_MAXOFFSET 0xF + + #define _WT_PACKET(b) ((b)+0) + #define _WT_CTXOPEN(b) ((b)+1) + #define _WT_CTXCLOSE(b) ((b)+2) + #define _WT_CTXUPDATE(b) ((b)+3) + #define _WT_CTXOVERLAP(b) ((b)+4) + #define _WT_PROXIMITY(b) ((b)+5) + #define _WT_INFOCHANGE(b) ((b)+6) + #define _WT_CSRCHANGE(b) ((b)+7) /* 1.1 */ + #define _WT_MAX(b) ((b)+WT_MAXOFFSET) + + #define WT_PACKET _WT_PACKET(WT_DEFBASE) + #define WT_CTXOPEN _WT_CTXOPEN(WT_DEFBASE) + #define WT_CTXCLOSE _WT_CTXCLOSE(WT_DEFBASE) + #define WT_CTXUPDATE _WT_CTXUPDATE(WT_DEFBASE) + #define WT_CTXOVERLAP _WT_CTXOVERLAP(WT_DEFBASE) + #define WT_PROXIMITY _WT_PROXIMITY(WT_DEFBASE) + #define WT_INFOCHANGE _WT_INFOCHANGE(WT_DEFBASE) + #define WT_CSRCHANGE _WT_CSRCHANGE(WT_DEFBASE) /* 1.1 */ + #define WT_MAX _WT_MAX(WT_DEFBASE) + +#endif + +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ +/* Data Types */ + +/* -------------------------------------------------------------------------- */ +/* COMMON DATA DEFS */ + +DECLARE_HANDLE(HMGR); /* manager handle */ +DECLARE_HANDLE(HCTX); /* context handle */ +DECLARE_HANDLE(HWTHOOK); /* hook handle */ + +typedef DWORD WTPKT; /* packet mask */ + + +#ifndef NOWTPKT + + /* WTPKT bits */ + #define PK_CONTEXT 0x0001 /* reporting context */ + #define PK_STATUS 0x0002 /* status bits */ + #define PK_TIME 0x0004 /* time stamp */ + #define PK_CHANGED 0x0008 /* change bit vector */ + #define PK_SERIAL_NUMBER 0x0010 /* packet serial number */ + #define PK_CURSOR 0x0020 /* reporting cursor */ + #define PK_BUTTONS 0x0040 /* button information */ + #define PK_X 0x0080 /* x axis */ + #define PK_Y 0x0100 /* y axis */ + #define PK_Z 0x0200 /* z axis */ + #define PK_NORMAL_PRESSURE 0x0400 /* normal or tip pressure */ + #define PK_TANGENT_PRESSURE 0x0800 /* tangential or barrel pressure */ + #define PK_ORIENTATION 0x1000 /* orientation info: tilts */ + #define PK_ROTATION 0x2000 /* rotation info; 1.1 */ + +#endif + +typedef DWORD FIX32; /* fixed-point arithmetic type */ + +#ifndef NOFIX32 + #define INT(x) HIWORD(x) + #define FRAC(x) LOWORD(x) + + #define CASTFIX32(x) ((FIX32)((x)*65536L)) + + #define ROUND(x) (INT(x) + (FRAC(x) > (WORD)0x8000)) + + #define FIX_MUL(c, a, b) \ + (c = (((DWORD)FRAC(a) * FRAC(b)) >> 16) + \ + (DWORD)INT(a) * FRAC(b) + \ + (DWORD)INT(b) * FRAC(a) + \ + ((DWORD)INT(a) * INT(b) << 16)) + + #ifdef _WINDLL + #define FIX_DIV_SC static + #else + #define FIX_DIV_SC + #endif + + #define FIX_DIV(c, a, b) \ + { \ + FIX_DIV_SC DWORD temp, rem, btemp; \ + \ + /* fraction done bytewise */ \ + temp = ((a / b) << 16); \ + rem = a % b; \ + btemp = b; \ + if (INT(btemp) < 256) { \ + rem <<= 8; \ + } \ + else { \ + btemp >>= 8; \ + } \ + temp += ((rem / btemp) << 8); \ + rem %= btemp; \ + rem <<= 8; \ + temp += rem / btemp; \ + c = temp; \ + } +#endif + +/* -------------------------------------------------------------------------- */ +/* INFO DATA DEFS */ + +#ifndef NOWTINFO + +#ifndef NOWTAXIS + +typedef struct tagAXIS { + LONG axMin; + LONG axMax; + UINT axUnits; + FIX32 axResolution; +} AXIS, *PAXIS, NEAR *NPAXIS, FAR *LPAXIS; + + /* unit specifiers */ + #define TU_NONE 0 + #define TU_INCHES 1 + #define TU_CENTIMETERS 2 + #define TU_CIRCLE 3 + +#endif + +#ifndef NOWTSYSBUTTONS + +/* system button assignment values */ +#define SBN_NONE 0x00 +#define SBN_LCLICK 0x01 +#define SBN_LDBLCLICK 0x02 +#define SBN_LDRAG 0x03 +#define SBN_RCLICK 0x04 +#define SBN_RDBLCLICK 0x05 +#define SBN_RDRAG 0x06 +#define SBN_MCLICK 0x07 +#define SBN_MDBLCLICK 0x08 +#define SBN_MDRAG 0x09 +/* for Pen Windows */ +#define SBN_PTCLICK 0x10 +#define SBN_PTDBLCLICK 0x20 +#define SBN_PTDRAG 0x30 +#define SBN_PNCLICK 0x40 +#define SBN_PNDBLCLICK 0x50 +#define SBN_PNDRAG 0x60 +#define SBN_P1CLICK 0x70 +#define SBN_P1DBLCLICK 0x80 +#define SBN_P1DRAG 0x90 +#define SBN_P2CLICK 0xA0 +#define SBN_P2DBLCLICK 0xB0 +#define SBN_P2DRAG 0xC0 +#define SBN_P3CLICK 0xD0 +#define SBN_P3DBLCLICK 0xE0 +#define SBN_P3DRAG 0xF0 + +#endif + +#ifndef NOWTCAPABILITIES + +/* hardware capabilities */ +#define HWC_INTEGRATED 0x0001 +#define HWC_TOUCH 0x0002 +#define HWC_HARDPROX 0x0004 +#define HWC_PHYSID_CURSORS 0x0008 /* 1.1 */ +#endif + +#ifndef NOWTIFC + +#ifndef NOWTCURSORS + +/* cursor capabilities */ +#define CRC_MULTIMODE 0x0001 /* 1.1 */ +#define CRC_AGGREGATE 0x0002 /* 1.1 */ +#define CRC_INVERT 0x0004 /* 1.1 */ + +#endif + +/* info categories */ +#define WTI_INTERFACE 1 + #define IFC_WINTABID 1 + #define IFC_SPECVERSION 2 + #define IFC_IMPLVERSION 3 + #define IFC_NDEVICES 4 + #define IFC_NCURSORS 5 + #define IFC_NCONTEXTS 6 + #define IFC_CTXOPTIONS 7 + #define IFC_CTXSAVESIZE 8 + #define IFC_NEXTENSIONS 9 + #define IFC_NMANAGERS 10 + #define IFC_MAX 10 + + +#endif + +#ifndef NOWTSTATUS + +#define WTI_STATUS 2 + #define STA_CONTEXTS 1 + #define STA_SYSCTXS 2 + #define STA_PKTRATE 3 + #define STA_PKTDATA 4 + #define STA_MANAGERS 5 + #define STA_SYSTEM 6 + #define STA_BUTTONUSE 7 + #define STA_SYSBTNUSE 8 + #define STA_MAX 8 + +#endif + +#ifndef NOWTDEFCONTEXT + +#define WTI_DEFCONTEXT 3 +#define WTI_DEFSYSCTX 4 +#define WTI_DDCTXS 400 /* 1.1 */ +#define WTI_DSCTXS 500 /* 1.1 */ + #define CTX_NAME 1 + #define CTX_OPTIONS 2 + #define CTX_STATUS 3 + #define CTX_LOCKS 4 + #define CTX_MSGBASE 5 + #define CTX_DEVICE 6 + #define CTX_PKTRATE 7 + #define CTX_PKTDATA 8 + #define CTX_PKTMODE 9 + #define CTX_MOVEMASK 10 + #define CTX_BTNDNMASK 11 + #define CTX_BTNUPMASK 12 + #define CTX_INORGX 13 + #define CTX_INORGY 14 + #define CTX_INORGZ 15 + #define CTX_INEXTX 16 + #define CTX_INEXTY 17 + #define CTX_INEXTZ 18 + #define CTX_OUTORGX 19 + #define CTX_OUTORGY 20 + #define CTX_OUTORGZ 21 + #define CTX_OUTEXTX 22 + #define CTX_OUTEXTY 23 + #define CTX_OUTEXTZ 24 + #define CTX_SENSX 25 + #define CTX_SENSY 26 + #define CTX_SENSZ 27 + #define CTX_SYSMODE 28 + #define CTX_SYSORGX 29 + #define CTX_SYSORGY 30 + #define CTX_SYSEXTX 31 + #define CTX_SYSEXTY 32 + #define CTX_SYSSENSX 33 + #define CTX_SYSSENSY 34 + #define CTX_MAX 34 + +#endif + +#ifndef NOWTDEVICES + +#define WTI_DEVICES 100 + #define DVC_NAME 1 + #define DVC_HARDWARE 2 + #define DVC_NCSRTYPES 3 + #define DVC_FIRSTCSR 4 + #define DVC_PKTRATE 5 + #define DVC_PKTDATA 6 + #define DVC_PKTMODE 7 + #define DVC_CSRDATA 8 + #define DVC_XMARGIN 9 + #define DVC_YMARGIN 10 + #define DVC_ZMARGIN 11 + #define DVC_X 12 + #define DVC_Y 13 + #define DVC_Z 14 + #define DVC_NPRESSURE 15 + #define DVC_TPRESSURE 16 + #define DVC_ORIENTATION 17 + #define DVC_ROTATION 18 /* 1.1 */ + #define DVC_PNPID 19 /* 1.1 */ + #define DVC_MAX 19 + +#endif + +#ifndef NOWTCURSORS + +#define WTI_CURSORS 200 + #define CSR_NAME 1 + #define CSR_ACTIVE 2 + #define CSR_PKTDATA 3 + #define CSR_BUTTONS 4 + #define CSR_BUTTONBITS 5 + #define CSR_BTNNAMES 6 + #define CSR_BUTTONMAP 7 + #define CSR_SYSBTNMAP 8 + #define CSR_NPBUTTON 9 + #define CSR_NPBTNMARKS 10 + #define CSR_NPRESPONSE 11 + #define CSR_TPBUTTON 12 + #define CSR_TPBTNMARKS 13 + #define CSR_TPRESPONSE 14 + #define CSR_PHYSID 15 /* 1.1 */ + #define CSR_MODE 16 /* 1.1 */ + #define CSR_MINPKTDATA 17 /* 1.1 */ + #define CSR_MINBUTTONS 18 /* 1.1 */ + #define CSR_CAPABILITIES 19 /* 1.1 */ + #define CSR_MAX 19 + +#endif + +#ifndef NOWTEXTENSIONS + +#define WTI_EXTENSIONS 300 + #define EXT_NAME 1 + #define EXT_TAG 2 + #define EXT_MASK 3 + #define EXT_SIZE 4 + #define EXT_AXES 5 + #define EXT_DEFAULT 6 + #define EXT_DEFCONTEXT 7 + #define EXT_DEFSYSCTX 8 + #define EXT_CURSORS 9 + #define EXT_MAX 109 /* Allow 100 cursors */ + +#endif + +#endif + +/* -------------------------------------------------------------------------- */ +/* CONTEXT DATA DEFS */ + +#define LCNAMELEN 40 +#define LC_NAMELEN 40 +#ifdef WIN32 +typedef struct tagLOGCONTEXTA { + char lcName[LCNAMELEN]; + UINT lcOptions; + UINT lcStatus; + UINT lcLocks; + UINT lcMsgBase; + UINT lcDevice; + UINT lcPktRate; + WTPKT lcPktData; + WTPKT lcPktMode; + WTPKT lcMoveMask; + DWORD lcBtnDnMask; + DWORD lcBtnUpMask; + LONG lcInOrgX; + LONG lcInOrgY; + LONG lcInOrgZ; + LONG lcInExtX; + LONG lcInExtY; + LONG lcInExtZ; + LONG lcOutOrgX; + LONG lcOutOrgY; + LONG lcOutOrgZ; + LONG lcOutExtX; + LONG lcOutExtY; + LONG lcOutExtZ; + FIX32 lcSensX; + FIX32 lcSensY; + FIX32 lcSensZ; + BOOL lcSysMode; + int lcSysOrgX; + int lcSysOrgY; + int lcSysExtX; + int lcSysExtY; + FIX32 lcSysSensX; + FIX32 lcSysSensY; +} LOGCONTEXTA, *PLOGCONTEXTA, NEAR *NPLOGCONTEXTA, FAR *LPLOGCONTEXTA; +typedef struct tagLOGCONTEXTW { + WCHAR lcName[LCNAMELEN]; + UINT lcOptions; + UINT lcStatus; + UINT lcLocks; + UINT lcMsgBase; + UINT lcDevice; + UINT lcPktRate; + WTPKT lcPktData; + WTPKT lcPktMode; + WTPKT lcMoveMask; + DWORD lcBtnDnMask; + DWORD lcBtnUpMask; + LONG lcInOrgX; + LONG lcInOrgY; + LONG lcInOrgZ; + LONG lcInExtX; + LONG lcInExtY; + LONG lcInExtZ; + LONG lcOutOrgX; + LONG lcOutOrgY; + LONG lcOutOrgZ; + LONG lcOutExtX; + LONG lcOutExtY; + LONG lcOutExtZ; + FIX32 lcSensX; + FIX32 lcSensY; + FIX32 lcSensZ; + BOOL lcSysMode; + int lcSysOrgX; + int lcSysOrgY; + int lcSysExtX; + int lcSysExtY; + FIX32 lcSysSensX; + FIX32 lcSysSensY; +} LOGCONTEXTW, *PLOGCONTEXTW, NEAR *NPLOGCONTEXTW, FAR *LPLOGCONTEXTW; +#ifdef UNICODE +typedef LOGCONTEXTW LOGCONTEXT; +typedef PLOGCONTEXTW PLOGCONTEXT; +typedef NPLOGCONTEXTW NPLOGCONTEXT; +typedef LPLOGCONTEXTW LPLOGCONTEXT; +#else +typedef LOGCONTEXTA LOGCONTEXT; +typedef PLOGCONTEXTA PLOGCONTEXT; +typedef NPLOGCONTEXTA NPLOGCONTEXT; +typedef LPLOGCONTEXTA LPLOGCONTEXT; +#endif /* UNICODE */ +#else /* WIN32 */ +typedef struct tagLOGCONTEXT { + char lcName[LCNAMELEN]; + UINT lcOptions; + UINT lcStatus; + UINT lcLocks; + UINT lcMsgBase; + UINT lcDevice; + UINT lcPktRate; + WTPKT lcPktData; + WTPKT lcPktMode; + WTPKT lcMoveMask; + DWORD lcBtnDnMask; + DWORD lcBtnUpMask; + LONG lcInOrgX; + LONG lcInOrgY; + LONG lcInOrgZ; + LONG lcInExtX; + LONG lcInExtY; + LONG lcInExtZ; + LONG lcOutOrgX; + LONG lcOutOrgY; + LONG lcOutOrgZ; + LONG lcOutExtX; + LONG lcOutExtY; + LONG lcOutExtZ; + FIX32 lcSensX; + FIX32 lcSensY; + FIX32 lcSensZ; + BOOL lcSysMode; + int lcSysOrgX; + int lcSysOrgY; + int lcSysExtX; + int lcSysExtY; + FIX32 lcSysSensX; + FIX32 lcSysSensY; +} LOGCONTEXT, *PLOGCONTEXT, NEAR *NPLOGCONTEXT, FAR *LPLOGCONTEXT; +#endif /* WIN32 */ + + /* context option values */ + #define CXO_SYSTEM 0x0001 + #define CXO_PEN 0x0002 + #define CXO_MESSAGES 0x0004 + #define CXO_MARGIN 0x8000 + #define CXO_MGNINSIDE 0x4000 + #define CXO_CSRMESSAGES 0x0008 /* 1.1 */ + + /* context status values */ + #define CXS_DISABLED 0x0001 + #define CXS_OBSCURED 0x0002 + #define CXS_ONTOP 0x0004 + + /* context lock values */ + #define CXL_INSIZE 0x0001 + #define CXL_INASPECT 0x0002 + #define CXL_SENSITIVITY 0x0004 + #define CXL_MARGIN 0x0008 + #define CXL_SYSOUT 0x0010 + +/* -------------------------------------------------------------------------- */ +/* EVENT DATA DEFS */ + +/* For packet structure definition, see pktdef.h */ + +/* packet status values */ +#define TPS_PROXIMITY 0x0001 +#define TPS_QUEUE_ERR 0x0002 +#define TPS_MARGIN 0x0004 +#define TPS_GRAB 0x0008 +#define TPS_INVERT 0x0010 /* 1.1 */ + +typedef struct tagORIENTATION { + int orAzimuth; + int orAltitude; + int orTwist; +} ORIENTATION, *PORIENTATION, NEAR *NPORIENTATION, FAR *LPORIENTATION; + +typedef struct tagROTATION { /* 1.1 */ + int roPitch; + int roRoll; + int roYaw; +} ROTATION, *PROTATION, NEAR *NPROTATION, FAR *LPROTATION; +// grandfather in obsolete member names. +#define rotPitch roPitch +#define rotRoll roRoll +#define rotYaw roYaw + +/* relative buttons */ +#define TBN_NONE 0 +#define TBN_UP 1 +#define TBN_DOWN 2 + +/* -------------------------------------------------------------------------- */ +/* DEVICE CONFIG CONSTANTS */ + +#ifndef NOWTDEVCFG + +#define WTDC_NONE 0 +#define WTDC_CANCEL 1 +#define WTDC_OK 2 +#define WTDC_RESTART 3 + +#endif + +/* -------------------------------------------------------------------------- */ +/* HOOK CONSTANTS */ + +#ifndef NOWTHOOKS + +#define WTH_PLAYBACK 1 +#define WTH_RECORD 2 + +#define WTHC_GETLPLPFN (-3) +#define WTHC_LPLPFNNEXT (-2) +#define WTHC_LPFNNEXT (-1) +#define WTHC_ACTION 0 +#define WTHC_GETNEXT 1 +#define WTHC_SKIP 2 + +#endif + +/* -------------------------------------------------------------------------- */ +/* PREFERENCE FUNCTION CONSTANTS */ + +#ifndef NOWTPREF + +#define WTP_LPDEFAULT ((LPVOID)-1L) +#define WTP_DWDEFAULT ((DWORD)-1L) + +#endif + +/* -------------------------------------------------------------------------- */ +/* EXTENSION TAGS AND CONSTANTS */ + +#ifndef NOWTEXTENSIONS + +/* constants for use with pktdef.h */ +#define PKEXT_ABSOLUTE 1 +#define PKEXT_RELATIVE 2 + +/* Extension tags. */ +#define WTX_OBT 0 /* Out of bounds tracking */ +#define WTX_FKEYS 1 /* Function keys */ +#define WTX_TILT 2 /* Raw Cartesian tilt; 1.1 */ +#define WTX_CSRMASK 3 /* select input by cursor type; 1.1 */ +#define WTX_XBTNMASK 4 /* Extended button mask; 1.1 */ + +typedef struct tagXBTNMASK { + BYTE xBtnDnMask[32]; + BYTE xBtnUpMask[32]; +} XBTNMASK; + +typedef struct tagTILT { /* 1.1 */ + int tiltX; + int tiltY; +} TILT; + +#endif + +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ +/* Functions */ + + #ifndef API + #ifndef WINAPI + #define API FAR PASCAL + #else + #define API WINAPI + #endif + #endif + +#ifndef NOWTCALLBACKS + + #ifndef CALLBACK + #define CALLBACK FAR PASCAL + #endif + + #ifndef NOWTMANAGERFXNS + /* callback function types */ + typedef BOOL (WINAPI * WTENUMPROC)(HCTX, LPARAM); /* changed CALLBACK->WINAPI, 1.1 */ + typedef BOOL (WINAPI * WTCONFIGPROC)(HCTX, HWND); + typedef LRESULT (WINAPI * WTHOOKPROC)(int, WPARAM, LPARAM); + typedef WTHOOKPROC FAR *LPWTHOOKPROC; + #endif + +#endif + + +#ifndef NOWTFUNCTIONS + + #ifndef NOWTBASICFXNS + /* BASIC FUNCTIONS */ +#ifdef WIN32 + UINT API WTInfoA(UINT, UINT, LPVOID); + #define ORD_WTInfoA 20 + UINT API WTInfoW(UINT, UINT, LPVOID); + #define ORD_WTInfoW 1020 + #ifdef UNICODE + #define WTInfo WTInfoW + #define ORD_WTInfo ORD_WTInfoW + #else + #define WTInfo WTInfoA + #define ORD_WTInfo ORD_WTInfoA + #endif /* !UNICODE */ +#else + UINT API WTInfo(UINT, UINT, LPVOID); + #define ORD_WTInfo 20 +#endif +#ifdef WIN32 + HCTX API WTOpenA(HWND, LPLOGCONTEXTA, BOOL); + #define ORD_WTOpenA 21 + HCTX API WTOpenW(HWND, LPLOGCONTEXTW, BOOL); + #define ORD_WTOpenW 1021 + #ifdef UNICODE + #define WTOpen WTOpenW + #define ORD_WTOpen ORD_WTOpenW + #else + #define WTOpen WTOpenA + #define ORD_WTOpen ORD_WTOpenA + #endif /* !UNICODE */ +#else + HCTX API WTOpen(HWND, LPLOGCONTEXT, BOOL); + #define ORD_WTOpen 21 +#endif + BOOL API WTClose(HCTX); + #define ORD_WTClose 22 + int API WTPacketsGet(HCTX, int, LPVOID); + #define ORD_WTPacketsGet 23 + BOOL API WTPacket(HCTX, UINT, LPVOID); + #define ORD_WTPacket 24 + #endif + + #ifndef NOWTVISIBILITYFXNS + /* VISIBILITY FUNCTIONS */ + BOOL API WTEnable(HCTX, BOOL); + #define ORD_WTEnable 40 + BOOL API WTOverlap(HCTX, BOOL); + #define ORD_WTOverlap 41 + #endif + + #ifndef NOWTCTXEDITFXNS + /* CONTEXT EDITING FUNCTIONS */ + BOOL API WTConfig(HCTX, HWND); + #define ORD_WTConfig 60 +#ifdef WIN32 + BOOL API WTGetA(HCTX, LPLOGCONTEXTA); + #define ORD_WTGetA 61 + BOOL API WTGetW(HCTX, LPLOGCONTEXTW); + #define ORD_WTGetW 1061 + #ifdef UNICODE + #define WTGet WTGetW + #define ORD_WTGet ORD_WTGetW + #else + #define WTGet WTGetA + #define ORD_WTGet ORD_WTGetA + #endif /* !UNICODE */ +#else + BOOL API WTGet(HCTX, LPLOGCONTEXT); + #define ORD_WTGet 61 +#endif +#ifdef WIN32 + BOOL API WTSetA(HCTX, LPLOGCONTEXTA); + #define ORD_WTSetA 62 + BOOL API WTSetW(HCTX, LPLOGCONTEXTW); + #define ORD_WTSetW 1062 + #ifdef UNICODE + #define WTSet WTSetW + #define ORD_WTSet ORD_WTSetW + #else + #define WTSet WTSetA + #define ORD_WTSet ORD_WTSetA + #endif /* !UNICODE */ +#else + BOOL API WTSet(HCTX, LPLOGCONTEXT); + #define ORD_WTSet 62 +#endif + BOOL API WTExtGet(HCTX, UINT, LPVOID); + #define ORD_WTExtGet 63 + BOOL API WTExtSet(HCTX, UINT, LPVOID); + #define ORD_WTExtSet 64 + BOOL API WTSave(HCTX, LPVOID); + #define ORD_WTSave 65 + HCTX API WTRestore(HWND, LPVOID, BOOL); + #define ORD_WTRestore 66 + #endif + + #ifndef NOWTQUEUEFXNS + /* ADVANCED PACKET AND QUEUE FUNCTIONS */ + int API WTPacketsPeek(HCTX, int, LPVOID); + #define ORD_WTPacketsPeek 80 + int API WTDataGet(HCTX, UINT, UINT, int, LPVOID, LPINT); + #define ORD_WTDataGet 81 + int API WTDataPeek(HCTX, UINT, UINT, int, LPVOID, LPINT); + #define ORD_WTDataPeek 82 +#ifndef WIN32 +/* OBSOLETE IN WIN32! */ + DWORD API WTQueuePackets(HCTX); + #define ORD_WTQueuePackets 83 +#endif + int API WTQueueSizeGet(HCTX); + #define ORD_WTQueueSizeGet 84 + BOOL API WTQueueSizeSet(HCTX, int); + #define ORD_WTQueueSizeSet 85 + #endif + + #ifndef NOWTHMGRFXNS + /* MANAGER HANDLE FUNCTIONS */ + HMGR API WTMgrOpen(HWND, UINT); + #define ORD_WTMgrOpen 100 + BOOL API WTMgrClose(HMGR); + #define ORD_WTMgrClose 101 + #endif + + #ifndef NOWTMGRCTXFXNS + /* MANAGER CONTEXT FUNCTIONS */ + BOOL API WTMgrContextEnum(HMGR, WTENUMPROC, LPARAM); + #define ORD_WTMgrContextEnum 120 + HWND API WTMgrContextOwner(HMGR, HCTX); + #define ORD_WTMgrContextOwner 121 + HCTX API WTMgrDefContext(HMGR, BOOL); + #define ORD_WTMgrDefContext 122 + HCTX API WTMgrDefContextEx(HMGR, UINT, BOOL); /* 1.1 */ + #define ORD_WTMgrDefContextEx 206 + #endif + + #ifndef NOWTMGRCONFIGFXNS + /* MANAGER CONFIG BOX FUNCTIONS */ + UINT API WTMgrDeviceConfig(HMGR, UINT, HWND); + #define ORD_WTMgrDeviceConfig 140 +#ifndef WIN32 +/* OBSOLETE IN WIN32! */ + BOOL API WTMgrConfigReplace(HMGR, BOOL, WTCONFIGPROC); + #define ORD_WTMgrConfigReplace 141 +#endif + #endif + + #ifndef NOWTMGRHOOKFXNS + /* MANAGER PACKET HOOK FUNCTIONS */ +#ifndef WIN32 +/* OBSOLETE IN WIN32! */ + WTHOOKPROC API WTMgrPacketHook(HMGR, BOOL, int, WTHOOKPROC); + #define ORD_WTMgrPacketHook 160 + LRESULT API WTMgrPacketHookDefProc(int, WPARAM, LPARAM, LPWTHOOKPROC); + #define ORD_WTMgrPacketHookDefProc 161 +#endif + #endif + + #ifndef NOWTMGRPREFFXNS + /* MANAGER PREFERENCE DATA FUNCTIONS */ + BOOL API WTMgrExt(HMGR, UINT, LPVOID); + #define ORD_WTMgrExt 180 + BOOL API WTMgrCsrEnable(HMGR, UINT, BOOL); + #define ORD_WTMgrCsrEnable 181 + BOOL API WTMgrCsrButtonMap(HMGR, UINT, LPBYTE, LPBYTE); + #define ORD_WTMgrCsrButtonMap 182 + BOOL API WTMgrCsrPressureBtnMarks(HMGR, UINT, DWORD, DWORD); + #define ORD_WTMgrCsrPressureBtnMarks 183 + BOOL API WTMgrCsrPressureResponse(HMGR, UINT, UINT FAR *, UINT FAR *); + #define ORD_WTMgrCsrPressureResponse 184 + BOOL API WTMgrCsrExt(HMGR, UINT, UINT, LPVOID); + #define ORD_WTMgrCsrExt 185 + #endif + +/* Win32 replacements for non-portable functions. */ + #ifndef NOWTQUEUEFXNS + /* ADVANCED PACKET AND QUEUE FUNCTIONS */ + BOOL API WTQueuePacketsEx(HCTX, UINT FAR *, UINT FAR *); + #define ORD_WTQueuePacketsEx 200 + #endif + + #ifndef NOWTMGRCONFIGFXNS + /* MANAGER CONFIG BOX FUNCTIONS */ +#ifdef WIN32 + BOOL API WTMgrConfigReplaceExA(HMGR, BOOL, LPSTR, LPSTR); + #define ORD_WTMgrConfigReplaceExA 202 + BOOL API WTMgrConfigReplaceExW(HMGR, BOOL, LPWSTR, LPSTR); + #define ORD_WTMgrConfigReplaceExW 1202 + #ifdef UNICODE + #define WTMgrConfigReplaceEx WTMgrConfigReplaceExW + #define ORD_WTMgrConfigReplaceEx ORD_WTMgrConfigReplaceExW + #else + #define WTMgrConfigReplaceEx WTMgrConfigReplaceExA + #define ORD_WTMgrConfigReplaceEx ORD_WTMgrConfigReplaceExA + #endif /* !UNICODE */ +#else + BOOL API WTMgrConfigReplaceEx(HMGR, BOOL, LPSTR, LPSTR); + #define ORD_WTMgrConfigReplaceEx 202 +#endif + #endif + + #ifndef NOWTMGRHOOKFXNS + /* MANAGER PACKET HOOK FUNCTIONS */ +#ifdef WIN32 + HWTHOOK API WTMgrPacketHookExA(HMGR, int, LPSTR, LPSTR); + #define ORD_WTMgrPacketHookExA 203 + HWTHOOK API WTMgrPacketHookExW(HMGR, int, LPWSTR, LPSTR); + #define ORD_WTMgrPacketHookExW 1203 + #ifdef UNICODE + #define WTMgrPacketHookEx WTMgrPacketHookExW + #define ORD_WTMgrPacketHookEx ORD_WTMgrPacketHookExW + #else + #define WTMgrPacketHookEx WTMgrPacketHookExA + #define ORD_WTMgrPacketHookEx ORD_WTMgrPacketHookExA + #endif /* !UNICODE */ +#else + HWTHOOK API WTMgrPacketHookEx(HMGR, int, LPSTR, LPSTR); + #define ORD_WTMgrPacketHookEx 203 +#endif + BOOL API WTMgrPacketUnhook(HWTHOOK); + #define ORD_WTMgrPacketUnhook 204 + LRESULT API WTMgrPacketHookNext(HWTHOOK, int, WPARAM, LPARAM); + #define ORD_WTMgrPacketHookNext 205 + #endif + + #ifndef NOWTMGRPREFFXNS + /* MANAGER PREFERENCE DATA FUNCTIONS */ + BOOL API WTMgrCsrPressureBtnMarksEx(HMGR, UINT, UINT FAR *, UINT FAR *); + #define ORD_WTMgrCsrPressureBtnMarksEx 201 + #endif + + + +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* #define _INC_WINTAB */ + |