From b6d2fd38c15ec44d5eb5d38f08db1cde7c85bffc Mon Sep 17 00:00:00 2001 From: Seoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com> Date: Thu, 18 Aug 2022 16:30:20 +0900 Subject: [PATCH 1/1] [NUI] Add ActionForward event for Accessibility (#4451) - In Accessibility, One finger double tap and hold gesture is to pass the event to the application. - For the application, it can get the signal using ActionForward event. - Dependencies : https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-adaptor/+/278951/ https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-toolkit/+/278952/ https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-csharp-binder/+/278953/ Signed-off-by: Seoyeon Kim Signed-off-by: Seoyeon Kim --- .../Interop/Interop.AccessibilityManager.cs | 3 ++ .../public/Accessibility/AccessibilityManager.cs | 18 +++++++++++ .../Accessibility/AccessibilityManagerEvent.cs | 36 ++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.AccessibilityManager.cs b/src/Tizen.NUI/src/internal/Interop/Interop.AccessibilityManager.cs index b796a36..5187f73 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.AccessibilityManager.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.AccessibilityManager.cs @@ -185,6 +185,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_AccessibilityManager_ActionScrollSignal")] public static extern global::System.IntPtr AccessibilityManager_ActionScrollSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_AccessibilityManager_ActionForwardSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionForwardSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_AccessibilityActionSignal_Empty")] public static extern bool AccessibilityActionSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); diff --git a/src/Tizen.NUI/src/public/Accessibility/AccessibilityManager.cs b/src/Tizen.NUI/src/public/Accessibility/AccessibilityManager.cs index d419132..23e19d3 100755 --- a/src/Tizen.NUI/src/public/Accessibility/AccessibilityManager.cs +++ b/src/Tizen.NUI/src/public/Accessibility/AccessibilityManager.cs @@ -327,6 +327,17 @@ namespace Tizen.NUI.Accessibility } return false; } + + // Callback for AccessibilityManager ActionForwardSignal + private bool OnActionForward(IntPtr data) + { + if (_accessibilityManagerActionForwardEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionForwardEventHandler(instance, null); + } + return false; + } // Callback for AccessibilityManager FocusChangedSignal private void OnFocusChanged(IntPtr view1, IntPtr view2) @@ -1089,5 +1100,12 @@ namespace Tizen.NUI.Accessibility if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + + internal AccessibilityActionSignal ActionForwardSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(Interop.AccessibilityManager.AccessibilityManager_ActionForwardSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } } } diff --git a/src/Tizen.NUI/src/public/Accessibility/AccessibilityManagerEvent.cs b/src/Tizen.NUI/src/public/Accessibility/AccessibilityManagerEvent.cs index 462e3d2..f08d42f 100755 --- a/src/Tizen.NUI/src/public/Accessibility/AccessibilityManagerEvent.cs +++ b/src/Tizen.NUI/src/public/Accessibility/AccessibilityManagerEvent.cs @@ -148,6 +148,10 @@ namespace Tizen.NUI.Accessibility private EventHandlerWithReturnType _accessibilityManagerActionStartStopEventHandler; private ActionStartStopEventCallbackDelegate _accessibilityManagerActionStartStopEventCallbackDelegate; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionForwardEventCallbackDelegate(IntPtr accessibilityManager); + private EventHandlerWithReturnType _accessibilityManagerActionForwardEventHandler; + private ActionForwardEventCallbackDelegate _accessibilityManagerActionForwardEventCallbackDelegate; /* // To be replaced by a new event that takes Touch [UnmanagedFunctionPointer(CallingConvention.StdCall)] @@ -982,6 +986,38 @@ namespace Tizen.NUI.Accessibility } } + /// + /// This is emitted when accessibility action is received to forward the event to the application (by one finger double tap and hold). + /// It is a kind of backdoor to bypass the normal behaviour. + /// + /// The signal to connect to + /// This is the only experimental API added to Tizen 6.0. (hidden as inhouse API.) + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandlerWithReturnType ActionForward + { + add + { + // Restricted to only one listener + if (_accessibilityManagerActionForwardEventHandler == null) + { + _accessibilityManagerActionForwardEventCallbackDelegate = new ActionForwardEventCallbackDelegate(OnActionForward); + this.ActionForwardSignal().Connect(_accessibilityManagerActionForwardEventCallbackDelegate); + } + + _accessibilityManagerActionForwardEventHandler += value; + } + + remove + { + _accessibilityManagerActionForwardEventHandler -= value; + + if (_accessibilityManagerActionForwardEventHandler == null && ActionForwardSignal().Empty() == false) + { + this.ActionForwardSignal().Disconnect(_accessibilityManagerActionForwardEventCallbackDelegate); + } + } + } + /* // To be replaced by a new event that takes Touch public event DaliEventHandlerWithReturnType ActionScroll -- 2.7.4