From 520d02de7e47e06c21ed6a414f45a55450509423 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Sun, 25 Mar 2018 18:00:16 +0200 Subject: [PATCH 1/3] KSP 1.4 compatibility: We must push back the input we consume --- SDLController.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/SDLController.cs b/SDLController.cs index e74f72a..d9523b8 100644 --- a/SDLController.cs +++ b/SDLController.cs @@ -85,6 +85,7 @@ public static void SDLUpdateState() SDL.SDL_JoystickUpdate(); SDL.SDL_Event ev; SDL.SDL_PollEvent(out ev); + SDL.SDL_PushEvent(ref ev); } public override string GetControllerName() From 6e2da799d82b95d073ca40ee69beea6181012cf4 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Sun, 25 Mar 2018 18:11:44 +0200 Subject: [PATCH 2/3] Add condition to only push back events on Linux. I think Unity on Windows does not use SDL, but I don't have a Windows box to confirm. --- SDLController.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SDLController.cs b/SDLController.cs index d9523b8..11a1fd2 100644 --- a/SDLController.cs +++ b/SDLController.cs @@ -85,7 +85,9 @@ public static void SDLUpdateState() SDL.SDL_JoystickUpdate(); SDL.SDL_Event ev; SDL.SDL_PollEvent(out ev); +#if LINUX SDL.SDL_PushEvent(ref ev); +#endif } public override string GetControllerName() From 57e42aad1c95ae62bd783bb718af9cfc2731e1a4 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Sun, 25 Mar 2018 21:32:11 +0200 Subject: [PATCH 3/3] Change SDL event queue handling once more to keep the queue sorted. --- SDLController.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/SDLController.cs b/SDLController.cs index 11a1fd2..102c835 100644 --- a/SDLController.cs +++ b/SDLController.cs @@ -83,11 +83,7 @@ public static void SDLUpdateState() { InitializeSDL(); SDL.SDL_JoystickUpdate(); - SDL.SDL_Event ev; - SDL.SDL_PollEvent(out ev); -#if LINUX - SDL.SDL_PushEvent(ref ev); -#endif + SDL.SDL_PumpEvents(); } public override string GetControllerName()