Onscreen keyboard working on Windows, by TOYAMA Shin-ichi.
This commit is contained in:
parent
7bc0e2c157
commit
4749214383
2 changed files with 12 additions and 3 deletions
5
src/im.c
5
src/im.c
|
|
@ -54,6 +54,11 @@
|
|||
#include "android_mbstowcs.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#define mbstowcs(wtok, tok, size) MultiByteToWideChar(CP_UTF8,0,tok,-1,wtok,size)
|
||||
#endif
|
||||
|
||||
/* ***************************************************************************
|
||||
* I18N GETTEXT
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ static void print_composemap(osk_composenode * composemap, char *sp);
|
|||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#define mbstowcs(wtok, tok, size) MultiByteToWideChar(CP_UTF8,MB_COMPOSITE,tok,-1,wtok,size)
|
||||
#define mbstowcs(wtok, tok, size) MultiByteToWideChar(CP_UTF8,0,tok,-1,wtok,size)
|
||||
#define wcstombs(tok, wtok, size) WideCharToMultiByte(CP_UTF8,0,wtok,-1,tok,size,NULL,NULL)
|
||||
#endif
|
||||
|
||||
struct osk_keyboard *osk_create(char * layout_name, SDL_Surface * canvas,
|
||||
|
|
@ -1829,9 +1830,12 @@ struct osk_keyboard *osk_clicked(on_screen_keyboard * keyboard, int x, int y)
|
|||
if (keyboard->composed_type == 1)
|
||||
wcstombs(event.text.text, keyboard->composed, 16);
|
||||
// event.text.text = *keyboard->composed;
|
||||
else
|
||||
snprintf(event.text.text, 16, "%lc", keysym2unicode(mnemo2keysym(mnemo, keyboard), keyboard));
|
||||
else{
|
||||
//snprintf(event.text.text, 16, "%lc", keysym2unicode(mnemo2keysym(mnemo, keyboard), keyboard));
|
||||
int iwc = keysym2unicode(mnemo2keysym(mnemo, keyboard), keyboard);
|
||||
wcstombs(event.text.text, (wchar_t *) &iwc, 16);
|
||||
//event.text.text = keysym2unicode(mnemo2keysym(mnemo, keyboard), keyboard);
|
||||
}
|
||||
|
||||
clear_dead_sticks(keyboard);
|
||||
event.type = SDL_TEXTINPUT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue