[Tizen] Fix the failure to emit Accessibility::WindowEvent::CREATE event. 00/298900/1
authorWonsik Jung <sidein@samsung.com>
Fri, 15 Sep 2023 02:43:34 +0000 (11:43 +0900)
committerWonsik Jung <sidein@samsung.com>
Fri, 15 Sep 2023 02:43:34 +0000 (11:43 +0900)
Fixing the failure to emit Accessibility::WindowEvent::CREATE event.
This event can be sent the at-spi dbus should be enabled.
So, This event can be sent when accessibility is enabled.

Change-Id: I555744a6b9c0429fcd461598d73d310c847ae93e

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

index 3456863..58a98fe 100644 (file)
@@ -160,6 +160,13 @@ struct DALI_ADAPTOR_API Bridge
   virtual Accessible* FindByPath(const std::string& path) const = 0;
 
   /**
+   * @brief Notifies accessibility dbus that window has just been created.
+   *
+   * @param[in] window The window to be created
+   */
+  virtual void WindowCreated(Window window) = 0;
+
+  /**
    * @brief Notifies accessibility dbus that window has just been shown.
    *
    * @param[in] window The window to be shown
index a63b06d..46c30c7 100644 (file)
@@ -365,6 +365,21 @@ public:
   }
 
   /**
+   * @brief Sends a signal to dbus that the window is created.
+   *
+   * @param[in] window The window to be created
+   * @see BridgeObject::Emit()
+   */
+  void EmitCreated(Dali::Window window)
+  {
+    auto windowAccessible = mApplication.GetWindowAccessible(window);
+    if(windowAccessible)
+    {
+      windowAccessible->Emit(WindowEvent::CREATE, 0);
+    }
+  }
+
+  /**
    * @brief Sends a signal to dbus that the window is shown.
    *
    * @param[in] window The window to be shown
@@ -425,6 +440,17 @@ public:
   }
 
   /**
+   * @copydoc Dali::Accessibility::Bridge::WindowCreated()
+   */
+  void WindowCreated(Dali::Window window) override
+  {
+    if(IsUp())
+    {
+      EmitCreated(window);
+    }
+  }
+
+  /**
    * @copydoc Dali::Accessibility::Bridge::WindowShown()
    */
   void WindowShown(Dali::Window window) override
index 12ab7c6..195fa6e 100644 (file)
@@ -77,6 +77,10 @@ struct DummyBridge : Dali::Accessibility::Bridge
     return nullptr;
   }
 
+  void WindowCreated(Window window) override
+  {
+  }
+
   void WindowShown(Window window) override
   {
   }
index 465aa12..0869986 100644 (file)
@@ -104,7 +104,8 @@ Window::Window()
   mOpaqueState(false),
   mWindowRotationAcknowledgement(false),
   mFocused(false),
-  mIsWindowRotating(false)
+  mIsWindowRotating(false),
+  mIsEmittedWindowCreatedEvent(false)
 {
 }
 
@@ -219,16 +220,19 @@ void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
 
   // Add Window to bridge for ATSPI
   auto bridge = Accessibility::Bridge::GetCurrentBridge();
-  if(bridge->IsUp())
-  {
-    auto rootLayer  = mScene.GetRootLayer();
-    auto accessible = Accessibility::Accessible::Get(rootLayer);
-    bridge->AddTopLevelWindow(accessible);
-  }
 
   bridge->EnabledSignal().Connect(this, &Window::OnAccessibilityEnabled);
   bridge->DisabledSignal().Connect(this, &Window::OnAccessibilityDisabled);
 
+  if(bridge->IsUp())
+  {
+    OnAccessibilityEnabled();
+  }
+  else
+  {
+    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();
@@ -1109,16 +1113,26 @@ void Window::OnAccessibilityEnabled()
   auto accessible = Accessibility::Accessible::Get(rootLayer);
   bridge->AddTopLevelWindow(accessible);
 
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Accessibility is enabled\n", this, mNativeWindowId);
+
+  Dali::Window handle(this);
+  if(!mIsEmittedWindowCreatedEvent)
+  {
+    DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Emit Accessbility Window Created Event\n", this, mNativeWindowId);
+    bridge->WindowCreated(handle);
+    mIsEmittedWindowCreatedEvent = true;
+  }
+
   if(!mVisible || mIconified)
   {
     return;
   }
 
-  Dali::Window handle(this);
   bridge->WindowShown(handle);
 
   if(mFocused)
   {
+    DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Emit Accessbility Window Focused Event\n", this, mNativeWindowId);
     bridge->WindowFocused(handle);
   }
 }
@@ -1129,6 +1143,7 @@ void Window::OnAccessibilityDisabled()
   auto rootLayer  = mScene.GetRootLayer();
   auto accessible = Accessibility::Accessible::Get(rootLayer);
   bridge->RemoveTopLevelWindow(accessible);
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Accessibility is disabled\n", this, mNativeWindowId);
 }
 
 void Window::OnMoveCompleted(Dali::Window::WindowPosition& position)
index eb2cd9b..2d8df6f 100644 (file)
@@ -863,6 +863,7 @@ private:
   bool mWindowRotationAcknowledgement : 1;
   bool mFocused : 1;
   bool mIsWindowRotating : 1; ///< The window rotating flag.
+  bool mIsEmittedWindowCreatedEvent : 1; ///< The Window Created Event emit flag for accessibility.
 };
 
 } // namespace Adaptor