Skip to content

Commit 3855d6c

Browse files
committed
Fix SDL pasting.
1 parent f7cf927 commit 3855d6c

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Machines/Utility/Typer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <cwchar>
1616
#include <memory>
1717
#include <string>
18+
#include <unordered_map>
19+
#include <vector>
1820

1921
namespace Utility {
2022

OSBindings/SDL/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <algorithm>
2727
#include <array>
2828
#include <atomic>
29+
#include <codecvt>
2930
#include <cstddef>
3031
#include <cstdio>
3132
#include <cstdlib>
@@ -1124,7 +1125,10 @@ int main(int argc, char *argv[]) {
11241125
// Syphon off the key-press if it's control+shift+V (paste).
11251126
if(event.key.keysym.sym == SDLK_v && (SDL_GetModState()&KMOD_CTRL) && (SDL_GetModState()&KMOD_SHIFT)) {
11261127
if(keyboard_machine) {
1127-
keyboard_machine->type_string(SDL_GetClipboardText());
1128+
char *const utf8 = SDL_GetClipboardText();
1129+
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
1130+
keyboard_machine->type_string(converter.from_bytes(utf8));
1131+
SDL_free(utf8);
11281132
break;
11291133
}
11301134
}

0 commit comments

Comments
 (0)