added leaving game controller configuration screen by using 'backspace' key
authorHolger Schemel <info@artsoft.org>
Tue, 25 Jul 2017 23:12:21 +0000 (01:12 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 25 Jul 2017 23:12:21 +0000 (01:12 +0200)
src/screens.c

index b13890a1c380161681c9c8f1a387035a83cfd94f..ba5a211911500f064607ea445b1b0a2f236e0dc8 100644 (file)
@@ -6777,14 +6777,19 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick)
            if (event.key.keysym.sym == KSYM_BackSpace ||
                event.key.keysym.sym == KSYM_Back)
            {
-             /* undo this step */
-             if (i > 0)
+             if (i == 0)
              {
-               prev_step = &steps[--i];
-               strcpy(mapping, prev_step->mapping);
-               next = TRUE;
+               /* leave screen */
+               success = FALSE;
+               done = TRUE;
              }
 
+             /* undo this step */
+             prev_step = &steps[i - 1];
+             strcpy(mapping, prev_step->mapping);
+             i--;
+             next = TRUE;
+
              break;
            }
 
@@ -6801,6 +6806,7 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick)
 
            if (event.key.keysym.sym == KSYM_Escape)
            {
+             /* leave screen */
              success = FALSE;
              done = TRUE;
            }