Commit b515b34dbb92ca04f1aca04c8271ae51405d92ba

Philipp Wiesemann 2016-12-16T22:58:32

Fixed hotplug with more than one device in testjoystick program.

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/test/testjoystick.c b/test/testjoystick.c
index 4821e2b..5c45eba 100644
--- a/test/testjoystick.c
+++ b/test/testjoystick.c
@@ -321,6 +321,7 @@ main(int argc, char *argv[])
                     || (event.type == SDL_MOUSEBUTTONDOWN)) {
                     keepGoing = SDL_FALSE;
                 } else if (event.type == SDL_JOYDEVICEADDED) {
+                    device = event.jdevice.which;
                     joystick = SDL_JoystickOpen(device);
                     if (joystick != NULL) {
                         SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);