From d98b7a8f4f94d8d3f7f1fdd131a7ead1658b721b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Thu, 23 Nov 2017 13:23:54 +0100 Subject: [PATCH] Sdk/Canvas: Prevent OnFocusLost/OnFocusReceived when using SetFocus on an already focused widget --- SDK/include/NDK/Canvas.inl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/SDK/include/NDK/Canvas.inl b/SDK/include/NDK/Canvas.inl index f1f1daec6..eb424332b 100644 --- a/SDK/include/NDK/Canvas.inl +++ b/SDK/include/NDK/Canvas.inl @@ -78,12 +78,15 @@ namespace Ndk inline void Canvas::SetKeyboardOwner(std::size_t canvasIndex) { - if (m_keyboardOwner != InvalidCanvasIndex) - m_widgetBoxes[m_keyboardOwner].widget->OnFocusLost(); + if (m_keyboardOwner != canvasIndex) + { + if (m_keyboardOwner != InvalidCanvasIndex) + m_widgetBoxes[m_keyboardOwner].widget->OnFocusLost(); - m_keyboardOwner = canvasIndex; + m_keyboardOwner = canvasIndex; - if (m_keyboardOwner != InvalidCanvasIndex) - m_widgetBoxes[m_keyboardOwner].widget->OnFocusReceived(); + if (m_keyboardOwner != InvalidCanvasIndex) + m_widgetBoxes[m_keyboardOwner].widget->OnFocusReceived(); + } } }