MCPcopy Create free account
hub / github.com/ClassicOldSong/Apollo / unicode

Function unicode

src/platform/windows/input.cpp:1147–1173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1145 }
1146
1147 void unicode(input_t &input, char *utf8, int size) {
1148 // We can do no worse than one UTF-16 character per byte of UTF-8
1149 WCHAR wide[size];
1150
1151 int chars = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, utf8, size, wide, size);
1152 if (chars <= 0) {
1153 return;
1154 }
1155
1156 // Send all key down events
1157 for (int i = 0; i < chars; i++) {
1158 INPUT input {};
1159 input.type = INPUT_KEYBOARD;
1160 input.ki.wScan = wide[i];
1161 input.ki.dwFlags = KEYEVENTF_UNICODE;
1162 send_input(input);
1163 }
1164
1165 // Send all key up events
1166 for (int i = 0; i < chars; i++) {
1167 INPUT input {};
1168 input.type = INPUT_KEYBOARD;
1169 input.ki.wScan = wide[i];
1170 input.ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP;
1171 send_input(input);
1172 }
1173 }
1174
1175 int alloc_gamepad(input_t &input, const gamepad_id_t &id, const gamepad_arrival_t &metadata, feedback_queue_t feedback_queue) {
1176 auto raw = (input_raw_t *) input.get();

Callers

nothing calls this directly

Calls 1

send_inputFunction · 0.85

Tested by

no test coverage detected