Widgets/Canvas: Fix OnFocusLost being called before removing focus

This commit is contained in:
SirLynix
2023-08-23 17:56:53 +02:00
parent 98c0a47dcc
commit 809dc7e0a7

View File

@@ -84,11 +84,13 @@ namespace Nz
{
if (m_keyboardOwner != canvasIndex)
{
if (m_keyboardOwner != InvalidCanvasIndex)
m_widgetEntries[m_keyboardOwner].widget->OnFocusLost();
std::size_t previousOwner = m_keyboardOwner;
m_keyboardOwner = canvasIndex;
if (previousOwner != InvalidCanvasIndex)
m_widgetEntries[previousOwner].widget->OnFocusLost();
if (m_keyboardOwner != InvalidCanvasIndex)
m_widgetEntries[m_keyboardOwner].widget->OnFocusReceived();
}