evdev: try to fix first call behaviour

We don't have all the events in the first call to get_next_button_press.
So we have to set all the buttons to max on the first call.
We also have to make sure that we don't manipulate the values if we just
want to know the connection status.
This commit is contained in:
Megamouse 2024-08-09 20:39:56 +02:00
parent 0dfc622b58
commit cb122819ae
10 changed files with 95 additions and 57 deletions

View file

@ -763,14 +763,14 @@ void sdl_pad_handler::get_motion_sensors(const std::string& pad_id, const motion
PadHandlerBase::get_motion_sensors(pad_id, callback, fail_callback, preview_values, sensors);
}
PadHandlerBase::connection sdl_pad_handler::get_next_button_press(const std::string& padId, const pad_callback& callback, const pad_fail_callback& fail_callback, bool first_call, bool get_blacklist, const std::vector<std::string>& buttons)
PadHandlerBase::connection sdl_pad_handler::get_next_button_press(const std::string& padId, const pad_callback& callback, const pad_fail_callback& fail_callback, gui_call_type call_type, const std::vector<std::string>& buttons)
{
if (!m_is_init)
return connection::disconnected;
SDL_PumpEvents();
return PadHandlerBase::get_next_button_press(padId, callback, fail_callback, first_call, get_blacklist, buttons);
return PadHandlerBase::get_next_button_press(padId, callback, fail_callback, call_type, buttons);
}
void sdl_pad_handler::apply_pad_data(const pad_ensemble& binding)