From a89e64d85043b887ba56660582fb45b19424bb30 Mon Sep 17 00:00:00 2001 From: dongsug-song <35130733+dongsug-song@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:01:49 +0900 Subject: [PATCH] [NUI] Fix Window.FocusChanged event problem (#1855) --- src/Tizen.NUI/src/public/WindowEvent.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Tizen.NUI/src/public/WindowEvent.cs b/src/Tizen.NUI/src/public/WindowEvent.cs index e67fed0..93fec0f 100755 --- a/src/Tizen.NUI/src/public/WindowEvent.cs +++ b/src/Tizen.NUI/src/public/WindowEvent.cs @@ -46,7 +46,7 @@ namespace Tizen.NUI private WindowTransitionEffectSignal transitionEffectSignal; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void WindowFocusChangedEventCallbackType(bool focusGained); + private delegate void WindowFocusChangedEventCallbackType(IntPtr window, bool focusGained); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData); [UnmanagedFunctionPointer(CallingConvention.StdCall)] @@ -54,7 +54,7 @@ namespace Tizen.NUI [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void WindowResizedEventCallbackType(IntPtr windowSize); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void WindowFocusChangedEventCallbackType2(bool focusGained); + private delegate void WindowFocusChangedEventCallbackType2(IntPtr window, bool focusGained); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void TransitionEffectEventCallbackType(IntPtr window, int state, int type); @@ -541,8 +541,14 @@ namespace Tizen.NUI return transitionEffectSignal; } - private void OnWindowFocusedChanged(bool focusGained) + private void OnWindowFocusedChanged(IntPtr window, bool focusGained) { + if (window == IntPtr.Zero) + { + NUILog.Error("OnWindowFocusedChanged() Window is null! Do nothing!"); + return; + } + FocusChangedEventArgs e = new FocusChangedEventArgs(); e.FocusGained = focusGained; @@ -654,8 +660,14 @@ namespace Tizen.NUI } } - private void OnWindowFocusedChanged2(bool focusGained) + private void OnWindowFocusedChanged2(IntPtr window, bool focusGained) { + if (window == IntPtr.Zero) + { + NUILog.Error("OnWindowFocusedChanged() Window is null! Do nothing!"); + return; + } + FocusChangedEventArgs e = new FocusChangedEventArgs(); e.FocusGained = focusGained; -- 2.7.4