summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-11-26 14:39:37 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2021-12-20 15:01:56 +1000
commite8a7b5a5ac359d6a53148f61a05f7996459fa5d4 (patch)
tree6ef52b578e4e8f15a98cefb1791daa2ff86ab47a /src
parent29d093bd8671a792124720281f7f1f7c4934d6b4 (diff)
downloadxf86-input-wacom-e8a7b5a5ac359d6a53148f61a05f7996459fa5d4.tar.gz
Move a function to the core driver layer
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/wcmCommon.c26
-rw-r--r--src/wcmXCommand.c25
2 files changed, 26 insertions, 25 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index d87405d..209e8c8 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -76,6 +76,32 @@ void set_absolute(WacomDevicePtr priv, Bool absolute)
priv->flags &= ~ABSOLUTE_FLAG;
}
+/*****************************************************************************
+* wcmDevSwitchModeCall --
+*****************************************************************************/
+
+int wcmDevSwitchModeCall(WacomDevicePtr priv, int mode)
+{
+ DBG(3, priv, "to mode=%d\n", mode);
+
+ /* 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;
+}
+
+
static int wcmButtonPerNotch(WacomDevicePtr priv, int value, int threshold, int btn_positive, int btn_negative)
{
int mode = is_absolute(priv);
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index a58b2ec..d7a42e6 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -38,31 +38,6 @@ static int wcmGetProperty(DeviceIntPtr dev, Atom property);
static int wcmDeleteProperty(DeviceIntPtr dev, Atom property);
/*****************************************************************************
-* wcmDevSwitchModeCall --
-*****************************************************************************/
-
-int wcmDevSwitchModeCall(WacomDevicePtr priv, int mode)
-{
- DBG(3, priv, "to mode=%d\n", mode);
-
- /* 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;
-}
-
-/*****************************************************************************
* wcmDevSwitchMode --
*****************************************************************************/