summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-02-22 16:52:52 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-03-01 10:31:35 +1000
commitc21b6876b435bb34112956716fea14477ef9e8d7 (patch)
tree1818c6eeac51b7ba88a9296d59f1344ccc3d1f2b
parent632134f4697935ada00d72bc19286f551b42da53 (diff)
Export current tool ID in the property too
Previously, we exported old serial number, old tool ID and current serial number. Export the current tool ID as well. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com> Tested-by: Bastien Nocera <hadess@hadess.net>
-rw-r--r--include/wacom-properties.h6
-rw-r--r--src/wcmCommon.c6
-rw-r--r--src/wcmXCommand.c16
-rw-r--r--src/xf86Wacom.h2
-rw-r--r--src/xf86WacomDefs.h1
5 files changed, 19 insertions, 12 deletions
diff --git a/include/wacom-properties.h b/include/wacom-properties.h
index 0bb84b1..5565a85 100644
--- a/include/wacom-properties.h
+++ b/include/wacom-properties.h
@@ -33,8 +33,10 @@
/* 32 bit, 4 values */
#define WACOM_PROP_PRESSURECURVE "Wacom Pressurecurve"
-/* CARD32, 4 values, tablet id, old serial, old hw device id, current serial
- read-only */
+/* CARD32, 5 values, tablet id, old serial, old hw device id,
+ current serial, current device id
+ read-only
+ */
#define WACOM_PROP_SERIALIDS "Wacom Serial IDs"
/* CARD32, 1 value */
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 034a3a3..e8c1209 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -729,8 +729,8 @@ void wcmSendEvents(InputInfoPtr pInfo, const WacomDeviceState* ds)
return;
}
- if (priv->cur_serial != serial)
- wcmUpdateSerial(pInfo, serial);
+ if (priv->cur_serial != serial || priv->cur_device_id != id)
+ wcmUpdateSerial(pInfo, serial, id);
/* don't move the cursor when going out-prox */
if (!ds->proximity)
@@ -832,7 +832,7 @@ void wcmSendEvents(InputInfoPtr pInfo, const WacomDeviceState* ds)
priv->devReverseCount = 0;
priv->old_serial = serial;
priv->old_device_id = id;
- wcmUpdateSerial(pInfo, 0);
+ wcmUpdateSerial(pInfo, 0, 0);
}
}
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 0fd5664..57b3f20 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -190,7 +190,8 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo)
values[1] = priv->old_serial;
values[2] = priv->old_device_id;
values[3] = priv->cur_serial;
- prop_serials = InitWcmAtom(pInfo->dev, WACOM_PROP_SERIALIDS, XA_INTEGER, 32, 4, values);
+ values[4] = priv->cur_device_id;
+ prop_serials = InitWcmAtom(pInfo->dev, WACOM_PROP_SERIALIDS, XA_INTEGER, 32, 5, values);
values[0] = priv->serial;
prop_serial_binding = InitWcmAtom(pInfo->dev, WACOM_PROP_SERIAL_BIND, XA_INTEGER, 32, 1, values);
@@ -718,7 +719,7 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
* set it at runtime. If we get here from wcmUpdateSerial,
* we know the serial has ben set internally already, so we
* can reply with success. */
- if (prop->size == 4 && prop->format == 32)
+ if (prop->size == 5 && prop->format == 32)
if (((CARD32*)prop->data)[3] == priv->cur_serial)
return Success;
@@ -875,11 +876,12 @@ int wcmGetProperty (DeviceIntPtr dev, Atom property)
values[1] = priv->old_serial;
values[2] = priv->old_device_id;
values[3] = priv->cur_serial;
+ values[4] = priv->cur_device_id;
DBG(10, priv, "Update to serial: %d\n", priv->old_serial);
return XIChangeDeviceProperty(dev, property, XA_INTEGER, 32,
- PropModeReplace, 4,
+ PropModeReplace, 5,
values, FALSE);
}
@@ -892,14 +894,14 @@ serialTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg)
InputInfoPtr pInfo = arg;
WacomDevicePtr priv = pInfo->private;
XIPropertyValuePtr prop;
- CARD32 prop_value[4];
+ CARD32 prop_value[5];
int sigstate;
int rc;
sigstate = xf86BlockSIGIO();
rc = XIGetDeviceProperty(pInfo->dev, prop_serials, &prop);
- if (rc != Success || prop->format != 32 || prop->size != 4)
+ if (rc != Success || prop->format != 32 || prop->size != 5)
{
xf86Msg(X_ERROR, "%s: Failed to update serial number.\n",
pInfo->name);
@@ -908,6 +910,7 @@ serialTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg)
memcpy(prop_value, prop->data, sizeof(prop_value));
prop_value[3] = priv->cur_serial;
+ prop_value[4] = priv->cur_device_id;
XIChangeDeviceProperty(pInfo->dev, prop_serials, XA_INTEGER,
prop->format, PropModeReplace,
@@ -919,7 +922,7 @@ serialTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg)
}
void
-wcmUpdateSerial(InputInfoPtr pInfo, unsigned int serial)
+wcmUpdateSerial(InputInfoPtr pInfo, unsigned int serial, int id)
{
WacomDevicePtr priv = pInfo->private;
@@ -927,6 +930,7 @@ wcmUpdateSerial(InputInfoPtr pInfo, unsigned int serial)
return;
priv->cur_serial = serial;
+ priv->cur_device_id = id;
/* This function is called during SIGIO. Schedule timer for property
* event delivery outside of signal handler. */
diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h
index ad45529..639885e 100644
--- a/src/xf86Wacom.h
+++ b/src/xf86Wacom.h
@@ -168,7 +168,7 @@ extern int wcmGetProperty(DeviceIntPtr dev, Atom property);
extern int wcmDeleteProperty(DeviceIntPtr dev, Atom property);
extern void InitWcmDeviceProperties(InputInfoPtr pInfo);
extern void wcmUpdateRotationProperty(WacomDevicePtr priv);
-extern void wcmUpdateSerial(InputInfoPtr pInfo, unsigned int serial);
+extern void wcmUpdateSerial(InputInfoPtr pInfo, unsigned int serial, int id);
/* Utility functions */
extern Bool is_absolute(InputInfoPtr pInfo);
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 625b07e..f662131 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -226,6 +226,7 @@ struct _WacomDeviceRec
double factorY; /* Y factor */
unsigned int serial; /* device serial number this device takes (if 0, any serial is ok) */
unsigned int cur_serial; /* current serial in prox */
+ int cur_device_id; /* current device ID in prox */
int maxWidth; /* max active screen width in screen coords */
int maxHeight; /* max active screen height in screen coords */
int leftPadding; /* left padding for virtual tablet in device coordinates*/