Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Implemented text input event for Win32
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 9, 2008
1 parent 9227677 commit 7630ca4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/video/win32/SDL_win32events.c
Expand Up @@ -397,6 +397,28 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
return (0);

case WM_CHAR:
{
char text[4];

/* Convert to UTF-8 and send it on... */
if (wParam <= 0x7F) {
text[0] = (char) wParam;
text[1] = '\0';
} else if (wParam <= 0x7FF) {
text[0] = 0xC0 | (char) ((wParam >> 6) & 0x1F);
text[1] = 0x80 | (char) (wParam & 0x3F);
text[2] = '\0';
} else {
text[0] = 0xE0 | (char) ((wParam >> 12) & 0x0F);
text[1] = 0x80 | (char) ((wParam >> 6) & 0x3F);
text[2] = 0x80 | (char) (wParam & 0x3F);
text[3] = '\0';
}
SDL_SendKeyboardText(data->videodata->keyboard, text);
}
return (0);

case WM_GETMINMAXINFO:
{
MINMAXINFO *info;
Expand Down

0 comments on commit 7630ca4

Please sign in to comment.