From: Shinwoo Kim Date: Tue, 12 Apr 2022 08:23:31 +0000 (+0900) Subject: [AT-SPI] Window: add highlight signal X-Git-Tag: dali_2.1.19~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=3b4167d089c2d26f5de66c979ca3e5ac57bf557f;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git [AT-SPI] Window: add highlight signal The Window will highlight itself on NUI side. The GrabHighlight emits the Highlight signal. Change-Id: I2296685688056359afe5ce807d0b61deb280c091 --- diff --git a/dali/devel-api/adaptor-framework/accessibility.cpp b/dali/devel-api/adaptor-framework/accessibility.cpp index dc9484a..ddc4f20 100644 --- a/dali/devel-api/adaptor-framework/accessibility.cpp +++ b/dali/devel-api/adaptor-framework/accessibility.cpp @@ -355,12 +355,69 @@ public: bool GrabHighlight() override { - return false; + if(!IsUp()) + { + return false; + } + + // Only window accessible is able to grab and clear highlight + if(!mRoot) + { + return false; + } + + auto self = Self(); + auto oldHighlightedActor = GetCurrentlyHighlightedActor(); + if(self == oldHighlightedActor) + { + return true; + } + + // Clear the old highlight. + if(oldHighlightedActor) + { + auto oldHighlightedObject = Dali::Accessibility::Component::DownCast(Accessible::Get(oldHighlightedActor)); + if(oldHighlightedObject) + { + oldHighlightedObject->ClearHighlight(); + } + } + + SetCurrentlyHighlightedActor(self); + + auto window = Dali::DevelWindow::Get(self); + Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation(window); + windowImpl.EmitAccessibilityHighlightSignal(true); + + return true; } bool ClearHighlight() override { - return false; + if(!IsUp()) + { + return false; + } + + // Only window accessible is able to grab and clear highlight + if(!mRoot) + { + return false; + } + + auto self = Self(); + if(self != GetCurrentlyHighlightedActor()) + { + return false; + } + + SetCurrentlyHighlightedActor({}); + + auto window = Dali::DevelWindow::Get(self); + Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation(window); + windowImpl.EmitAccessibilityHighlightSignal(false); + + return true; } Role GetRole() const override diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp index b9aa46c..34b609a 100644 --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -106,6 +106,11 @@ AuxiliaryMessageSignalType& AuxiliaryMessageSignal(Window window) return GetImplementation(window).AuxiliaryMessageSignal(); } +AccessibilityHighlightSignalType& AccessibilityHighlightSignal(Window window) +{ + return GetImplementation(window).AccessibilityHighlightSignal(); +} + void SetParent(Window window, Window parent) { GetImplementation(window).SetParent(parent); diff --git a/dali/devel-api/adaptor-framework/window-devel.h b/dali/devel-api/adaptor-framework/window-devel.h index a4779f7..8f51d27 100644 --- a/dali/devel-api/adaptor-framework/window-devel.h +++ b/dali/devel-api/adaptor-framework/window-devel.h @@ -53,6 +53,8 @@ typedef Signal KeyboardRepeatSettingsChangedSignalType; ///< Keyboard re typedef Signal AuxiliaryMessageSignalType; ///< Auxiliary message signal type +typedef Signal AccessibilityHighlightSignalType; ///< Accessibility Highlight signal type + /** * @brief Creates an initialized handle to a new Window. * @@ -163,6 +165,25 @@ DALI_ADAPTOR_API KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettings DALI_ADAPTOR_API AuxiliaryMessageSignalType& AuxiliaryMessageSignal(Window window); /** + * @brief This signal is emitted when the window needs to grab or clear accessibility highlight. + * The highlight indicates that it is an object to interact with the user regardless of focus. + * After setting the highlight on the object, you can do things that the object can do, such as + * giving or losing focus. + * + * This signal is emitted by Dali::Accessibility::Component::GrabHighlight + * and Dali::Accessibility::Component::ClearHighlight + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName( Window window, bool highlight ); + * @endcode + * + * @param[in] window The window instance + * @return The signal to connect to + */ +DALI_ADAPTOR_API AccessibilityHighlightSignalType& AccessibilityHighlightSignal(Window window); + +/** * @brief Sets parent window of the window. * * After setting that, these windows do together when raise-up, lower and iconified/deiconified. diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 794438d..1c99009 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -357,6 +357,12 @@ void Window::SetPositionSizeWithOrientation(PositionSize positionSize, WindowOri mWindowBase->SetPositionSizeWithAngle(positionSize, angle); } +void Window::EmitAccessibilityHighlightSignal(bool highlight) +{ + Dali::Window handle(this); + mAccessibilityHighlightSignal.Emit(handle, highlight); +} + void Window::SetAvailableAnlges(const std::vector& angles) { if(angles.size() > 4) diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index 282a3ca..ce91a7f 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -65,6 +65,7 @@ public: typedef Dali::DevelWindow::TransitionEffectEventSignalType TransitionEffectEventSignalType; typedef Dali::DevelWindow::KeyboardRepeatSettingsChangedSignalType KeyboardRepeatSettingsChangedSignalType; typedef Dali::DevelWindow::AuxiliaryMessageSignalType AuxiliaryMessageSignalType; + typedef Dali::DevelWindow::AccessibilityHighlightSignalType AccessibilityHighlightSignalType; typedef Signal SignalType; /** @@ -392,6 +393,16 @@ public: */ void SetPositionSizeWithOrientation(PositionSize positionSize, WindowOrientation orientation); + /** + * @brief Emit the accessibility highlight signal. + * The highlight indicates that it is an object to interact with the user regardless of focus. + * After setting the highlight on the object, you can do things that the object can do, such as + * giving or losing focus. + * + * @param[in] highlight If window needs to grab or clear highlight. + */ + void EmitAccessibilityHighlightSignal(bool highlight); + public: // Dali::Internal::Adaptor::SceneHolder /** * @copydoc Dali::Internal::Adaptor::SceneHolder::GetNativeHandle @@ -683,6 +694,14 @@ public: // Signals return mAuxiliaryMessageSignal; } + /** + * @copydoc Dali::DevelWindow::AccessibilityHighlightSignal() + */ + AccessibilityHighlightSignalType& AccessibilityHighlightSignal() + { + return mAccessibilityHighlightSignal; + } + private: WindowRenderSurface* mWindowSurface; ///< The window rendering surface WindowBase* mWindowBase; @@ -718,6 +737,7 @@ private: TransitionEffectEventSignalType mTransitionEffectEventSignal; KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal; AuxiliaryMessageSignalType mAuxiliaryMessageSignal; + AccessibilityHighlightSignalType mAccessibilityHighlightSignal; }; } // namespace Adaptor