summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-12-15 12:11:12 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-12-17 09:56:06 +1000
commitb009e88c4ca2a72d286d15b44426150e792acd5d (patch)
tree9e6b436443964fd68d7a84e09fe885143fbcf554
parent1721220517c2e5d4833ea1bb116b10c1e4e2fa62 (diff)
downloadxf86-input-wacom-b009e88c4ca2a72d286d15b44426150e792acd5d.tar.gz
Fix up btnaction property setting.
Buggy behaviour meant that unsetting a property got never removed from the property handlers. Since we only support one action per button anyway, simply overwriting the current one is enough. The static array isn't enough either, it's shared within the driver, hence updating the property on one device will update it on the other. Move it into the priv struct. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/wcmXCommand.c21
-rw-r--r--src/xf86WacomDefs.h1
2 files changed, 5 insertions, 17 deletions
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 2ac7eed..563a42d 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -300,7 +300,6 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate;
WacomDevicePtr priv = (WacomDevicePtr) local->private;
WacomCommonPtr common = priv->common;
- static Atom btn_actions[WCM_MAX_MOUSE_BUTTONS] = { 0 };
DBG(10, priv->debugLevel, ErrorF("xf86WcmSetProperty for %s \n", local->name));
@@ -636,19 +635,7 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
{
/* any action property needs to be registered for this handler. */
for (i = 0; i < prop->size; i++)
- {
- if (!values[i])
- continue;
-
- for (j = 0; j < ARRAY_SIZE(btn_actions); j++)
- {
- if (!btn_actions[j])
- {
- btn_actions[j] = values[i];
- break;
- }
- }
- }
+ priv->btn_actions[i] = values[i];
for (i = 0; i < prop->size; i++)
{
@@ -668,11 +655,11 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
int i, j;
/* check all properties used for button actions */
- for (i = 0; i < ARRAY_SIZE(btn_actions); i++)
- if (!btn_actions[i] || btn_actions[i] == property)
+ for (i = 0; i < ARRAY_SIZE(priv->btn_actions); i++)
+ if (priv->btn_actions[i] == property)
break;
- if (i < ARRAY_SIZE(btn_actions))
+ if (i < ARRAY_SIZE(priv->btn_actions))
{
CARD32 *data;
int code;
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index f6144d0..2412692 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -251,6 +251,7 @@ struct _WacomDeviceRec
WacomToolAreaPtr toolarea; /* The area defined for this device */
int isParent; /* set to 1 if the device is not auto-hotplugged */
+ Atom btn_actions[WCM_MAX_BUTTONS]; /* property handlers to listen to */
};
/******************************************************************************