From 9112005f3adf24ccb219fe6bca4401e42a5ccf4f Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Mon, 29 Nov 2021 17:02:20 +0900 Subject: [PATCH] [AT-SPI] Fix not working screen reader when rerunning it [Reproduce Steps] 1. Screen Reader ON 2. Run any application 3. Turn Screen Reader OFF 4. Turn Screen Reader ON - It is caused by NULL windowAccessible which is returned by following function used by EmitActivate() Dali::Accessibility::Accessible* GetWindowAccessible(Dali::Window window) - Connected Enabled / Disabled signals to Window so that Window can add and remove itself from bridge when the state of bridge changes. Change-Id: I3bdebedd7bf4f9017d24b72999412a0f70cfd24b Signed-off-by: Seoyeon Kim --- dali/internal/accessibility/bridge/bridge-impl.cpp | 4 ++-- dali/internal/window-system/common/window-impl.cpp | 21 ++++++++++++++++++++- dali/internal/window-system/common/window-impl.h | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/dali/internal/accessibility/bridge/bridge-impl.cpp b/dali/internal/accessibility/bridge/bridge-impl.cpp index 5962576..8f72698 100644 --- a/dali/internal/accessibility/bridge/bridge-impl.cpp +++ b/dali/internal/accessibility/bridge/bridge-impl.cpp @@ -319,6 +319,8 @@ public: mApplication.mParent.SetAddress(std::move(std::get<0>(res))); + mEnabledSignal.Emit(); + if(mIsShown) { auto rootLayer = Dali::Stage::GetCurrent().GetRootLayer(); @@ -326,8 +328,6 @@ public: EmitActivate(window); // Currently, sends a signal that the default window is activated here. } - mEnabledSignal.Emit(); - return ForceUpResult::JUST_STARTED; } diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index f682484..f6c4c62 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -101,7 +101,7 @@ Window::~Window() { auto bridge = Accessibility::Bridge::GetCurrentBridge(); auto rootLayer = mScene.GetRootLayer(); - auto accessible = Accessibility::Accessible::Get(rootLayer); + auto accessible = Accessibility::Accessible::Get(rootLayer, true); bridge->RemoveTopLevelWindow(accessible); if(mAdaptor) @@ -179,6 +179,9 @@ void Window::OnAdaptorSet(Dali::Adaptor& adaptor) auto accessible = Accessibility::Accessible::Get(rootLayer, true); bridge->AddTopLevelWindow(accessible); + bridge->EnabledSignal().Connect(this, &Window::OnAccessibilityEnabled); + bridge->DisabledSignal().Connect(this, &Window::OnAccessibilityDisabled); + // If you call the 'Show' before creating the adaptor, the application cannot know the app resource id. // The show must be called after the adaptor is initialized. Show(); @@ -865,6 +868,22 @@ void Window::OnAuxiliaryMessage(const std::string& key, const std::string& value mAuxiliaryMessageSignal.Emit(key, value, options); } +void Window::OnAccessibilityEnabled() +{ + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + auto rootLayer = mScene.GetRootLayer(); + auto accessible = Accessibility::Accessible::Get(rootLayer, true); + bridge->AddTopLevelWindow(accessible); +} + +void Window::OnAccessibilityDisabled() +{ + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + auto rootLayer = mScene.GetRootLayer(); + auto accessible = Accessibility::Accessible::Get(rootLayer, true); + bridge->RemoveTopLevelWindow(accessible); +} + void Window::RecalculateTouchPosition(Integration::Point& point) { Vector2 position = point.GetScreenPosition(); diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index af5263c..3ea83ab 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -503,6 +503,20 @@ private: void OnAuxiliaryMessage(const std::string& key, const std::string& value, const Property::Array& options); /** + * @brief Called when Accessibility is enabled. + * + * This method is to register the window to accessibility bridge. + */ + void OnAccessibilityEnabled(); + + /** + * @brief Called when Accessibility is disabled. + * + * This method is to remove the window from accessibility bridge. + */ + void OnAccessibilityDisabled(); + + /** * @brief Set available orientation to window base. */ void SetAvailableAnlges(const std::vector& angles); -- 2.7.4