No functional changes, just making code hopefully more readable.
Signed-off-by: Peter Hutterer <[email protected]>
---
src/wcmCommon.c | 39 +++++++++++++++++++++++++++------------
1 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 81aa6a0..ee49698 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -556,18 +556,14 @@ static void sendAButton(LocalDevicePtr local, int button,
int mask,
}
/*****************************************************************************
- * sendWheelStripEvents --
- * Send events defined for relative/absolute wheels or strips
+ * getWheelButton --
+ * Get the wheel button to be sent for the current device state.
****************************************************************************/
-static void sendWheelStripEvents(LocalDevicePtr local, const WacomDeviceState*
ds,
- int x, int y, int z, int v3, int v4, int v5)
+static int getWheelButton(LocalDevicePtr local, const WacomDeviceState* ds)
{
WacomDevicePtr priv = (WacomDevicePtr) local->private;
- int fakeButton = 0, i, value = 0, naxes = priv->naxes;
- int is_absolute = priv->flags & ABSOLUTE_FLAG;
-
- DBG(10, priv, "\n");
+ int fakeButton = 0, value;
/* emulate events for relative wheel */
if ( ds->relwheel )
@@ -592,7 +588,7 @@ static void sendWheelStripEvents(LocalDevicePtr local,
const WacomDeviceState* d
/* emulate events for left strip */
if ( ds->stripx != priv->oldStripX )
{
- int temp = 0, n;
+ int temp = 0, n, i;
for (i=1; i<14; i++)
{
n = 1 << (i-1);
@@ -613,7 +609,7 @@ static void sendWheelStripEvents(LocalDevicePtr local,
const WacomDeviceState* d
/* emulate events for right strip */
if ( ds->stripy != priv->oldStripY )
{
- int temp = 0, n;
+ int temp = 0, n, i;
for (i=1; i<14; i++)
{
n = 1 << (i-1);
@@ -631,11 +627,30 @@ static void sendWheelStripEvents(LocalDevicePtr local,
const WacomDeviceState* d
fakeButton = priv->striprdn;
}
- if (!fakeButton) return;
-
DBG(10, priv, "send fakeButton %x with value = %d \n",
fakeButton, value);
+ return fakeButton;
+}
+/*****************************************************************************
+ * sendWheelStripEvents --
+ * Send events defined for relative/absolute wheels or strips
+ ****************************************************************************/
+
+static void sendWheelStripEvents(LocalDevicePtr local, const WacomDeviceState*
ds,
+ int x, int y, int z, int v3, int v4, int v5)
+{
+ WacomDevicePtr priv = (WacomDevicePtr) local->private;
+ int fakeButton = 0, naxes = priv->naxes;
+ int is_absolute = priv->flags & ABSOLUTE_FLAG;
+
+ DBG(10, priv, "\n");
+
+ fakeButton = getWheelButton(local, ds);
+
+ if (!fakeButton)
+ return;
+
switch (fakeButton & AC_TYPE)
{
case 0: /* no spec. action defined */
--
1.6.6.1
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel