Remove WindowAccessible on accessible detroyed 95/317695/2
authorYoungsun Suh <youngsun.suh@samsung.com>
Thu, 12 Sep 2024 01:40:28 +0000 (10:40 +0900)
committerYoungsun Suh <youngsun.suh@samsung.com>
Fri, 13 Sep 2024 05:12:29 +0000 (14:12 +0900)
Change-Id: I272ee43a819a5f6df85d90a08f50b3338875ff19

dali/devel-api/adaptor-framework/accessibility.cpp
dali/devel-api/adaptor-framework/atspi-accessibility.cpp
dali/devel-api/adaptor-framework/atspi-accessibility.h
dali/internal/accessibility/bridge/bridge-base.cpp
dali/internal/window-system/common/window-impl.cpp

index fe0b3a51778bb29b91292034bed0f87dd061470e..f6e1702eaf7f29fb6686d240b5f0942bd12bee18 100644 (file)
@@ -359,6 +359,17 @@ public:
   {
   }
 
+  ~AdaptorAccessible() override
+  {
+    if(mRoot)
+    {
+      if(auto bridge = Accessibility::Bridge::GetCurrentBridge())
+      {
+        bridge->RemoveTopLevelWindow(this);
+      }
+    }
+  }
+
   bool GrabFocus() override
   {
     return false;
index 1adebe75636d291bbad92e32b9b9ce54649152ef..c5d33a1547b04d47effcb25d8c040f6fc1f96384 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -61,59 +61,6 @@ void Dali::AtspiAccessibility::Say(const std::string& text, bool discardable, st
   }
 }
 
-int Dali::AtspiAccessibility::SetForcefully(bool turnOn)
-{
-  if(turnOn)
-  {
-    if(auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge())
-    {
-      bridge->Initialize();
-      auto ret = bridge->ForceUp();
-      return (int)ret;
-    }
-  }
-  else
-  {
-    if(auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge())
-    {
-      bridge->ForceDown();
-      return 0;
-    }
-  }
-  return -1;
-}
-
-int Dali::AtspiAccessibility::GetStatus()
-{
-  //0(ATSPI OFF, ScreenReader OFF), 1(ATSPI ON, ScreenReader OFF), 2 (ATSPI OFF, ScreenReader ON), 3(ATSPI ON, ScreenReader ON)
-  if(auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge())
-  {
-    if(bridge->GetScreenReaderEnabled())
-    {
-      if(bridge->IsEnabled())
-      {
-        return 3;
-      }
-      else
-      {
-        return 2;
-      }
-    }
-    else
-    {
-      if(bridge->IsEnabled())
-      {
-        return 1;
-      }
-      else
-      {
-        return 0;
-      }
-    }
-  }
-  return -1;
-}
-
 bool Dali::AtspiAccessibility::IsEnabled()
 {
   return Dali::Accessibility::IsUp();
index 3ee0674ea5d6deae1aa3b5001b09f22c5c4cc1ea..26ca5f2dc32c0889d14eec7f5adb61258bdc37e4 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef DALI_DEVEL_ATSPI_ACCESSIBILITY_H
 #define DALI_DEVEL_ATSPI_ACCESSIBILITY_H
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -64,22 +64,6 @@ DALI_ADAPTOR_API void StopReading(bool alsoNonDiscardable = false);
  */
 DALI_ADAPTOR_API bool SuppressScreenReader(bool suppress);
 
-/**
- * @brief Sets ATSPI to be turned On or Off forcibly.
- *
- * @param[in] turnOn true to turn on, false to turn off.
- * @return The status of ATSPI : 0(ATSPI OFF, ScreenReader OFF), 1(ATSPI ON, ScreenReader OFF),
- * 2 (ATSPI OFF, ScreenReader ON), 3(ATSPI ON, ScreenReader ON)
- */
-DALI_ADAPTOR_API int SetForcefully(bool turnOn);
-
-/**
- * @brief Gets ATSPI status.
- * @return Status of ATSPI : 0(ATSPI OFF, ScreenReader OFF), 1(ATSPI ON, ScreenReader OFF),
- * 2 (ATSPI OFF, ScreenReader ON), 3(ATSPI ON, ScreenReader ON)
- */
-DALI_ADAPTOR_API int GetStatus();
-
 /**
  * @brief Returns whether the state of Accessibility is enabled or not.
  *
index 0e3269c37e6ff067cc23afcbb188ef6291d0dc2c..3179368beb985009496a8c9eb9b5588d28275d84 100644 (file)
@@ -38,7 +38,6 @@ BridgeBase::BridgeBase()
 
 BridgeBase::~BridgeBase()
 {
-  mApplication.mChildren.clear();
 }
 
 void BridgeBase::AddCoalescableMessage(CoalescableMessages kind, Dali::Accessibility::Accessible* obj, float delay, std::function<void()> functor)
@@ -225,6 +224,7 @@ void BridgeBase::RemoveTopLevelWindow(Accessible* windowAccessible)
     if(mApplication.mChildren[i] == windowAccessible)
     {
       mApplication.mChildren.erase(mApplication.mChildren.begin() + i);
+      Emit(windowAccessible, WindowEvent::DESTROY);
       break;
     }
   }
index 3fce651f90527d6e96b92dde1ca08be3b8c00126..22e1264149e2e1b91ce883f97836a0a1feda43d5 100644 (file)
@@ -113,16 +113,6 @@ Window::Window()
 
 Window::~Window()
 {
-  if(mScene)
-  {
-    auto bridge     = Accessibility::Bridge::GetCurrentBridge();
-    auto rootLayer  = mScene.GetRootLayer();
-    auto accessible = Accessibility::Accessible::Get(rootLayer);
-    bridge->RemoveTopLevelWindow(accessible);
-    // Related to multi-window case. This is called for default window and non-default window, but it is effective for non-default window.
-    bridge->Emit(accessible, Accessibility::WindowEvent::DESTROY);
-  }
-
   if(mAdaptor)
   {
     mAdaptor->RemoveWindow(this);
@@ -1308,14 +1298,9 @@ void Window::OnAccessibilityEnabled()
 
 void Window::OnAccessibilityDisabled()
 {
-  auto bridge     = Accessibility::Bridge::GetCurrentBridge();
-  auto rootLayer  = mScene.GetRootLayer();
-  auto accessible = Accessibility::Accessible::Get(rootLayer);
-
   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Accessibility is disabled\n", this, mNativeWindowId);
 
   InterceptKeyEventSignal().Disconnect(this, &Window::OnAccessibilityInterceptKeyEvent);
-  bridge->RemoveTopLevelWindow(accessible);
 }
 
 bool Window::OnAccessibilityInterceptKeyEvent(const Dali::KeyEvent& keyEvent)