Windows joystick events fix.

Followup on 02520fb6.

Versions of wxWidgets after 3.0 change the windows event loop in such a
way that using QueueEvent for joystick events no longer works, use
ProcessEvent instead. This has no effect on latency since the joystick
events only cause the emulator controller state to be updated.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-12-03 20:09:56 +00:00
parent 198e2467dd
commit 498e4e858d
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 14 additions and 14 deletions

View File

@ -54,14 +54,14 @@ void wxSDLJoy::Poll()
auto prev_val = !val;
if (handler) {
wxSDLJoyEvent* ev = new wxSDLJoyEvent(wxEVT_SDLJOY);
ev->joy = joy;
ev->ctrl_type = WXSDLJOY_BUTTON;
ev->ctrl_idx = but;
ev->ctrl_val = val;
ev->prev_val = prev_val;
wxSDLJoyEvent ev(wxEVT_SDLJOY);
ev.joy = joy;
ev.ctrl_type = WXSDLJOY_BUTTON;
ev.ctrl_idx = but;
ev.ctrl_val = val;
ev.prev_val = prev_val;
handler->QueueEvent(ev);
handler->ProcessEvent(ev);
}
wxLogDebug("GOT SDL_CONTROLLERBUTTON: joy:%d but:%d val:%d prev_val:%d", joy, but, val, prev_val);
@ -78,14 +78,14 @@ void wxSDLJoy::Poll()
auto prev_val = joystate[joy].axis[axis];
if (handler && val != prev_val) {
wxSDLJoyEvent* ev = new wxSDLJoyEvent(wxEVT_SDLJOY);
ev->joy = joy;
ev->ctrl_type = WXSDLJOY_AXIS;
ev->ctrl_idx = axis;
ev->ctrl_val = val;
ev->prev_val = prev_val;
wxSDLJoyEvent ev(wxEVT_SDLJOY);
ev.joy = joy;
ev.ctrl_type = WXSDLJOY_AXIS;
ev.ctrl_idx = axis;
ev.ctrl_val = val;
ev.prev_val = prev_val;
handler->QueueEvent(ev);
handler->ProcessEvent(ev);
joystate[joy].axis[axis] = val;