Commit 2eebf3c7 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

Enable Tablet support with both Tilt and Pressure.

parent 4e4460ea
......@@ -7410,9 +7410,11 @@ _ACEOF
for ac_header in X11/XKBlib.h \
X11/Xutil.h \
X11/extensions/shape.h \
X11/extensions/XInput.h \
X11/extensions/XShm.h \
X11/extensions/Xrandr.h \
X11/extensions/Xrender.h \
......@@ -14333,6 +14335,80 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
fi
echo "$as_me:$LINENO: checking for -lXi soname" >&5
echo $ECHO_N "checking for -lXi soname... $ECHO_C" >&6
if test "${ac_cv_lib_soname_Xi+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_get_soname_save_LIBS=$LIBS
LIBS="-lXi $X_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char XOpenDevice ();
int
main ()
{
XOpenDevice ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_soname_Xi=`$ac_cv_path_LDD conftest$ac_exeext | grep libXi\\.so | sed 's/^.*\(libXi\.so[^ ]*\).*$/\1/'`
if test "x$ac_cv_lib_soname_Xi" = "x"
then
ac_cv_lib_soname_Xi="libXi.so"
fi
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_soname_Xi="libXi.so"
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_get_soname_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_soname_Xi" >&5
echo "${ECHO_T}$ac_cv_lib_soname_Xi" >&6
if test "x$ac_cv_lib_soname_Xi" != xNONE
then
cat >>confdefs.h <<_ACEOF
#define SONAME_LIBXI "$ac_cv_lib_soname_Xi"
_ACEOF
fi
echo "$as_me:$LINENO: checking for -lXrender soname" >&5
echo $ECHO_N "checking for -lXrender soname... $ECHO_C" >&6
if test "${ac_cv_lib_soname_Xrender+set}" = set; then
......
......@@ -181,6 +181,7 @@ then
AC_CHECK_HEADERS([X11/XKBlib.h \
X11/Xutil.h \
X11/extensions/shape.h \
X11/extensions/XInput.h \
X11/extensions/XShm.h \
X11/extensions/Xrandr.h \
X11/extensions/Xrender.h \
......@@ -989,6 +990,7 @@ if test "$LIBEXT" = "so"
then
WINE_GET_SONAME(X11,XCreateWindow,[$X_LIBS $X_EXTRA_LIBS])
WINE_GET_SONAME(Xext,XextCreateExtension,[$X_LIBS -lX11 $X_EXTRA_LIBS])
WINE_GET_SONAME(Xi,XOpenDevice,[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
WINE_GET_SONAME(Xrender,XRenderQueryExtension,[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
WINE_GET_SONAME(freetype,FT_Init_FreeType,[$X_LIBS])
WINE_GET_SONAME(GL,glXQueryExtension,[$X_LIBS $X_EXTRA_LIBS])
......
......@@ -3,14 +3,15 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = wintab32.dll
IMPORTS = kernel32
IMPORTS = user32 kernel32
ALTNAMES = wintab.dll
SPEC_SRCS16 = $(ALTNAMES:.dll=.spec)
C_SRCS = \
context.c \
manager.c
manager.c \
wintab32.c
C_SRCS16 = \
wintab16.c
......
/*
* WinTab32 library
*
* Copyright 2003 CodeWeavers, Aric Stewart
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "wintab.h"
#include "wintab_internal.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wintab32);
HWND hwndDefault = NULL;
static const WCHAR
WC_TABLETCLASSNAME[] = {'W','i','n','e','T','a','b','l','e','t','C','l','a','s','s',0};
CRITICAL_SECTION csTablet;
int (*pLoadTabletInfo)(HWND hwnddefault) = NULL;
int (*pGetCurrentPacket)(LPWTPACKET packet) = NULL;
int (*pAttachEventQueueToTablet)(HWND hOwner) = NULL;
UINT (*pWTInfoA)(UINT wCategory, UINT nIndex, LPVOID lpOutput) = NULL;
static LRESULT WINAPI TABLET_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam);
static VOID TABLET_Register()
{
WNDCLASSW wndClass;
ZeroMemory(&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS;
wndClass.lpfnWndProc = TABLET_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hCursor = (HCURSOR)NULL;
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW +1);
wndClass.lpszClassName = WC_TABLETCLASSNAME;
RegisterClassW(&wndClass);
}
static VOID TABLET_Unregister()
{
UnregisterClassW(WC_TABLETCLASSNAME, (HINSTANCE)NULL);
}
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved)
{
static const WCHAR name[] = {'T','a','b','l','e','t',0};
HMODULE hx11drv;
TRACE("%p, %lx, %p\n",hInstDLL,fdwReason,lpReserved);
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
TRACE("Initialization\n");
InitializeCriticalSection(&csTablet);
hx11drv = GetModuleHandleA("x11drv.dll");
if (hx11drv)
{
pLoadTabletInfo = (void *)GetProcAddress(hx11drv, "LoadTabletInfo");
pAttachEventQueueToTablet = (void *)GetProcAddress(hx11drv, "AttachEventQueueToTablet");
pGetCurrentPacket = (void *)GetProcAddress(hx11drv, "GetCurrentPacket");
pWTInfoA = (void *)GetProcAddress(hx11drv, "WTInfoA");
TABLET_Register();
hwndDefault = CreateWindowW(WC_TABLETCLASSNAME, name,
WS_POPUPWINDOW,0,0,0,0,0,0,hInstDLL,0);
}
else
return FALSE;
break;
case DLL_PROCESS_DETACH:
TRACE("Detaching\n");
if (hwndDefault)
{
DestroyWindow(hwndDefault);
hwndDefault = 0;
}
TABLET_Unregister();
DeleteCriticalSection(&csTablet);
break;
}
return TRUE;
}
/*
* The window proc for the default TABLET window
*/
static LRESULT WINAPI TABLET_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
TRACE("Incomming Message 0x%x (0x%08x, 0x%08x)\n", uMsg, (UINT)wParam,
(UINT)lParam);
switch(uMsg)
{
case WM_NCCREATE:
return TRUE;
case WT_PACKET:
{
WTPACKET packet;
LPOPENCONTEXT handler;
pGetCurrentPacket(&packet);
handler = AddPacketToContextQueue(&packet,(HWND)lParam);
if (handler)
TABLET_PostTabletMessage(handler, WT_PACKET,
(WPARAM)packet.pkSerialNumber,
(LPARAM)handler->handle, FALSE);
break;
}
case WT_PROXIMITY:
{
LPOPENCONTEXT handler;
LPARAM prox;
handler = FindOpenContext((HWND)lParam);
if (handler)
{
prox = MAKELPARAM( wParam, 1 );
TABLET_PostTabletMessage(handler, WT_PROXIMITY,
(WPARAM)handler->handle, (LPARAM)prox,
TRUE);
}
break;
}
}
return 0;
}
/*
* Tablet header
*
* Copyright 2003 CodeWeavers (Aric Stewart)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_WINTAB_INTERNAL_H
#define __WINE_WINTAB_INTERNAL_H
typedef struct tagWTI_INTERFACE_INFO {
CHAR WINTABID[1024];
/* a copy of the null-terminated tablet hardware identification string
* in the user buffer. This string should include make, model, and
* revision information in user-readable format.
*/
WORD SPECVERSION;
/* the specification version number. The high-order byte contains the
* major version number; the low-order byte contains the minor version
* number.
*/
WORD IMPLVERSION;
/* the implementation version number. The high-order byte contains the
* major version number; the low-order byte contains the minor version
* number.
*/
UINT NDEVICES;
/* the number of devices supported. */
UINT NCURSORS;
/* the total number of cursor types supported. */
UINT NCONTEXTS;
/* the number of contexts supported. */
UINT CTXOPTIONS;
/* flags indicating which context options are supported */
UINT CTXSAVESIZE;
/* the size of the save information returned from WTSave.*/
UINT NEXTENSIONS;
/* the number of extension data items supported.*/
UINT NMANAGERS;
/* the number of manager handles supported.*/
}WTI_INTERFACE_INFO, *LPWTI_INTERFACE_INFO;
typedef struct tagWTI_STATUS_INFO{
UINT CONTEXTS;
/* the number of contexts currently open.*/
UINT SYSCTXS;
/* the number of system contexts currently open.*/
UINT PKTRATE;
/* the maximum packet report rate currently being received by any
* context, in Hertz.
*/
WTPKT PKTDATA;
/* a mask indicating which packet data items are requested by at
* least one context.
*/
UINT MANAGERS;
/* the number of manager handles currently open.*/
BOOL SYSTEM;
/* a non-zero value if system pointing is available to the whole
* screen; zero otherwise.
*/
DWORD BUTTONUSE;
/* a button mask indicating the logical buttons whose events are
* requested by at least one context.
*/
DWORD SYSBTNUSE;
/* a button mask indicating which logical buttons are assigned a system
* button function by the current cursor's system button map.
*/
} WTI_STATUS_INFO, *LPWTI_STATUS_INFO;
typedef struct tagWTI_EXTENSIONS_INFO
{
CHAR NAME[256];
/* a unique, null-terminated string describing the extension.*/
UINT TAG;
/* a unique identifier for the extension. */
WTPKT MASK;
/* a mask that can be bitwise OR'ed with WTPKT-type variables to select
* the extension.
*/
UINT SIZE[2];
/* an array of two UINTs specifying the extension's size within a packet
* (in bytes). The first is for absolute mode; the second is for
* relative mode.
*/
AXIS *AXES;
/* an array of axis descriptions, as needed for the extension. */
BYTE *DEFAULT;
/* the current global default data, as needed for the extension. This
* data is modified via the WTMgrExt function.
*/
BYTE *DEFCONTEXT;
BYTE *DEFSYSCTX;
/* the current default context-specific data, as needed for the
* extension. The indices identify the digitizing- and system-context
* defaults, respectively.
*/
BYTE *CURSORS;
/* Is the first of one or more consecutive indices, one per cursor type.
* Each returns the current default cursor-specific data, as need for
* the extension. This data is modified via the WTMgrCsrExt function.
*/
} WTI_EXTENSIONS_INFO, *LPWTI_EXTENSIONS_INFO;
typedef struct tagWTPACKET {
HCTX pkContext;
UINT pkStatus;
LONG pkTime;
WTPKT pkChanged;
UINT pkSerialNumber;
UINT pkCursor;
DWORD pkButtons;
DWORD pkX;
DWORD pkY;
DWORD pkZ;
UINT pkNormalPressure;
UINT pkTangentPressure;
ORIENTATION pkOrientation;
ROTATION pkRotation; /* 1.1 */
} WTPACKET, *LPWTPACKET;
typedef struct tagOPENCONTEXT
{
HCTX handle;
LOGCONTEXTA context;
HWND hwndOwner;
BOOL enabled;
INT ActiveCursor;
INT QueueSize;
INT PacketsQueued;
LPWTPACKET PacketQueue;
struct tagOPENCONTEXT *next;
} OPENCONTEXT, *LPOPENCONTEXT;
int TABLET_PostTabletMessage(LPOPENCONTEXT newcontext, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL send_always);
LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd);
LPOPENCONTEXT FindOpenContext(HWND hwnd);
/* X11drv functions */
extern int (*pLoadTabletInfo)(HWND hwnddefault);
extern int (*pGetCurrentPacket)(LPWTPACKET packet);
extern int (*pAttachEventQueueToTablet)(HWND hOwner);
extern UINT (*pWTInfoA)(UINT wCategory, UINT nIndex, LPVOID lpOutput);
extern HWND hwndDefault;
extern CRITICAL_SECTION csTablet;
#endif /* __WINE_WINTAB_INTERNAL_H */
......@@ -34,6 +34,7 @@ C_SRCS = \
text.c \
window.c \
winpos.c \
wintab.c \
x11ddraw.c \
x11drv_main.c \
xdnd.c \
......
......@@ -274,9 +274,18 @@ static void EVENT_ProcessEvent( XEvent *event )
if (!hWnd && event->type != PropertyNotify && event->type != MappingNotify)
WARN( "Got event %s for unknown Window %08lx\n",
event_names[event->type], event->xany.window );
else if (event->type <= MappingNotify)
TRACE("Got event %s for hwnd/window %p/%lx, GetFocus()=%p\n",
event_names[event->type], hWnd, event->xany.window, GetFocus() );
else
TRACE("Got event %s for hwnd %p\n",
event_names[event->type], hWnd );
TRACE("Got extension event for hwnd/window %p/%lx, GetFocus()=%p\n",
hWnd, event->xany.window, GetFocus() );
if (X11DRV_ProcessTabletEvent(hWnd, event))
{
TRACE("Return: filtered by tablet\n");
return;
}
switch(event->type)
{
......
......@@ -475,6 +475,8 @@ extern INPUT_TYPE X11DRV_EVENT_SetInputMethod(INPUT_TYPE type);
void X11DRV_EVENT_SetDGAStatus(HWND hwnd, int event_base) ;
#endif
extern int X11DRV_ProcessTabletEvent(HWND hwnd, XEvent *event);
/* x11drv private window data */
struct x11drv_win_data
{
......
......@@ -111,6 +111,12 @@
@ cdecl ShowWindow(long long) X11DRV_ShowWindow
@ cdecl SysCommandSizeMove(long long) X11DRV_SysCommandSizeMove
# WinTab32
@ cdecl AttachEventQueueToTablet(long) X11DRV_AttachEventQueueToTablet
@ cdecl GetCurrentPacket(ptr) X11DRV_GetCurrentPacket
@ cdecl LoadTabletInfo(long) X11DRV_LoadTabletInfo
@ cdecl WTInfoA(long long ptr) X11DRV_WTInfoA
# X11 locks
@ cdecl -norelay wine_tsx11_lock()
@ cdecl -norelay wine_tsx11_unlock()
......@@ -1195,6 +1195,11 @@
#undef HAVE_X11_EXTENSIONS_XF86VMODE_H
/*
Define to 1 if you have the <X11/extensions/XInput.h>
header file. */
#undef HAVE_X11_EXTENSIONS_XINPUT_H
/*
Define to 1 if you have the <X11/extensions/Xrandr.h>
header file. */
#undef HAVE_X11_EXTENSIONS_XRANDR_H
......@@ -1379,6 +1384,11 @@
#undef SONAME_LIBXEXT
/*
Define to the soname of the libXi library.
*/
#undef SONAME_LIBXI
/*
Define to the soname of the libXrender library.
*/
#undef SONAME_LIBXRENDER
......
......@@ -328,7 +328,9 @@ typedef struct tagAXIS {
#define CSR_MINPKTDATA 17 /* 1.1 */
#define CSR_MINBUTTONS 18 /* 1.1 */
#define CSR_CAPABILITIES 19 /* 1.1 */
#define CSR_MAX 19
/* from http://www.wacomeng.com/devsupport/ibmpc/wacomwindevfaq.html */
#define CSR_TYPE 20
#define CSR_MAX 20
#endif
......
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