summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wcmCommon.c21
-rw-r--r--src/x11/xf86Wacom.c9
-rw-r--r--src/xf86Wacom.h2
3 files changed, 15 insertions, 17 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 85c0b3b..87d8ecf 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -80,25 +80,16 @@ void set_absolute(WacomDevicePtr priv, Bool absolute)
* wcmDevSwitchModeCall --
*****************************************************************************/
-int wcmDevSwitchModeCall(WacomDevicePtr priv, int mode)
+Bool wcmDevSwitchModeCall(WacomDevicePtr priv, Bool absolute)
{
- DBG(3, priv, "to mode=%d\n", mode);
+ DBG(3, priv, "to mode=%s\n", absolute ? "absolute" : "relative");
/* Pad is always in absolute mode.*/
if (IsPad(priv))
- return (mode == Absolute) ? Success : XI_BadMode;
-
- if ((mode == Absolute) && !is_absolute(priv))
- set_absolute(priv, TRUE);
- else if ((mode == Relative) && is_absolute(priv))
- set_absolute(priv, FALSE);
- else if ( (mode != Absolute) && (mode != Relative))
- {
- DBG(10, priv, "invalid mode=%d\n", mode);
- return XI_BadMode;
- }
-
- return Success;
+ return absolute;
+ else
+ set_absolute(priv, absolute);
+ return TRUE;
}
diff --git a/src/x11/xf86Wacom.c b/src/x11/xf86Wacom.c
index d28541b..af8e5b9 100644
--- a/src/x11/xf86Wacom.c
+++ b/src/x11/xf86Wacom.c
@@ -838,14 +838,21 @@ out:
static int wcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode)
{
InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
+ Bool is_absolute = TRUE;
#ifdef DEBUG
WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
DBG(3, priv, "dev=%p mode=%d\n",
(void *)dev, mode);
#endif
+ if (mode != Absolute) {
+ if (mode != Relative)
+ return XI_BadMode;
+ is_absolute = FALSE;
+ }
+
/* Share this call with sendAButton in wcmCommon.c */
- return wcmDevSwitchModeCall(priv, mode);
+ return wcmDevSwitchModeCall(priv, is_absolute) ? Success : XI_BadMode;
}
static int preInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h
index 8cd121d..6c69a60 100644
--- a/src/xf86Wacom.h
+++ b/src/xf86Wacom.h
@@ -128,7 +128,7 @@ extern Bool wcmPreInitParseOptions(WacomDevicePtr priv, Bool is_primary, Bool is
extern Bool wcmPostInitParseOptions(WacomDevicePtr priv, Bool is_primary, Bool is_dependent);
extern int wcmParseSerials(WacomDevicePtr priv);
-extern int wcmDevSwitchModeCall(WacomDevicePtr priv, int mode);
+extern Bool wcmDevSwitchModeCall(WacomDevicePtr priv, Bool absolute);
extern void wcmResetButtonAction(WacomDevicePtr priv, int button);
extern void wcmResetStripAction(WacomDevicePtr priv, int index);