Due to the performance issue, we do not allow to use Window.ViewAdded signal.
Instead, We need to guide app to use View.AddedToWindow event
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
+++ /dev/null
-/*
- * Copyright(c) 2023 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-namespace Tizen.NUI
-{
- internal class WindowViewAddedSignal : Disposable
- {
-
- internal WindowViewAddedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
- {
- }
-
- protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
- {
- Interop.WindowViewAddedSignal.DeleteSignal(swigCPtr);
- }
-
- public bool Empty()
- {
- bool ret = Interop.WindowViewAddedSignal.Empty(SwigCPtr);
-
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- public uint GetConnectionCount()
- {
- uint ret = Interop.WindowViewAddedSignal.GetConnectionCount(SwigCPtr);
-
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- public void Connect(System.Delegate func)
- {
- System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
- {
- Interop.WindowViewAddedSignal.Connect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- }
-
- public void Disconnect(System.Delegate func)
- {
- System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
- {
- Interop.WindowViewAddedSignal.Disconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- }
-
- public bool Emit()
- {
- bool ret = Interop.WindowViewAddedSignal.Emit(SwigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- public WindowViewAddedSignal(Window window) : this(Interop.WindowViewAddedSignal.GetSignal(Window.getCPtr(window)), false)
- {
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2023 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System.Runtime.InteropServices;
-
-namespace Tizen.NUI
-{
- internal static partial class Interop
- {
- internal static partial class WindowViewAddedSignal
- {
- [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_View_Added_Signal")]
- public static extern global::System.IntPtr GetSignal(HandleRef jarg1);
-
- [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_View_Added_Signal_Empty")]
- [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
- public static extern bool Empty(HandleRef jarg1);
-
- [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_View_Added_Signal_GetConnectionCount")]
- public static extern uint GetConnectionCount(HandleRef jarg1);
-
- [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_View_Added_Signal_Connect")]
- public static extern void Connect(HandleRef jarg1, HandleRef jarg2);
-
- [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_View_Added_Signal_Disconnect")]
- public static extern void Disconnect(HandleRef jarg1, HandleRef jarg2);
-
- [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_View_Added_Signal_Emit")]
- [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
- public static extern bool Emit(HandleRef jarg1);
-
- [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_View_Added_Signal_new")]
- public static extern global::System.IntPtr NewSignal();
-
- [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_View_Added_delete")]
- public static extern void DeleteSignal(HandleRef jarg1);
- }
- }
-}
private MovedEventCallbackType movedEventCallback;
private OrientationChangedEventCallbackType orientationChangedEventCallback;
private KeyboardRepeatSettingsChangedEventCallbackType keyboardRepeatSettingsChangedEventCallback;
- private ViewAddedEventCallbackType viewAddedEventCallback;
private AuxiliaryMessageEventCallbackType auxiliaryMessageEventCallback;
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void WindowFocusChangedEventCallbackType(IntPtr window, bool focusGained);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void KeyboardRepeatSettingsChangedEventCallbackType();
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void ViewAddedEventCallbackType(IntPtr view);
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void AuxiliaryMessageEventCallbackType(IntPtr kData, IntPtr vData, IntPtr optionsArray);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool InterceptKeyEventDelegateType(IntPtr arg1);
}
}
- /// <summary>
- /// ViewAdded will be triggered when the view added on Window
- /// </summary>
- /// <since_tizen> 6 </since_tizen>
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler ViewAdded
- {
- add
- {
- if (viewAddedHandler == null)
- {
- viewAddedEventCallback = OnViewAdded;
- using WindowViewAddedSignal signal = new WindowViewAddedSignal(Interop.WindowViewAddedSignal.GetSignal(SwigCPtr), false);
- signal.Ensure()?.Connect(viewAddedEventCallback);
- }
- viewAddedHandler += value;
- }
- remove
- {
- viewAddedHandler -= value;
- if (viewAddedHandler == null && viewAddedEventCallback != null)
- {
- using WindowViewAddedSignal signal = new WindowViewAddedSignal(Interop.WindowViewAddedSignal.GetSignal(SwigCPtr), false);
- signal.Ensure()?.Disconnect(viewAddedEventCallback);
- viewAddedEventCallback = null;
- }
- }
- }
-
private event EventHandler<FocusChangedEventArgs> windowFocusChangedEventHandler;
private event EventHandler<TouchEventArgs> rootLayerTouchDataEventHandler;
private ReturnTypeEventHandler<object, TouchEventArgs, bool> rootLayerInterceptTouchDataEventHandler;
private event EventHandler<WindowMovedEventArgs> movedHandler;
private event EventHandler<WindowOrientationChangedEventArgs> orientationChangedHandler;
private event EventHandler keyboardRepeatSettingsChangedHandler;
- private event EventHandler viewAddedHandler;
private event EventHandler<AuxiliaryMessageEventArgs> auxiliaryMessageEventHandler;
keyboardRepeatSettingsChangedEventCallback = null;
}
- if (viewAddedEventCallback != null)
- {
- using WindowViewAddedSignal signal = new WindowViewAddedSignal(Interop.WindowViewAddedSignal.GetSignal(GetBaseHandleCPtrHandleRef), false);
- signal?.Disconnect(viewAddedEventCallback);
- viewAddedEventCallback = null;
- }
-
if (auxiliaryMessageEventCallback != null)
{
using WindowAuxiliaryMessageSignal signal = new WindowAuxiliaryMessageSignal(Interop.WindowAuxiliaryMessageSignalType.Get(GetBaseHandleCPtrHandleRef), false);
return;
}
- private void OnViewAdded(IntPtr view)
- {
- if (view == global::System.IntPtr.Zero)
- {
- return;
- }
-
- View addedView = Extensions.GetInstanceSafely<View>(this, view);
- if (addedView)
- {
- // Note : object sender is View, not window it selfs (Since tizen_5.5, Pull Request #705)
- viewAddedHandler?.Invoke(view, EventArgs.Empty);
- }
- return;
- }
-
/// <summary>
/// The focus changed event argument.
/// </summary>