diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2021-11-26 14:39:37 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2021-12-20 15:01:56 +1000 |
commit | e8a7b5a5ac359d6a53148f61a05f7996459fa5d4 (patch) | |
tree | 6ef52b578e4e8f15a98cefb1791daa2ff86ab47a /src | |
parent | 29d093bd8671a792124720281f7f1f7c4934d6b4 (diff) | |
download | xf86-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.c | 26 | ||||
-rw-r--r-- | src/wcmXCommand.c | 25 |
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 -- *****************************************************************************/ |