summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-08-07 21:12:45 +0300
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-08-07 21:12:45 +0300
commitbaf93b3abe1e88d82ee6a3d6939f50f96ded271a (patch)
tree4edf5bae6d09ff0824ff8930207d371cdf0e6931
parentccb53340b66a778abf10182fd88a7d699207fb84 (diff)
kdrive: move map initialisation to KdNewPointer
Do a linear n -> n initialisation on the map up until KD_MAX_BUTTON in KdNewPointer, moving it out of both KdParsePointer, and KdPointerProc. Also remove dead pointer acceleration code.
-rw-r--r--hw/kdrive/src/kinfo.c4
-rw-r--r--hw/kdrive/src/kinput.c42
2 files changed, 4 insertions, 42 deletions
diff --git a/hw/kdrive/src/kinfo.c b/hw/kdrive/src/kinfo.c
index 1d81ed396..1e03ac8a2 100644
--- a/hw/kdrive/src/kinfo.c
+++ b/hw/kdrive/src/kinfo.c
@@ -117,6 +117,7 @@ KdPointerInfo *
KdNewPointer (void)
{
KdPointerInfo *pi;
+ int i;
pi = (KdPointerInfo *)xcalloc(1, sizeof(KdPointerInfo));
if (!pi)
@@ -130,6 +131,9 @@ KdNewPointer (void)
pi->next = NULL;
pi->options = NULL;
pi->nAxes = 3;
+ pi->nButtons = KD_MAX_BUTTON;
+ for (i = 1; i < KD_MAX_BUTTON; i++)
+ pi->map[i] = i;
return pi;
}
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index e8a00dc7f..1718fdad1 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -433,9 +433,6 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
return BadImplementation;
}
- for (i = 1; i <= pi->nButtons; i++)
- pi->map[i] = i;
-
if ((*pi->driver->Init) (pi) != Success) {
return !Success;
}
@@ -1156,9 +1153,6 @@ KdParsePointer (char *arg)
pi->nButtons = 3;
pi->inputClass = KD_MOUSE;
- for (i = 0; i < KD_MAX_BUTTON; i++)
- pi->map[i] = i + 1;
-
if (!arg)
{
ErrorF("mouse: no arg\n");
@@ -1967,39 +1961,6 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
* passed off to MI for enqueueing.
*/
-static void
-KdMouseAccelerate (KdPointerInfo *pi, int *dx, int *dy)
-{
- DeviceIntPtr device = pi->dixdev;
- PtrCtrl *pCtrl = &device->ptrfeed->ctrl;
- double speed = sqrt (*dx * *dx + *dy * *dy);
- double accel;
-#ifdef QUADRATIC_ACCELERATION
- double m;
-
- /*
- * Ok, so we want it moving num/den times faster at threshold*2
- *
- * accel = m *threshold + b
- * 1 = m * 0 + b -> b = 1
- *
- * num/den = m * (threshold * 2) + 1
- *
- * num / den - 1 = m * threshold * 2
- * (num / den - 1) / threshold * 2 = m
- */
- m = (((double) pCtrl->num / (double) pCtrl->den - 1.0) /
- ((double) pCtrl->threshold * 2.0));
- accel = m * speed + 1;
-#else
- accel = 1.0;
- if (speed > pCtrl->threshold)
- accel = (double) pCtrl->num / pCtrl->den;
-#endif
- *dx = accel * *dx;
- *dy = accel * *dy;
-}
-
/* FIXME do something a little more clever to deal with multiple axes here */
void
KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
@@ -2028,9 +1989,6 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
x = rx;
y = ry;
}
- /* screw this, use the DIX's acceleration (stolen from XFree86)
- * instead.
- * KdMouseAccelerate (pi, &x, &y); */
}
else {
if (pi->transformCoordinates) {