Properly separate Qt and SDL UI codepaths in update_mouse_msg()

Also drop the related hack for non-Windows platforms in qt_mainwindow.cpp
This commit is contained in:
Alexander Babikov
2025-11-26 11:45:50 +05:00
parent fc55d51887
commit e1b7579f9d
2 changed files with 7 additions and 20 deletions

View File

@@ -1728,6 +1728,7 @@ pc_reset_hard_init(void)
void
update_mouse_msg(void)
{
#ifdef USE_SDL_UI
wchar_t wcpufamily[2048];
wchar_t wcpu[2048];
wchar_t wmachine[2048];
@@ -1744,13 +1745,6 @@ update_mouse_msg(void)
if (wcp) /* remove parentheses */
*(wcp - 1) = L'\0';
mbstowcs(wcpu, cpu_s->name, strlen(cpu_s->name) + 1);
#ifdef _WIN32
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%%i%%%% - %ls",
plat_get_string(STRING_MOUSE_CAPTURE));
swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%%i%%%% - %ls",
(mouse_get_buttons() > 2) ? plat_get_string(STRING_MOUSE_RELEASE) : plat_get_string(STRING_MOUSE_RELEASE_MMB));
wcsncpy(mouse_msg[2], L"%i%%", sizeof_w(mouse_msg[2]));
#else
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls - %ls",
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu,
plat_get_string(STRING_MOUSE_CAPTURE));
@@ -1759,6 +1753,12 @@ update_mouse_msg(void)
(mouse_get_buttons() > 2) ? plat_get_string(STRING_MOUSE_RELEASE) : plat_get_string(STRING_MOUSE_RELEASE_MMB));
swprintf(mouse_msg[2], sizeof_w(mouse_msg[2]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls",
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu);
#else
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%%i%%%% - %ls",
plat_get_string(STRING_MOUSE_CAPTURE));
swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%%i%%%% - %ls",
(mouse_get_buttons() > 2) ? plat_get_string(STRING_MOUSE_RELEASE) : plat_get_string(STRING_MOUSE_RELEASE_MMB));
wcsncpy(mouse_msg[2], L"%i%%", sizeof_w(mouse_msg[2]));
#endif
}

View File

@@ -313,20 +313,7 @@ MainWindow::MainWindow(QWidget *parent)
return;
}
if (!hide_tool_bar)
#ifdef _WIN32
toolbar_label->setText(title);
#else
{
/* get the percentage and mouse message, TODO: refactor ui_window_title() */
auto parts = title.split(" - ");
if (parts.size() >= 2) {
if (parts.size() < 5)
toolbar_label->setText(parts[1]);
else
toolbar_label->setText(QString("%1 - %2").arg(parts[1], parts.last()));
}
}
#endif
});
connect(this, &MainWindow::getTitleForNonQtThread, this, &MainWindow::getTitle_, Qt::BlockingQueuedConnection);