From: Jaehyun Cho Date: Mon, 20 Dec 2021 09:38:17 +0000 (+0900) Subject: Merge branch 'devel/master' into tizen X-Git-Tag: accepted/tizen/unified/20211222.230356~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9dbe6f1424da7834a3b1572c852b84bb652f1156;hp=2f2f4cd842b984dc871878d5d15cfd75d33af5b2;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Merge branch 'devel/master' into tizen --- diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 802f5aa..7d2da30 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -272,6 +272,7 @@ SET( tizenadaptordevelapidir ${INCLUDE_DIR}/dali/devel-api ) SET( tizenadaptorintegrationapidir ${INCLUDE_DIR}/dali/integration-api/adaptor-framework ) SET( tizenadaptorframeworkpublicapidir ${tizenadaptorpublicapidir}/adaptor-framework ) SET( tizenadaptorframeworkdevelapidir ${tizenadaptordevelapidir}/adaptor-framework ) +SET( tizenatspiinterfacesdevelapidir ${tizenadaptordevelapidir}/atspi-interfaces ) SET( tizentextabstractiondevelapidir ${tizenadaptordevelapidir}/text-abstraction ) SET( tizenadaptordaliheaderdir ${INCLUDE_DIR}/dali ) SET( tizenwatchpublicapidir ${tizenadaptorpublicapidir}/watch ) @@ -285,6 +286,7 @@ INSTALL( FILES ${public_api_header_files} DESTINATION ${tizenadaptorpublicapidir INSTALL( FILES ${adaptor_integration_api_header_files} DESTINATION ${tizenadaptorintegrationapidir} ) INSTALL( FILES ${public_api_adaptor_framework_header_files} DESTINATION ${tizenadaptorframeworkpublicapidir} ) INSTALL( FILES ${devel_api_adaptor_framework_header_files} DESTINATION ${tizenadaptorframeworkdevelapidir} ) +INSTALL( FILES ${devel_api_atspi_interfaces_header_files} DESTINATION ${tizenatspiinterfacesdevelapidir} ) INSTALL( FILES ${text_abstraction_header_files} DESTINATION ${tizentextabstractiondevelapidir} ) # Install Android framework headers for Android build diff --git a/dali/devel-api/adaptor-framework/accessibility-bridge.h b/dali/devel-api/adaptor-framework/accessibility-bridge.h new file mode 100644 index 0000000..90f9fb5 --- /dev/null +++ b/dali/devel-api/adaptor-framework/accessibility-bridge.h @@ -0,0 +1,463 @@ +#ifndef DALI_ADAPTOR_ACCESSIBILITY_BRIDGE_H +#define DALI_ADAPTOR_ACCESSIBILITY_BRIDGE_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ +namespace Accessibility +{ +class Accessible; + +/** + * @brief Base class for different accessibility bridges. + * + * Bridge is resposible for initializing and managing connection on accessibility bus. + * Accessibility clients will not get any information about UI without initialized and upraised bridge. + * Concrete implementation depends on the accessibility technology available on the platform. + * + * @note This class is singleton. + */ +struct DALI_ADAPTOR_API Bridge +{ + enum class ForceUpResult + { + JUST_STARTED, + ALREADY_UP + }; + + /** + * @brief Destructor + */ + virtual ~Bridge() = default; + + /** + * @brief Gets bus name which bridge is initialized on. + * + * @return The bus name + */ + virtual const std::string& GetBusName() const = 0; + + /** + * @brief Registers top level window. + * + * Hierarchy of objects visible for accessibility clients is based on tree-like + * structure created from Actors objects. This method allows to connect chosen + * object as direct ancestor of application and therefore make it visible for + * accessibility clients. + * + * @param[in] object The accessible object + */ + virtual void AddTopLevelWindow(Accessible* object) = 0; + + /** + * @brief Removes top level window. + * + * Hierarchy of objects visible for accessibility clients is based on tree-like + * structure created from Actors objects. This method removes previously added + * window from visible accessibility objects. + * + * @param[in] object The accessible object + */ + virtual void RemoveTopLevelWindow(Accessible* object) = 0; + + /** + * @brief Adds object on the top of the stack of "default label" sourcing objects. + * + * @see GetDefaultLabel + * + * @param[in] object The accessible object + */ + virtual void RegisterDefaultLabel(Accessible* object) = 0; + + /** + * @brief Removes object from the stack of "default label" sourcing objects. + * + * @see GetDefaultLabel + * + * @param[in] object The accessible object + */ + virtual void UnregisterDefaultLabel(Accessible* object) = 0; + + /** + * @brief Gets the top-most object from the stack of "default label" sourcing objects. + * + * The "default label" is a reading material (text) derived from an accesibility object + * that could be read by screen-reader immediately after the navigation context has changed + * (window activates, popup shows up, tab changes) and before first UI element is highlighted. + * + * @return The handler to accessibility object + * @note This is a Tizen only feature not present in upstream ATSPI. + * Feature can be enabled/disabled for particular context root object + * by setting value of its accessibility attribute "default_label". + * Following strings are valid values for "default_label" attribute: "enabled", "disabled". + * Any other value will be interpreted as "enabled". + */ + virtual Accessible* GetDefaultLabel() const = 0; + + /** + * @brief Sets name of current application which will be visible on accessibility bus. + * + * @param[in] name The application name + */ + virtual void SetApplicationName(std::string name) = 0; + + /** + * @brief Gets object being root of accessibility tree. + * + * @return handler to accessibility object + */ + virtual Accessible* GetApplication() const = 0; + + /** + * @brief Finds an object in accessibility tree. + * + * @param[in] path The path to object + * + * @return The handler to accessibility object + */ + virtual Accessible* FindByPath(const std::string& path) const = 0; + + /** + * @brief Notifies accessibility dbus that window has just been shown. + * + * @param[in] window The window to be shown + */ + virtual void WindowShown(Window window) = 0; + + /** + * @brief Notifies accessibility dbus that window has just been hidden. + * + * @param[in] window The window to be hidden + */ + virtual void WindowHidden(Window window) = 0; + + /** + * @brief Notifies accessibility dbus that window has just been focused. + * + * @param[in] window The window to be focused + */ + virtual void WindowFocused(Window window) = 0; + + /** + * @brief Notifies accessibility dbus that window has just been out of focus. + * + * @param[in] window The window to be out of focus + */ + virtual void WindowUnfocused(Window window) = 0; + + /** + * @brief Initializes accessibility bus. + */ + virtual void Initialize() = 0; + + /** + * @brief Terminates accessibility bus. + */ + virtual void Terminate() = 0; + + /** + * @brief This method is called, when bridge is being activated. + */ + virtual ForceUpResult ForceUp() + { + if(mData) + { + return ForceUpResult::ALREADY_UP; + } + mData = std::make_shared(); + mData->mBridge = this; + return ForceUpResult::JUST_STARTED; + } + + /** + * @brief This method is called, when bridge is being deactivated. + */ + virtual void ForceDown() = 0; + + /** + * @brief Checks if bridge is activated or not. + * @return True if brige is activated. + */ + bool IsUp() const + { + return bool(mData); + } + + /** + * @brief Emits cursor-moved event on at-spi bus. + * + * @param[in] obj The accessible object + * @param[in] cursorPosition The new cursor position + **/ + virtual void EmitCursorMoved(Accessible* obj, unsigned int cursorPosition) = 0; + + /** + * @brief Emits active-descendant-changed event on at-spi bus. + * + * @param[in] obj The accessible object + * @param[in] child The child of the object + **/ + virtual void EmitActiveDescendantChanged(Accessible* obj, Accessible* child) = 0; + + /** + * @brief Emits text-changed event on at-spi bus. + * + * @param[in] obj The accessible object + * @param[in] state The changed state for text, such as Inserted or Deleted + * @param[in] position The cursor position + * @param[in] length The text length + * @param[in] content The changed text + **/ + virtual void EmitTextChanged(Accessible* obj, TextChangedState state, unsigned int position, unsigned int length, const std::string& content) = 0; + + /** + * @brief Emits MoveOuted event on at-spi bus. + * + * @param[in] obj Accessible object + * @param[in] type Direction type when an Accessible object moves out of screen + **/ + virtual void EmitMovedOutOfScreen(Accessible* obj, ScreenRelativeMoveType type) = 0; + + /** + * @brief Emits state-changed event on at-spi bus. + * + * @param[in] obj The accessible object + * @param[in] state The accessibility state (SHOWING, HIGHLIGHTED, etc) + * @param[in] newValue Whether the state value is changed to new value or not. + * @param[in] reserved Reserved. (Currently, this argument is not implemented in dali) + **/ + virtual void EmitStateChanged(Accessible* obj, State state, int newValue, int reserved = 0) = 0; + + /** + * @brief Emits window event on at-spi bus. + * + * @param[in] obj The accessible object + * @param[in] event The enumerated window event + * @param[in] detail The additional parameter which interpretation depends on chosen event + **/ + virtual void Emit(Accessible* obj, WindowEvent event, unsigned int detail = 0) = 0; + + /** + * @brief Emits property-changed event on at-spi bus. + * + * @param[in] obj The accessible object + * @param[in] event Property changed event + **/ + virtual void Emit(Accessible* obj, ObjectPropertyChangeEvent event) = 0; + + /** + * @brief Emits bounds-changed event on at-spi bus. + * + * @param[in] obj The accessible object + * @param[in] rect The rectangle for changed bounds + **/ + virtual void EmitBoundsChanged(Accessible* obj, Rect<> rect) = 0; + + /** + * @brief Emits key event on at-spi bus. + * + * Screen-reader might receive this event and reply, that given keycode is consumed. In that case + * further processing of the keycode should be ignored. + * + * @param[in] type Key event type + * @param[in] keyCode Key code + * @param[in] keyName Key name + * @param[in] timeStamp Time stamp + * @param[in] isText Whether it's text or not + * @return Whether this event is consumed or not + **/ + virtual Consumed Emit(KeyEventType type, unsigned int keyCode, const std::string& keyName, unsigned int timeStamp, bool isText) = 0; + + /** + * @brief Reads given text by screen reader + * + * @param[in] text The text to read + * @param[in] discardable If TRUE, reading can be discarded by subsequent reading requests, + * if FALSE the reading must finish before next reading request can be started + * @param[in] callback the callback function that is called on reading signals emitted + * during processing of this reading request. + * Callback can be one of the following signals: + * ReadingCancelled, ReadingStopped, ReadingSkipped + */ + virtual void Say(const std::string& text, bool discardable, std::function callback) = 0; + + /** + * @brief Force accessibility client to pause. + */ + virtual void Pause() = 0; + + /** + * @brief Force accessibility client to resume. + */ + virtual void Resume() = 0; + + /** + * @brief Cancels anything screen-reader is reading / has queued to read + * + * @param[in] alsoNonDiscardable whether to cancel non-discardable readings as well + */ + virtual void StopReading(bool alsoNonDiscardable) = 0; + + /** + * @brief Suppresses reading of screen-reader + * + * @param[in] suppress whether to suppress reading of screen-reader + */ + virtual void SuppressScreenReader(bool suppress) = 0; + + /** + * @brief Gets screen reader status. + * + * @return True if screen reader is enabled + */ + virtual bool GetScreenReaderEnabled() = 0; + + /** + * @brief Gets ATSPI status. + * + * @return True if ATSPI is enabled + */ + virtual bool IsEnabled() = 0; + + /** + * @brief Returns instance of bridge singleton object. + * + * @return The current bridge object + **/ + static Bridge* GetCurrentBridge(); + + /** + * @brief Blocks auto-initialization of AT-SPI bridge + * + * Use this only if your application starts before DBus does, and call it early in main() + * (before GetCurrentBridge() is called by anyone). GetCurrentBridge() will then return an + * instance of DummyBridge. + * + * When DBus is ready, call EnableAutoInit(). Please note that GetCurrentBridge() may still + * return an instance of DummyBridge if AT-SPI was disabled at compile time or using an + * environment variable, or if creating the real bridge failed. + * + * @see Dali::Accessibility::DummyBridge + * @see Dali::Accessibility::Bridge::EnableAutoInit + */ + static void DisableAutoInit(); + + /** + * @brief Re-enables auto-initialization of AT-SPI bridge + * + * Normal applications do not have to call this function. GetCurrentBridge() tries to + * initialize the AT-SPI bridge when it is called for the first time. + * + * @see Dali::Accessibility::Bridge::DisableAutoInit + * @see Dali::Accessibility::Bridge::AddTopLevelWindow + * @see Dali::Accessibility::Bridge::SetApplicationName + */ + static void EnableAutoInit(); + + static Signal& EnabledSignal() + { + return mEnabledSignal; + } + + static Signal& DisabledSignal() + { + return mDisabledSignal; + } + +protected: + struct Data + { + std::unordered_set mKnownObjects; + std::string mBusName; + Bridge* mBridge = nullptr; + Actor mHighlightActor; + Actor mCurrentlyHighlightedActor; + }; + std::shared_ptr mData; + friend class Accessible; + + enum class AutoInitState + { + DISABLED, + ENABLED + }; + + inline static AutoInitState mAutoInitState = AutoInitState::ENABLED; + + inline static Signal mEnabledSignal; + inline static Signal mDisabledSignal; + + /** + * @brief Registers accessible object to be known in bridge object. + * + * Bridge must known about all currently alive accessible objects, as some requst + * might come and object will be identified by number id (it's memory address). + * To avoid memory corruption number id is checked against set of known objects. + * + * @param[in] object The accessible object + **/ + void RegisterOnBridge(Accessible* object); + + /** + * @brief Tells bridge, that given object is considered root (doesn't have any parents). + * + * All root objects will have the same parent - application object. Application object + * is controlled by bridge and private. + * + * @param[in] owner The accessible object + **/ + void SetIsOnRootLevel(Accessible* owner); +}; + +/** + * @brief Checks if ATSPI is activated or not. + * @return True if ATSPI is activated. + */ +inline bool IsUp() +{ + if(Bridge::GetCurrentBridge() == nullptr) + { + return false; + } + + if(Bridge::GetCurrentBridge()->IsEnabled() == false) + { + return false; + } + + return Bridge::GetCurrentBridge()->IsUp(); +} + +} // namespace Accessibility +} // namespace Dali + +#endif // DALI_ADAPTOR_ACCESSIBILITY_BRIDGE_H diff --git a/dali/devel-api/adaptor-framework/accessibility-impl.h b/dali/devel-api/adaptor-framework/accessibility-impl.h deleted file mode 100644 index fed9592..0000000 --- a/dali/devel-api/adaptor-framework/accessibility-impl.h +++ /dev/null @@ -1,1529 +0,0 @@ -#ifndef DALI_INTERNAL_ATSPI_ACCESSIBILITY_IMPL_H -#define DALI_INTERNAL_ATSPI_ACCESSIBILITY_IMPL_H - -/* - * Copyright (c) 2021 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//INTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ -namespace Accessibility -{ -class DALI_ADAPTOR_API Accessible; -class DALI_ADAPTOR_API Text; -class DALI_ADAPTOR_API Value; -class DALI_ADAPTOR_API Component; -class DALI_ADAPTOR_API Collection; -class DALI_ADAPTOR_API Action; -class DALI_ADAPTOR_API Application; -class DALI_ADAPTOR_API Hypertext; -class DALI_ADAPTOR_API Hyperlink; - -/** - * @brief Base class for different accessibility bridges. - * - * Bridge is resposible for initializing and managing connection on accessibility bus. - * Accessibility clients will not get any information about UI without initialized and upraised bridge. - * Concrete implementation depends on the accessibility technology available on the platform. - * - * @note This class is singleton. - */ -struct DALI_ADAPTOR_API Bridge -{ - enum class ForceUpResult - { - JUST_STARTED, - ALREADY_UP - }; - - /** - * @brief Destructor - */ - virtual ~Bridge() = default; - - /** - * @brief Gets bus name which bridge is initialized on. - * - * @return The bus name - */ - virtual const std::string& GetBusName() const = 0; - - /** - * @brief Registers top level window. - * - * Hierarchy of objects visible for accessibility clients is based on tree-like - * structure created from Actors objects. This method allows to connect chosen - * object as direct ancestor of application and therefore make it visible for - * accessibility clients. - * - * @param[in] object The accessible object - */ - virtual void AddTopLevelWindow(Accessible* object) = 0; - - /** - * @brief Removes top level window. - * - * Hierarchy of objects visible for accessibility clients is based on tree-like - * structure created from Actors objects. This method removes previously added - * window from visible accessibility objects. - * - * @param[in] object The accessible object - */ - virtual void RemoveTopLevelWindow(Accessible* object) = 0; - - /** - * @brief Adds popup window. - * - * Hierarchy of objects visible for accessibility clients is based on tree-like - * structure created from Actors objects. This method adds new popup to the tree. - * - * @param[in] object The accessible object - */ - virtual void AddPopup(Accessible* object) = 0; - - /** - * @brief Removes popup window. - * - * Hierarchy of objects visible for accessibility clients is based on tree-like - * structure created from Actors objects. This method removes previously added - * popup window. - * - * @param[in] object The accessible object - */ - virtual void RemovePopup(Accessible* object) = 0; - - /** - * @brief Sets name of current application which will be visible on accessibility bus. - * - * @param[in] name The application name - */ - virtual void SetApplicationName(std::string name) = 0; - - /** - * @brief Gets object being root of accessibility tree. - * - * @return handler to accessibility object - */ - virtual Accessible* GetApplication() const = 0; - - /** - * @brief Finds an object in accessibility tree. - * - * @param[in] path The path to object - * - * @return The handler to accessibility object - */ - virtual Accessible* FindByPath(const std::string& path) const = 0; - - /** - * @brief Notifies accessibility dbus that window has just been shown. - * - * @param[in] window The window to be shown - */ - virtual void WindowShown(Window window) = 0; - - /** - * @brief Notifies accessibility dbus that window has just been hidden. - * - * @param[in] window The window to be hidden - */ - virtual void WindowHidden(Window window) = 0; - - /** - * @brief Notifies accessibility dbus that window has just been focused. - * - * @param[in] window The window to be focused - */ - virtual void WindowFocused(Window window) = 0; - - /** - * @brief Notifies accessibility dbus that window has just been out of focus. - * - * @param[in] window The window to be out of focus - */ - virtual void WindowUnfocused(Window window) = 0; - - /** - * @brief Initializes accessibility bus. - */ - virtual void Initialize() = 0; - - /** - * @brief Terminates accessibility bus. - */ - virtual void Terminate() = 0; - - /** - * @brief This method is called, when bridge is being activated. - */ - virtual ForceUpResult ForceUp() - { - if(mData) - { - return ForceUpResult::ALREADY_UP; - } - mData = std::make_shared(); - mData->mBridge = this; - return ForceUpResult::JUST_STARTED; - } - - /** - * @brief This method is called, when bridge is being deactivated. - */ - virtual void ForceDown() = 0; - - /** - * @brief Checks if bridge is activated or not. - * @return True if brige is activated. - */ - bool IsUp() const - { - return bool(mData); - } - - /** - * @brief Emits cursor-moved event on at-spi bus. - * - * @param[in] obj The accessible object - * @param[in] cursorPosition The new cursor position - **/ - virtual void EmitCursorMoved(Accessible* obj, unsigned int cursorPosition) = 0; - - /** - * @brief Emits active-descendant-changed event on at-spi bus. - * - * @param[in] obj The accessible object - * @param[in] child The child of the object - **/ - virtual void EmitActiveDescendantChanged(Accessible* obj, Accessible* child) = 0; - - /** - * @brief Emits text-changed event on at-spi bus. - * - * @param[in] obj The accessible object - * @param[in] state The changed state for text, such as Inserted or Deleted - * @param[in] position The cursor position - * @param[in] length The text length - * @param[in] content The changed text - **/ - virtual void EmitTextChanged(Accessible* obj, TextChangedState state, unsigned int position, unsigned int length, const std::string& content) = 0; - - /** - * @brief Emits MoveOuted event on at-spi bus. - * - * @param[in] obj Accessible object - * @param[in] type Direction type when an Accessible object moves out of screen - **/ - virtual void EmitMovedOutOfScreen(Accessible* obj, ScreenRelativeMoveType type) = 0; - - /** - * @brief Emits state-changed event on at-spi bus. - * - * @param[in] obj The accessible object - * @param[in] state The accessibility state (SHOWING, HIGHLIGHTED, etc) - * @param[in] newValue Whether the state value is changed to new value or not. - * @param[in] reserved Reserved. (Currently, this argument is not implemented in dali) - **/ - virtual void EmitStateChanged(Accessible* obj, State state, int newValue, int reserved = 0) = 0; - - /** - * @brief Emits window event on at-spi bus. - * - * @param[in] obj The accessible object - * @param[in] event The enumerated window event - * @param[in] detail The additional parameter which interpretation depends on chosen event - **/ - virtual void Emit(Accessible* obj, WindowEvent event, unsigned int detail = 0) = 0; - - /** - * @brief Emits property-changed event on at-spi bus. - * - * @param[in] obj The accessible object - * @param[in] event Property changed event - **/ - virtual void Emit(Accessible* obj, ObjectPropertyChangeEvent event) = 0; - - /** - * @brief Emits bounds-changed event on at-spi bus. - * - * @param[in] obj The accessible object - * @param[in] rect The rectangle for changed bounds - **/ - virtual void EmitBoundsChanged(Accessible* obj, Rect<> rect) = 0; - - /** - * @brief Emits key event on at-spi bus. - * - * Screen-reader might receive this event and reply, that given keycode is consumed. In that case - * further processing of the keycode should be ignored. - * - * @param[in] type Key event type - * @param[in] keyCode Key code - * @param[in] keyName Key name - * @param[in] timeStamp Time stamp - * @param[in] isText Whether it's text or not - * @return Whether this event is consumed or not - **/ - virtual Consumed Emit(KeyEventType type, unsigned int keyCode, const std::string& keyName, unsigned int timeStamp, bool isText) = 0; - - /** - * @brief Reads given text by screen reader - * - * @param[in] text The text to read - * @param[in] discardable If TRUE, reading can be discarded by subsequent reading requests, - * if FALSE the reading must finish before next reading request can be started - * @param[in] callback the callback function that is called on reading signals emitted - * during processing of this reading request. - * Callback can be one of the following signals: - * ReadingCancelled, ReadingStopped, ReadingSkipped - */ - virtual void Say(const std::string& text, bool discardable, std::function callback) = 0; - - /** - * @brief Force accessibility client to pause. - */ - virtual void Pause() = 0; - - /** - * @brief Force accessibility client to resume. - */ - virtual void Resume() = 0; - - /** - * @brief Cancels anything screen-reader is reading / has queued to read - * - * @param[in] alsoNonDiscardable whether to cancel non-discardable readings as well - */ - virtual void StopReading(bool alsoNonDiscardable) = 0; - - /** - * @brief Suppresses reading of screen-reader - * - * @param[in] suppress whether to suppress reading of screen-reader - */ - virtual void SuppressScreenReader(bool suppress) = 0; - - /** - * @brief Gets screen reader status. - * - * @return True if screen reader is enabled - */ - virtual bool GetScreenReaderEnabled() = 0; - - /** - * @brief Gets ATSPI status. - * - * @return True if ATSPI is enabled - */ - virtual bool IsEnabled() = 0; - - /** - * @brief Returns instance of bridge singleton object. - * - * @return The current bridge object - **/ - static Bridge* GetCurrentBridge(); - - /** - * @brief Blocks auto-initialization of AT-SPI bridge - * - * Use this only if your application starts before DBus does, and call it early in main() - * (before GetCurrentBridge() is called by anyone). GetCurrentBridge() will then return an - * instance of DummyBridge. - * - * When DBus is ready, call EnableAutoInit(). Please note that GetCurrentBridge() may still - * return an instance of DummyBridge if AT-SPI was disabled at compile time or using an - * environment variable, or if creating the real bridge failed. - * - * @see Dali::Accessibility::DummyBridge - * @see Dali::Accessibility::Bridge::EnableAutoInit - */ - static void DisableAutoInit(); - - /** - * @brief Re-enables auto-initialization of AT-SPI bridge - * - * Normal applications do not have to call this function. GetCurrentBridge() tries to - * initialize the AT-SPI bridge when it is called for the first time. - * - * @see Dali::Accessibility::Bridge::DisableAutoInit - * @see Dali::Accessibility::Bridge::AddTopLevelWindow - * @see Dali::Accessibility::Bridge::SetApplicationName - */ - static void EnableAutoInit(); - - static Signal& EnabledSignal() - { - return mEnabledSignal; - } - - static Signal& DisabledSignal() - { - return mDisabledSignal; - } - -protected: - struct Data - { - std::unordered_set mKnownObjects; - std::string mBusName; - Bridge* mBridge = nullptr; - Actor mHighlightActor; - Actor mCurrentlyHighlightedActor; - }; - std::shared_ptr mData; - friend class Accessible; - - enum class AutoInitState - { - DISABLED, - ENABLED - }; - - inline static AutoInitState mAutoInitState = AutoInitState::ENABLED; - - inline static Signal mEnabledSignal; - inline static Signal mDisabledSignal; - - /** - * @brief Registers accessible object to be known in bridge object. - * - * Bridge must known about all currently alive accessible objects, as some requst - * might come and object will be identified by number id (it's memory address). - * To avoid memory corruption number id is checked against set of known objects. - * - * @param[in] object The accessible object - **/ - void RegisterOnBridge(Accessible* object); - - /** - * @brief Tells bridge, that given object is considered root (doesn't have any parents). - * - * All root objects will have the same parent - application object. Application object - * is controlled by bridge and private. - * - * @param[in] owner The accessible object - **/ - void SetIsOnRootLevel(Accessible* owner); -}; - -/** - * @brief Checks if ATSPI is activated or not. - * @return True if ATSPI is activated. - */ -inline bool IsUp() -{ - if(Bridge::GetCurrentBridge() == nullptr) - { - return false; - } - - if(Bridge::GetCurrentBridge()->IsEnabled() == false) - { - return false; - } - - return Bridge::GetCurrentBridge()->IsUp(); -} - -/** - * @brief Basic interface implemented by all accessibility objects. - */ -class Accessible -{ -public: - virtual ~Accessible(); - - using utf8_t = unsigned char; - - /** - * @brief Calculates and finds word boundaries in given utf8 text. - * - * @param[in] string The source text to find - * @param[in] length The length of text to find - * @param[in] language The language to use - * @param[out] breaks The word boundaries in given text - * - * @note Word boundaries are returned as non-zero values in table breaks, which must be of size at least length. - */ - void FindWordSeparationsUtf8(const utf8_t* string, size_t length, const char* language, char* breaks); - - /** - * @brief Calculates and finds line boundaries in given utf8 text. - * - * @param[in] string The source text to find - * @param[in] length The length of text to find - * @param[in] language The language to use - * @param[out] breaks The line boundaries in given text - * - * @note Line boundaries are returned as non-zero values in table breaks, which must be of size at least length. - */ - void FindLineSeparationsUtf8(const utf8_t* string, size_t length, const char* language, char* breaks); - - /** - * @brief Helper function for emiting active-descendant-changed event. - * - * @param[in] obj The accessible object - * @param[in] child The child of the object - */ - void EmitActiveDescendantChanged(Accessible* obj, Accessible* child); - - /** - * @brief Helper function for emiting state-changed event. - * - * @param[in] state The accessibility state (SHOWING, HIGHLIGHTED, etc) - * @param[in] newValue Whether the state value is changed to new value or not. - * @param[in] reserved Reserved. (TODO : Currently, this argument is not implemented in dali) - * - * @note The second argument determines which value is depending on State. - * For instance, if the state is PRESSED, newValue means isPressed or isSelected. - * If the state is SHOWING, newValue means isShowing. - */ - void EmitStateChanged(State state, int newValue, int reserved = 0); - - /** - * @brief Helper function for emiting bounds-changed event. - * - * @param rect The rectangle for changed bounds - */ - void EmitBoundsChanged(Rect<> rect); - - /** - * @brief Emits "showing" event. - * The method informs accessibility clients about "showing" state. - * - * @param[in] isShowing The flag pointing if object is showing - */ - void EmitShowing(bool isShowing); - - /** - * @brief Emits "visible" event. - * The method informs accessibility clients about "visible" state. - * - * @param[in] isVisible The flag pointing if object is visible - */ - void EmitVisible(bool isVisible); - - /** - * @brief Emits "highlighted" event. - * The method informs accessibility clients about "highlighted" state. - * - * @param[in] isHighlighted The flag pointing if object is highlighted - */ - void EmitHighlighted(bool isHighlighted); - - /** - * @brief Emits "focused" event. - * The method informs accessibility clients about "focused" state. - * - * @param[in] isFocused The flag pointing if object is focused - */ - void EmitFocused(bool isFocused); - - /** - * @brief Emits "text inserted" event. - * - * @param[in] position The cursor position - * @param[in] length The text length - * @param[in] content The inserted text - */ - void EmitTextInserted(unsigned int position, unsigned int length, const std::string& content); - - /** - * @brief Emits "text deleted" event. - * - * @param[in] position The cursor position - * @param[in] length The text length - * @param[in] content The deleted text - */ - void EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content); - - /** - * @brief Emits "cursor moved" event. - * - * @param[in] cursorPosition The new cursor position - */ - void EmitTextCursorMoved(unsigned int cursorPosition); - - /** - * @brief Emits "MoveOuted" event. - * - * @param[in] type moved out of screen type - */ - void EmitMovedOutOfScreen(ScreenRelativeMoveType type); - - /** - * @brief Emits "highlighted" event. - * - * @param[in] event The enumerated window event - * @param[in] detail The additional parameter which interpretation depends on chosen event - */ - void Emit(WindowEvent event, unsigned int detail = 0); - - /** - * @brief Emits property-changed event. - * - * @param[in] event Property changed event - **/ - void Emit(ObjectPropertyChangeEvent event); - - /** - * @brief Gets accessibility name. - * - * @return The string with name - */ - virtual std::string GetName() = 0; - - /** - * @brief Gets accessibility description. - * - * @return The string with description - */ - virtual std::string GetDescription() = 0; - - /** - * @brief Gets parent. - * - * @return The handler to accessibility object - */ - virtual Accessible* GetParent() = 0; - - /** - * @brief Gets the number of children. - * - * @return The number of children - */ - virtual size_t GetChildCount() = 0; - - /** - * @brief Gets collection with all children. - * - * @return The collection of accessibility objects - */ - virtual std::vector GetChildren(); - - /** - * @brief Gets child of the index. - * - * @return The child object - */ - virtual Accessible* GetChildAtIndex(size_t index) = 0; - - /** - * @brief Gets index that current object has in its parent's children collection. - * - * @return The index of the current object - */ - virtual size_t GetIndexInParent() = 0; - - /** - * @brief Gets accessibility role. - * - * @return Role enumeration - * - * @see Dali::Accessibility::Role - */ - virtual Role GetRole() = 0; - - /** - * @brief Gets name of accessibility role. - * - * @return The string with human readable role converted from enumeration - * - * @see Dali::Accessibility::Role - * @see Accessibility::Accessible::GetRole - */ - virtual std::string GetRoleName(); - - /** - * @brief Gets localized name of accessibility role. - * - * @return The string with human readable role translated according to current - * translation domain - * - * @see Dali::Accessibility::Role - * @see Accessibility::Accessible::GetRole - * @see Accessibility::Accessible::GetRoleName - * - * @note translation is not supported in this version - */ - virtual std::string GetLocalizedRoleName(); - - /** - * @brief Gets accessibility states. - * - * @return The collection of states - * - * @note States class is instatation of ArrayBitset template class - * - * @see Dali::Accessibility::State - * @see Dali::Accessibility::ArrayBitset - */ - virtual States GetStates() = 0; - - /** - * @brief Gets accessibility attributes. - * - * @return The map of attributes and their values - */ - virtual Attributes GetAttributes() = 0; - - /** - * @brief Checks if this is proxy. - * - * @return True if this is proxy - */ - virtual bool IsProxy(); - - /** - * @brief Gets unique address on accessibility bus. - * - * @return The Address class containing address - * - * @see Dali::Accessibility::Address - */ - virtual Address GetAddress(); - - /** - * @brief Gets accessibility object, which is "default label" for this object. - * - * @return The Accessible object - */ - virtual Accessible* GetDefaultLabel(); - - /** - * @brief Deputes an object to perform provided gesture. - * - * @param[in] gestureInfo The structure describing the gesture - * - * @return true on success, false otherwise - * - * @see Dali::Accessibility::GestureInfo - */ - virtual bool DoGesture(const GestureInfo& gestureInfo) = 0; - - /** - * @brief Re-emits selected states of an Accessibility Object. - * - * @param[in] states The chosen states to re-emit - * @param[in] isRecursive If true, all children of the Accessibility object will also re-emit the states - */ - void NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive); - - /** - * @brief Gets information about current object and all relations that connects - * it with other accessibility objects. - * - * @return The iterable collection of Relation objects - * - * @see Dali::Accessibility::Relation - */ - virtual std::vector GetRelationSet() = 0; - - /** - * @brief Gets internal Actor to be saved before. - * - * @return The internal Actor - */ - virtual Dali::Actor GetInternalActor() = 0; - - /** - * @brief Gets all implemented interfaces. - * - * @return The collection of strings with implemented interfaces - */ - std::vector GetInterfaces(); - - /** - * @brief Checks if object is on root level. - * - * @return Whether object is on root level or not - */ - bool IsOnRootLevel() const - { - return mIsOnRootLevel; - } - -protected: - Accessible(); - Accessible(const Accessible&) = delete; - Accessible(Accessible&&) = delete; - Accessible& operator=(const Accessible&) = delete; - Accessible& operator=(Accessible&&) = delete; - std::shared_ptr GetBridgeData(); - -public: - /** - * @brief Gets the highlight actor. - * - * This method is to get the highlight itself. - * @return The highlight actor - */ - static Dali::Actor GetHighlightActor(); - - /** - * @brief Sets the highlight actor. - * - * This method is to set the highlight itself. - * @param[in] actor The highlight actor - */ - static void SetHighlightActor(Dali::Actor actor); - - /** - * @brief Gets the currently highlighted actor. - * - * @return The current highlighted actor - */ - static Dali::Actor GetCurrentlyHighlightedActor(); - - /** - * @brief Sets currently highlighted actor. - * - * @param[in] actor The highlight actor - */ - static void SetCurrentlyHighlightedActor(Dali::Actor actor); - - /** - * @brief Sets ObjectRegistry. - * - * @param[in] registry ObjectRegistry instance - */ - static void SetObjectRegistry(ObjectRegistry registry); - - /** - * @brief The method registers functor resposible for converting Actor into Accessible. - * @param functor The returning Accessible handle from Actor object - */ - static void RegisterExternalAccessibleGetter(std::function functor); - - /** - * @brief Acquires Accessible object from Actor object. - * - * @param[in] actor Actor object - * @param[in] isRoot True, if it's top level object (window) - * - * @return The handle to Accessible object - */ - static Accessible* Get(Dali::Actor actor, bool isRoot = false); - -private: - friend class Bridge; - - std::weak_ptr mBridgeData; - bool mIsOnRootLevel = false; - -}; // Accessible class - -/** - * @brief Interface enabling to perform provided actions. - */ -class Action : public virtual Accessible -{ -public: - /** - * @brief Gets name of action with given index. - * - * @param[in] index The index of action - * - * @return The string with name of action - */ - virtual std::string GetActionName(size_t index) = 0; - - /** - * @brief Gets translated name of action with given index. - * - * @param[in] index The index of action - * - * @return The string with name of action translated according to current translation domain - * - * @note The translation is not supported in this version - */ - virtual std::string GetLocalizedActionName(size_t index) = 0; - - /** - * @brief Gets description of action with given index. - * - * @param[in] index The index of action - * - * @return The string with description of action - */ - virtual std::string GetActionDescription(size_t index) = 0; - - /** - * @brief Gets key code binded to action with given index. - * - * @param[in] index The index of action - * - * @return The string with key name - */ - virtual std::string GetActionKeyBinding(size_t index) = 0; - - /** - * @brief Gets number of provided actions. - * - * @return The number of actions - */ - virtual size_t GetActionCount() = 0; - - /** - * @brief Performs an action with given index. - * - * @param index The index of action - * - * @return true on success, false otherwise - */ - virtual bool DoAction(size_t index) = 0; - - /** - * @brief Performs an action with given name. - * - * @param name The name of action - * - * @return true on success, false otherwise - */ - virtual bool DoAction(const std::string& name) = 0; -}; - -/** - * @brief An interface identifying the root object - * associated with a running application. - * - * @note Provides global properties describing - * application's runtime environment. - */ -class Application : public virtual Accessible -{ -public: - /** - * @brief Gets name of graphic user interface framework used by an application. - * - * @return String with name - */ - virtual std::string GetToolkitName() = 0; - - /** - * @brief Gets version of graphic user interface framework used by an application. - * - * @return String with version - */ - virtual std::string GetVersion() = 0; -}; - -/** - * @brief Interface enabling advanced quering of accessibility objects. - * - * @note since all mathods can be implemented inside bridge, - * none methods have to be overrided - */ -class Collection : public virtual Accessible -{ -public: -}; - -/** - * @brief Interface representing objects having screen coordinates. - */ -class Component : public virtual Accessible -{ -public: - /** - * @brief Gets rectangle describing size. - * - * @param[in] type The enumeration with type of coordinate systems - * - * @return Rect<> object - * - * @see Dali::Rect - */ - virtual Rect<> GetExtents(CoordinateType type) = 0; - - /** - * @brief Gets layer current object is localized on. - * - * @return The enumeration pointing layer - * - * @see Dali::Accessibility::ComponentLayer - */ - virtual ComponentLayer GetLayer() = 0; - - /** - * @brief Gets value of z-order. - * - * @return The value of z-order - * @remarks MDI means "Multi Document Interface" (https://en.wikipedia.org/wiki/Multiple-document_interface) - * which in short means that many stacked windows can be displayed within a single application. - * In such model, the concept of z-order of UI element became important to deal with element overlapping. - */ - virtual int16_t GetMdiZOrder() = 0; - - /** - * @brief Sets current object as "focused". - * - * @return true on success, false otherwise - */ - virtual bool GrabFocus() = 0; - - /** - * @brief Gets value of alpha channel. - * - * @return The alpha channel value in range [0.0, 1.0] - */ - virtual double GetAlpha() = 0; - - /** - * @brief Sets current object as "highlighted". - * - * The method assings "highlighted" state, simultaneously removing it - * from currently highlighted object. - * - * @return true on success, false otherwise - */ - virtual bool GrabHighlight() = 0; - - /** - * @brief Sets current object as "unhighlighted". - * - * The method removes "highlighted" state from object. - * - * @return true on success, false otherwise - * - * @see Dali:Accessibility::State - */ - virtual bool ClearHighlight() = 0; - - /** - * @brief Checks whether object can be scrolled. - * - * @return true if object is scrollable, false otherwise - * - * @see Dali:Accessibility::State - */ - virtual bool IsScrollable(); - - /** - * @brief Gets Accessible object containing given point. - * - * @param[in] point The two-dimensional point - * @param[in] type The enumeration with type of coordinate system - * - * @return The handle to last child of current object which contains given point - * - * @see Dali::Accessibility::Point - */ - virtual Accessible* GetAccessibleAtPoint(Point point, CoordinateType type); - - /** - * @brief Checks if the current object contains the given point inside. - * - * @param[in] point The two-dimensional point - * @param[in] type The enumeration with type of coordinate system - * - * @return True if accessible contains in point, otherwise false. - * - * @remarks This method is `Contains` in DBus method. - * @see Dali::Accessibility::Point - */ - virtual bool IsAccessibleContainingPoint(Point point, CoordinateType type); -}; - -/** - * @brief Interface representing objects which can store numeric value. - */ -class Value : public virtual Accessible -{ -public: - /** - * @brief Gets the lowest possible value. - * - * @return The minimum value - */ - virtual double GetMinimum() = 0; - - /** - * @brief Gets the current value. - * - * @return The current value - */ - virtual double GetCurrent() = 0; - - /** - * @brief Gets the highest possible value. - * - * @return The highest value. - */ - virtual double GetMaximum() = 0; - - /** - * @brief Sets the current value. - * - * @param[in] value The current value to set - * - * @return true if value could have been assigned, false otherwise - */ - virtual bool SetCurrent(double value) = 0; - - /** - * @brief Gets the lowest increment that can be distinguished. - * - * @return The lowest increment - */ - virtual double GetMinimumIncrement() = 0; -}; - -/** - * @brief Interface representing objects which can store immutable texts. - * - * @see Dali::Accessibility::EditableText - */ -class DALI_ADAPTOR_API Text : public virtual Accessible -{ -public: - /** - * @brief Gets stored text in given range. - * - * @param[in] startOffset The index of first character - * @param[in] endOffset The index of first character after the last one expected - * - * @return The substring of stored text - */ - virtual std::string GetText(size_t startOffset, size_t endOffset) = 0; - - /** - * @brief Gets number of all stored characters. - * - * @return The number of characters - * @remarks This method is `CharacterCount` in DBus method. - */ - virtual size_t GetCharacterCount() = 0; - - /** - * @brief Gets the cursor offset. - * - * @return Value of cursor offset - * @remarks This method is `CaretOffset` in DBus method. - */ - virtual size_t GetCursorOffset() = 0; - - /** - * @brief Sets the cursor offset. - * - * @param[in] offset Cursor offset - * - * @return True if successful - * @remarks This method is `SetCaretOffset` in DBus method. - */ - virtual bool SetCursorOffset(size_t offset) = 0; - - /** - * @brief Gets substring of stored text truncated in concrete gradation. - * - * @param[in] offset The position in stored text - * @param[in] boundary The enumeration describing text gradation - * - * @return Range structure containing acquired text and offsets in original string - * - * @see Dali::Accessibility::Range - */ - virtual Range GetTextAtOffset(size_t offset, TextBoundary boundary) = 0; - - /** - * @brief Gets selected text. - * - * @param[in] selectionIndex The selection index - * @note Currently only one selection (i.e. with index = 0) is supported - * - * @return Range structure containing acquired text and offsets in original string - * - * @remarks This method is `GetSelection` in DBus method. - * @see Dali::Accessibility::Range - */ - virtual Range GetRangeOfSelection(size_t selectionIndex) = 0; - - /** - * @brief Removes the whole selection. - * - * @param[in] selectionIndex The selection index - * @note Currently only one selection (i.e. with index = 0) is supported - * - * @return bool on success, false otherwise - */ - virtual bool RemoveSelection(size_t selectionIndex) = 0; - - /** - * @brief Sets selected text. - * - * @param[in] selectionIndex The selection index - * @param[in] startOffset The index of first character - * @param[in] endOffset The index of first character after the last one expected - * - * @note Currently only one selection (i.e. with index = 0) is supported - * - * @return true on success, false otherwise - * @remarks This method is `SetSelection` in DBus method. - */ - virtual bool SetRangeOfSelection(size_t selectionIndex, size_t startOffset, size_t endOffset) = 0; -}; - -/** - * @brief Interface representing objects which can store editable texts. - * - * @note Paste method is entirely implemented inside bridge - * - * @see Dali::Accessibility::EditableText - */ -class DALI_ADAPTOR_API EditableText : public virtual Accessible -{ -public: - /** - * @brief Copies text in range to system clipboard. - * - * @param[in] startPosition The index of first character - * @param[in] endPosition The index of first character after the last one expected - * - * @return true on success, false otherwise - */ - virtual bool CopyText(size_t startPosition, size_t endPosition) = 0; - - /** - * @brief Cuts text in range to system clipboard. - * - * @param[in] startPosition The index of first character - * @param[in] endPosition The index of first character after the last one expected - * - * @return true on success, false otherwise - */ - virtual bool CutText(size_t startPosition, size_t endPosition) = 0; - - /** - * @brief Deletes text in range. - * - * @param[in] startPosition The index of first character - * @param[in] endPosition The index of first character after the last one expected - * - * @return true on success, false otherwise - */ - virtual bool DeleteText(size_t startPosition, size_t endPosition) = 0; - - /** - * @brief Inserts text at startPosition. - * - * @param[in] startPosition The index of first character - * @param[in] text The text content - * - * @return true on success, false otherwise - */ - virtual bool InsertText(size_t startPosition, std::string text) = 0; - - /** - * @brief Replaces text with content. - * - * @param[in] newContents The text content - * - * @return true on success, false otherwise - */ - virtual bool SetTextContents(std::string newContents) = 0; -}; - -/** - * @brief Interface representing hypertext that can store a collection of hyperlinks. - */ -class Hypertext : public virtual Accessible -{ -public: - /** - * @brief Gets the handle to hyperlink object from a specified index in hyperlink collection of this hypertext. - * - * @param[in] linkIndex The 0-based index in hyperlink collection. - * - * @return Handle to hyperlink object at a specified index in hyperlink collection of hypertext. - */ - virtual Hyperlink* GetLink(int32_t linkIndex) const = 0; - - /** - * @brief Gets the index in hyperlink collection occupied by hyperlink which spans over a specified character offset in this hypertext. - * - * @param[in] characterOffset The 0-based index of character in hypertext. - * - * @return The value of 0-based index in hyperlink collection (-1 if there is no hyperlink at the specified character offset). - */ - virtual int32_t GetLinkIndex(int32_t characterOffset) const = 0; - - /** - * @brief Gets number of hyperlinks stored in this hypertext. - * - * @return The number of hyperlinks (zero if none or -1 if the number cannot be determined) - */ - virtual int32_t GetLinkCount() const = 0; -}; - -/** - * @brief Interface representing a hyperlink in hypertext . - */ -class Hyperlink : public virtual Accessible -{ -public: - /** - * @brief Gets the index of character in originating hypertext at which this hyperlink ends. - * - * @return The 0-based index of hyperlink's last character + 1, in its originating hypertext. - */ - virtual int32_t GetEndIndex() const = 0; - - /** - * @brief Gets the index of character in originating hypertext at which this hyperlink starts. - * - * @return The 0-based index of hyperlink's first character, in its originating hypertext. - */ - virtual int32_t GetStartIndex() const = 0; - - /** - * @brief Gets the total number of anchors which this hyperlink has. Though, typical hyperlinks will have only one anchor. - * - * @return The number of anchors. - */ - virtual int32_t GetAnchorCount() const = 0; - - /** - * @brief Gets the object associated with a particular hyperlink's anchor. - * - * @param[in] anchorIndex The 0-based index in anchor collection. - * - * @return The handle to accessible object. - */ - virtual Accessible* GetAnchorAccessible(int32_t anchorIndex) const = 0; - - /** - * @brief Gets the URI associated with a particular hyperlink's anchor. - * - * @param[in] anchorIndex The 0-based index in anchor collection. - * - * @return The string containing URI. - */ - virtual std::string GetAnchorUri(int32_t anchorIndex) const = 0; - - /** - * @brief Tells whether this hyperlink object is still valid with respect to its originating hypertext object. - * - * @return True if hyperlink object is valid, false otherwise - */ - virtual bool IsValid() const = 0; -}; - -/** - * @brief Interface representing objects which can store a set of selected items. - */ -class DALI_ADAPTOR_API Selection : public virtual Accessible -{ -public: - /** - * @brief Gets the number of selected children. - * - * @return The number of selected children (zero if none) - */ - virtual int GetSelectedChildrenCount() = 0; - - /** - * @brief Gets a specific selected child. - * - * @param selectedChildIndex The index of the selected child - * - * @note @p selectedChildIndex refers to the list of selected children, - * not the list of all children - * - * @return The selected child or nullptr if index is invalid - */ - virtual Accessible* GetSelectedChild(int selectedChildIndex) = 0; - - /** - * @brief Selects a child. - * - * @param childIndex The index of the child - * - * @return true on success, false otherwise - */ - virtual bool SelectChild(int childIndex) = 0; - - /** - * @brief Deselects a selected child. - * - * @param selectedChildIndex The index of the selected child - * - * @note @p selectedChildIndex refers to the list of selected children, - * not the list of all children - * - * @return true on success, false otherwise - * - * @see Dali::Accessibility::Selection::DeselectChild - */ - virtual bool DeselectSelectedChild(int selectedChildIndex) = 0; - - /** - * @brief Checks whether a child is selected. - * - * @param childIndex The index of the child - * - * @return true if given child is selected, false otherwise - */ - virtual bool IsChildSelected(int childIndex) = 0; - - /** - * @brief Selects all children. - * - * @return true on success, false otherwise - */ - virtual bool SelectAll() = 0; - - /** - * @brief Deselects all children. - * - * @return true on success, false otherwise - */ - virtual bool ClearSelection() = 0; - - /** - * @brief Deselects a child. - * - * @param childIndex The index of the child. - * - * @return true on success, false otherwise - * - * @see Dali::Accessibility::Selection::DeselectSelectedChild - */ - virtual bool DeselectChild(int childIndex) = 0; -}; - -/** - * @brief The minimalistic, always empty Accessible object with settable address. - * - * For those situations, where you want to return address in different bridge - * (embedding for example), but the object itself ain't planned to be used otherwise. - * This object has null parent, no children, empty name and so on - */ -class DALI_ADAPTOR_API EmptyAccessibleWithAddress : public virtual Accessible -{ -public: - EmptyAccessibleWithAddress() = default; - - EmptyAccessibleWithAddress(Address address) - : mAddress(std::move(address)) - { - } - - void SetAddress(Address address) - { - this->mAddress = std::move(address); - } - - std::string GetName() override - { - return ""; - } - - std::string GetDescription() override - { - return ""; - } - - Accessible* GetParent() override - { - return nullptr; - } - - size_t GetChildCount() override - { - return 0; - } - - std::vector GetChildren() override - { - return {}; - } - - Accessible* GetChildAtIndex(size_t index) override - { - throw std::domain_error{"out of bounds index (" + std::to_string(index) + ") - no children"}; - } - - size_t GetIndexInParent() override - { - return static_cast(-1); - } - - Role GetRole() override - { - return {}; - } - - std::string GetRoleName() override; - - States GetStates() override - { - return {}; - } - - Attributes GetAttributes() override - { - return {}; - } - - Address GetAddress() override - { - return mAddress; - } - - bool DoGesture(const GestureInfo& gestureInfo) override - { - return false; - } - - std::vector GetRelationSet() override - { - return {}; - } - - Dali::Actor GetInternalActor() override - { - return Dali::Actor{}; - } - -private: - Address mAddress; -}; - -} // namespace Accessibility -} // namespace Dali - -#endif // DALI_INTERNAL_ATSPI_ACCESSIBILITY_IMPL_H diff --git a/dali/devel-api/adaptor-framework/accessibility-impl.cpp b/dali/devel-api/adaptor-framework/accessibility.cpp similarity index 98% rename from dali/devel-api/adaptor-framework/accessibility-impl.cpp rename to dali/devel-api/adaptor-framework/accessibility.cpp index 774915f..fcf60cd 100644 --- a/dali/devel-api/adaptor-framework/accessibility-impl.cpp +++ b/dali/devel-api/adaptor-framework/accessibility.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -// CLASS HEADER - // EXTERNAL INCLUDES #include #include @@ -27,8 +25,12 @@ #include // INTERNAL INCLUDES -#include +#include +#include #include +#include +#include +#include #include #include diff --git a/dali/devel-api/adaptor-framework/atspi-accessibility.cpp b/dali/devel-api/adaptor-framework/atspi-accessibility.cpp index 481aec8..53a230d 100644 --- a/dali/devel-api/adaptor-framework/atspi-accessibility.cpp +++ b/dali/devel-api/adaptor-framework/atspi-accessibility.cpp @@ -15,7 +15,7 @@ * */ -#include +#include #include void Dali::AtspiAccessibility::Pause() diff --git a/dali/devel-api/adaptor-framework/proxy-accessible.h b/dali/devel-api/adaptor-framework/proxy-accessible.h new file mode 100644 index 0000000..c931039 --- /dev/null +++ b/dali/devel-api/adaptor-framework/proxy-accessible.h @@ -0,0 +1,130 @@ +#ifndef DALI_ADAPTOR_PROXY_ACCESSIBLE_H +#define DALI_ADAPTOR_PROXY_ACCESSIBLE_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali::Accessibility +{ +/** + * @brief The minimalistic, always empty Accessible object with settable address. + * + * For those situations, where you want to return address in different bridge + * (embedding for example), but the object itself ain't planned to be used otherwise. + * This object has null parent, no children, empty name and so on + */ +class DALI_ADAPTOR_API EmptyAccessibleWithAddress : public virtual Accessible +{ +public: + EmptyAccessibleWithAddress() = default; + + EmptyAccessibleWithAddress(Address address) + : mAddress(std::move(address)) + { + } + + void SetAddress(Address address) + { + this->mAddress = std::move(address); + } + + std::string GetName() override + { + return ""; + } + + std::string GetDescription() override + { + return ""; + } + + Accessible* GetParent() override + { + return nullptr; + } + + size_t GetChildCount() override + { + return 0; + } + + std::vector GetChildren() override + { + return {}; + } + + Accessible* GetChildAtIndex(size_t index) override + { + throw std::domain_error{"out of bounds index (" + std::to_string(index) + ") - no children"}; + } + + size_t GetIndexInParent() override + { + return static_cast(-1); + } + + Role GetRole() override + { + return {}; + } + + std::string GetRoleName() override; + + States GetStates() override + { + return {}; + } + + Attributes GetAttributes() override + { + return {}; + } + + Address GetAddress() override + { + return mAddress; + } + + bool DoGesture(const GestureInfo& gestureInfo) override + { + return false; + } + + std::vector GetRelationSet() override + { + return {}; + } + + Dali::Actor GetInternalActor() override + { + return Dali::Actor{}; + } + +private: + Address mAddress; +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_PROXY_ACCESSIBLE_H diff --git a/dali/devel-api/atspi-interfaces/accessible.h b/dali/devel-api/atspi-interfaces/accessible.h new file mode 100644 index 0000000..da7786e --- /dev/null +++ b/dali/devel-api/atspi-interfaces/accessible.h @@ -0,0 +1,416 @@ +#ifndef DALI_ADAPTOR_ATSPI_ACCESSIBLE_H +#define DALI_ADAPTOR_ATSPI_ACCESSIBLE_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali::Accessibility +{ +/** + * @brief Basic interface implemented by all accessibility objects. + */ +class DALI_ADAPTOR_API Accessible +{ +public: + virtual ~Accessible(); + + using utf8_t = unsigned char; + + /** + * @brief Calculates and finds word boundaries in given utf8 text. + * + * @param[in] string The source text to find + * @param[in] length The length of text to find + * @param[in] language The language to use + * @param[out] breaks The word boundaries in given text + * + * @note Word boundaries are returned as non-zero values in table breaks, which must be of size at least length. + */ + void FindWordSeparationsUtf8(const utf8_t* string, size_t length, const char* language, char* breaks); + + /** + * @brief Calculates and finds line boundaries in given utf8 text. + * + * @param[in] string The source text to find + * @param[in] length The length of text to find + * @param[in] language The language to use + * @param[out] breaks The line boundaries in given text + * + * @note Line boundaries are returned as non-zero values in table breaks, which must be of size at least length. + */ + void FindLineSeparationsUtf8(const utf8_t* string, size_t length, const char* language, char* breaks); + + /** + * @brief Helper function for emiting active-descendant-changed event. + * + * @param[in] obj The accessible object + * @param[in] child The child of the object + */ + void EmitActiveDescendantChanged(Accessible* obj, Accessible* child); + + /** + * @brief Helper function for emiting state-changed event. + * + * @param[in] state The accessibility state (SHOWING, HIGHLIGHTED, etc) + * @param[in] newValue Whether the state value is changed to new value or not. + * @param[in] reserved Reserved. (TODO : Currently, this argument is not implemented in dali) + * + * @note The second argument determines which value is depending on State. + * For instance, if the state is PRESSED, newValue means isPressed or isSelected. + * If the state is SHOWING, newValue means isShowing. + */ + void EmitStateChanged(State state, int newValue, int reserved = 0); + + /** + * @brief Helper function for emiting bounds-changed event. + * + * @param rect The rectangle for changed bounds + */ + void EmitBoundsChanged(Rect<> rect); + + /** + * @brief Emits "showing" event. + * The method informs accessibility clients about "showing" state. + * + * @param[in] isShowing The flag pointing if object is showing + */ + void EmitShowing(bool isShowing); + + /** + * @brief Emits "visible" event. + * The method informs accessibility clients about "visible" state. + * + * @param[in] isVisible The flag pointing if object is visible + */ + void EmitVisible(bool isVisible); + + /** + * @brief Emits "highlighted" event. + * The method informs accessibility clients about "highlighted" state. + * + * @param[in] isHighlighted The flag pointing if object is highlighted + */ + void EmitHighlighted(bool isHighlighted); + + /** + * @brief Emits "focused" event. + * The method informs accessibility clients about "focused" state. + * + * @param[in] isFocused The flag pointing if object is focused + */ + void EmitFocused(bool isFocused); + + /** + * @brief Emits "text inserted" event. + * + * @param[in] position The cursor position + * @param[in] length The text length + * @param[in] content The inserted text + */ + void EmitTextInserted(unsigned int position, unsigned int length, const std::string& content); + + /** + * @brief Emits "text deleted" event. + * + * @param[in] position The cursor position + * @param[in] length The text length + * @param[in] content The deleted text + */ + void EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content); + + /** + * @brief Emits "cursor moved" event. + * + * @param[in] cursorPosition The new cursor position + */ + void EmitTextCursorMoved(unsigned int cursorPosition); + + /** + * @brief Emits "MoveOuted" event. + * + * @param[in] type moved out of screen type + */ + void EmitMovedOutOfScreen(ScreenRelativeMoveType type); + + /** + * @brief Emits "highlighted" event. + * + * @param[in] event The enumerated window event + * @param[in] detail The additional parameter which interpretation depends on chosen event + */ + void Emit(WindowEvent event, unsigned int detail = 0); + + /** + * @brief Emits property-changed event. + * + * @param[in] event Property changed event + **/ + void Emit(ObjectPropertyChangeEvent event); + + /** + * @brief Gets accessibility name. + * + * @return The string with name + */ + virtual std::string GetName() = 0; + + /** + * @brief Gets accessibility description. + * + * @return The string with description + */ + virtual std::string GetDescription() = 0; + + /** + * @brief Gets parent. + * + * @return The handler to accessibility object + */ + virtual Accessible* GetParent() = 0; + + /** + * @brief Gets the number of children. + * + * @return The number of children + */ + virtual size_t GetChildCount() = 0; + + /** + * @brief Gets collection with all children. + * + * @return The collection of accessibility objects + */ + virtual std::vector GetChildren(); + + /** + * @brief Gets child of the index. + * + * @return The child object + */ + virtual Accessible* GetChildAtIndex(size_t index) = 0; + + /** + * @brief Gets index that current object has in its parent's children collection. + * + * @return The index of the current object + */ + virtual size_t GetIndexInParent() = 0; + + /** + * @brief Gets accessibility role. + * + * @return Role enumeration + * + * @see Dali::Accessibility::Role + */ + virtual Role GetRole() = 0; + + /** + * @brief Gets name of accessibility role. + * + * @return The string with human readable role converted from enumeration + * + * @see Dali::Accessibility::Role + * @see Accessibility::Accessible::GetRole + */ + virtual std::string GetRoleName(); + + /** + * @brief Gets localized name of accessibility role. + * + * @return The string with human readable role translated according to current + * translation domain + * + * @see Dali::Accessibility::Role + * @see Accessibility::Accessible::GetRole + * @see Accessibility::Accessible::GetRoleName + * + * @note translation is not supported in this version + */ + virtual std::string GetLocalizedRoleName(); + + /** + * @brief Gets accessibility states. + * + * @return The collection of states + * + * @note States class is instatation of ArrayBitset template class + * + * @see Dali::Accessibility::State + * @see Dali::Accessibility::ArrayBitset + */ + virtual States GetStates() = 0; + + /** + * @brief Gets accessibility attributes. + * + * @return The map of attributes and their values + */ + virtual Attributes GetAttributes() = 0; + + /** + * @brief Checks if this is proxy. + * + * @return True if this is proxy + */ + virtual bool IsProxy(); + + /** + * @brief Gets unique address on accessibility bus. + * + * @return The Address class containing address + * + * @see Dali::Accessibility::Address + */ + virtual Address GetAddress(); + + /** + * @brief Deputes an object to perform provided gesture. + * + * @param[in] gestureInfo The structure describing the gesture + * + * @return true on success, false otherwise + * + * @see Dali::Accessibility::GestureInfo + */ + virtual bool DoGesture(const GestureInfo& gestureInfo) = 0; + + /** + * @brief Re-emits selected states of an Accessibility Object. + * + * @param[in] states The chosen states to re-emit + * @param[in] isRecursive If true, all children of the Accessibility object will also re-emit the states + */ + void NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive); + + /** + * @brief Gets information about current object and all relations that connects + * it with other accessibility objects. + * + * @return The iterable collection of Relation objects + * + * @see Dali::Accessibility::Relation + */ + virtual std::vector GetRelationSet() = 0; + + /** + * @brief Gets internal Actor to be saved before. + * + * @return The internal Actor + */ + virtual Dali::Actor GetInternalActor() = 0; + + /** + * @brief Gets all implemented interfaces. + * + * @return The collection of strings with implemented interfaces + */ + std::vector GetInterfaces(); + + /** + * @brief Checks if object is on root level. + * + * @return Whether object is on root level or not + */ + bool IsOnRootLevel() const + { + return mIsOnRootLevel; + } + +protected: + Accessible(); + Accessible(const Accessible&) = delete; + Accessible(Accessible&&) = delete; + Accessible& operator=(const Accessible&) = delete; + Accessible& operator=(Accessible&&) = delete; + std::shared_ptr GetBridgeData(); + +public: + /** + * @brief Gets the highlight actor. + * + * This method is to get the highlight itself. + * @return The highlight actor + */ + static Dali::Actor GetHighlightActor(); + + /** + * @brief Sets the highlight actor. + * + * This method is to set the highlight itself. + * @param[in] actor The highlight actor + */ + static void SetHighlightActor(Dali::Actor actor); + + /** + * @brief Gets the currently highlighted actor. + * + * @return The current highlighted actor + */ + static Dali::Actor GetCurrentlyHighlightedActor(); + + /** + * @brief Sets currently highlighted actor. + * + * @param[in] actor The highlight actor + */ + static void SetCurrentlyHighlightedActor(Dali::Actor actor); + + /** + * @brief Sets ObjectRegistry. + * + * @param[in] registry ObjectRegistry instance + */ + static void SetObjectRegistry(ObjectRegistry registry); + + /** + * @brief The method registers functor resposible for converting Actor into Accessible. + * @param functor The returning Accessible handle from Actor object + */ + static void RegisterExternalAccessibleGetter(std::function functor); + + /** + * @brief Acquires Accessible object from Actor object. + * + * @param[in] actor Actor object + * @param[in] isRoot True, if it's top level object (window) + * + * @return The handle to Accessible object + */ + static Accessible* Get(Dali::Actor actor, bool isRoot = false); + +private: + friend class Bridge; + + std::weak_ptr mBridgeData; + bool mIsOnRootLevel = false; + +}; // Accessible class + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_ACCESSIBLE_H diff --git a/dali/devel-api/atspi-interfaces/action.h b/dali/devel-api/atspi-interfaces/action.h new file mode 100644 index 0000000..0276378 --- /dev/null +++ b/dali/devel-api/atspi-interfaces/action.h @@ -0,0 +1,100 @@ +#ifndef DALI_ADAPTOR_ATSPI_ACTION_H +#define DALI_ADAPTOR_ATSPI_ACTION_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali::Accessibility +{ +/** + * @brief Interface enabling to perform provided actions. + */ +class DALI_ADAPTOR_API Action : public virtual Accessible +{ +public: + /** + * @brief Gets name of action with given index. + * + * @param[in] index The index of action + * + * @return The string with name of action + */ + virtual std::string GetActionName(size_t index) = 0; + + /** + * @brief Gets translated name of action with given index. + * + * @param[in] index The index of action + * + * @return The string with name of action translated according to current translation domain + * + * @note The translation is not supported in this version + */ + virtual std::string GetLocalizedActionName(size_t index) = 0; + + /** + * @brief Gets description of action with given index. + * + * @param[in] index The index of action + * + * @return The string with description of action + */ + virtual std::string GetActionDescription(size_t index) = 0; + + /** + * @brief Gets key code binded to action with given index. + * + * @param[in] index The index of action + * + * @return The string with key name + */ + virtual std::string GetActionKeyBinding(size_t index) = 0; + + /** + * @brief Gets number of provided actions. + * + * @return The number of actions + */ + virtual size_t GetActionCount() = 0; + + /** + * @brief Performs an action with given index. + * + * @param index The index of action + * + * @return true on success, false otherwise + */ + virtual bool DoAction(size_t index) = 0; + + /** + * @brief Performs an action with given name. + * + * @param name The name of action + * + * @return true on success, false otherwise + */ + virtual bool DoAction(const std::string& name) = 0; +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_ACTION_H diff --git a/dali/devel-api/atspi-interfaces/application.h b/dali/devel-api/atspi-interfaces/application.h new file mode 100644 index 0000000..c4eb62a --- /dev/null +++ b/dali/devel-api/atspi-interfaces/application.h @@ -0,0 +1,55 @@ +#ifndef DALI_ADAPTOR_ATSPI_APPLICATION_H +#define DALI_ADAPTOR_ATSPI_APPLICATION_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali::Accessibility +{ +/** + * @brief An interface identifying the root object + * associated with a running application. + * + * @note Provides global properties describing + * application's runtime environment. + */ +class DALI_ADAPTOR_API Application : public virtual Accessible +{ +public: + /** + * @brief Gets name of graphic user interface framework used by an application. + * + * @return String with name + */ + virtual std::string GetToolkitName() = 0; + + /** + * @brief Gets version of graphic user interface framework used by an application. + * + * @return String with version + */ + virtual std::string GetVersion() = 0; +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_APPLICATION_H diff --git a/dali/devel-api/atspi-interfaces/collection.h b/dali/devel-api/atspi-interfaces/collection.h new file mode 100644 index 0000000..173c929 --- /dev/null +++ b/dali/devel-api/atspi-interfaces/collection.h @@ -0,0 +1,38 @@ +#ifndef DALI_ADAPTOR_ATSPI_COLLECTION_H +#define DALI_ADAPTOR_ATSPI_COLLECTION_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// INTERNAL INCLUDES +#include + +namespace Dali::Accessibility +{ +/** + * @brief Interface enabling advanced quering of accessibility objects. + * + * @note since all mathods can be implemented inside bridge, + * none methods have to be overrided + */ +class DALI_ADAPTOR_API Collection : public virtual Accessible +{ +public: +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_COLLECTION_H diff --git a/dali/devel-api/atspi-interfaces/component.h b/dali/devel-api/atspi-interfaces/component.h new file mode 100644 index 0000000..b32fe02 --- /dev/null +++ b/dali/devel-api/atspi-interfaces/component.h @@ -0,0 +1,138 @@ +#ifndef DALI_ADAPTOR_ATSPI_COMPONENT_H +#define DALI_ADAPTOR_ATSPI_COMPONENT_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali::Accessibility +{ +/** + * @brief Interface representing objects having screen coordinates. + */ +class DALI_ADAPTOR_API Component : public virtual Accessible +{ +public: + /** + * @brief Gets rectangle describing size. + * + * @param[in] type The enumeration with type of coordinate systems + * + * @return Rect<> object + * + * @see Dali::Rect + */ + virtual Rect<> GetExtents(CoordinateType type) = 0; + + /** + * @brief Gets layer current object is localized on. + * + * @return The enumeration pointing layer + * + * @see Dali::Accessibility::ComponentLayer + */ + virtual ComponentLayer GetLayer() = 0; + + /** + * @brief Gets value of z-order. + * + * @return The value of z-order + * @remarks MDI means "Multi Document Interface" (https://en.wikipedia.org/wiki/Multiple-document_interface) + * which in short means that many stacked windows can be displayed within a single application. + * In such model, the concept of z-order of UI element became important to deal with element overlapping. + */ + virtual int16_t GetMdiZOrder() = 0; + + /** + * @brief Sets current object as "focused". + * + * @return true on success, false otherwise + */ + virtual bool GrabFocus() = 0; + + /** + * @brief Gets value of alpha channel. + * + * @return The alpha channel value in range [0.0, 1.0] + */ + virtual double GetAlpha() = 0; + + /** + * @brief Sets current object as "highlighted". + * + * The method assings "highlighted" state, simultaneously removing it + * from currently highlighted object. + * + * @return true on success, false otherwise + */ + virtual bool GrabHighlight() = 0; + + /** + * @brief Sets current object as "unhighlighted". + * + * The method removes "highlighted" state from object. + * + * @return true on success, false otherwise + * + * @see Dali:Accessibility::State + */ + virtual bool ClearHighlight() = 0; + + /** + * @brief Checks whether object can be scrolled. + * + * @return true if object is scrollable, false otherwise + * + * @see Dali:Accessibility::State + */ + virtual bool IsScrollable(); + + /** + * @brief Gets Accessible object containing given point. + * + * @param[in] point The two-dimensional point + * @param[in] type The enumeration with type of coordinate system + * + * @return The handle to last child of current object which contains given point + * + * @see Dali::Accessibility::Point + */ + virtual Accessible* GetAccessibleAtPoint(Point point, CoordinateType type); + + /** + * @brief Checks if the current object contains the given point inside. + * + * @param[in] point The two-dimensional point + * @param[in] type The enumeration with type of coordinate system + * + * @return True if accessible contains in point, otherwise false. + * + * @remarks This method is `Contains` in DBus method. + * @see Dali::Accessibility::Point + */ + virtual bool IsAccessibleContainingPoint(Point point, CoordinateType type); +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_COMPONENT_H diff --git a/dali/devel-api/atspi-interfaces/editable-text.h b/dali/devel-api/atspi-interfaces/editable-text.h new file mode 100644 index 0000000..b710958 --- /dev/null +++ b/dali/devel-api/atspi-interfaces/editable-text.h @@ -0,0 +1,90 @@ +#ifndef DALI_ADAPTOR_ATSPI_EDITABLE_TEXT_H +#define DALI_ADAPTOR_ATSPI_EDITABLE_TEXT_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali::Accessibility +{ +/** + * @brief Interface representing objects which can store editable texts. + * + * @note Paste method is entirely implemented inside bridge + * + * @see Dali::Accessibility::EditableText + */ +class DALI_ADAPTOR_API EditableText : public virtual Accessible +{ +public: + /** + * @brief Copies text in range to system clipboard. + * + * @param[in] startPosition The index of first character + * @param[in] endPosition The index of first character after the last one expected + * + * @return true on success, false otherwise + */ + virtual bool CopyText(size_t startPosition, size_t endPosition) = 0; + + /** + * @brief Cuts text in range to system clipboard. + * + * @param[in] startPosition The index of first character + * @param[in] endPosition The index of first character after the last one expected + * + * @return true on success, false otherwise + */ + virtual bool CutText(size_t startPosition, size_t endPosition) = 0; + + /** + * @brief Deletes text in range. + * + * @param[in] startPosition The index of first character + * @param[in] endPosition The index of first character after the last one expected + * + * @return true on success, false otherwise + */ + virtual bool DeleteText(size_t startPosition, size_t endPosition) = 0; + + /** + * @brief Inserts text at startPosition. + * + * @param[in] startPosition The index of first character + * @param[in] text The text content + * + * @return true on success, false otherwise + */ + virtual bool InsertText(size_t startPosition, std::string text) = 0; + + /** + * @brief Replaces text with content. + * + * @param[in] newContents The text content + * + * @return true on success, false otherwise + */ + virtual bool SetTextContents(std::string newContents) = 0; +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_EDITABLE_TEXT_H diff --git a/dali/devel-api/atspi-interfaces/hyperlink.h b/dali/devel-api/atspi-interfaces/hyperlink.h new file mode 100644 index 0000000..dc24615 --- /dev/null +++ b/dali/devel-api/atspi-interfaces/hyperlink.h @@ -0,0 +1,84 @@ +#ifndef DALI_ADAPTOR_ATSPI_HYPERLINK_H +#define DALI_ADAPTOR_ATSPI_HYPERLINK_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include + +namespace Dali::Accessibility +{ +/** + * @brief Interface representing a hyperlink in hypertext . + */ +class Hyperlink : public virtual Accessible +{ +public: + /** + * @brief Gets the index of character in originating hypertext at which this hyperlink ends. + * + * @return The 0-based index of hyperlink's last character + 1, in its originating hypertext. + */ + virtual int32_t GetEndIndex() const = 0; + + /** + * @brief Gets the index of character in originating hypertext at which this hyperlink starts. + * + * @return The 0-based index of hyperlink's first character, in its originating hypertext. + */ + virtual int32_t GetStartIndex() const = 0; + + /** + * @brief Gets the total number of anchors which this hyperlink has. Though, typical hyperlinks will have only one anchor. + * + * @return The number of anchors. + */ + virtual int32_t GetAnchorCount() const = 0; + + /** + * @brief Gets the object associated with a particular hyperlink's anchor. + * + * @param[in] anchorIndex The 0-based index in anchor collection. + * + * @return The handle to accessible object. + */ + virtual Accessible* GetAnchorAccessible(int32_t anchorIndex) const = 0; + + /** + * @brief Gets the URI associated with a particular hyperlink's anchor. + * + * @param[in] anchorIndex The 0-based index in anchor collection. + * + * @return The string containing URI. + */ + virtual std::string GetAnchorUri(int32_t anchorIndex) const = 0; + + /** + * @brief Tells whether this hyperlink object is still valid with respect to its originating hypertext object. + * + * @return True if hyperlink object is valid, false otherwise + */ + virtual bool IsValid() const = 0; +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_HYPERLINK_H diff --git a/dali/devel-api/atspi-interfaces/hypertext.h b/dali/devel-api/atspi-interfaces/hypertext.h new file mode 100644 index 0000000..cc96bbb --- /dev/null +++ b/dali/devel-api/atspi-interfaces/hypertext.h @@ -0,0 +1,63 @@ +#ifndef DALI_ADAPTOR_ATSPI_HYPERTEXT_H +#define DALI_ADAPTOR_ATSPI_HYPERTEXT_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali::Accessibility +{ +/** + * @brief Interface representing hypertext that can store a collection of hyperlinks. + */ +class DALI_ADAPTOR_API Hypertext : public virtual Accessible +{ +public: + /** + * @brief Gets the handle to hyperlink object from a specified index in hyperlink collection of this hypertext. + * + * @param[in] linkIndex The 0-based index in hyperlink collection. + * + * @return Handle to hyperlink object at a specified index in hyperlink collection of hypertext. + */ + virtual Hyperlink* GetLink(int32_t linkIndex) const = 0; + + /** + * @brief Gets the index in hyperlink collection occupied by hyperlink which spans over a specified character offset in this hypertext. + * + * @param[in] characterOffset The 0-based index of character in hypertext. + * + * @return The value of 0-based index in hyperlink collection (-1 if there is no hyperlink at the specified character offset). + */ + virtual int32_t GetLinkIndex(int32_t characterOffset) const = 0; + + /** + * @brief Gets number of hyperlinks stored in this hypertext. + * + * @return The number of hyperlinks (zero if none or -1 if the number cannot be determined) + */ + virtual int32_t GetLinkCount() const = 0; +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_HYPERTEXT_H diff --git a/dali/devel-api/atspi-interfaces/selection.h b/dali/devel-api/atspi-interfaces/selection.h new file mode 100644 index 0000000..fb6bdf9 --- /dev/null +++ b/dali/devel-api/atspi-interfaces/selection.h @@ -0,0 +1,110 @@ +#ifndef DALI_ADAPTOR_ATSPI_SELECTION_H +#define DALI_ADAPTOR_ATSPI_SELECTION_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// INTERNAL INCLUDES +#include + +namespace Dali::Accessibility +{ +/** + * @brief Interface representing objects which can store a set of selected items. + */ +class DALI_ADAPTOR_API Selection : public virtual Accessible +{ +public: + /** + * @brief Gets the number of selected children. + * + * @return The number of selected children (zero if none) + */ + virtual int GetSelectedChildrenCount() = 0; + + /** + * @brief Gets a specific selected child. + * + * @param selectedChildIndex The index of the selected child + * + * @note @p selectedChildIndex refers to the list of selected children, + * not the list of all children + * + * @return The selected child or nullptr if index is invalid + */ + virtual Accessible* GetSelectedChild(int selectedChildIndex) = 0; + + /** + * @brief Selects a child. + * + * @param childIndex The index of the child + * + * @return true on success, false otherwise + */ + virtual bool SelectChild(int childIndex) = 0; + + /** + * @brief Deselects a selected child. + * + * @param selectedChildIndex The index of the selected child + * + * @note @p selectedChildIndex refers to the list of selected children, + * not the list of all children + * + * @return true on success, false otherwise + * + * @see Dali::Accessibility::Selection::DeselectChild + */ + virtual bool DeselectSelectedChild(int selectedChildIndex) = 0; + + /** + * @brief Checks whether a child is selected. + * + * @param childIndex The index of the child + * + * @return true if given child is selected, false otherwise + */ + virtual bool IsChildSelected(int childIndex) = 0; + + /** + * @brief Selects all children. + * + * @return true on success, false otherwise + */ + virtual bool SelectAll() = 0; + + /** + * @brief Deselects all children. + * + * @return true on success, false otherwise + */ + virtual bool ClearSelection() = 0; + + /** + * @brief Deselects a child. + * + * @param childIndex The index of the child. + * + * @return true on success, false otherwise + * + * @see Dali::Accessibility::Selection::DeselectSelectedChild + */ + virtual bool DeselectChild(int childIndex) = 0; +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_SELECTION_H diff --git a/dali/devel-api/atspi-interfaces/text.h b/dali/devel-api/atspi-interfaces/text.h new file mode 100644 index 0000000..53158ba --- /dev/null +++ b/dali/devel-api/atspi-interfaces/text.h @@ -0,0 +1,125 @@ +#ifndef DALI_ADAPTOR_ATSPI_TEXT_H +#define DALI_ADAPTOR_ATSPI_TEXT_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali::Accessibility +{ +/** + * @brief Interface representing objects which can store immutable texts. + * + * @see Dali::Accessibility::EditableText + */ +class DALI_ADAPTOR_API Text : public virtual Accessible +{ +public: + /** + * @brief Gets stored text in given range. + * + * @param[in] startOffset The index of first character + * @param[in] endOffset The index of first character after the last one expected + * + * @return The substring of stored text + */ + virtual std::string GetText(size_t startOffset, size_t endOffset) = 0; + + /** + * @brief Gets number of all stored characters. + * + * @return The number of characters + * @remarks This method is `CharacterCount` in DBus method. + */ + virtual size_t GetCharacterCount() = 0; + + /** + * @brief Gets the cursor offset. + * + * @return Value of cursor offset + * @remarks This method is `CaretOffset` in DBus method. + */ + virtual size_t GetCursorOffset() = 0; + + /** + * @brief Sets the cursor offset. + * + * @param[in] offset Cursor offset + * + * @return True if successful + * @remarks This method is `SetCaretOffset` in DBus method. + */ + virtual bool SetCursorOffset(size_t offset) = 0; + + /** + * @brief Gets substring of stored text truncated in concrete gradation. + * + * @param[in] offset The position in stored text + * @param[in] boundary The enumeration describing text gradation + * + * @return Range structure containing acquired text and offsets in original string + * + * @see Dali::Accessibility::Range + */ + virtual Range GetTextAtOffset(size_t offset, TextBoundary boundary) = 0; + + /** + * @brief Gets selected text. + * + * @param[in] selectionIndex The selection index + * @note Currently only one selection (i.e. with index = 0) is supported + * + * @return Range structure containing acquired text and offsets in original string + * + * @remarks This method is `GetSelection` in DBus method. + * @see Dali::Accessibility::Range + */ + virtual Range GetRangeOfSelection(size_t selectionIndex) = 0; + + /** + * @brief Removes the whole selection. + * + * @param[in] selectionIndex The selection index + * @note Currently only one selection (i.e. with index = 0) is supported + * + * @return bool on success, false otherwise + */ + virtual bool RemoveSelection(size_t selectionIndex) = 0; + + /** + * @brief Sets selected text. + * + * @param[in] selectionIndex The selection index + * @param[in] startOffset The index of first character + * @param[in] endOffset The index of first character after the last one expected + * + * @note Currently only one selection (i.e. with index = 0) is supported + * + * @return true on success, false otherwise + * @remarks This method is `SetSelection` in DBus method. + */ + virtual bool SetRangeOfSelection(size_t selectionIndex, size_t startOffset, size_t endOffset) = 0; +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_TEXT_H diff --git a/dali/devel-api/atspi-interfaces/value.h b/dali/devel-api/atspi-interfaces/value.h new file mode 100644 index 0000000..69bba32 --- /dev/null +++ b/dali/devel-api/atspi-interfaces/value.h @@ -0,0 +1,71 @@ +#ifndef DALI_ADAPTOR_ATSPI_VALUE_H +#define DALI_ADAPTOR_ATSPI_VALUE_H + +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// INTERNAL INCLUDES +#include + +namespace Dali::Accessibility +{ +/** + * @brief Interface representing objects which can store numeric value. + */ +class DALI_ADAPTOR_API Value : public virtual Accessible +{ +public: + /** + * @brief Gets the lowest possible value. + * + * @return The minimum value + */ + virtual double GetMinimum() = 0; + + /** + * @brief Gets the current value. + * + * @return The current value + */ + virtual double GetCurrent() = 0; + + /** + * @brief Gets the highest possible value. + * + * @return The highest value. + */ + virtual double GetMaximum() = 0; + + /** + * @brief Sets the current value. + * + * @param[in] value The current value to set + * + * @return true if value could have been assigned, false otherwise + */ + virtual bool SetCurrent(double value) = 0; + + /** + * @brief Gets the lowest increment that can be distinguished. + * + * @return The lowest increment + */ + virtual double GetMinimumIncrement() = 0; +}; + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_VALUE_H diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index 4e16b3b..b501e0c 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -1,7 +1,7 @@ SET( devel_api_src_files - ${adaptor_devel_api_dir}/adaptor-framework/accessibility-impl.cpp + ${adaptor_devel_api_dir}/adaptor-framework/accessibility.cpp ${adaptor_devel_api_dir}/adaptor-framework/animated-image-loading.cpp ${adaptor_devel_api_dir}/adaptor-framework/application-devel.cpp ${adaptor_devel_api_dir}/adaptor-framework/atspi-accessibility.cpp @@ -54,7 +54,7 @@ SET( devel_api_src_files SET( devel_api_adaptor_framework_header_files ${adaptor_devel_api_dir}/adaptor-framework/accessibility.h - ${adaptor_devel_api_dir}/adaptor-framework/accessibility-impl.h + ${adaptor_devel_api_dir}/adaptor-framework/accessibility-bridge.h ${adaptor_devel_api_dir}/adaptor-framework/animated-image-loading.h ${adaptor_devel_api_dir}/adaptor-framework/application-devel.h ${adaptor_devel_api_dir}/adaptor-framework/atspi-accessibility.h @@ -91,6 +91,7 @@ SET( devel_api_adaptor_framework_header_files ${adaptor_devel_api_dir}/adaptor-framework/orientation.h ${adaptor_devel_api_dir}/adaptor-framework/performance-logger.h ${adaptor_devel_api_dir}/adaptor-framework/pixel-buffer.h + ${adaptor_devel_api_dir}/adaptor-framework/proxy-accessible.h ${adaptor_devel_api_dir}/adaptor-framework/sound-player.h ${adaptor_devel_api_dir}/adaptor-framework/style-monitor.h ${adaptor_devel_api_dir}/adaptor-framework/tilt-sensor.h @@ -135,6 +136,21 @@ SET( devel_api_adaptor_framework_header_files ) +SET( devel_api_atspi_interfaces_header_files + ${adaptor_devel_api_dir}/atspi-interfaces/accessible.h + ${adaptor_devel_api_dir}/atspi-interfaces/action.h + ${adaptor_devel_api_dir}/atspi-interfaces/application.h + ${adaptor_devel_api_dir}/atspi-interfaces/collection.h + ${adaptor_devel_api_dir}/atspi-interfaces/component.h + ${adaptor_devel_api_dir}/atspi-interfaces/editable-text.h + ${adaptor_devel_api_dir}/atspi-interfaces/hyperlink.h + ${adaptor_devel_api_dir}/atspi-interfaces/hypertext.h + ${adaptor_devel_api_dir}/atspi-interfaces/selection.h + ${adaptor_devel_api_dir}/atspi-interfaces/text.h + ${adaptor_devel_api_dir}/atspi-interfaces/value.h +) + + SET( devel_api_text_abstraction_src_files ${adaptor_devel_api_dir}/text-abstraction/bidirectional-support.cpp ${adaptor_devel_api_dir}/text-abstraction/bitmap-font.cpp diff --git a/dali/internal/accessibility/bridge/accessibility-common.h b/dali/internal/accessibility/bridge/accessibility-common.h index eabad2f..4da5e3c 100644 --- a/dali/internal/accessibility/bridge/accessibility-common.h +++ b/dali/internal/accessibility/bridge/accessibility-common.h @@ -25,7 +25,7 @@ #include // INTERNAL INCLUDES -#include +#include #include #include #include diff --git a/dali/internal/accessibility/bridge/accessible.cpp b/dali/internal/accessibility/bridge/accessible.cpp index 7d6010e..2921e60 100644 --- a/dali/internal/accessibility/bridge/accessible.cpp +++ b/dali/internal/accessibility/bridge/accessible.cpp @@ -18,6 +18,18 @@ // CLASS HEADER //INTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -236,11 +248,6 @@ bool Accessible::IsProxy() return false; } -Accessible* Accessible::GetDefaultLabel() -{ - return this; -} - void Accessible::NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive) { if(auto data = GetBridgeData()) diff --git a/dali/internal/accessibility/bridge/bridge-accessible.cpp b/dali/internal/accessibility/bridge/bridge-accessible.cpp index 2b3d24a..59481d3 100644 --- a/dali/internal/accessibility/bridge/bridge-accessible.cpp +++ b/dali/internal/accessibility/bridge/bridge-accessible.cpp @@ -22,6 +22,13 @@ #include #include +// INTERNAL INCLUDES +#include +#include +#include +#include +#include + //comment out 2 lines below to get more logs #undef LOG #define LOG() _LoggerEmpty() @@ -32,7 +39,6 @@ using namespace Dali::Accessibility; namespace { - bool SortVertically(Component* lhs, Component* rhs) { auto leftRect = lhs->GetExtents(CoordinateType::WINDOW); @@ -63,8 +69,8 @@ std::vector> SplitLines(const std::vector& c } std::vector> lines(1); - Dali::Rect<> lineRect = (*first)->GetExtents(CoordinateType::WINDOW); - Dali::Rect<> rect; + Dali::Rect<> lineRect = (*first)->GetExtents(CoordinateType::WINDOW); + Dali::Rect<> rect; // Split into lines for(auto it = first; it != children.end(); ++it) @@ -251,7 +257,7 @@ static std::string GetComponentInfo(Component* obj) std::ostringstream object; auto extent = obj->GetExtents(CoordinateType::SCREEN); object << "name: " << obj->GetName() << " extent: (" << extent.x << ", " - << extent.y << "), [" << extent.width << ", " << extent.height << "]"; + << extent.y << "), [" << extent.width << ", " << extent.height << "]"; return object.str(); } @@ -354,13 +360,13 @@ static Accessible* GetDeputyOfProxyInParent(Accessible* obj) return nullptr; } -static std::vector GetScrollableParents(Accessible *accessible) +static std::vector GetScrollableParents(Accessible* accessible) { std::vector scrollableParents; while(accessible) { - accessible = accessible->GetParent(); + accessible = accessible->GetParent(); auto component = dynamic_cast(accessible); if(component && component->IsScrollable()) { @@ -370,7 +376,7 @@ static std::vector GetScrollableParents(Accessible *accessible) return scrollableParents; } -static std::vector GetNonDuplicatedScrollableParents(Accessible *child, Accessible *start) +static std::vector GetNonDuplicatedScrollableParents(Accessible* child, Accessible* start) { auto scrollableParentsOfChild = GetScrollableParents(child); auto scrollableParentsOfStart = GetScrollableParents(start); @@ -381,14 +387,13 @@ static std::vector GetNonDuplicatedScrollableParents(Accessible *chi { scrollableParentsOfChild.pop_back(); scrollableParentsOfStart.pop_back(); - } + } return scrollableParentsOfChild; } } // anonymous namespace - BridgeAccessible::BridgeAccessible() { } @@ -606,11 +611,6 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial() describedByObject}; } -void BridgeAccessible::SuppressScreenReader(bool suppress) -{ - mIsScreenReaderSuppressed = suppress; -} - DBus::ValueOrError BridgeAccessible::DoGesture(Dali::Accessibility::Gesture type, int32_t startPositionX, int32_t startPositionY, int32_t endPositionX, int32_t endPositionY, Dali::Accessibility::GestureState state, uint32_t eventTime) { // Please be aware of sending GestureInfo point in the different order with parameters @@ -649,8 +649,8 @@ std::vector BridgeAccessible::GetValidChildren(const std::vector vec; Dali::Rect<> scrollableParentExtents; - auto nonDuplicatedScrollableParents = GetNonDuplicatedScrollableParents(children.front(), start); - if (!nonDuplicatedScrollableParents.empty()) + auto nonDuplicatedScrollableParents = GetNonDuplicatedScrollableParents(children.front(), start); + if(!nonDuplicatedScrollableParents.empty()) { scrollableParentExtents = nonDuplicatedScrollableParents.front()->GetExtents(CoordinateType::WINDOW); } @@ -690,7 +690,6 @@ void BridgeAccessible::SortChildrenFromTopLeft(std::vector struct CycleDetection { @@ -861,7 +860,7 @@ Accessible* BridgeAccessible::CalculateNeighbor(Accessible* root, Accessible* st // 2. parent after all children in backward traversing // 3. Nodes with roles: ATSPI_ROLE_PAGE_TAB, ATSPI_ROLE_POPUP_MENU and ATSPI_ROLE_DIALOG, only when looking for first or last element. // Objects with those roles shouldnt be reachable, when navigating next / prev. - bool areAllChildrenVisitedOrMovingForward= (children.size() == 0 || forward || areAllChildrenVisited); + bool areAllChildrenVisitedOrMovingForward = (children.size() == 0 || forward || areAllChildrenVisited); if(!forceNext && node != start && areAllChildrenVisitedOrMovingForward && IsObjectAcceptable(node)) { @@ -879,7 +878,7 @@ Accessible* BridgeAccessible::CalculateNeighbor(Accessible* root, Accessible* st // be checked first before using the elm_layout as a node. if(forceNext && forward) { - auto deputy = GetDeputyOfProxyInParent(node); + auto deputy = GetDeputyOfProxyInParent(node); nextRelatedInDirection = GetObjectInRelation(deputy, RelationType::FLOWS_TO); } @@ -1041,7 +1040,11 @@ std::string BridgeAccessible::GetName() DBus::ValueOrError> BridgeAccessible::GetDefaultLabelInfo() { - auto defaultLabel = FindSelf()->GetDefaultLabel(); + auto defaultLabel = GetDefaultLabel(); + if(defaultLabel == nullptr) + { + defaultLabel = FindSelf(); + } // By default, the text is taken from navigation context root's accessibility properties name and description. return {defaultLabel, static_cast(defaultLabel->GetRole()), defaultLabel->GetAttributes()}; } diff --git a/dali/internal/accessibility/bridge/bridge-accessible.h b/dali/internal/accessibility/bridge/bridge-accessible.h index 219db3b..3ca2223 100644 --- a/dali/internal/accessibility/bridge/bridge-accessible.h +++ b/dali/internal/accessibility/bridge/bridge-accessible.h @@ -25,7 +25,9 @@ #include // INTERNAL INCLUDES -#include "bridge-base.h" +#include +#include +#include /** * @brief The BridgeAccessible class is to correspond with Dali::Accessibility::Accessible. @@ -33,7 +35,6 @@ class BridgeAccessible : public virtual BridgeBase { protected: - /** * @brief Constructor. */ @@ -50,10 +51,10 @@ public: */ enum class NeighborSearchMode { - NORMAL = 0, ///< Normal - RECURSE_FROM_ROOT = 1, ///< Recurse from root - CONTINUE_AFTER_FAILED_RECURSION = 2, ///< Continue after failed recursion - RECURSE_TO_OUTSIDE = 3, ///< Recurse to outside + NORMAL = 0, ///< Normal + RECURSE_FROM_ROOT = 1, ///< Recurse from root + CONTINUE_AFTER_FAILED_RECURSION = 2, ///< Continue after failed recursion + RECURSE_TO_OUTSIDE = 3, ///< Recurse to outside }; using ReadingMaterialType = DBus::ValueOrError< @@ -177,7 +178,7 @@ public: * * The "Default label" is a text that could be read by screen-reader immediately * after the navigation context has changed (window activates, popup shows up, tab changes) and before first UI element is highlighted. - * @return The array containing the default label, its role, and its attributes + * @return The array containing the Accessible object being a source of default label text, its role, and its attributes * @note This is a Tizen only feature not present in upstream ATSPI. * Feature can be enabled/disabled for particular context root object by setting value of its accessibility attribute "default_label". */ @@ -190,11 +191,6 @@ public: ReadingMaterialType GetReadingMaterial(); /** - * @copydoc Dali::Accessibility::Bridge::SuppressScreenReader() - */ - void SuppressScreenReader(bool) override; - - /** * @copydoc Dali::Accessibility::Accessible::DoGesture() */ DBus::ValueOrError DoGesture(Dali::Accessibility::Gesture type, int32_t startPositionX, int32_t startPositionY, int32_t endPositionX, int32_t endPositionY, Dali::Accessibility::GestureState state, uint32_t eventTime); @@ -285,10 +281,6 @@ private: * @return The Component object */ Dali::Accessibility::Component* CalculateNavigableAccessibleAtPoint(Dali::Accessibility::Accessible* root, Dali::Accessibility::Point point, Dali::Accessibility::CoordinateType type, unsigned int maxRecursionDepth); - - -protected: - bool mIsScreenReaderSuppressed = false; }; #endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_ACCESSIBLE_H diff --git a/dali/internal/accessibility/bridge/bridge-action.h b/dali/internal/accessibility/bridge/bridge-action.h index 2d11264..c83fe8d 100644 --- a/dali/internal/accessibility/bridge/bridge-action.h +++ b/dali/internal/accessibility/bridge/bridge-action.h @@ -23,6 +23,7 @@ #include // INTERNAL INCLUDES +#include #include /** diff --git a/dali/internal/accessibility/bridge/bridge-application.h b/dali/internal/accessibility/bridge/bridge-application.h index ca1e417..f4cefc4 100644 --- a/dali/internal/accessibility/bridge/bridge-application.h +++ b/dali/internal/accessibility/bridge/bridge-application.h @@ -19,6 +19,7 @@ */ // INTERNAL INCLUDES +#include #include /** diff --git a/dali/internal/accessibility/bridge/bridge-base.cpp b/dali/internal/accessibility/bridge/bridge-base.cpp index 23c6c60..816194a 100644 --- a/dali/internal/accessibility/bridge/bridge-base.cpp +++ b/dali/internal/accessibility/bridge/bridge-base.cpp @@ -184,42 +184,6 @@ Accessible* BridgeBase::FindByPath(const std::string& name) const } } -void BridgeBase::AddPopup(Accessible* object) -{ - if(std::find(mPopups.begin(), mPopups.end(), object) != mPopups.end()) - { - return; - } - mPopups.push_back(object); - if(IsUp()) - { - object->Emit(WindowEvent::ACTIVATE, 0); - } -} - -void BridgeBase::RemovePopup(Accessible* object) -{ - auto it = std::find(mPopups.begin(), mPopups.end(), object); - if(it == mPopups.end()) - { - return; - } - mPopups.erase(it); - - if(IsUp()) - { - object->Emit(WindowEvent::DEACTIVATE, 0); - if(mPopups.empty()) - { - mApplication.mChildren.back()->Emit(WindowEvent::ACTIVATE, 0); - } - else - { - mPopups.back()->Emit(WindowEvent::ACTIVATE, 0); - } - } -} - void BridgeBase::OnWindowVisibilityChanged(Dali::Window window, bool visible) { if(visible) @@ -231,7 +195,6 @@ void BridgeBase::OnWindowVisibilityChanged(Dali::Window window, bool visible) { Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(window); // Called when Window is hidden and iconified. } - } void BridgeBase::OnWindowFocusChanged(Dali::Window window, bool focusIn) @@ -264,6 +227,8 @@ void BridgeBase::AddTopLevelWindow(Accessible* windowAccessible) mApplication.mChildren.push_back(windowAccessible); SetIsOnRootLevel(windowAccessible); + RegisterDefaultLabel(windowAccessible); + Dali::Window window = Dali::DevelWindow::Get(windowAccessible->GetInternalActor()); if(window) { @@ -287,6 +252,8 @@ void BridgeBase::RemoveTopLevelWindow(Accessible* windowAccessible) } } + UnregisterDefaultLabel(windowAccessible); + for(auto i = 0u; i < mApplication.mChildren.size(); ++i) { if(mApplication.mChildren[i] == windowAccessible) @@ -297,6 +264,23 @@ void BridgeBase::RemoveTopLevelWindow(Accessible* windowAccessible) } } +void BridgeBase::RegisterDefaultLabel(Accessible* object) +{ + if(std::find(mDefaultLabels.begin(), mDefaultLabels.end(), object) == mDefaultLabels.end()) + { + mDefaultLabels.push_back(object); + } +} + +void BridgeBase::UnregisterDefaultLabel(Accessible* object) +{ + auto it = std::find(mDefaultLabels.begin(), mDefaultLabels.end(), object); + if(it != mDefaultLabels.end()) + { + mDefaultLabels.erase(it); + } +} + std::string BridgeBase::StripPrefix(const std::string& path) { auto size = strlen(AtspiPath); @@ -310,7 +294,7 @@ Accessible* BridgeBase::Find(const std::string& path) const return &mApplication; } - void* accessible; + void* accessible; std::istringstream tmp{path}; if(!(tmp >> accessible)) { @@ -334,7 +318,7 @@ Accessible* BridgeBase::Find(const Address& ptr) const Accessible* BridgeBase::FindSelf() const { - auto path = DBus::DBusServer::getCurrentObjectPath(); + auto path = DBus::DBusServer::getCurrentObjectPath(); auto size = strlen(AtspiPath); if(path.size() <= size) { diff --git a/dali/internal/accessibility/bridge/bridge-base.h b/dali/internal/accessibility/bridge/bridge-base.h index 62a0094..77cd826 100644 --- a/dali/internal/accessibility/bridge/bridge-base.h +++ b/dali/internal/accessibility/bridge/bridge-base.h @@ -19,13 +19,17 @@ */ // EXTERNAL INCLUDES +#include #include #include -#include #include // INTERNAL INCLUDES +#include #include +#include +#include +#include #include /** @@ -227,14 +231,22 @@ public: void RemoveTopLevelWindow(Dali::Accessibility::Accessible* windowAccessible) override; /** - * @copydoc Dali::Accessibility::Bridge::AddPopup() + * @copydoc Dali::Accessibility::Bridge::RegisterDefaultLabel() + */ + void RegisterDefaultLabel(Dali::Accessibility::Accessible* object) override; + + /** + * @copydoc Dali::Accessibility::Bridge::UnregisterDefaultLabel() */ - void AddPopup(Dali::Accessibility::Accessible* object) override; + void UnregisterDefaultLabel(Dali::Accessibility::Accessible* object) override; /** - * @copydoc Dali::Accessibility::Bridge::RemovePopup() + * @copydoc Dali::Accessibility::Bridge::GetDefaultLabel() */ - void RemovePopup(Dali::Accessibility::Accessible* object) override; + Dali::Accessibility::Accessible* GetDefaultLabel() const override + { + return mDefaultLabels.empty() ? nullptr : mDefaultLabels.back(); + } /** * @copydoc Dali::Accessibility::Bridge::GetApplication() @@ -432,10 +444,10 @@ public: protected: mutable AppAccessible mApplication; - std::vector mPopups; + std::vector mDefaultLabels; + bool mIsScreenReaderSuppressed = false; private: - /** * @brief Sets an ID. * @param[in] id An ID (integer value) diff --git a/dali/internal/accessibility/bridge/bridge-collection.h b/dali/internal/accessibility/bridge/bridge-collection.h index dc22b1f..88f4d02 100644 --- a/dali/internal/accessibility/bridge/bridge-collection.h +++ b/dali/internal/accessibility/bridge/bridge-collection.h @@ -25,6 +25,7 @@ #include // INTERNAL INCLUDES +#include #include /** diff --git a/dali/internal/accessibility/bridge/bridge-component.h b/dali/internal/accessibility/bridge/bridge-component.h index 8688689..ec24f42 100644 --- a/dali/internal/accessibility/bridge/bridge-component.h +++ b/dali/internal/accessibility/bridge/bridge-component.h @@ -26,6 +26,7 @@ #include // INTERNAL INCLUDES +#include #include /** diff --git a/dali/internal/accessibility/bridge/bridge-editable-text.h b/dali/internal/accessibility/bridge/bridge-editable-text.h index a123b72..742a8d7 100644 --- a/dali/internal/accessibility/bridge/bridge-editable-text.h +++ b/dali/internal/accessibility/bridge/bridge-editable-text.h @@ -19,6 +19,7 @@ */ // INTERNAL INCLUDES +#include #include /** diff --git a/dali/internal/accessibility/bridge/bridge-hyperlink.h b/dali/internal/accessibility/bridge/bridge-hyperlink.h index 0b00356..c326141 100644 --- a/dali/internal/accessibility/bridge/bridge-hyperlink.h +++ b/dali/internal/accessibility/bridge/bridge-hyperlink.h @@ -19,6 +19,7 @@ */ // INTERNAL INCLUDES +#include #include class BridgeHyperlink : public virtual BridgeBase diff --git a/dali/internal/accessibility/bridge/bridge-hypertext.h b/dali/internal/accessibility/bridge/bridge-hypertext.h index c39c5f8..d3dcb2d 100644 --- a/dali/internal/accessibility/bridge/bridge-hypertext.h +++ b/dali/internal/accessibility/bridge/bridge-hypertext.h @@ -19,6 +19,7 @@ */ // INTERNAL INCLUDES +#include #include class BridgeHypertext : public virtual BridgeBase diff --git a/dali/internal/accessibility/bridge/bridge-impl.cpp b/dali/internal/accessibility/bridge/bridge-impl.cpp index 19d519a..116e703 100644 --- a/dali/internal/accessibility/bridge/bridge-impl.cpp +++ b/dali/internal/accessibility/bridge/bridge-impl.cpp @@ -443,6 +443,19 @@ public: } } + /** + * @copydoc Dali::Accessibility::Bridge::SuppressScreenReader() + */ + void SuppressScreenReader(bool suppress) override + { + if(mIsScreenReaderSuppressed == suppress) + { + return; + } + mIsScreenReaderSuppressed = suppress; + ReadScreenReaderEnabledProperty(); + } + bool ReadIsEnabledTimerCallback() { ReadIsEnabledProperty(); @@ -467,10 +480,14 @@ public: return; } mIsEnabled = std::get<0>(msg); - if(mIsEnabled) + if((!mIsScreenReaderSuppressed && mIsScreenReaderEnabled) || mIsEnabled) { ForceUp(); } + else + { + ForceDown(); + } }); } @@ -497,6 +514,12 @@ public: void ReadScreenReaderEnabledProperty() { + // can be true because of SuppressScreenReader before init + if (!mAccessibilityStatusClient) + { + return; + } + mAccessibilityStatusClient.property("ScreenReaderEnabled").asyncGet([this](DBus::ValueOrError msg) { if(!msg) { @@ -513,10 +536,14 @@ public: return; } mIsScreenReaderEnabled = std::get<0>(msg); - if(mIsScreenReaderEnabled) + if((!mIsScreenReaderSuppressed && mIsScreenReaderEnabled) || mIsEnabled) { ForceUp(); } + else + { + ForceDown(); + } }); } @@ -524,7 +551,7 @@ public: { mAccessibilityStatusClient.addPropertyChangedEvent("ScreenReaderEnabled", [this](bool res) { mIsScreenReaderEnabled = res; - if(mIsScreenReaderEnabled || mIsEnabled) + if((!mIsScreenReaderSuppressed && mIsScreenReaderEnabled) || mIsEnabled) { ForceUp(); } diff --git a/dali/internal/accessibility/bridge/bridge-object.h b/dali/internal/accessibility/bridge/bridge-object.h index 918c704..69ca828 100644 --- a/dali/internal/accessibility/bridge/bridge-object.h +++ b/dali/internal/accessibility/bridge/bridge-object.h @@ -25,6 +25,7 @@ #include // INTERNAL INCLUDES +#include #include #include diff --git a/dali/internal/accessibility/bridge/bridge-selection.h b/dali/internal/accessibility/bridge/bridge-selection.h index 5892544..639401d 100644 --- a/dali/internal/accessibility/bridge/bridge-selection.h +++ b/dali/internal/accessibility/bridge/bridge-selection.h @@ -19,6 +19,7 @@ */ // INTERNAL INCLUDES +#include #include /** diff --git a/dali/internal/accessibility/bridge/bridge-text.h b/dali/internal/accessibility/bridge/bridge-text.h index 49e69e3..737d318 100644 --- a/dali/internal/accessibility/bridge/bridge-text.h +++ b/dali/internal/accessibility/bridge/bridge-text.h @@ -19,6 +19,7 @@ */ // INTERNAL INCLUDES +#include #include /** diff --git a/dali/internal/accessibility/bridge/bridge-value.h b/dali/internal/accessibility/bridge/bridge-value.h index e4bfec5..caa7cc1 100644 --- a/dali/internal/accessibility/bridge/bridge-value.h +++ b/dali/internal/accessibility/bridge/bridge-value.h @@ -26,6 +26,7 @@ #include // INTERNAL INCLUDES +#include #include /** diff --git a/dali/internal/accessibility/bridge/component.cpp b/dali/internal/accessibility/bridge/component.cpp index d93789a..7992df5 100644 --- a/dali/internal/accessibility/bridge/component.cpp +++ b/dali/internal/accessibility/bridge/component.cpp @@ -21,6 +21,7 @@ #include // INTERNAL INCLUDES +#include #include using namespace Dali::Accessibility; diff --git a/dali/internal/accessibility/bridge/dummy-atspi.cpp b/dali/internal/accessibility/bridge/dummy-atspi.cpp index 518330f..a518df9 100644 --- a/dali/internal/accessibility/bridge/dummy-atspi.cpp +++ b/dali/internal/accessibility/bridge/dummy-atspi.cpp @@ -15,8 +15,10 @@ * */ -#include #include +#include +#include +#include #include namespace Dali @@ -34,11 +36,6 @@ std::vector Accessibility::Accessible::GetChildren() return {}; } -Accessibility::Accessible* Accessibility::Accessible::GetDefaultLabel() -{ - return nullptr; -} - Accessibility::Address Accessibility::Accessible::GetAddress() { return {}; diff --git a/dali/internal/accessibility/bridge/dummy-atspi.h b/dali/internal/accessibility/bridge/dummy-atspi.h index 06995b9..80079c1 100644 --- a/dali/internal/accessibility/bridge/dummy-atspi.h +++ b/dali/internal/accessibility/bridge/dummy-atspi.h @@ -1,3 +1,6 @@ +#ifndef DALI_ADAPTOR_DUMMY_ATSPI_H +#define DALI_ADAPTOR_DUMMY_ATSPI_H + /* * Copyright (c) 2021 Samsung Electronics Co., Ltd. * @@ -15,8 +18,8 @@ * */ -#include #include +#include namespace Dali::Accessibility { @@ -43,12 +46,17 @@ struct DummyBridge : Dali::Accessibility::Bridge { } - void AddPopup(Accessibility::Accessible* object) override + void RegisterDefaultLabel(Accessibility::Accessible* object) override + { + } + + void UnregisterDefaultLabel(Accessibility::Accessible* object) override { } - void RemovePopup(Accessibility::Accessible* object) override + Dali::Accessibility::Accessible* GetDefaultLabel() const override { + return nullptr; } void SetApplicationName(std::string name) override @@ -167,3 +175,5 @@ struct DummyBridge : Dali::Accessibility::Bridge }; } // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_DUMMY_ATSPI_H diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index d880a94..ddc912a 100644 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -67,7 +67,7 @@ #include #include -#include +#include #include #include diff --git a/dali/internal/adaptor/common/application-impl.cpp b/dali/internal/adaptor/common/application-impl.cpp index 4e08ba1..03138a9 100644 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -24,8 +24,9 @@ #include // INTERNAL INCLUDES -#include +#include #include +#include #include #include #include diff --git a/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp b/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp index eec74af..bee69ec 100644 --- a/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp +++ b/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp @@ -347,6 +347,12 @@ void EglGraphicsController::ProcessDiscardQueues() // Process Framebuffers ProcessDiscardQueue(mDiscardFramebufferQueue); + // Process RenderPass + ProcessDiscardQueue(mDiscardRenderPassQueue); + + // Process RenderTarget + ProcessDiscardQueue(mDiscardRenderTargetQueue); + // Process pipelines ProcessDiscardQueue(mDiscardPipelineQueue); diff --git a/dali/internal/graphics/gles-impl/egl-graphics-controller.h b/dali/internal/graphics/gles-impl/egl-graphics-controller.h index a792eea..6af7383 100644 --- a/dali/internal/graphics/gles-impl/egl-graphics-controller.h +++ b/dali/internal/graphics/gles-impl/egl-graphics-controller.h @@ -392,6 +392,30 @@ public: } /** + * @brief Pushes RenderPass to the discard queue + * + * Function is called from the UniquePtr custom deleter. + * + * @param[in] program Pointer to the RenderPass + */ + void DiscardResource(GLES::RenderPass* renderPass) + { + mDiscardRenderPassQueue.push(renderPass); + } + + /** + * @brief Pushes RenderTarget to the discard queue + * + * Function is called from the UniquePtr custom deleter. + * + * @param[in] program Pointer to the RenderTarget + */ + void DiscardResource(GLES::RenderTarget* renderTarget) + { + mDiscardRenderTargetQueue.push(renderTarget); + } + + /** * @brief Pushes Shader to the discard queue * * Function is called from the UniquePtr custom deleter. @@ -747,6 +771,8 @@ private: std::queue mDiscardProgramQueue; ///< Discard queue for program resource std::queue mDiscardPipelineQueue; ///< Discard queue of pipelines + std::queue mDiscardRenderPassQueue; ///< Discard queue for renderpass resource + std::queue mDiscardRenderTargetQueue; ///< Discard queue for rendertarget resource std::queue mDiscardShaderQueue; ///< Discard queue of shaders std::queue mDiscardSamplerQueue; ///< Discard queue of samplers std::queue mDiscardCommandBufferQueue; ///< Discard queue of command buffers diff --git a/dali/internal/graphics/gles-impl/gles-graphics-render-pass.cpp b/dali/internal/graphics/gles-impl/gles-graphics-render-pass.cpp index bb5d680..554bfe4 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-render-pass.cpp +++ b/dali/internal/graphics/gles-impl/gles-graphics-render-pass.cpp @@ -18,6 +18,9 @@ // CLASS HEADER #include "gles-graphics-render-pass.h" +// INTERNAL INCLUDES +#include "egl-graphics-controller.h" + namespace Dali::Graphics::GLES { struct RenderPass::Impl @@ -25,7 +28,7 @@ struct RenderPass::Impl Impl() = default; ~Impl() = default; - std::vector attachments; + std::vector attachments{}; }; RenderPass::RenderPass(const Graphics::RenderPassCreateInfo& createInfo, Graphics::EglGraphicsController& controller) @@ -41,4 +44,11 @@ RenderPass::RenderPass(const Graphics::RenderPassCreateInfo& createInfo, Graphic } } +RenderPass::~RenderPass() = default; + +void RenderPass::DiscardResource() +{ + mController.DiscardResource(this); +} + } // namespace Dali::Graphics::GLES diff --git a/dali/internal/graphics/gles-impl/gles-graphics-render-pass.h b/dali/internal/graphics/gles-impl/gles-graphics-render-pass.h index 1186f61..0281a66 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-render-pass.h +++ b/dali/internal/graphics/gles-impl/gles-graphics-render-pass.h @@ -42,14 +42,14 @@ public: /** * @brief Destructor */ - ~RenderPass() override = default; + ~RenderPass() override; /** * @brief Called when GL resources are destroyed */ void DestroyResource() override { - // TODO: Implement destroying the resource + // There is no graphic resource here. do nothing. } /** @@ -59,17 +59,14 @@ public: */ bool InitializeResource() override { - // TODO: Implement initializing resource - return {}; + // There is no graphic resource here. return true. + return true; } /** * @brief Called when UniquePtr<> on client-side dies */ - void DiscardResource() override - { - // TODO: Implement moving to the discard queue - } + void DiscardResource() override; private: struct Impl; diff --git a/dali/internal/graphics/gles-impl/gles-graphics-render-target.cpp b/dali/internal/graphics/gles-impl/gles-graphics-render-target.cpp index efdaeb2..8cfd3f1 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-render-target.cpp +++ b/dali/internal/graphics/gles-impl/gles-graphics-render-target.cpp @@ -25,35 +25,32 @@ namespace Dali::Graphics::GLES { -struct RenderTarget::Impl -{ - Impl(EglGraphicsController& controller) - : controller(controller){}; - - ~Impl() = default; - - EglGraphicsController& controller; -}; RenderTarget::RenderTarget(const Graphics::RenderTargetCreateInfo& createInfo, Graphics::EglGraphicsController& controller) : RenderTargetResource(createInfo, controller) { - mImpl = std::make_unique(controller); - if(createInfo.surface) { controller.CreateSurfaceContext(static_cast(createInfo.surface)); } } -RenderTarget::~RenderTarget() +RenderTarget::~RenderTarget() = default; + +void RenderTarget::DestroyResource() { + // This is a proper destructor if(mCreateInfo.surface) { - mImpl->controller.DeleteSurfaceContext(static_cast(mCreateInfo.surface)); + mController.DeleteSurfaceContext(static_cast(mCreateInfo.surface)); } } +void RenderTarget::DiscardResource() +{ + mController.DiscardResource(this); +} + GLES::Framebuffer* RenderTarget::GetFramebuffer() const { return static_cast(mCreateInfo.framebuffer); diff --git a/dali/internal/graphics/gles-impl/gles-graphics-render-target.h b/dali/internal/graphics/gles-impl/gles-graphics-render-target.h index 6a9fcab..2169e62 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-render-target.h +++ b/dali/internal/graphics/gles-impl/gles-graphics-render-target.h @@ -48,10 +48,7 @@ public: /** * @brief Called when GL resources are destroyed */ - void DestroyResource() override - { - // TODO: Implement destroying the resource - } + void DestroyResource() override; /** * @brief Called when initializing the resource @@ -60,17 +57,14 @@ public: */ bool InitializeResource() override { - // TODO: Implement initializing resource - return {}; + // There is no graphic resource here. return true. + return true; } /** * @brief Called when UniquePtr<> on client-side dies */ - void DiscardResource() override - { - // TODO: Implement moving to the discard queue - } + void DiscardResource() override; /** * @brief Returns framebuffer associated with the render target @@ -81,10 +75,6 @@ public: * @brief Returns surface associated with the render target */ Surface* GetSurface() const; - -private: - struct Impl; - std::unique_ptr mImpl{nullptr}; }; } // namespace Dali::Graphics::GLES diff --git a/dali/internal/graphics/gles-impl/gles-graphics-shader.h b/dali/internal/graphics/gles-impl/gles-graphics-shader.h index 3b2abb8..180a14b 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-shader.h +++ b/dali/internal/graphics/gles-impl/gles-graphics-shader.h @@ -77,7 +77,7 @@ public: private: struct Impl; - std::unique_ptr mImpl; + std::unique_ptr mImpl{nullptr}; }; } // namespace Dali::Graphics::GLES diff --git a/dali/internal/graphics/gles-impl/gles-graphics-texture.h b/dali/internal/graphics/gles-impl/gles-graphics-texture.h index 2ae566f..ee7b1c2 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-texture.h +++ b/dali/internal/graphics/gles-impl/gles-graphics-texture.h @@ -160,7 +160,7 @@ private: uint32_t maxLevel{0}; } mDefaultSamplerState; - std::vector mStagingBuffer; + std::vector mStagingBuffer{}; uint32_t mTextureId{0u}; GLenum mGlTarget{0u}; uint32_t mMaxMipMapLevel{0u}; diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index e3f6525..58476e3 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -32,7 +32,8 @@ #include // INTERNAL HEADERS -#include +#include +#include #include #include #include diff --git a/dali/public-api/dali-adaptor-version.cpp b/dali/public-api/dali-adaptor-version.cpp index c97b1f4..a6daef3 100644 --- a/dali/public-api/dali-adaptor-version.cpp +++ b/dali/public-api/dali-adaptor-version.cpp @@ -27,7 +27,7 @@ namespace Dali { const unsigned int ADAPTOR_MAJOR_VERSION = 2; const unsigned int ADAPTOR_MINOR_VERSION = 1; -const unsigned int ADAPTOR_MICRO_VERSION = 2; +const unsigned int ADAPTOR_MICRO_VERSION = 3; const char* const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index 5a29b8a..96079bb 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -17,7 +17,7 @@ Name: dali2-adaptor Summary: The DALi Tizen Adaptor -Version: 2.1.2 +Version: 2.1.3 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT