win32: fix non-ASCII text display in window title (#13089)

This commit is contained in:
Soar Qin 2021-10-09 12:28:17 +08:00 committed by GitHub
parent a5a9393b26
commit 39fd4677d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -1615,20 +1615,22 @@ bool win32_window_create(void *data, unsigned style,
bool window_save_positions = settings->bools.video_window_save_positions;
unsigned user_width = width;
unsigned user_height = height;
wchar_t *title_wide = utf8_to_utf16_string_alloc(msg_hash_to_str(MSG_PROGRAM));
if (window_save_positions && !fullscreen)
{
user_width = g_win32->pos_width;
user_height = g_win32->pos_height;
}
main_window.hwnd = CreateWindowEx(0,
"RetroArch", msg_hash_to_str(MSG_PROGRAM),
main_window.hwnd = CreateWindowExW(0,
L"RetroArch", title_wide,
style,
fullscreen ? mon_rect->left : g_win32->pos_x,
fullscreen ? mon_rect->top : g_win32->pos_y,
user_width,
user_height,
NULL, NULL, NULL, data);
free(title_wide);
if (!main_window.hwnd)
return false;

View File

@ -116,7 +116,9 @@ static void ui_window_win32_set_visible(void *data,
static void ui_window_win32_set_title(void *data, char *buf)
{
ui_window_win32_t *window = (ui_window_win32_t*)data;
SetWindowText(window->hwnd, buf);
wchar_t *title_wide = utf8_to_utf16_string_alloc(buf);
SetWindowTextW(window->hwnd, title_wide);
free(title_wide);
}
void ui_window_win32_set_droppable(void *data, bool droppable)