Skip to content

Commit

Permalink
checkkeys: report SDL_TEXTEDITING events.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed May 1, 2015
1 parent 4232627 commit 0045e2e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/checkkeys.c
Expand Up @@ -121,7 +121,7 @@ PrintKey(SDL_Keysym * sym, SDL_bool pressed, SDL_bool repeat)
}

static void
PrintText(char *text)
PrintText(char *eventtype, char *text)
{
char *spot, expanded[1024];

Expand All @@ -131,7 +131,7 @@ PrintText(char *text)
size_t length = SDL_strlen(expanded);
SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", (unsigned char)*spot);
}
SDL_Log("Text (%s): \"%s%s\"\n", expanded, *text == '"' ? "\\" : "", text);
SDL_Log("%s Text (%s): \"%s%s\"\n", eventtype, expanded, *text == '"' ? "\\" : "", text);
}

void
Expand All @@ -147,8 +147,11 @@ loop()
case SDL_KEYUP:
PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
break;
case SDL_TEXTEDITING:
PrintText("EDIT", event.text.text);
break;
case SDL_TEXTINPUT:
PrintText(event.text.text);
PrintText("INPUT", event.text.text);
break;
case SDL_MOUSEBUTTONDOWN:
/* Any button press quits the app... */
Expand Down

0 comments on commit 0045e2e

Please sign in to comment.