mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-27 16:23:35 +01:00
Post a message when the window title's text needs to change. This resolves #3282.
This commit is contained in:
1 parent
670d0c35fe
commit
975b8cf7e7
3 files changed
+21
-24
No files matched your search
+6
-24
@@ -107,32 +107,14 @@ void WindowsHost::ShutdownGL()
|
||||
|
||||
void WindowsHost::SetWindowTitle(const char *message)
|
||||
{
|
||||
std::string title = std::string("PPSSPP ") + PPSSPP_GIT_VERSION;
|
||||
if (message)
|
||||
title = title + " - " + message;
|
||||
|
||||
int size = MultiByteToWideChar(CP_UTF8, 0, title.c_str(), (int) title.size(), NULL, 0);
|
||||
if (size > 0)
|
||||
{
|
||||
// VC++6.0 any more?
|
||||
wchar_t *utf16_title = new(std::nothrow) wchar_t[size + 1];
|
||||
if (utf16_title)
|
||||
size = MultiByteToWideChar(CP_UTF8, 0, title.c_str(), (int) title.size(), utf16_title, size);
|
||||
else
|
||||
size = 0;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
utf16_title[size] = 0;
|
||||
// Don't use SetWindowTextW because it will internally use DefWindowProcA.
|
||||
DefWindowProcW(mainWindow_, WM_SETTEXT, 0, (LPARAM) utf16_title);
|
||||
delete[] utf16_title;
|
||||
}
|
||||
std::wstring winTitle = ConvertUTF8ToWString(std::string("PPSSPP ") + PPSSPP_GIT_VERSION);
|
||||
if(message != nullptr) {
|
||||
winTitle.append(ConvertUTF8ToWString(" - "));
|
||||
winTitle.append(ConvertUTF8ToWString(message));
|
||||
}
|
||||
|
||||
// Something went wrong, fall back to using the local codepage.
|
||||
if (size <= 0)
|
||||
SetWindowTextA(mainWindow_, title.c_str());
|
||||
MainWindow::SetWindowTitle(winTitle.c_str());
|
||||
PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_WINDOW_TITLE_CHANGED, 0, 0);
|
||||
}
|
||||
|
||||
void WindowsHost::InitSound(PMixer *mixer)
|
||||
|
||||
Reference in new issue
Block a user