[ATSPI] Introduce SetListenPostRender interface 60/290860/1
authorWoochan Lee <wc0917.lee@samsung.com>
Mon, 13 Mar 2023 11:49:16 +0000 (20:49 +0900)
committerWoochan Lee <wc0917.lee@samsung.com>
Tue, 4 Apr 2023 06:03:10 +0000 (15:03 +0900)
A new interface for delivering PostRender event to atspi.

Change-Id: Ic80f3637f74a0b6f99b2cbb9eb11c793c88b9e06

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

index b058328..3d143bf 100644 (file)
@@ -338,6 +338,9 @@ namespace
 {
 class AdaptorAccessible : public ActorAccessible
 {
+private:
+  std::unique_ptr<TriggerEventInterface> mRenderNotification = nullptr;
+
 protected:
   bool mRoot = false;
 
@@ -474,6 +477,39 @@ public:
   {
     return {};
   }
+
+  void SetListenPostRender(bool enabled) override
+  {
+    if (!mRoot)
+    {
+      return;
+    }
+
+    auto window                                 = Dali::DevelWindow::Get(Self());
+    Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation(window);
+
+    if(!mRenderNotification)
+    {
+      mRenderNotification = std::unique_ptr<TriggerEventInterface>(
+                                           TriggerEventFactory::CreateTriggerEvent(MakeCallback(this, &AdaptorAccessible::OnPostRender),
+                                           TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER));
+    }
+
+    if (enabled)
+    {
+      windowImpl.SetRenderNotification(mRenderNotification.get());
+    }
+    else
+    {
+      windowImpl.SetRenderNotification(nullptr);
+    }
+  }
+
+  void OnPostRender()
+  {
+    Accessibility::Bridge::GetCurrentBridge()->Emit(Accessibility::Accessible::Get(Self()), Accessibility::WindowEvent::POST_RENDER);
+  }
+
 }; // AdaptorAccessible
 
 using AdaptorAccessiblesType = std::unordered_map<const Dali::RefObject*, std::unique_ptr<AdaptorAccessible> >;
index 77c7257..20f8d69 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef DALI_ATSPI_ACCESSIBILITY_H\r
 #define DALI_ATSPI_ACCESSIBILITY_H\r
 /*\r
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -341,6 +341,7 @@ enum class WindowEvent
   SHADE,\r
   UU_SHADE,\r
   RESTYLE,\r
+  POST_RENDER,\r
 };\r
 \r
 /**\r
index edac6d9..554fb73 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_ADAPTOR_ATSPI_ACCESSIBLE_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -316,6 +316,13 @@ public:
   virtual Dali::Actor GetInternalActor() = 0;
 
   /**
+   * @brief Sets whether to listen for post render callback.
+   *
+   * @param[in] enabled If ture, registration post render callback, false otherwise
+   */
+  virtual void SetListenPostRender(bool enabled);
+
+  /**
    * @brief Gets all implemented interfaces.
    *
    * Override DoGetInterfaces() to customize the return value of this method.
index c2a62b3..bc3557b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -191,6 +191,10 @@ bool Accessible::IsHidden() const
   return false;
 }
 
+void Accessible::SetListenPostRender(bool enabled)
+{
+}
+
 bool Accessible::IsProxy() const
 {
   return false;
index 31443ff..db9a2aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -393,6 +393,7 @@ void BridgeAccessible::RegisterInterfaces()
   AddFunctionToInterface(desc, "DoGesture", &BridgeAccessible::DoGesture);
   AddFunctionToInterface(desc, "GetReadingMaterial", &BridgeAccessible::GetReadingMaterial);
   AddFunctionToInterface(desc, "GetRelationSet", &BridgeAccessible::GetRelationSet);
+  AddFunctionToInterface(desc, "SetListenPostRender", &BridgeAccessible::SetListenPostRender);
   mDbusServer.addInterface("/", desc, true);
 }
 
@@ -1010,3 +1011,9 @@ DBus::ValueOrError<std::vector<BridgeAccessible::Relation>> BridgeAccessible::Ge
 
   return ret;
 }
+
+DBus::ValueOrError<void> BridgeAccessible::SetListenPostRender(bool enabled)
+{
+  FindSelf()->SetListenPostRender(enabled);
+  return {};
+}
index 0a3299c..cf67cac 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_ACCESSIBILITY_BRIDGE_ACCESSIBLE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -207,6 +207,11 @@ public:
    */
   DBus::ValueOrError<std::vector<Relation>> GetRelationSet();
 
+  /**
+   * @copydoc Dali::Accessibility::Accessible::SetListenPostRender()
+   */
+  DBus::ValueOrError<void> SetListenPostRender(bool enabled);
+
 private:
   /**
    * @brief Calculates Neighbor candidate object in root node.
index 26b697c..78684b0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -119,6 +119,7 @@ void BridgeObject::Emit(Accessible* obj, WindowEvent event, unsigned int detail)
     {WindowEvent::SHADE, "Shade"},
     {WindowEvent::UU_SHADE, "uUshade"},
     {WindowEvent::RESTYLE, "Restyle"},
+    {WindowEvent::POST_RENDER, "PostRender"},
   };
 
   if(!IsUp() || obj->IsHidden() || obj->GetSuppressedEvents()[AtspiEvent::WINDOW_CHANGED])
index 713dd3c..c13506f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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,6 +61,10 @@ bool Accessibility::Component::IsScrollable() const
   return false;
 }
 
+void Accessibility::Accessible::SetListenPostRender(bool enabled)
+{
+}
+
 bool Accessibility::Component::IsAccessibleContainingPoint(Point point, CoordinateType type) const
 {
   return false;
index f34d740..515aee9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -195,6 +195,16 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std
   mNativeWindowId = mWindowBase->GetNativeWindowId();
 }
 
+void Window::SetRenderNotification(TriggerEventInterface *renderNotification)
+{
+  if(!mWindowSurface)
+  {
+    return;
+  }
+
+  mWindowSurface->SetRenderNotification(renderNotification);
+}
+
 void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
 {
   mEventHandler = EventHandlerPtr(new EventHandler(mWindowSurface->GetWindowBase(), *mAdaptor));
index c0258f2..9f3663e 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -421,6 +421,13 @@ public:
    */
   void EmitAccessibilityHighlightSignal(bool highlight);
 
+  /**
+   * @brief Sets the render notification trigger to call when render thread is completed a frame
+   *
+   * @param[in] renderNotification to use
+   */
+  void SetRenderNotification(TriggerEventInterface *renderNotification);
+
 public: // Dali::Internal::Adaptor::SceneHolder
   /**
    * @copydoc Dali::Internal::Adaptor::SceneHolder::GetNativeHandle