aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZephaniah E. Hull <warp@agamemnon.b5>2007-06-05 23:55:50 -0400
committerZephaniah E. Hull <warp@agamemnon.b5>2007-06-05 23:55:50 -0400
commit276685fa1dfc7c2d78178173545df3e28bc82544 (patch)
treeccebffddfbb08d8a18f2e0dc072c773f7dda35f3
parentUpdate the copyright notices for me to include 2007. (diff)
downloadxf86-input-evdev-276685fa1dfc7c2d78178173545df3e28bc82544.tar.gz
xf86-input-evdev-276685fa1dfc7c2d78178173545df3e28bc82544.tar.bz2
xf86-input-evdev-276685fa1dfc7c2d78178173545df3e28bc82544.zip
Fix REL mode.
Make buttons mostly work again. (Short term fix.) NOTE: Wheel to button remapping is still missing!
-rw-r--r--src/evdev_axes.c31
-rw-r--r--src/evdev_btn.c10
2 files changed, 29 insertions, 12 deletions
diff --git a/src/evdev_axes.c b/src/evdev_axes.c
index beeb765..1443495 100644
--- a/src/evdev_axes.c
+++ b/src/evdev_axes.c
@@ -371,7 +371,7 @@ EvdevConvert(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v2,
* after a cleanup.
*/
static void
-EvdevAxesDoRotation (InputInfoPtr pInfo, float x, float y)
+EvdevAxesDoRotation (InputInfoPtr pInfo)
{
evdevDevicePtr pEvdev = pInfo->private;
evdevStatePtr state = &pEvdev->state;
@@ -390,18 +390,16 @@ EvdevAxesDoRotation (InputInfoPtr pInfo, float x, float y)
}
if (axes->rotation) {
+ float x = axes->v[0], y = axes->v[1];
axes->v[0] = (x * axes->rot_cos) - (y * axes->rot_sin);
axes->v[1] = (y * axes->rot_cos) + (x * axes->rot_sin);
axes->v_flags[0] |= EV_AXES_V_UPDATED;
axes->v_flags[1] |= EV_AXES_V_UPDATED;
#if DEBUG
- xf86Msg(X_ERROR, "%s %d (%s): cos=%f, sin=%f, x=%f, y=%f, v[0]=%d, v[1]=%d\n", __FILE__, __LINE__, __FUNCTION__,
- axes->rot_cos, axes->rot_sin, x, y, axes->v[0], axes->v[1]);
+ xf86Msg(X_ERROR, "%s %d (%s): rotation=%d, cos=%f, sin=%f, x=%f, y=%f, v[0]=%d, v[1]=%d\n", __FILE__, __LINE__, __FUNCTION__,
+ axes->rotation, axes->rot_cos, axes->rot_sin, x, y, axes->v[0], axes->v[1]);
#endif
- } else {
- axes->v[0] = x;
- axes->v[1] = y;
}
}
@@ -521,7 +519,7 @@ EvdevAxesSynRep (InputInfoPtr pInfo)
max_y = dabs->max_y;
}
- EvdevAxesDoRotation (pInfo, axes->v[0], axes->v[1]);
+ EvdevAxesDoRotation (pInfo);
axes->v[0] = EvdevScaleAxis (axes->v[0], 0, width, min_x, max_x);
axes->v[1] = EvdevScaleAxis (axes->v[1], 0, height, min_y, max_y);
@@ -546,15 +544,31 @@ EvdevAxesSynRep (InputInfoPtr pInfo)
if (dabs->flip_y)
axes->v[1] = -axes->v[1];
- EvdevAxesDoRotation (pInfo, axes->v[0], axes->v[1]);
+ EvdevAxesDoRotation (pInfo);
}
}
+#if DEBUG
+ xf86Msg(X_ERROR, "%s %d (%s): v[0]=%d%s%s, v[1]=%d%s%s, v[2]=%d%s%s\n", __FILE__, __LINE__, __FUNCTION__,
+ axes->v[0],
+ axes->v_flags[0] & EV_AXES_V_M_ABS ? "!" : "",
+ axes->v_flags[0] & EV_AXES_V_UPDATED ? "*" : "",
+ axes->v[1],
+ axes->v_flags[1] & EV_AXES_V_M_ABS ? "!" : "",
+ axes->v_flags[1] & EV_AXES_V_UPDATED ? "*" : "",
+ axes->v[2],
+ axes->v_flags[2] & EV_AXES_V_M_ABS ? "!" : "",
+ axes->v_flags[2] & EV_AXES_V_UPDATED ? "*" : "");
+#endif
for (i = 0; i < axes->axes; i++) {
if (axes->v_flags[i] & EV_AXES_V_UPDATED) {
if (run) {
if (mode != (axes->v_flags[i] & EV_AXES_V_M_MASK)) {
mode = (mode == EV_AXES_V_M_ABS);
+#if DEBUG
+ xf86Msg(X_ERROR, "%s %d (%s): mode=%d, start=%d, i - start=%d\n", __FILE__, __LINE__, __FUNCTION__,
+ mode, start, i - start);
+#endif
xf86PostMotionEventP (pInfo->dev, mode, start, i - start, axes->v + start);
start = i;
mode = axes->v_flags[i] & EV_AXES_V_M_MASK;
@@ -568,6 +582,7 @@ EvdevAxesSynRep (InputInfoPtr pInfo)
} else if (run) {
mode = (mode == EV_AXES_V_M_ABS);
xf86PostMotionEventP (pInfo->dev, mode, start, i - start, axes->v + start);
+ run = 0;
}
}
if (run) {
diff --git a/src/evdev_btn.c b/src/evdev_btn.c
index d5fce8f..3d52e9f 100644
--- a/src/evdev_btn.c
+++ b/src/evdev_btn.c
@@ -214,7 +214,7 @@ EvdevBtnOff (DeviceIntPtr device)
return Success;
}
-#if 0
+#if 1
/*
* Warning, evil lives here.
*/
@@ -227,6 +227,7 @@ EvdevBtnCalcRemap (InputInfoPtr pInfo)
int i, j, base, clear, fake, bit;
for (i = 0, base = 1, fake = 0; i < pEvdev->state.btn->real_buttons; i++) {
+#if 0
if (state->rel) {
do {
clear = 1;
@@ -244,6 +245,7 @@ EvdevBtnCalcRemap (InputInfoPtr pInfo)
}
} while (!clear);
}
+#endif
if (!fake && base != 1)
fake = i;
@@ -278,6 +280,7 @@ EvdevBtnCalcRemap (InputInfoPtr pInfo)
btn->map[2] = base;
}
+#if 0
if (state->rel) {
for (i = 0; i < REL_MAX; i++) {
if (state->rel->btnMap[i][0] > btn->buttons)
@@ -286,6 +289,7 @@ EvdevBtnCalcRemap (InputInfoPtr pInfo)
btn->buttons = state->rel->btnMap[i][1];
}
}
+#endif
}
#endif
@@ -352,7 +356,7 @@ EvdevBtnNew1(InputInfoPtr pInfo)
if (!state->btn)
return !Success;
-#if 0
+#if 1
EvdevBtnCalcRemap (pInfo);
#else
state->btn->buttons = state->btn->real_buttons;
@@ -405,9 +409,7 @@ EvdevBtnProcess (InputInfoPtr pInfo, struct input_event *ev)
if (state->btn->ignore[button] & EV_BTN_IGNORE_X)
return;
-#if 0
button = state->btn->map[button];
-#endif
xf86PostButtonEvent (pInfo->dev, 0, button, ev->value, 0, 0);
}