[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 345686370b4e75285ea5f082d806e1edd9d96462..58a98fed947a1bb415c13ef0d092a8b7fdd843c5 100644 (file)
@@ -159,6 +159,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.
    *
index a63b06d1c6e5add7c7063bd1042c7dc27f63e74f..46c30c7d98ea1e1bd645235e6624e61b406d60e3 100644 (file)
@@ -364,6 +364,21 @@ public:
     return ForceUpResult::JUST_STARTED;
   }
 
+  /**
+   * @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.
    *
@@ -424,6 +439,17 @@ public:
     }
   }
 
+  /**
+   * @copydoc Dali::Accessibility::Bridge::WindowCreated()
+   */
+  void WindowCreated(Dali::Window window) override
+  {
+    if(IsUp())
+    {
+      EmitCreated(window);
+    }
+  }
+
   /**
    * @copydoc Dali::Accessibility::Bridge::WindowShown()
    */
index 12ab7c611fced44d12b0b05f6c1239ddae86dad2..195fa6eb2013e1871114222afdb79ce9bd3b456b 100644 (file)
@@ -77,6 +77,10 @@ struct DummyBridge : Dali::Accessibility::Bridge
     return nullptr;
   }
 
+  void WindowCreated(Window window) override
+  {
+  }
+
   void WindowShown(Window window) override
   {
   }
index 465aa1236f5d01a37b160b25a37f44a672530f6a..08699869485c46b88df760b2084fab3bce20a170 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 eb2cd9bec3618c9dea2f28e876967e70cc40604a..2d8df6f6450c18836494125a5d2feb1670719f99 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