summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-05-21 12:27:55 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-05-31 14:56:48 +1000
commite7e8157cd7e9d633d920c5dcaad18263f7c6b514 (patch)
tree6087075cc0a765f872f68be448f0736f8218350a
parent64006101c24621c443b90ed54509bdeb0853dce9 (diff)
Push DeviceOn/Off hook calls down to core
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/synaptics-x11.c6
-rw-r--r--src/synaptics.c18
-rw-r--r--src/synaptics.h10
3 files changed, 30 insertions, 4 deletions
diff --git a/src/synaptics-x11.c b/src/synaptics-x11.c
index 18f587c..0544638 100644
--- a/src/synaptics-x11.c
+++ b/src/synaptics-x11.c
@@ -385,8 +385,7 @@ DeviceOn(DeviceIntPtr dev)
return !Success;
}
- if (priv->proto_ops->DeviceOnHook &&
- !priv->proto_ops->DeviceOnHook(priv, &priv->synpara, pInfo->fd))
+ if (!SynapticsEnableDevice(priv, pInfo->fd))
return !Success;
xf86FlushInput(pInfo->fd);
@@ -417,8 +416,7 @@ DeviceOff(DeviceIntPtr dev)
xf86RemoveEnabledDevice(pInfo);
SynapticsReset(priv);
- if (priv->proto_ops->DeviceOffHook &&
- !priv->proto_ops->DeviceOffHook(priv, pInfo->fd))
+ if (!SynapticsDisableDevice(priv, pInfo->fd))
rc = !Success;
xf86CloseSerial(pInfo->fd);
pInfo->fd = -1;
diff --git a/src/synaptics.c b/src/synaptics.c
index 30de7ac..4c62f0c 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -640,6 +640,24 @@ SynapticsInitDevice(SynapticsPrivate *priv)
return !Success;
}
+Bool
+SynapticsEnableDevice(SynapticsPrivate *priv, int fd)
+{
+ if (priv->proto_ops->DeviceOnHook &&
+ !priv->proto_ops->DeviceOnHook(priv, &priv->synpara, fd))
+ return 1;
+ return 0;
+}
+
+Bool
+SynapticsDisableDevice(SynapticsPrivate *priv, int fd)
+{
+ if (priv->proto_ops->DeviceOffHook &&
+ !priv->proto_ops->DeviceOffHook(priv, fd))
+ return 1;
+ return 0;
+}
+
/* return angle of point relative to center */
static double
angle(SynapticsPrivate * priv, int x, int y)
diff --git a/src/synaptics.h b/src/synaptics.h
index e637e1a..f5805b3 100644
--- a/src/synaptics.h
+++ b/src/synaptics.h
@@ -60,6 +60,16 @@ void SynapticsReadInput(SynapticsPrivate *priv, int fd);
*/
Bool SynapticsInitDevice(SynapticsPrivate *priv);
/**
+ * Enable the backend to start sending events.
+ * Implemented-by: core
+ */
+Bool SynapticsEnableDevice(SynapticsPrivate *priv, int fd);
+/**
+ * Disable the backend to stop sending events.
+ * Implemented-by: core
+ */
+Bool SynapticsDisableDevice(SynapticsPrivate *priv, int fd);
+/**
* Shut down the device. Call this after disabling the file descriptor.
* Implemented-by: core
*/