Vitaliy Margolen : dinput: [joystick_linux]
Use correct offset to queue events.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jan 11 05:34:04 CST 2007
Module: wine
Branch: master
Commit: 1bc557eea06a81a729d9d9a4bf26abbf57936452
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1bc557eea06a81a729d9d9a4bf26abbf57936452
Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date: Tue Jan 9 13:44:07 2007 -0700
dinput: [joystick_linux] Use correct offset to queue events.
---
dlls/dinput/joystick_linux.c | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
index c297f70..1a6b063 100644
--- a/dlls/dinput/joystick_linux.c
+++ b/dlls/dinput/joystick_linux.c
@@ -778,7 +778,11 @@ static void joy_polldev(JoystickImpl *Th
WARN("no device\n");
return;
}
- while (1) {
+ while (1)
+ {
+ LONG value;
+ int inst_id = -1;
+
plfd.fd = This->joyfd;
plfd.events = POLLIN;
if (poll(&plfd,1,0) != 1)
@@ -789,19 +793,19 @@ static void joy_polldev(JoystickImpl *Th
}
TRACE("js_event: type 0x%x, number %d, value %d\n",
jse.type,jse.number,jse.value);
- if (jse.type & JS_EVENT_BUTTON) {
- int offset = This->base.data_format.offsets[jse.number + 12];
- int value = jse.value?0x80:0x00;
-
- This->js.rgbButtons[jse.number] = value;
- queue_event((LPDIRECTINPUTDEVICE8A)This, offset, value, jse.time, This->dinput->evsequence++);
- } else if (jse.type & JS_EVENT_AXIS) {
+ if (jse.type & JS_EVENT_BUTTON)
+ {
+ inst_id = DIDFT_MAKEINSTANCE(jse.number) | DIDFT_PSHBUTTON;
+ This->js.rgbButtons[jse.number] = value = jse.value ? 0x80 : 0x00;
+ }
+ else if (jse.type & JS_EVENT_AXIS)
+ {
int number = This->axis_map[jse.number]; /* wine format object index */
- if (number < 12) {
- int offset = This->base.data_format.offsets[number];
- int index = offset_to_object(This->base.data_format.user_df, offset);
- LONG value = map_axis(This, jse.value, index);
+ if (number < 12)
+ {
+ inst_id = DIDFT_MAKEINSTANCE(jse.number) | (number < 8 ? DIDFT_AXIS : DIDFT_POV);
+ value = map_axis(This, jse.value, number);
/* FIXME do deadzone and saturation here */
TRACE("changing axis %d => %d\n", jse.number, number);
@@ -860,11 +864,13 @@ static void joy_polldev(JoystickImpl *Th
value = calculate_pov(This, 3);
break;
}
-
- queue_event((LPDIRECTINPUTDEVICE8A)This, offset, value, jse.time, This->dinput->evsequence++);
} else
WARN("axis %d not supported\n", number);
}
+ if (inst_id >= 0)
+ queue_event((LPDIRECTINPUTDEVICE8A)This,
+ id_to_offset(&This->base.data_format, inst_id),
+ value, jse.time, This->dinput->evsequence++);
}
}
More information about the wine-cvs
mailing list