From 36cd73c44146a4f85939d5b8bfdcd141f362f86a Mon Sep 17 00:00:00 2001 From: Woochan Lee Date: Mon, 13 Mar 2023 20:49:16 +0900 Subject: [PATCH] [ATSPI] Introduce SetListenPostRender interface A new interface for delivering PostRender event to atspi. Change-Id: Ic80f3637f74a0b6f99b2cbb9eb11c793c88b9e06 --- dali/devel-api/adaptor-framework/accessibility.cpp | 36 ++++++++++++++++++++++ dali/devel-api/adaptor-framework/accessibility.h | 3 +- dali/devel-api/atspi-interfaces/accessible.h | 9 +++++- dali/internal/accessibility/bridge/accessible.cpp | 6 +++- .../accessibility/bridge/bridge-accessible.cpp | 9 +++++- .../accessibility/bridge/bridge-accessible.h | 7 ++++- .../accessibility/bridge/bridge-object.cpp | 3 +- .../accessibility/bridge/dummy/dummy-atspi.cpp | 6 +++- dali/internal/window-system/common/window-impl.cpp | 12 +++++++- dali/internal/window-system/common/window-impl.h | 9 +++++- 10 files changed, 91 insertions(+), 9 deletions(-) diff --git a/dali/devel-api/adaptor-framework/accessibility.cpp b/dali/devel-api/adaptor-framework/accessibility.cpp index b058328..3d143bf 100644 --- a/dali/devel-api/adaptor-framework/accessibility.cpp +++ b/dali/devel-api/adaptor-framework/accessibility.cpp @@ -338,6 +338,9 @@ namespace { class AdaptorAccessible : public ActorAccessible { +private: + std::unique_ptr 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( + 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 >; diff --git a/dali/devel-api/adaptor-framework/accessibility.h b/dali/devel-api/adaptor-framework/accessibility.h index 77c7257..20f8d69 100644 --- a/dali/devel-api/adaptor-framework/accessibility.h +++ b/dali/devel-api/adaptor-framework/accessibility.h @@ -1,7 +1,7 @@ #ifndef DALI_ATSPI_ACCESSIBILITY_H #define DALI_ATSPI_ACCESSIBILITY_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. @@ -341,6 +341,7 @@ enum class WindowEvent SHADE, UU_SHADE, RESTYLE, + POST_RENDER, }; /** diff --git a/dali/devel-api/atspi-interfaces/accessible.h b/dali/devel-api/atspi-interfaces/accessible.h index edac6d9..554fb73 100644 --- a/dali/devel-api/atspi-interfaces/accessible.h +++ b/dali/devel-api/atspi-interfaces/accessible.h @@ -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. diff --git a/dali/internal/accessibility/bridge/accessible.cpp b/dali/internal/accessibility/bridge/accessible.cpp index c2a62b3..bc3557b 100644 --- a/dali/internal/accessibility/bridge/accessible.cpp +++ b/dali/internal/accessibility/bridge/accessible.cpp @@ -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; diff --git a/dali/internal/accessibility/bridge/bridge-accessible.cpp b/dali/internal/accessibility/bridge/bridge-accessible.cpp index 31443ff..db9a2aa 100644 --- a/dali/internal/accessibility/bridge/bridge-accessible.cpp +++ b/dali/internal/accessibility/bridge/bridge-accessible.cpp @@ -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> BridgeAccessible::Ge return ret; } + +DBus::ValueOrError BridgeAccessible::SetListenPostRender(bool enabled) +{ + FindSelf()->SetListenPostRender(enabled); + return {}; +} diff --git a/dali/internal/accessibility/bridge/bridge-accessible.h b/dali/internal/accessibility/bridge/bridge-accessible.h index 0a3299c..cf67cac 100644 --- a/dali/internal/accessibility/bridge/bridge-accessible.h +++ b/dali/internal/accessibility/bridge/bridge-accessible.h @@ -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> GetRelationSet(); + /** + * @copydoc Dali::Accessibility::Accessible::SetListenPostRender() + */ + DBus::ValueOrError SetListenPostRender(bool enabled); + private: /** * @brief Calculates Neighbor candidate object in root node. diff --git a/dali/internal/accessibility/bridge/bridge-object.cpp b/dali/internal/accessibility/bridge/bridge-object.cpp index 26b697c..78684b0 100644 --- a/dali/internal/accessibility/bridge/bridge-object.cpp +++ b/dali/internal/accessibility/bridge/bridge-object.cpp @@ -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]) diff --git a/dali/internal/accessibility/bridge/dummy/dummy-atspi.cpp b/dali/internal/accessibility/bridge/dummy/dummy-atspi.cpp index 713dd3c..c13506f 100644 --- a/dali/internal/accessibility/bridge/dummy/dummy-atspi.cpp +++ b/dali/internal/accessibility/bridge/dummy/dummy-atspi.cpp @@ -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; diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index f34d740..515aee9 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -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)); diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index c0258f2..9f3663e 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -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 -- 2.7.4