win32: fix broken win9x builds caused by #13089 (#13106)

Co-authored-by: Soar Qin <soarchin@gmial.com>
This commit is contained in:
Soar Qin 2021-10-12 17:24:58 +08:00 committed by GitHub
parent e9d4fcc00c
commit 290bc214e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

@ -1615,22 +1615,31 @@ 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));
#ifdef LEGACY_WIN32
char *title_local = utf8_to_local_string_alloc(new_label2);
#else
wchar_t *title_local = utf8_to_utf16_string_alloc(msg_hash_to_str(MSG_PROGRAM));
#endif
if (window_save_positions && !fullscreen)
{
user_width = g_win32->pos_width;
user_height = g_win32->pos_height;
}
#ifdef LEGACY_WIN32
main_window.hwnd = CreateWindowEx(0,
"RetroArch", title_local,
#else
main_window.hwnd = CreateWindowExW(0,
L"RetroArch", title_wide,
L"RetroArch", title_local,
#endif
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);
free(title_local);
if (!main_window.hwnd)
return false;

View File

@ -116,9 +116,14 @@ 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;
wchar_t *title_wide = utf8_to_utf16_string_alloc(buf);
SetWindowTextW(window->hwnd, title_wide);
free(title_wide);
#ifdef LEGACY_WIN32
char *title_local = utf8_to_local_string_alloc(new_label2);
SetWindowText(window->hwnd, title_local);
#else
wchar_t *title_local = utf8_to_utf16_string_alloc(buf);
SetWindowTextW(window->hwnd, title_local);
#endif
free(title_local);
}
void ui_window_win32_set_droppable(void *data, bool droppable)