define UNICODE when including windows

This commit is contained in:
jacob 2024-04-04 17:57:26 -05:00
parent 8035e3d4bd
commit d29b0569ee

View File

@ -12,6 +12,7 @@
#include "tls.h" #include "tls.h"
#include "utf.h" #include "utf.h"
#define UNICODE
#include <Windows.h> #include <Windows.h>
#include <windowsx.h> #include <windowsx.h>
#include <ShlObj_core.h> #include <ShlObj_core.h>
@ -930,8 +931,6 @@ INTERNAL LRESULT CALLBACK win32_window_proc(HWND hwnd, UINT msg, WPARAM wparam,
struct utf16_decode_result decoded = utf16_decode((struct string16) { .len = ARRAY_COUNT(utf16_pair_bytes), .text = utf16_pair_bytes }); struct utf16_decode_result decoded = utf16_decode((struct string16) { .len = ARRAY_COUNT(utf16_pair_bytes), .text = utf16_pair_bytes });
if (decoded.advance16 == 2 && decoded.codepoint < U32_MAX) { if (decoded.advance16 == 2 && decoded.codepoint < U32_MAX) {
codepoint = decoded.codepoint; codepoint = decoded.codepoint;
} else {
codepoint = '?';
} }
} }
window->utf16_high_surrogate_last_input = 0; window->utf16_high_surrogate_last_input = 0;
@ -1923,9 +1922,9 @@ int CALLBACK wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev_instance,
wc->hInstance = instance; wc->hInstance = instance;
/* Use first icon resource as window icon (same as explorer) */ /* Use first icon resource as window icon (same as explorer) */
char path[MAX_PATH] = { 0 }; wchar_t path[MAX_PATH] = { 0 };
GetModuleFileName(instance, path, MAX_PATH); GetModuleFileNameW(instance, path, MAX_PATH);
ExtractIconEx(path, 0, &wc->hIcon, &wc->hIconSm, 1); ExtractIconExW(path, 0, &wc->hIcon, &wc->hIconSm, 1);
if (!RegisterClassExW(wc)) { if (!RegisterClassExW(wc)) {
/* TODO: GetLastError */ /* TODO: GetLastError */