mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
device: Fix erroneous dpad_*-up events when emulating a dpad on Linux
The first time axis are processed while a dpad axis is engaged will result in the opposite dpad "button" getting set to a state of S_up from S_unknown, which results in an '-up' event getting fired. Instead, assume the emulated dpad buttons start in a state of S_up. This fix is for the Joystick API and for the evdev API, but only the evdev changes were tested. Closes #973
This commit is contained in:
parent
3fe1d286d0
commit
2893d8cef8
@ -595,6 +595,8 @@ init_device() {
|
||||
_buttons.push_back(ButtonState(GamepadButton::hat_left()));
|
||||
_buttons.push_back(ButtonState(GamepadButton::hat_right()));
|
||||
}
|
||||
_buttons[_dpad_left_button]._state = S_up;
|
||||
_buttons[_dpad_left_button+1]._state = S_up;
|
||||
}
|
||||
break;
|
||||
case ABS_HAT0Y:
|
||||
@ -608,6 +610,8 @@ init_device() {
|
||||
_buttons.push_back(ButtonState(GamepadButton::hat_up()));
|
||||
_buttons.push_back(ButtonState(GamepadButton::hat_down()));
|
||||
}
|
||||
_buttons[_dpad_up_button]._state = S_up;
|
||||
_buttons[_dpad_up_button+1]._state = S_up;
|
||||
}
|
||||
break;
|
||||
case ABS_HAT2X:
|
||||
|
@ -234,6 +234,8 @@ open_device() {
|
||||
add_button(GamepadButton::hat_left());
|
||||
add_button(GamepadButton::hat_right());
|
||||
}
|
||||
_buttons[_dpad_left_button]._state = S_up;
|
||||
_buttons[_dpad_left_button+1]._state = S_up;
|
||||
axis = Axis::none;
|
||||
}
|
||||
break;
|
||||
@ -250,6 +252,8 @@ open_device() {
|
||||
add_button(GamepadButton::hat_up());
|
||||
add_button(GamepadButton::hat_down());
|
||||
}
|
||||
_buttons[_dpad_up_button]._state = S_up;
|
||||
_buttons[_dpad_up_button+1]._state = S_up;
|
||||
axis = Axis::none;
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user