1
1
forked from 0ad/0ad

Fix 34ce0f865d resetting the cursor after calling the GUI pages script "init" function, refs #539.

Reset the cursor everytime the GUI page is opened, therefore also when
hotloading.

The init function shall be able to determine a cursor, such as already
present in the loading screen.

Differential Revision: https://code.wildfiregames.com/D2417
Tested on: clang 9.0.0, Jenkins/gcc6, Jenkins/vs2015

This was SVN commit r23149.
This commit is contained in:
elexis 2019-11-12 14:43:58 +00:00
parent aca8b9fffc
commit 235e238f9d
3 changed files with 2 additions and 13 deletions

View File

@ -105,8 +105,6 @@ void CGUIManager::PushPage(const CStrW& pageName, shared_ptr<ScriptInterface::St
// another GUI page on init which should be pushed on top of this new page.
m_PageStack.emplace_back(pageName, initData);
m_PageStack.back().LoadPage(m_ScriptRuntime);
ResetCursor();
}
void CGUIManager::PopPage(shared_ptr<ScriptInterface::StructuredClone> args)
@ -142,6 +140,7 @@ void CGUIManager::SGUIPage::LoadPage(shared_ptr<ScriptRuntime> scriptRuntime)
hotloadData = scriptInterface->WriteStructuredClone(hotloadDataVal);
}
g_CursorName = g_DefaultCursor;
inputs.clear();
gui.reset(new CGUI(scriptRuntime));
@ -285,11 +284,6 @@ Status CGUIManager::ReloadAllPages()
return INFO::OK;
}
void CGUIManager::ResetCursor()
{
g_CursorName = g_DefaultCursor;
}
InReaction CGUIManager::HandleEvent(const SDL_Event_* ev)
{
// We want scripts to have access to the raw input events, so they can do complex

View File

@ -82,11 +82,6 @@ public:
*/
Status ReloadChangedFile(const VfsPath& path);
/**
* Sets the default mouse pointer.
*/
void ResetCursor();
/**
* Called when we should reload all pages (e.g. translation hotloading update).
*/

View File

@ -82,7 +82,7 @@ std::wstring JSI_GUIManager::SetCursor(ScriptInterface::CxPrivate* UNUSED(pCxPri
void JSI_GUIManager::ResetCursor(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
{
g_GUI->ResetCursor();
g_CursorName = g_DefaultCursor;
}
bool JSI_GUIManager::TemplateExists(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& templateName)