diff --git a/src/eventthread.cpp b/src/eventthread.cpp index e08283be..100a2a90 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -83,6 +83,7 @@ enum REQUEST_SETFULLSCREEN = 0, REQUEST_WINRESIZE, REQUEST_WINREPOSITION, + REQUEST_WINRENAME, REQUEST_MESSAGEBOX, REQUEST_SETCURSORVISIBLE, @@ -413,6 +414,11 @@ void EventThread::process(RGSSThreadData &rtData) case REQUEST_WINREPOSITION : SDL_SetWindowPosition(win, event.window.data1, event.window.data2); + break; + + case REQUEST_WINRENAME : + rtData.config.windowTitle = (const char*)event.user.data1; + SDL_SetWindowTitle(win, rtData.config.windowTitle.c_str()); break; case REQUEST_MESSAGEBOX : @@ -601,6 +607,14 @@ void EventThread::requestWindowReposition(int x, int y) SDL_PushEvent(&event); } +void EventThread::requestWindowRename(const char *title) +{ + SDL_Event event; + event.type = usrIdStart + REQUEST_WINRENAME; + event.user.data1 = (void*)title; + SDL_PushEvent(&event); +} + void EventThread::requestShowCursor(bool mode) { SDL_Event event; diff --git a/src/eventthread.h b/src/eventthread.h index 97657fe8..74dfbf05 100644 --- a/src/eventthread.h +++ b/src/eventthread.h @@ -87,6 +87,7 @@ public: void requestFullscreenMode(bool mode); void requestWindowResize(int width, int height); void requestWindowReposition(int x, int y); + void requestWindowRename(const char *title); void requestShowCursor(bool mode); void requestTerminate(); diff --git a/src/fake-api.cpp b/src/fake-api.cpp index 3dca7eb0..e33b8149 100644 --- a/src/fake-api.cpp +++ b/src/fake-api.cpp @@ -303,7 +303,7 @@ MKXP_SetWindowPos(HWND hWnd, PREFABI BOOL MKXP_SetWindowTextA(HWND hWnd, LPCSTR lpString) { - SDL_SetWindowTitle(shState->sdlWindow(), (const char*)lpString); + shState->eThread().requestWindowRename((const char*)lpString); return true; }