summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpingc <pingc>2007-04-17 21:37:14 +0000
committerpingc <pingc>2007-04-17 21:37:14 +0000
commit2fe7d4bde4c99a5a91eab4f2eb15c412debb9993 (patch)
tree795f993204ee8daafb88a2f2e2dd07684d5e2129
parent63fb0ef1f39ce9d33e27ab3c3ca282528d2d7d34 (diff)
downloadxf86-input-wacom-release-0_7_7-8.tar.gz
Updated xsetwacom and fixed bug 1675567release-0_7_7-8release-0.7.7-8
-rw-r--r--ChangeLog11
-rw-r--r--acinclude.m48
-rw-r--r--configure.in5
-rw-r--r--src/Makefile.am4
-rwxr-xr-xsrc/include/Xwacom.h1
-rwxr-xr-xsrc/util/xsetwacom.c11
-rw-r--r--src/wacom.4x48
-rwxr-xr-xsrc/xdrv/wcmCommon.c4
-rwxr-xr-xsrc/xdrv/wcmConfig.c42
-rwxr-xr-xsrc/xdrv/xf86Wacom.c135
-rwxr-xr-xsrc/xdrv/xf86Wacom.h29
11 files changed, 177 insertions, 121 deletions
diff --git a/ChangeLog b/ChangeLog
index 107a624..0688d6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-04-17 Ping Cheng <pingc@wacom.com>
+ * Prepared for toggling CoreEvent option
+ * Fixed bug 1698123
+
+2007-03-30 Ping Cheng <pingc@wacom.com>
+ * Updated acinclude.m4 to default to system running kernel
+
+2007-03-29 Ping Cheng <pingc@wacom.com>
+ * Incorporated patch 1680163 from Magnus Vigerlöf
+ * Updated wacom man page, wacom.4x
+
2007-03-21 Ping Cheng <pingc@wacom.com>
* Updated wacomcpl with new xsetwacom command
* Removed xsetwacom GetModel option
diff --git a/acinclude.m4 b/acinclude.m4
index 3784160..7113bbd 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -210,6 +210,14 @@ if test x$WCM_ENV_KERNEL = xyes; then
UTS_PATH="$WCM_KERNELDIR/include/linux/utsrelease.h"
MODUTS=`grep UTS_RELEASE $UTS_PATH`
fi
+ if test "x$MODUTS" = x; then
+ echo "***"
+ echo "*** WARNING:"
+ echo "*** Can not identify your kernel source version"
+ echo "*** Use your current running kernel version instead"
+ echo "***"
+ MODUTS=`uname -r`
+ fi
if test "x$MODUTS" != x; then
WCM_OPTION_MODVER=yes
AC_MSG_RESULT(yes)
diff --git a/configure.in b/configure.in
index 9df1850..3258bd5 100644
--- a/configure.in
+++ b/configure.in
@@ -511,11 +511,6 @@ if test $kver != 0; then
fi
fi
-dnl Create man page file for the current driver
-if test -f src/wacom.4x; then
- gzip -f src/wacom.4x
-fi
-
dnl Separate test output from file-generation output
echo
diff --git a/src/Makefile.am b/src/Makefile.am
index bd0c463..9771b82 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,3 +4,7 @@ wmanpagedir = /usr/share/man/man4
wmanpage_HEADERS = wacom.4x.gz
EXTRA_DIST = wacom.4x
+
+$(wmanpage_HEADERS): $(EXTRA_DIST)
+ rm -f $(wmanpage_HEADERS)
+ gzip -c < $(EXTRA_DIST) > $(wmanpage_HEADERS)
diff --git a/src/include/Xwacom.h b/src/include/Xwacom.h
index 6ca7b81..f8bafcb 100755
--- a/src/include/Xwacom.h
+++ b/src/include/Xwacom.h
@@ -35,6 +35,7 @@
#define XWACOM_PARAM_TPCBUTTON 8
#define XWACOM_PARAM_CURSORPROX 9
#define XWACOM_PARAM_ROTATE 10
+#define XWACOM_PARAM_COREEVENT 11
/* The followings are defined together */
#define XWACOM_PARAM_BUTTON1 101
#define XWACOM_PARAM_BUTTON2 102
diff --git a/src/util/xsetwacom.c b/src/util/xsetwacom.c
index b3806a2..3f048d3 100755
--- a/src/util/xsetwacom.c
+++ b/src/util/xsetwacom.c
@@ -27,10 +27,11 @@
** 2007-01-10 0.0.8 - PC - don't display uninitialized tools
** 2007-02-07 0.0.9 - PC - support keystrokes
** 2007-02-22 0.1.0 - PC - support wheels and strips
+** 2007-04-12 0.1.1 - PC - Support CoreEvent on/off
**
****************************************************************************/
-#define XSETWACOM_VERSION "0.1.0"
+#define XSETWACOM_VERSION "0.1.1"
#include "wacomcfg.h"
#include "../include/Xwacom.h" /* give us raw access to parameter values */
@@ -431,6 +432,12 @@ static PARAMINFO gParamInfo[] =
XWACOM_VALUE_ROTATE_HALF, SINGLE_VALUE,
XWACOM_VALUE_ROTATE_NONE },
+ { "CoreEvent",
+ "Turns on/off device to send core event. "
+ "default is decided by X driver and xorg.conf ",
+ XWACOM_PARAM_COREEVENT, VALUE_OPTIONAL,
+ RANGE, 0, 1, BOOLEAN_VALUE },
+
{ "ToolID",
"Returns the ID of the associated device. ",
XWACOM_PARAM_TOOLID, VALUE_REQUIRED },
@@ -901,7 +908,7 @@ static void DisplayValue (WACOMDEVICE *hDev, const char *devname, PARAMINFO *p,
else
{
if ((p->nParamID >= XWACOM_PARAM_BUTTON1) &&
- (p->nParamID >= XWACOM_PARAM_STRIPRDN) &&
+ (p->nParamID <= XWACOM_PARAM_STRIPRDN) &&
((value & AC_TYPE) != AC_BUTTON))
printf ("This %s option is only an xsetwacom command \n", p->pszParam);
else
diff --git a/src/wacom.4x b/src/wacom.4x
index 6de9c29..2af9c9c 100644
--- a/src/wacom.4x
+++ b/src/wacom.4x
@@ -1,7 +1,7 @@
.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/wacom.man,v 1.1 2001/01/24 00:06:39 dawes Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
-.TH WACOM 4 "linuxwacom 0.7.6" "X Version 11"
+.TH WACOM 4 "linuxwacom 0.7.8" "X Version 11"
.SH NAME
wacom \- Wacom input driver
.SH SYNOPSIS
@@ -37,13 +37,11 @@ supports the following entries:
.RS 8
.TP 4
.B Option \fI"Type"\fP \fI"stylus"|"eraser"|"cursor"|"pad"\fP
-sets the type of tool the device represents. This option is mandatory. "pad" is
-for Intuos 3, Cintiq 21UX, or Graphire 4 ExpressKeys only. It is required
-for Intuos 3, Cintiq 21UX, or Graphire 4 if your application supports
-ExpressKeys
-features. "pad" is reported as a second tool in the driver. Since it will
-not move the system's cursor, IT SHOULD NOT have any of those core options,
-such as "SendCoreEvents" or "AlwaysCore".
+sets the type of tool the device represents. This option is mandatory. The core options, such as "SendCoreEvents" or "AlwaysCore", are
+unnecessary in Gimp if you don't need to move system cursor outside
+of Gimp drawing area. "pad" is for Intuos 3, Cintiq 21UX, or
+Graphire 4 ExpressKeys only. It is required for Intuos3, Cintiq 21UX, and Graphire 4 if your application supports ExpressKeys
+features. "pad" is reported as a second tool in the driver.
.TP 4
.B Option \fI"Device"\fP \fI"path"\fP
sets the path to the special file which represents serial line where
@@ -80,45 +78,49 @@ greater than suppress;
the change between the current degree of rotation and the previous
one of the transducer is greater than suppress;
- the change between the current wheel value and the previous one is
-equal to or greater than suppress;
+ the change between the current absolute wheel value and the previous
+one is equal to or greater than suppress;
+
+ the change between the current tilt value and the previous one is equal
+to or greater than suppress (if tilt is supported);
+
+ relative wheel value has changed;
button value has changed;
proximity has changed.
.TP 4
.B Option \fI"Mode"\fP \fI"Relative"|"Absolute"\fP
-sets the mode of the device.
+sets the mode of the device. The default value for stylus and
+eraser is Absolute; cursor is Relative; pad mode is decided
+according to its core option due to its nature of not moving
+system cursor: Relative if it is a core device; Absolute, otherwise.
.TP 4
.B Option \fI"TopX"\fP \fI"number"\fP
-X coordinate of the top corner of the active zone.
+X coordinate of the top corner of the active zone. Default to 0.
.TP 4
.B Option \fI"TopY"\fP \fI"number"\fP
-Y coordinate of the top corner of the active zone.
+Y coordinate of the top corner of the active zone. Default to 0.
.TP 4
.B Option \fI"BottomX"\fP \fI"Inumber"\fP
-X coordinate of the bottom corner of the active zone.
+X coordinate of the bottom corner of the active zone. Default to width of the tablet.
.TP 4
.B Option \fI"BottomY"\fP \fI"number"\fP
-Y coordinate of the bottom corner of the active zone.
+Y coordinate of the bottom corner of the active zone. Default to height of the tablet.
.TP 4
.B Option \fI"ButtonsOnly"\fP \fI"on"\fP
-disables the device's motion events.
+disables the device's motion events. Default to off.
.TP 4
.B Option \fI"ButtonM"\fP \fI"AC"\fP
reports an action AC when button M is pressed, where M
is one of the device supported button numbers, it can be 1
-to 32. The default action reported to Xinput is mouse button M click.
-To assign it to a left-double-click, use "dblclick 1".
+to 32. The default action reported to Xinput is mouse button M click.
To ignore the button click, i.e., to not report any button click event
-to Xinput, use "0" or "button 0". Use "modetoggle" to assign
-it to switching between relative and absolute mode, which is
-useful to switch windows in a multi-monitor environment.
+to Xinput, use "0" or "button 0".
.TP 4
.B Option \fI"TPCButton"\fP \fI"on"\fP
enables the stylus buttons as Tablet PC buttons, i.e., reports stylus button
-event only when its tip is pressed. Default to "on" for Tablet PC; "off" for
-all the other models.
+event only when its tip is pressed. Default to "on" for Tablet PC; "off" for all other models.
.TP 4
.B Option \fI"Speed"\fP \fI"Rspeed"\fP
sets the cursor's relative movement speed to Rspeed. The default value is 1.0.
diff --git a/src/xdrv/wcmCommon.c b/src/xdrv/wcmCommon.c
index b0296db..cf36675 100755
--- a/src/xdrv/wcmCommon.c
+++ b/src/xdrv/wcmCommon.c
@@ -416,7 +416,7 @@ static void sendAButton(LocalDevicePtr local, int button, int mask,
WacomDevicePtr priv = (WacomDevicePtr) local->private;
WacomCommonPtr common = priv->common;
int is_absolute = priv->flags & ABSOLUTE_FLAG;
- int is_core = local->flags & XI86_ALWAYS_CORE;
+ int is_core = local->flags & (XI86_ALWAYS_CORE | XI86_CORE_POINTER);
int i, button_idx, naxes = priv->naxes;
if (IsPad(priv))
@@ -536,7 +536,7 @@ static void sendWheelStripEvents(LocalDevicePtr local, const WacomDeviceState* d
int fakeButton = 0, i, value = 0, naxes = priv->naxes;
unsigned *keyP = 0;
int is_absolute = priv->flags & ABSOLUTE_FLAG;
- int is_core = local->flags & XI86_ALWAYS_CORE;
+ int is_core = local->flags & (XI86_ALWAYS_CORE | XI86_CORE_POINTER);
DBG(10, ErrorF("sendWheelStripEvents for %s \n", local->name));
diff --git a/src/xdrv/wcmConfig.c b/src/xdrv/wcmConfig.c
index efebcf6..d20da88 100755
--- a/src/xdrv/wcmConfig.c
+++ b/src/xdrv/wcmConfig.c
@@ -38,18 +38,18 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag)
WacomToolPtr tool;
WacomToolAreaPtr area;
- priv = (WacomDevicePtr) xalloc(sizeof(WacomDeviceRec));
+ priv = (WacomDevicePtr) xcalloc(1, sizeof(WacomDeviceRec));
if (!priv)
return NULL;
- common = (WacomCommonPtr) xalloc(sizeof(WacomCommonRec));
+ common = (WacomCommonPtr) xcalloc(1, sizeof(WacomCommonRec));
if (!common)
{
xfree(priv);
return NULL;
}
- tool = (WacomToolPtr) xalloc(sizeof(WacomTool));
+ tool = (WacomToolPtr) xcalloc(1, sizeof(WacomTool));
if(!tool)
{
xfree(priv);
@@ -57,7 +57,7 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag)
return NULL;
}
- area = (WacomToolAreaPtr) xalloc(sizeof(WacomToolArea));
+ area = (WacomToolAreaPtr) xcalloc(1, sizeof(WacomToolArea));
if(!area)
{
xfree(tool);
@@ -66,7 +66,7 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag)
return NULL;
}
- local = xf86AllocateInput(gWacomModule.v4.wcmDrv, 0);
+ local = xf86AllocateInput(gWacomModule.wcmDrv, 0);
if (!local)
{
xfree(area);
@@ -93,8 +93,9 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag)
local->history_size = 0;
local->old_x = -1;
local->old_y = -1;
-
- memset(priv,0,sizeof(*priv));
+
+ priv->next = NULL;
+ priv->local = local;
priv->flags = flag; /* various flags (device type, absolute, first touch...) */
priv->oldX = 0; /* previous X position */
priv->oldY = 0; /* previous Y position */
@@ -171,14 +172,10 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag)
priv->throttleStart = 0;
priv->throttleLimit = -1;
- memset(common,0,sizeof(*common));
- memset(common->wcmChannel, 0, sizeof(common->wcmChannel));
common->wcmDevice = ""; /* device file name */
common->wcmSuppress = DEFAULT_SUPPRESS; /* transmit position if increment is superior */
common->wcmFlags = RAW_FILTERING_FLAG; /* various flags */
- common->wcmDevices = (LocalDevicePtr*) xalloc(sizeof(LocalDevicePtr));
- common->wcmDevices[0] = local;
- common->wcmNumDevices = 1; /* number of devices */
+ common->wcmDevices = priv;
common->wcmMaxX = 0; /* max X value */
common->wcmMaxY = 0; /* max Y value */
common->wcmMaxZ = 0; /* max Z value */
@@ -377,14 +374,10 @@ static Bool xf86WcmMatchDevice(LocalDevicePtr pMatch, LocalDevicePtr pLocal)
privMatch->common->wcmEraserID=pLocal->name;
}
}
- xfree(common->wcmDevices);
xfree(common);
common = priv->common = privMatch->common;
- common->wcmNumDevices++;
- common->wcmDevices = (LocalDevicePtr *)xrealloc(
- common->wcmDevices,
- sizeof(LocalDevicePtr) * common->wcmNumDevices);
- common->wcmDevices[common->wcmNumDevices - 1] = pLocal;
+ priv->next = common->wcmDevices;
+ common->wcmDevices = priv;
return 1;
}
return 0;
@@ -405,7 +398,7 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags)
WacomToolPtr tool = NULL;
WacomToolAreaPtr area = NULL;
- gWacomModule.v4.wcmDrv = drv;
+ gWacomModule.wcmDrv = drv;
fakeLocal = (LocalDevicePtr) xcalloc(1, sizeof(LocalDeviceRec));
if (!fakeLocal)
@@ -512,12 +505,11 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags)
* Always in absolute mode when it is not a core device.
*/
if (IsPad(priv))
- {
- if (local->flags & (XI86_ALWAYS_CORE | XI86_CORE_POINTER))
- priv->flags &= ~ABSOLUTE_FLAG;
- else
- priv->flags |= ABSOLUTE_FLAG;
- }
+ xf86WcmSetPadCoreMode(local);
+
+ /* Store original local Core flag so it can be changed later */
+ if (local->flags & (XI86_ALWAYS_CORE | XI86_CORE_POINTER))
+ priv->flags |= COREEVENT_FLAG;
xf86Msg(X_CONFIG, "%s is in %s mode\n", local->name,
(priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative");
diff --git a/src/xdrv/xf86Wacom.c b/src/xdrv/xf86Wacom.c
index 0c9055b..b9e7ec3 100755
--- a/src/xdrv/xf86Wacom.c
+++ b/src/xdrv/xf86Wacom.c
@@ -58,9 +58,10 @@
* 2007-01-31 47-pc0.7.7-3 - multiarea support
* 2007-02-09 47-pc0.7.7-5 - Support keystrokes
* 2007-03-28 47-pc0.7.7-7 - multiarea support
+ * 2007-03-29 47-pc0.7.7-8 - clean up code
*/
-static const char identification[] = "$Identification: 47-0.7.7-7 $";
+static const char identification[] = "$Identification: 47-0.7.7-8 $";
/****************************************************************************/
@@ -84,9 +85,9 @@ extern int usbWcmGetRanges(LocalDevicePtr local);
WacomModule gWacomModule =
{
- 0, /* debug level */
+ 0, /* debug level */
identification, /* version */
- { NULL, }, /* input driver pointer */
+ NULL, /* input driver pointer */
/* device procedures */
xf86WcmDevOpen,
@@ -212,7 +213,6 @@ static int xf86WcmInitArea(LocalDevicePtr local)
/* The first one in the list is always valid */
if (area != inlist && xf86WcmAreaListOverlap(area, inlist))
{
- int i, j;
inlist = priv->tool->arealist;
/* remove this area from the list */
@@ -223,20 +223,21 @@ static int xf86WcmInitArea(LocalDevicePtr local)
inlist->next = area->next;
xfree(area);
priv->toolarea = NULL;
- break;
+ break;
}
}
/* Remove this device from the common struct */
- i = 0;
- while (i<common->wcmNumDevices && common->wcmDevices[i] != local)
- i++;
- for (j=i; j<common->wcmNumDevices-1; j++)
+ if (common->wcmDevices == priv)
+ common->wcmDevices = priv->next;
+ else
{
- common->wcmDevices[j] = common->wcmDevices[j+1];
+ WacomDevicePtr tmp = common->wcmDevices;
+ while(tmp->next && tmp->next != priv)
+ tmp = tmp->next;
+ if(tmp)
+ tmp->next = priv->next;
}
- common->wcmDevices[common->wcmNumDevices-1] = NULL;
- common->wcmNumDevices--;
xf86Msg(X_ERROR, "%s: Top/Bottom area overlaps with another devices.\n",
local->conf_idev->identifier);
return FALSE;
@@ -561,14 +562,15 @@ void xf86WcmReadPacket(LocalDevicePtr local)
if (len <= 0)
{
- /* In case of error, we assume the device has been
+ /* In case of error, we assume the device has been
* disconnected. So we close it and iterate over all
* wcmDevices to actually close associated devices. */
- for (cnt=0; cnt<common->wcmNumDevices; cnt++)
- {
- if (common->wcmDevices[cnt]->fd >= 0)
- xf86WcmDevProc(common->wcmDevices[cnt]->dev, DEVICE_OFF);
- }
+ WacomDevicePtr wDev = common->wcmDevices;
+ for(; wDev; wDev = wDev->next)
+ {
+ if (wDev->local->fd >= 0)
+ xf86WcmDevProc(wDev->local->dev, DEVICE_OFF);
+ }
ErrorF("Error reading wacom device : %s\n", strerror(errno));
return;
}
@@ -670,7 +672,7 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what)
/* All devices must be opened here to initialize and
* register even a 'pad' which doesn't "SendCoreEvents"
*/
- case DEVICE_INIT:
+ case DEVICE_INIT:
priv->wcmDevOpenCount = 0;
if (!xf86WcmDevOpen(pWcm))
{
@@ -712,6 +714,28 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what)
return Success;
}
+
+/*****************************************************************************
+ * xf86WcmSetPadCoreMode
+ ****************************************************************************/
+int xf86WcmSetPadCoreMode(LocalDevicePtr local)
+{
+ WacomDevicePtr priv = (WacomDevicePtr)local->private;
+ int is_core = local->flags & (XI86_ALWAYS_CORE | XI86_CORE_POINTER);
+
+ /* Pad is always in relative mode when it's a core device.
+ * Always in absolute mode when it is not a core device.
+ */
+ DBG(10, ErrorF("xf86WcmSetParam Pad (%p) is always in %s mode " "when it %s core device\n", (void *)local->dev,
+ !is_core ? "absolute" : "relative",
+ is_core ? "is" : "isn't"));
+ if (is_core)
+ priv->flags &= ~ABSOLUTE_FLAG;
+ else
+ priv->flags |= ABSOLUTE_FLAG;
+ return Success;
+}
+
/*****************************************************************************
* xf86WcmSetParam
****************************************************************************/
@@ -722,7 +746,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
WacomCommonPtr common = priv->common;
WacomDevicePtr tmppriv;
char st[32];
- int oldRotation, dev;
+ int oldRotation;
int tmpTopX, tmpTopY, tmpBottomX, tmpBottomY, oldMaxX, oldMaxY;
WacomToolAreaPtr area = priv->toolarea;
WacomToolAreaPtr tmparea;
@@ -731,7 +755,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
* This eliminates some confusion when driver is running on
* default values.
*/
- switch (param)
+ switch (param)
{
case XWACOM_PARAM_TOPX:
if ( priv->topX != value)
@@ -845,18 +869,14 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
}
case XWACOM_PARAM_MODE:
{
- /* Pad's mode stays as is */
int is_absolute = priv->flags & ABSOLUTE_FLAG;
- if (IsPad(priv))
- {
- DBG(10, ErrorF("xf86WcmSetParam Pad (%p) is always in %s mode\n", (void *)local->dev, is_absolute ? "absolute" : "relative"));
- return Success;
- }
-
if ((value < 0) || (value > 1)) return BadValue;
if (value == is_absolute)
break;
+ if (IsPad(priv))
+ return xf86WcmSetPadCoreMode(local);
+
if (value)
{
priv->flags |= ABSOLUTE_FLAG;
@@ -931,6 +951,20 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
common->wcmCursorProxoutDist = value;
}
break;
+ case XWACOM_PARAM_COREEVENT:
+ if ((value != 0) && (value != 1)) return BadValue;
+ /* Change the local flags. But not the configure file */
+ if (value)
+ {
+ local->flags |= XI86_ALWAYS_CORE;
+/* xf86XInputSetSendCoreEvents (local, TRUE);
+*/ }
+ else
+ {
+ local->flags &= ~XI86_ALWAYS_CORE;
+/* xf86XInputSetSendCoreEvents (local, FALSE);
+*/ }
+ break;
case XWACOM_PARAM_ROTATE:
if ((value < 0) || (value > 3)) return BadValue;
switch(value) {
@@ -963,9 +997,8 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
}
/* rotate all devices at once! else they get misaligned */
- for (dev=0; dev < common->wcmNumDevices; dev++)
+ for (tmppriv = common->wcmDevices; tmppriv; tmppriv = tmppriv->next)
{
- tmppriv = (WacomDevicePtr)common->wcmDevices[dev]->private;
tmparea = tmppriv->toolarea;
/* recover the unrotated xy-rectangles */
switch (oldRotation) {
@@ -1020,17 +1053,17 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
tmparea->topY = tmppriv->topY = tmpTopY;
tmparea->bottomY = tmppriv->bottomY = tmpBottomY;
break;
- }
+ }
- xf86WcmInitialCordinates(common->wcmDevices[dev], 0);
- xf86WcmInitialCordinates(common->wcmDevices[dev], 1);
+ xf86WcmInitialCordinates(tmppriv->local, 0);
+ xf86WcmInitialCordinates(tmppriv->local, 1);
- xf86ReplaceIntOption(common->wcmDevices[dev]->options, "TopX", tmppriv->topX);
- xf86ReplaceIntOption(common->wcmDevices[dev]->options, "TopY", tmppriv->topY);
- xf86ReplaceIntOption(common->wcmDevices[dev]->options, "BottomX", tmppriv->bottomX);
- xf86ReplaceIntOption(common->wcmDevices[dev]->options, "BottomY", tmppriv->bottomY);
+ xf86ReplaceIntOption(tmppriv->local->options, "TopX", tmppriv->topX);
+ xf86ReplaceIntOption(tmppriv->local->options, "TopY", tmppriv->topY);
+ xf86ReplaceIntOption(tmppriv->local->options, "BottomX", tmppriv->bottomX);
+ xf86ReplaceIntOption(tmppriv->local->options, "BottomY", tmppriv->bottomY);
}
- break;
+ break;
default:
DBG(10, ErrorF("xf86WcmSetParam invalid param %d\n",param));
return BadMatch;
@@ -1056,11 +1089,11 @@ static int xf86WcmSetButtonParam(LocalDevicePtr local, int param, int value)
return BadValue;
else
{
- if ((!(value & AC_TYPE)) && (value != priv->button[bn - 1]))
+ if ((!(value & AC_TYPE)) && (value != priv->button[bn]))
{
snprintf (st, sizeof (st), "Button%d", bn);
xf86ReplaceIntOption (local->options, st, value);
- priv->button[bn - 1] = xf86SetIntOption (local->options, st, bn);
+ priv->button[bn] = xf86SetIntOption (local->options, st, bn);
}
setVal = &(priv->button [bn]);
keyP = priv->keys[bn];
@@ -1294,7 +1327,9 @@ static int xf86WcmGetParam(LocalDevicePtr local, int param)
(priv->nPressCtrl [3]);
return -1;
case XWACOM_PARAM_MODE:
- return (priv->flags & ABSOLUTE_FLAG) ? 1 : 0;
+ return ((priv->flags & ABSOLUTE_FLAG) ? 1 : 0);
+ case XWACOM_PARAM_COREEVENT:
+ return ((local->flags & (XI86_ALWAYS_CORE | XI86_CORE_POINTER)) ? 1 : 0);
case XWACOM_PARAM_SPEEDLEVEL:
return (priv->speed > 1) ?
(int) (priv->speed / 2) + 6 :
@@ -1440,7 +1475,7 @@ static int xf86WcmGetDefaultParam(LocalDevicePtr local, int param)
case XWACOM_PARAM_BUTTON5:
return (param - XWACOM_PARAM_BUTTON1 + 1);
case XWACOM_PARAM_MODE:
- if (IsCursor(priv) || IsPad(priv))
+ if (IsCursor(priv) || (IsPad(priv) && (priv->flags & COREEVENT_FLAG)))
return 0;
else
return 1;
@@ -1472,6 +1507,8 @@ static int xf86WcmGetDefaultParam(LocalDevicePtr local, int param)
if (IsCursor (priv))
return common->wcmCursorProxoutDistDefault;
return -1;
+ case XWACOM_PARAM_COREEVENT:
+ return ((priv->flags & COREEVENT_FLAG) ? 1 : 0);
}
DBG(10, ErrorF("xf86WcmGetDefaultParam invalid param %d\n",param));
return -1;
@@ -1489,20 +1526,20 @@ static int xf86WcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode)
DBG(3, ErrorF("xf86WcmSwitchMode dev=%p mode=%d\n", (void *)dev, mode));
- if (IsPad(priv))
- {
- DBG(10, ErrorF("xf86WcmSwitchMode Pad (%p) is always in %s mode\n", (void *)dev, is_absolute ? "absolute" : "relative"));
- return Success;
- }
+ /* Pad is always in relative mode when it's a core device.
+ * Always in absolute mode when it is not a core device.
+ */
+ if (IsPad(priv))
+ return xf86WcmSetPadCoreMode(local);
- if ((mode == Absolute) && !(priv->flags & ABSOLUTE_FLAG))
+ if ((mode == Absolute) && !is_absolute)
{
priv->flags |= ABSOLUTE_FLAG;
xf86ReplaceStrOption(local->options, "Mode", "Absolute");
xf86WcmInitialCordinates(local, 0);
xf86WcmInitialCordinates(local, 1);
}
- else if ((mode == Relative) && (priv->flags & ABSOLUTE_FLAG))
+ else if ((mode == Relative) && is_absolute)
{
priv->flags &= ~ABSOLUTE_FLAG;
xf86ReplaceStrOption(local->options, "Mode", "Relative");
diff --git a/src/xdrv/xf86Wacom.h b/src/xdrv/xf86Wacom.h
index 88b2548..32137f0 100755
--- a/src/xdrv/xf86Wacom.h
+++ b/src/xdrv/xf86Wacom.h
@@ -154,8 +154,6 @@
*****************************************************************************/
typedef struct _WacomModule WacomModule;
-typedef struct _WacomModule4 WacomModule4;
-typedef struct _WacomModule3 WacomModule3;
typedef struct _WacomModel WacomModel, *WacomModelPtr;
typedef struct _WacomDeviceRec WacomDeviceRec, *WacomDevicePtr;
typedef struct _WacomDeviceState WacomDeviceState, *WacomDeviceStatePtr;
@@ -171,17 +169,12 @@ typedef struct _WacomToolArea WacomToolArea, *WacomToolAreaPtr;
* global namespaces as clean as possible.
*****************************************************************************/
-struct _WacomModule4
-{
- InputDriverPtr wcmDrv;
-};
-
struct _WacomModule
{
int debugLevel;
const char* identification;
- WacomModule4 v4;
+ InputDriverPtr wcmDrv;
int (*DevOpen)(DeviceIntPtr pWcm);
void (*DevReadInput)(LocalDevicePtr local);
@@ -240,6 +233,7 @@ struct _WacomModel
#define BUTTONS_ONLY_FLAG 0x00000080
#define TPCBUTTONS_FLAG 0x00000100
#define TPCBUTTONONE_FLAG 0x00000200
+#define COREEVENT_FLAG 0x00000400
#define IsCursor(priv) (DEVICE_ID((priv)->flags) == CURSOR_ID)
#define IsStylus(priv) (DEVICE_ID((priv)->flags) == STYLUS_ID)
@@ -266,6 +260,9 @@ typedef enum { TV_NONE = 0, TV_ABOVE_BELOW = 1, TV_LEFT_RIGHT = 2 } tvMode;
struct _WacomDeviceRec
{
/* configuration fields */
+ struct _WacomDeviceRec *next;
+ LocalDevicePtr local;
+
unsigned int flags; /* various flags (type, abs, touch...) */
int topX; /* X top */
int topY; /* Y top */
@@ -279,7 +276,7 @@ struct _WacomDeviceRec
int screenTopY[32]; /* top cordinate of the associated screen */
int screenBottomX[32]; /* right cordinate of the associated screen */
int screenBottomY[32]; /* bottom cordinate of the associated screen */
- int button[MAX_BUTTONS];/* buttons assignments */
+ int button[MAX_BUTTONS];/* buttons assignments */
unsigned keys[MAX_BUTTONS][256]; /* keystrokes assigned to buttons */
int relup;
unsigned rupk[256]; /* keystrokes assigned to relative wheel up event (default is button 4) */
@@ -297,10 +294,10 @@ struct _WacomDeviceRec
unsigned srupk[256]; /* keystrokes assigned to right strip up event (default is button 4) */
int striprdn;
unsigned srdnk[256]; /* keystrokes assigned to right strip up event (default is button 4) */
- int nbuttons; /* number of buttons for this subdevice */
- int naxes; /* number of axes */
-
- WacomCommonPtr common; /* common info pointer */
+ int nbuttons; /* number of buttons for this subdevice */
+ int naxes; /* number of axes */
+
+ WacomCommonPtr common;/* common info pointer */
/* state fields */
int currentX; /* current X position */
@@ -498,8 +495,7 @@ struct _WacomCommonRec
int npadkeys; /* number of pad keys in the above array */
int padkey_code[MAX_BUTTONS];/* hardware codes for buttons */
- LocalDevicePtr* wcmDevices; /* array of devices sharing same port */
- int wcmNumDevices; /* number of devices */
+ WacomDevicePtr wcmDevices; /* list of devices sharing same port */
int wcmPktLength; /* length of a packet */
int wcmProtocolLevel; /* 4 for Wacom IV, 5 for Wacom V */
float wcmVersion; /* ROM version */
@@ -629,5 +625,8 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds);
Bool xf86WcmPointInArea(WacomToolAreaPtr area, int x, int y);
Bool xf86WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list);
+/* Change pad's mode according to it core event status */
+int xf86WcmSetPadCoreMode(LocalDevicePtr local);
+
/****************************************************************************/
#endif /* __XF86WACOM_H */