Browse Source

testime: use the correct properties when enabling text input

(cherry picked from commit 6f952a8e636b8c3173075ddf1fd9458489adedf3)
Sam Lantinga 2 weeks ago
parent
commit
d83ac9ebfc
1 changed files with 4 additions and 2 deletions
  1. 4 2
      test/testime.c

+ 4 - 2
test/testime.c

@@ -474,7 +474,7 @@ static void InitInput(WindowState *ctx)
 {
     /* Prepare a rect for text input */
     ctx->textRect.x = 100.0f;
-	ctx->textRect.y = 250.0f;
+    ctx->textRect.y = 250.0f;
     ctx->textRect.w = DEFAULT_WINDOW_WIDTH - 2 * ctx->textRect.x;
     ctx->textRect.h = 50.0f;
     ctx->markedRect = ctx->textRect;
@@ -1062,7 +1062,7 @@ int main(int argc, char *argv[])
                         SDL_StopTextInput(ctx->window);
                     } else {
                         SDL_Log("Enabling text input\n");
-                        SDL_StartTextInput(ctx->window);
+                        SDL_StartTextInputWithProperties(ctx->window, ctx->text_settings);
                     }
                 }
                 break;
@@ -1109,12 +1109,14 @@ int main(int argc, char *argv[])
                         int index = (event.key.key - SDLK_KP_1);
                         if (index < state->num_windows) {
                             SDL_Window *window = state->windows[index];
+                            ctx = &windowstate[index];
                             if (SDL_TextInputActive(window)) {
                                 SDL_Log("Disabling text input for window %d\n", 1 + index);
                                 SDL_StopTextInput(window);
                             } else {
                                 SDL_Log("Enabling text input for window %d\n", 1 + index);
                                 SDL_StartTextInput(window);
+                                SDL_StartTextInputWithProperties(window, ctx->text_settings);
                             }
                         }
                     }