Mercurial > sdl-ios-xcode
diff src/video/win32/SDL_win32events.c @ 2309:21591ae7355d
Implemented text input event for Win32
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 09 Feb 2008 06:47:46 +0000 |
parents | 514f7c1651fc |
children | 2f31ce8f1149 |
line wrap: on
line diff
--- a/src/video/win32/SDL_win32events.c Fri Feb 08 08:35:49 2008 +0000 +++ b/src/video/win32/SDL_win32events.c Sat Feb 09 06:47:46 2008 +0000 @@ -397,6 +397,28 @@ } 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;