summaryrefslogtreecommitdiff
path: root/test/testgamecontroller.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/testgamecontroller.c')
-rw-r--r--test/testgamecontroller.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c
index 6b0f512ff..bc1f66dd5 100644
--- a/test/testgamecontroller.c
+++ b/test/testgamecontroller.c
@@ -101,8 +101,9 @@ static void
UpdateWindowTitle()
{
const char *name = SDL_GameControllerName(gamecontroller);
+ const char *serial = SDL_GameControllerGetSerial(gamecontroller);
const char *basetitle = "Game Controller Test: ";
- const size_t titlelen = SDL_strlen(basetitle) + SDL_strlen(name) + 1;
+ const size_t titlelen = SDL_strlen(basetitle) + SDL_strlen(name) + (serial ? 3 + SDL_strlen(serial) : 0) + 1;
char *title = (char *)SDL_malloc(titlelen);
retval = SDL_FALSE;
@@ -110,6 +111,11 @@ UpdateWindowTitle()
if (title) {
SDL_snprintf(title, titlelen, "%s%s", basetitle, name);
+ if (serial) {
+ SDL_strlcat(title, " (", titlelen);
+ SDL_strlcat(title, serial, titlelen);
+ SDL_strlcat(title, ")", titlelen);
+ }
SDL_SetWindowTitle(window, title);
SDL_free(title);
}