mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-06 23:15:42 +02:00
Rename window from event thread
This commit is contained in:
parent
3c157daf34
commit
6f2a9d66cb
3 changed files with 16 additions and 1 deletions
|
@ -83,6 +83,7 @@ enum
|
||||||
REQUEST_SETFULLSCREEN = 0,
|
REQUEST_SETFULLSCREEN = 0,
|
||||||
REQUEST_WINRESIZE,
|
REQUEST_WINRESIZE,
|
||||||
REQUEST_WINREPOSITION,
|
REQUEST_WINREPOSITION,
|
||||||
|
REQUEST_WINRENAME,
|
||||||
REQUEST_MESSAGEBOX,
|
REQUEST_MESSAGEBOX,
|
||||||
REQUEST_SETCURSORVISIBLE,
|
REQUEST_SETCURSORVISIBLE,
|
||||||
|
|
||||||
|
@ -413,6 +414,11 @@ void EventThread::process(RGSSThreadData &rtData)
|
||||||
|
|
||||||
case REQUEST_WINREPOSITION :
|
case REQUEST_WINREPOSITION :
|
||||||
SDL_SetWindowPosition(win, event.window.data1, event.window.data2);
|
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;
|
break;
|
||||||
|
|
||||||
case REQUEST_MESSAGEBOX :
|
case REQUEST_MESSAGEBOX :
|
||||||
|
@ -601,6 +607,14 @@ void EventThread::requestWindowReposition(int x, int y)
|
||||||
SDL_PushEvent(&event);
|
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)
|
void EventThread::requestShowCursor(bool mode)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
|
@ -87,6 +87,7 @@ public:
|
||||||
void requestFullscreenMode(bool mode);
|
void requestFullscreenMode(bool mode);
|
||||||
void requestWindowResize(int width, int height);
|
void requestWindowResize(int width, int height);
|
||||||
void requestWindowReposition(int x, int y);
|
void requestWindowReposition(int x, int y);
|
||||||
|
void requestWindowRename(const char *title);
|
||||||
void requestShowCursor(bool mode);
|
void requestShowCursor(bool mode);
|
||||||
|
|
||||||
void requestTerminate();
|
void requestTerminate();
|
||||||
|
|
|
@ -303,7 +303,7 @@ MKXP_SetWindowPos(HWND hWnd,
|
||||||
PREFABI BOOL
|
PREFABI BOOL
|
||||||
MKXP_SetWindowTextA(HWND hWnd, LPCSTR lpString)
|
MKXP_SetWindowTextA(HWND hWnd, LPCSTR lpString)
|
||||||
{
|
{
|
||||||
SDL_SetWindowTitle(shState->sdlWindow(), (const char*)lpString);
|
shState->eThread().requestWindowRename((const char*)lpString);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue