src/video/winrt/SDL_winrtkeyboard.cpp
changeset 9240 dc4ad21d8596
parent 9193 5ca521b8486d
child 9619 b94b6d0bff0f
equal deleted inserted replaced
9239:4a4293b8a37f 9240:dc4ad21d8596
   363     //args->Handled = true;
   363     //args->Handled = true;
   364 #endif
   364 #endif
   365     SDL_SendKeyboardKey(SDL_RELEASED, sdlScancode);
   365     SDL_SendKeyboardKey(SDL_RELEASED, sdlScancode);
   366 }
   366 }
   367 
   367 
       
   368 void
       
   369 WINRT_ProcessCharacterReceivedEvent(Windows::UI::Core::CharacterReceivedEventArgs ^args)
       
   370 {
       
   371     wchar_t src_ucs2[2];
       
   372     char dest_utf8[16];
       
   373     int result;
       
   374 
       
   375     /* Setup src */
       
   376     src_ucs2[0] = args->KeyCode;
       
   377     src_ucs2[1] = L'\0';
       
   378 
       
   379     /* Convert the text, then send an SDL_TEXTINPUT event. */
       
   380     result = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)&src_ucs2, -1, (LPSTR)dest_utf8, sizeof(dest_utf8), NULL, NULL);
       
   381     if (result > 0) {
       
   382         SDL_SendKeyboardText(dest_utf8);
       
   383     }
       
   384 }
       
   385 
   368 #endif // SDL_VIDEO_DRIVER_WINRT
   386 #endif // SDL_VIDEO_DRIVER_WINRT