@@ -217,10 +217,12 @@ static void print_events(void)
217217 printf ("# Support for multiple mice not enabled\n" );
218218 }
219219
220- printf ("# SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_EVENTS))\n" );
220+ // With recent SDL2 versions (SDL 2.0.14+?), it seems that the video
221+ // subsystem must be initialized to get events from xinput controllers.
222+ printf ("# SDL_Init(SDL_INIT_EVERYTHING)\n" );
221223 flush_stdout ();
222- if (SDL_Init (SDL_INIT_JOYSTICK | SDL_INIT_EVENTS ) < 0 ) {
223- printf ("# SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_EVENTS) ) < 0\n" );
224+ if (SDL_Init (SDL_INIT_EVERYTHING ) < 0 ) {
225+ printf ("# SDL_Init(SDL_INIT_EVERYTHING ) < 0\n" );
224226 flush_stdout ();
225227 return ;
226228 }
@@ -314,7 +316,6 @@ static void print_events(void)
314316
315317static void print_state (SDL_Joystick * joystick , const char * name )
316318{
317-
318319 int num_buttons = SDL_JoystickNumButtons (joystick );
319320 int num_hats = SDL_JoystickNumHats (joystick );
320321 int num_axes = SDL_JoystickNumAxes (joystick );
@@ -397,9 +398,12 @@ int main(int argc, char* argv[])
397398
398399 char * compare_name = joystick_config_name (argv [1 ], 1 );
399400
400- printf ("# SDL_Init(SDL_INIT_JOYSTICK)\n" );
401- if (SDL_Init (SDL_INIT_JOYSTICK ) < 0 ) {
402- printf ("# SDL_Init(SDL_INIT_JOYSTICK) < 0\n" );
401+ // With recent SDL2 versions (SDL 2.0.14+?), it seems that the video
402+ // subsystem must be initialized to get events from xinput controllers.
403+ printf ("# SDL_Init(SDL_INIT_EVERYTHING)\n" );
404+ flush_stdout ();
405+ if (SDL_Init (SDL_INIT_EVERYTHING ) < 0 ) {
406+ printf ("# SDL_Init(SDL_INIT_EVERYTHING) < 0\n" );
403407 flush_stdout ();
404408 return 2 ;
405409 }
0 commit comments