diff options
author | Sascha Hlusiak <saschahlusiak@arcor.de> | 2007-08-08 14:49:29 +0200 |
---|---|---|
committer | Sascha Hlusiak <saschahlusiak@arcor.de> | 2007-08-08 14:49:29 +0200 |
commit | 20bcf86f2abdeb0fd6cf2f9cc4fb96befc0c5cbc (patch) | |
tree | acbc1e357ea41e43735507e739ca7a26f07af87b | |
parent | f4c1519bffdb12f4337261a8a9a9b63a4fa19cad (diff) |
Added "oldvalue" to axis struct, containing the exact last "value" of the axis
-rw-r--r-- | src/bsd_jstk.c | 3 | ||||
-rw-r--r-- | src/linux_jstk.c | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/bsd_jstk.c b/src/bsd_jstk.c index a0c8ea3..bc0d208 100644 --- a/src/bsd_jstk.c +++ b/src/bsd_jstk.c @@ -264,6 +264,7 @@ jstkReadData(JoystickDevPtr joystick, - bsddata->axis_item[j].logical_minimum); if (abs(d) < joystick->axis[j].deadzone) d = 0; if (d != joystick->axis[j].value) { + joystick->axis[j].oldvalue = joystick->axis[j].value; joystick->axis[j].value = d; if (event != NULL) *event = EVENT_AXIS; if (number != NULL) *number = j; @@ -283,12 +284,14 @@ jstkReadData(JoystickDevPtr joystick, d = hid_get_data(bsddata->data_buf, &bsddata->hat_item[j]) - bsddata->hat_item[j].logical_minimum; if (joystick->axis[a].value != v1_data[d]) { + joystick->axis[a].oldvalue = joystick->axis[a].value; joystick->axis[a].value = v1_data[d]; if (event != NULL) *event = EVENT_AXIS; if (number != NULL) *number = a; return 2; } if (joystick->axis[a+1].value != v2_data[d]) { + joystick->axis[a+1].oldvalue = joystick->axis[a+1].value; joystick->axis[a+1].value = v2_data[d]; if (event != NULL) *event = EVENT_AXIS; if (number != NULL) *number = a+1; diff --git a/src/linux_jstk.c b/src/linux_jstk.c index ff89c54..2a35942 100644 --- a/src/linux_jstk.c +++ b/src/linux_jstk.c @@ -177,11 +177,13 @@ jstkReadData(JoystickDevPtr joystick, if (abs(js.value) < joystick->axis[js.number].deadzone) { /* We only want one event when in deadzone */ if (joystick->axis[js.number].value != 0) { + joystick->axis[js.number].oldvalue = joystick->axis[js.number].value; joystick->axis[js.number].value = 0; if (event != NULL) *event = EVENT_AXIS; if (number != NULL) *number = js.number; } }else{ + joystick->axis[js.number].oldvalue = joystick->axis[js.number].value; joystick->axis[js.number].value = js.value; if (event != NULL) *event = EVENT_AXIS; if (number != NULL) *number = js.number; |