Allied chat opens with t bug (on linux)
Comments By: vladislav, elexis Solution Proposed By: elexis fixes #5194 refs #3870 Differential Revision: D1386 This was SVN commit r26530.
This commit is contained in:
parent
2fbd9ea17d
commit
fefde41317
@ -423,6 +423,15 @@ CSize2D CGUI::GetWindowSize() const
|
||||
return CSize2D{static_cast<float>(g_xres) / g_VideoMode.GetScale(), static_cast<float>(g_yres) / g_VideoMode.GetScale() };
|
||||
}
|
||||
|
||||
void CGUI::SendFocusMessage(EGUIMessageType msgType)
|
||||
{
|
||||
if (m_FocusedObject)
|
||||
{
|
||||
SGUIMessage msg(msgType);
|
||||
m_FocusedObject->HandleMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void CGUI::SetFocusedObject(IGUIObject* pObject)
|
||||
{
|
||||
if (pObject == m_FocusedObject)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "gui/GUITooltip.h"
|
||||
#include "gui/SettingTypes/CGUIColor.h"
|
||||
#include "gui/SGUIIcon.h"
|
||||
#include "gui/SGUIMessage.h"
|
||||
#include "gui/SGUIStyle.h"
|
||||
#include "lib/input.h"
|
||||
#include "maths/Rect.h"
|
||||
@ -287,6 +288,11 @@ public:
|
||||
*/
|
||||
void SetFocusedObject(IGUIObject* pObject);
|
||||
|
||||
/**
|
||||
* Alert the focussed object of this GUIPage that the focus of the page has changed.
|
||||
*/
|
||||
void SendFocusMessage(EGUIMessageType msg);
|
||||
|
||||
/**
|
||||
* Reads a string value and modifies the given value of type T if successful.
|
||||
* Does not change the value upon conversion failure.
|
||||
|
@ -103,7 +103,12 @@ void CGUIManager::SwitchPage(const CStrW& pageName, const ScriptInterface* srcSc
|
||||
initDataClone = Script::WriteStructuredClone(rq, initData);
|
||||
}
|
||||
|
||||
m_PageStack.clear();
|
||||
if (!m_PageStack.empty())
|
||||
{
|
||||
// Make sure we unfocus anything on the current page.
|
||||
m_PageStack.back().gui->SendFocusMessage(GUIM_LOST_FOCUS);
|
||||
m_PageStack.clear();
|
||||
}
|
||||
|
||||
PushPage(pageName, initDataClone, JS::UndefinedHandleValue);
|
||||
}
|
||||
@ -112,8 +117,13 @@ void CGUIManager::PushPage(const CStrW& pageName, Script::StructuredClone initDa
|
||||
{
|
||||
// Store the callback handler in the current GUI page before opening the new one
|
||||
if (!m_PageStack.empty() && !callbackFunction.isUndefined())
|
||||
{
|
||||
m_PageStack.back().SetCallbackFunction(*m_ScriptInterface, callbackFunction);
|
||||
|
||||
// Make sure we unfocus anything on the current page.
|
||||
m_PageStack.back().gui->SendFocusMessage(GUIM_LOST_FOCUS);
|
||||
}
|
||||
|
||||
// Push the page prior to loading its contents, because that may push
|
||||
// another GUI page on init which should be pushed on top of this new page.
|
||||
m_PageStack.emplace_back(pageName, initData);
|
||||
@ -128,8 +138,14 @@ void CGUIManager::PopPage(Script::StructuredClone args)
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure we unfocus anything on the current page.
|
||||
m_PageStack.back().gui->SendFocusMessage(GUIM_LOST_FOCUS);
|
||||
|
||||
m_PageStack.pop_back();
|
||||
m_PageStack.back().PerformCallbackFunction(args);
|
||||
|
||||
// We return to a page where some object might have been focused.
|
||||
m_PageStack.back().gui->SendFocusMessage(GUIM_GOT_FOCUS);
|
||||
}
|
||||
|
||||
CGUIManager::SGUIPage::SGUIPage(const CStrW& pageName, const Script::StructuredClone initData)
|
||||
|
Loading…
Reference in New Issue
Block a user