case Graphics::BlendOp::MAX:
op = GL_MAX;
break;
-
- // @todo Add advanced blend equations
+ case Graphics::BlendOp::MULTIPLY:
+ {
+ op = GL_MULTIPLY;
+ break;
+ }
+ case Graphics::BlendOp::SCREEN:
+ {
+ op = GL_SCREEN;
+ break;
+ }
+ case Graphics::BlendOp::OVERLAY:
+ {
+ op = GL_OVERLAY;
+ break;
+ }
+ case Graphics::BlendOp::DARKEN:
+ {
+ op = GL_DARKEN;
+ break;
+ }
+ case Graphics::BlendOp::LIGHTEN:
+ {
+ op = GL_LIGHTEN;
+ break;
+ }
+ case Graphics::BlendOp::COLOR_DODGE:
+ {
+ op = GL_COLORDODGE;
+ break;
+ }
+ case Graphics::BlendOp::COLOR_BURN:
+ {
+ op = GL_COLORBURN;
+ break;
+ }
+ case Graphics::BlendOp::HARD_LIGHT:
+ {
+ op = GL_HARDLIGHT;
+ break;
+ }
+ case Graphics::BlendOp::SOFT_LIGHT:
+ {
+ op = GL_SOFTLIGHT;
+ break;
+ }
+ case Graphics::BlendOp::DIFFERENCE:
+ {
+ op = GL_DIFFERENCE;
+ break;
+ }
+ case Graphics::BlendOp::EXCLUSION:
+ {
+ op = GL_EXCLUSION;
+ break;
+ }
+ case Graphics::BlendOp::HUE:
+ {
+ op = GL_HSL_HUE;
+ break;
+ }
+ case Graphics::BlendOp::SATURATION:
+ {
+ op = GL_HSL_SATURATION;
+ break;
+ }
+ case Graphics::BlendOp::COLOR:
+ {
+ op = GL_HSL_COLOR;
+ break;
+ }
+ case Graphics::BlendOp::LUMINOSITY:
+ {
+ op = GL_HSL_LUMINOSITY;
+ break;
+ }
}
return op;
}
/**
* @brief Gets bus name which bridge is initialized on.
+ *
+ * @return The bus name
*/
virtual const std::string& GetBusName() const = 0;
ENABLED
};
- inline static AutoInitState autoInitState = AutoInitState::ENABLED;
+ inline static AutoInitState mAutoInitState = AutoInitState::ENABLED;
/**
* @brief Registers accessible object to be known in bridge object.
virtual Accessible* GetAccessibleAtPoint(Point point, CoordinateType type);
/**
- * @brief Checks if current object contains given point.
+ * @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
* @remarks This method is `Contains` in DBus method.
* @see Dali::Accessibility::Point
*/
- virtual bool IsAccessibleContainedAtPoint(Point point, CoordinateType type);
+ virtual bool IsAccessibleContainingPoint(Point point, CoordinateType type);
};
/**
/**\r
* @brief Enumeration describing if coordinates are relative to screen or window\r
* @see Accessibility::Component::GetExtents\r
- * @see Accessibility::Component::IsAccessibleContainedAtPoint\r
+ * @see Accessibility::Component::IsAccessibleContainingPoint\r
*/\r
enum class CoordinateType\r
{\r
template<size_t I, typename S>\r
class BitSets\r
{\r
- std::array<uint32_t, I> data;\r
+ std::array<uint32_t, I> mData;\r
\r
void Set()\r
{\r
public:\r
BitSets()\r
{\r
- for(auto& u : data)\r
+ for(auto& u : mData)\r
{\r
u = 0;\r
}\r
template<typename T, typename... ARGS, typename std::enable_if<Accepts<T, ARGS...>()>::type* = nullptr>\r
BitSets(T t, ARGS... args)\r
{\r
- for(auto& u : data)\r
+ for(auto& u : mData)\r
+ {\r
u = 0;\r
+ }\r
Set(t, args...);\r
}\r
\r
{\r
for(auto i = 0u; i < I; ++i)\r
{\r
- data[i] = d[i];\r
+ mData[i] = d[i];\r
}\r
}\r
\r
{\r
for(auto i = 0u; i < I; ++i)\r
{\r
- data[i] = static_cast<uint32_t>(d[i]);\r
+ mData[i] = static_cast<uint32_t>(d[i]);\r
}\r
}\r
\r
BitSets& operator=(const BitSets&) = default;\r
BitSets& operator=(BitSets&&) = default;\r
\r
- struct reference\r
+ struct Reference\r
{\r
std::array<uint32_t, I>& data;\r
size_t pos;\r
\r
- reference& operator=(reference r)\r
+ Reference& operator=(Reference r)\r
{\r
(*this) = static_cast<bool>(r);\r
return *this;\r
}\r
\r
- reference& operator=(bool v)\r
+ Reference& operator=(bool v)\r
{\r
if(v)\r
{\r
auto i = static_cast<size_t>(pos);\r
return (data[i / 32] & (1 << (i & 31))) != 0;\r
}\r
- };\r
+ }; // Reference struct\r
\r
- reference operator[](S index)\r
+ Reference operator[](S index)\r
{\r
- return {data, static_cast<size_t>(index)};\r
+ return {mData, static_cast<size_t>(index)};\r
}\r
\r
bool operator[](S index) const\r
{\r
auto i = static_cast<size_t>(index);\r
- return (data[i / 32] & (1 << (i & 31))) != 0;\r
+ return (mData[i / 32] & (1 << (i & 31))) != 0;\r
}\r
\r
std::array<uint32_t, I> GetRawData() const\r
{\r
- return data;\r
+ return mData;\r
}\r
\r
BitSets operator|(BitSets b) const\r
BitSets r;\r
for(auto i = 0u; i < I; ++i)\r
{\r
- r.data[i] = data[i] | b.data[i];\r
+ r.mData[i] = mData[i] | b.mData[i];\r
}\r
return r;\r
}\r
BitSets r;\r
for(auto i = 0u; i < I; ++i)\r
{\r
- r.data[i] = data[i] ^ b.data[i];\r
+ r.mData[i] = mData[i] ^ b.mData[i];\r
}\r
return r;\r
}\r
BitSets r;\r
for(auto i = 0u; i < I; ++i)\r
{\r
- r.data[i] = data[i] & b.data[i];\r
+ r.mData[i] = mData[i] & b.mData[i];\r
}\r
return r;\r
}\r
{\r
for(auto i = 0u; i < I; ++i)\r
{\r
- if(data[i] != b.data[i])\r
+ if(mData[i] != b.mData[i])\r
{\r
return false;\r
}\r
\r
explicit operator bool() const\r
{\r
- for(auto& u : data)\r
+ for(auto& u : mData)\r
{\r
if(u)\r
{\r
{\r
return I;\r
}\r
-};\r
+}; // BitSets class\r
\r
using ReadingInfoTypes = BitSets<1, ReadingInfoType>;\r
using States = BitSets<2, State>;\r
/**\r
* @brief Structure containing all values needed to invoke Accessible::DoGesture\r
* type : numerated gesture type\r
- * xBeg, yBeg : point where gesture begins\r
- * xEnd, yEnd : point where gesture ends\r
+ * startPositionX, startPositionY : point where gesture begins\r
+ * endPositionX, endPositionY : point where gesture ends\r
* state : enumerated state of gesture\r
* eventTime : time when event occured\r
* @see Dali::Accessibility::Accessible::DoGesture\r
struct DALI_ADAPTOR_API GestureInfo\r
{\r
GestureInfo() = default;\r
- GestureInfo(Gesture type, int32_t xBeg, int32_t xEnd, int32_t yBeg, int32_t yEnd, GestureState state, uint32_t eventTime)\r
+ GestureInfo(Gesture type, int32_t startPositionX, int32_t endPositionX, int32_t startPositionY, int32_t endPositionY, GestureState state, uint32_t eventTime)\r
: type(type),\r
- xBeg(xBeg),\r
- xEnd(xEnd),\r
- yBeg(yBeg),\r
- yEnd(yEnd),\r
+ startPointX(startPositionX),\r
+ endPointX(endPositionX),\r
+ startPointY(startPositionY),\r
+ endPointY(endPositionY),\r
state(state),\r
eventTime(eventTime)\r
{\r
}\r
\r
Gesture type{};\r
- int32_t xBeg{};\r
- int32_t xEnd{};\r
- int32_t yBeg{};\r
- int32_t yEnd{};\r
+ int32_t startPointX{};\r
+ int32_t endPointX{};\r
+ int32_t startPointY{};\r
+ int32_t endPointY{};\r
GestureState state{};\r
uint32_t eventTime{};\r
};\r
return Dali::Internal::Adaptor::NativeImageSource::GetImplementation(image).ReleaseBuffer();\r
}\r
\r
+void SetResourceDestructionCallback(NativeImageSource& image, EventThreadCallback* callback)\r
+{\r
+ return Dali::Internal::Adaptor::NativeImageSource::GetImplementation(image).SetResourceDestructionCallback(callback);\r
+}\r
+\r
} // namespace DevelNativeImageSource\r
\r
} // namespace Dali\r
\r
// EXTERNAL INCLUDES\r
#include <dali/public-api/adaptor-framework/native-image-source.h>\r
+#include <dali/devel-api/adaptor-framework/event-thread-callback.h>\r
+\r
\r
namespace Dali\r
{\r
*/\r
DALI_ADAPTOR_API bool ReleaseBuffer(NativeImageSource& image);\r
\r
+/**\r
+ * @brief Set the Resource Destruction Callback object\r
+ *\r
+ * @param image The instance of NativeImageSource.\r
+ * @param callback The Resource Destruction callback\r
+ * @note Ownership of the callback is passed onto this class.\r
+ */\r
+DALI_ADAPTOR_API void SetResourceDestructionCallback(NativeImageSource& image, EventThreadCallback* callback);\r
+\r
} // namespace DevelNativeImageSource\r
\r
} // namespace Dali\r
// EXTERNAL INCLUDES
#include <functional>
#include <memory>
+#include <dali/public-api/images/native-image-interface.h>
+#include <dali/public-api/math/rect.h>
+#include <dali/public-api/signals/dali-signal.h>
// INTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali/devel-api/adaptor-framework/web-engine-hit-test.h>
#include <dali/devel-api/common/bitwise-enum.h>
-#include <dali/public-api/images/native-image-interface.h>
-#include <dali/public-api/math/rect.h>
-#include <dali/public-api/signals/dali-signal.h>
namespace Dali
{
/**
* @brief Get image to render.
*/
- virtual NativeImageInterfacePtr GetNativeImageSource() = 0;
+ virtual NativeImageSourcePtr GetNativeImageSource() = 0;
/**
* @brief Return the URL of the Web.
GetImplementation(*this).Destroy();
}
-NativeImageInterfacePtr WebEngine::GetNativeImageSource()
+NativeImageSourcePtr WebEngine::GetNativeImageSource()
{
return GetImplementation(*this).GetNativeImageSource();
}
/**
* @brief Get native image source to render.
*/
- NativeImageInterfacePtr GetNativeImageSource();
+ NativeImageSourcePtr GetNativeImageSource();
/**
* @brief Get settings of WebEngine.
#include <dali/internal/accessibility/bridge/dbus.h>
#include <dali/public-api/dali-adaptor-common.h>
+/* DBus Interfaces */
+
#define A11yDbusName "org.a11y.Bus"
#define A11yDbusPath "/org/a11y/bus"
#define A11yDbusStatusInterface "org.a11y.Status"
#define AtspiDbusInterfaceAccessible "org.a11y.atspi.Accessible"
#define AtspiDbusInterfaceAction "org.a11y.atspi.Action"
#define AtspiDbusInterfaceApplication "org.a11y.atspi.Application"
+#define AtspiDbusInterfaceCache "org.a11y.atspi.Cache"
+#define AtspiDbusPathCache "/org/a11y/atspi/cache"
#define AtspiDbusInterfaceCollection "org.a11y.atspi.Collection"
#define AtspiDbusInterfaceComponent "org.a11y.atspi.Component"
#define AtspiDbusInterfaceDocument "org.a11y.atspi.Document"
namespace DBus
{
+
+/**
+ * @brief The CurrentBridgePtr class is to save the current Accessibility Bridge.
+ */
class CurrentBridgePtr
{
- static Dali::Accessibility::Bridge*& get()
+ static Dali::Accessibility::Bridge*& Get()
{
- static thread_local Dali::Accessibility::Bridge* b = nullptr;
- return b;
+ static thread_local Dali::Accessibility::Bridge* bridge = nullptr;
+ return bridge;
}
- Dali::Accessibility::Bridge* prev;
+ Dali::Accessibility::Bridge* mPrev;
CurrentBridgePtr(const CurrentBridgePtr&) = delete;
CurrentBridgePtr(CurrentBridgePtr&&) = delete;
CurrentBridgePtr& operator=(const CurrentBridgePtr&) = delete;
CurrentBridgePtr& operator=(CurrentBridgePtr&&) = delete;
public:
- CurrentBridgePtr(Dali::Accessibility::Bridge* b)
- : prev(get())
+ CurrentBridgePtr(Dali::Accessibility::Bridge* bridge)
+ : mPrev(Get())
{
- get() = b;
+ Get() = bridge;
}
~CurrentBridgePtr()
{
- get() = prev;
+ Get() = mPrev;
}
- static Dali::Accessibility::Bridge* current()
+ static Dali::Accessibility::Bridge* GetCurrentBridge()
{
- return get();
+ return Get();
}
-};
+}; // CurrentBridgePtr
+
+// Templates for setting and getting Accessible values
namespace detail
{
template<typename T>
-struct signature_accessible_impl : signature_helper<signature_accessible_impl<T>>
+struct SignatureAccessibleImpl : signature_helper<SignatureAccessibleImpl<T>>
{
using subtype = std::pair<std::string, ObjectPath>;
static constexpr auto sig_v = concat("(so)");
/**
- * @brief Marshals value v as marshalled type into message
+ * @brief Marshals value address as marshalled type into message
*/
- static void set(const DBusWrapper::MessageIterPtr& iter, T* t)
+ static void set(const DBusWrapper::MessageIterPtr& iter, T* accessible)
{
- if(t)
+ if(accessible)
{
- auto v = t->GetAddress();
- signature<subtype>::set(iter, {v.GetBus(), ObjectPath{std::string{ATSPI_PREFIX_PATH} + v.GetPath()}});
+ auto address = accessible->GetAddress();
+ signature<subtype>::set(iter, {address.GetBus(), ObjectPath{std::string{ATSPI_PREFIX_PATH} + address.GetPath()}});
}
else
{
}
/**
- * @brief Marshals value from marshalled type into variable v
+ * @brief Marshals value from marshalled type into variable path
*/
- static bool get(const DBusWrapper::MessageIterPtr& iter, T*& v)
+ static bool get(const DBusWrapper::MessageIterPtr& iter, T*& path)
{
subtype tmp;
if(!signature<subtype>::get(iter, tmp))
if(tmp.second.value == ATSPI_NULL_PATH)
{
- v = nullptr;
+ path = nullptr;
return true;
}
return false;
}
- auto b = CurrentBridgePtr::current();
- if(b->GetBusName() != tmp.first)
+ auto currentBridge = CurrentBridgePtr::GetCurrentBridge();
+ if(currentBridge->GetBusName() != tmp.first)
{
return false;
}
- v = b->FindByPath(tmp.second.value.substr(strlen(ATSPI_PREFIX_PATH)));
- return v != nullptr;
+ path = currentBridge->FindByPath(tmp.second.value.substr(strlen(ATSPI_PREFIX_PATH)));
+ return path != nullptr;
}
};
template<>
-struct signature<Dali::Accessibility::Accessible*> : public signature_accessible_impl<Dali::Accessibility::Accessible>
+struct signature<Dali::Accessibility::Accessible*> : public SignatureAccessibleImpl<Dali::Accessibility::Accessible>
{
};
static constexpr auto sig_v = concat("(so)");
/**
- * @brief Marshals value v as marshalled type into message
+ * @brief Marshals value address as marshalled type into message
*/
- static void set(const DBusWrapper::MessageIterPtr& iter, const Dali::Accessibility::Address& v)
+ static void set(const DBusWrapper::MessageIterPtr& iter, const Dali::Accessibility::Address& address)
{
- if(v)
+ if(address)
{
- signature<subtype>::set(iter, {v.GetBus(), ObjectPath{std::string{ATSPI_PREFIX_PATH} + v.GetPath()}});
+ signature<subtype>::set(iter, {address.GetBus(), ObjectPath{std::string{ATSPI_PREFIX_PATH} + address.GetPath()}});
}
else
{
- signature<subtype>::set(iter, {v.GetBus(), ObjectPath{ATSPI_NULL_PATH}});
+ signature<subtype>::set(iter, {address.GetBus(), ObjectPath{ATSPI_NULL_PATH}});
}
}
/**
- * @brief Marshals value from marshalled type into variable v
+ * @brief Marshals value from marshalled type into variable address
*/
- static bool get(const DBusWrapper::MessageIterPtr& iter, Dali::Accessibility::Address& v)
+ static bool get(const DBusWrapper::MessageIterPtr& iter, Dali::Accessibility::Address& address)
{
subtype tmp;
if(!signature<subtype>::get(iter, tmp))
if(tmp.second.value == ATSPI_NULL_PATH)
{
- v = {};
+ address = {};
return true;
}
if(tmp.second.value.substr(0, strlen(ATSPI_PREFIX_PATH)) != ATSPI_PREFIX_PATH)
return false;
}
- v = {std::move(tmp.first), tmp.second.value.substr(strlen(ATSPI_PREFIX_PATH))};
+ address = {std::move(tmp.first), tmp.second.value.substr(strlen(ATSPI_PREFIX_PATH))};
return true;
}
};
static constexpr auto sig_v = signature<subtype>::sig_v;
/**
- * @brief Marshals value v as marshalled type into message
+ * @brief Marshals value state as marshalled type into message
*/
- static void set(const DBusWrapper::MessageIterPtr& iter, const Dali::Accessibility::States& v)
+ static void set(const DBusWrapper::MessageIterPtr& iter, const Dali::Accessibility::States& states)
{
- signature<subtype>::set(iter, v.GetRawData());
+ signature<subtype>::set(iter, states.GetRawData());
}
/**
- * @brief Marshals value from marshalled type into variable v
+ * @brief Marshals value from marshalled type into variable state
*/
- static bool get(const DBusWrapper::MessageIterPtr& iter, Dali::Accessibility::States& v)
+ static bool get(const DBusWrapper::MessageIterPtr& iter, Dali::Accessibility::States& state)
{
subtype tmp;
if(!signature<subtype>::get(iter, tmp))
{
return false;
}
- v = Dali::Accessibility::States{tmp};
+ state = Dali::Accessibility::States{tmp};
return true;
}
};
struct _Logger
{
- const char* file;
- int line;
- std::ostringstream tmp;
+ const char* mFile;
+ int mLine;
+ std::ostringstream mTmp;
- _Logger(const char* f, int l)
- : file(f),
- line(l)
+ _Logger(const char* file, int line)
+ : mFile(file),
+ mLine(line)
{
}
~_Logger()
{
- Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, "%s:%d: %s", file, line, tmp.str().c_str());
+ Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, "%s:%d: %s", mFile, mLine, mTmp.str().c_str());
}
template<typename T>
_Logger& operator<<(T&& t)
{
- tmp << std::forward<T>(t);
+ mTmp << std::forward<T>(t);
return *this;
}
};
struct _LoggerScope
{
- const char* file;
- int line;
+ const char* mFile;
+ int mLine;
- _LoggerScope(const char* f, int l)
- : file(f),
- line(l)
+ _LoggerScope(const char* file, int line)
+ : mFile(file),
+ mLine(line)
{
- Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, "%s:%d: +", file, line);
+ Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, "%s:%d: +", mFile, mLine);
}
~_LoggerScope()
{
- Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, "%s:%d: -", file, line);
+ Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, "%s:%d: -", mFile, mLine);
}
};
#define GET_NAVIGABLE_AT_POINT_MAX_RECURSION_DEPTH 10000
-namespace {
+namespace
+{
bool SortVertically(Component* lhs, Component* rhs)
{
return lines;
}
-} // anonymous namespace
-
-BridgeAccessible::BridgeAccessible()
-{
-}
-
-void BridgeAccessible::RegisterInterfaces()
-{
- DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceAccessible};
- AddGetPropertyToInterface(desc, "ChildCount", &BridgeAccessible::GetChildCount);
- AddGetPropertyToInterface(desc, "Name", &BridgeAccessible::GetName);
- AddGetPropertyToInterface(desc, "Description", &BridgeAccessible::GetDescription);
- AddGetPropertyToInterface(desc, "Parent", &BridgeAccessible::GetParent);
- AddFunctionToInterface(desc, "GetRole", &BridgeAccessible::GetRole);
- AddFunctionToInterface(desc, "GetRoleName", &BridgeAccessible::GetRoleName);
- AddFunctionToInterface(desc, "GetLocalizedRoleName", &BridgeAccessible::GetLocalizedRoleName);
- AddFunctionToInterface(desc, "GetState", &BridgeAccessible::GetStates);
- AddFunctionToInterface(desc, "GetAttributes", &BridgeAccessible::GetAttributes);
- AddFunctionToInterface(desc, "GetInterfaces", &BridgeAccessible::GetInterfaces);
- AddFunctionToInterface(desc, "GetChildAtIndex", &BridgeAccessible::GetChildAtIndex);
- AddFunctionToInterface(desc, "GetChildren", &BridgeAccessible::GetChildren);
- AddFunctionToInterface(desc, "GetIndexInParent", &BridgeAccessible::GetIndexInParent);
- AddFunctionToInterface(desc, "GetNavigableAtPoint", &BridgeAccessible::GetNavigableAtPoint);
- AddFunctionToInterface(desc, "GetNeighbor", &BridgeAccessible::GetNeighbor);
- AddFunctionToInterface(desc, "GetDefaultLabelInfo", &BridgeAccessible::GetDefaultLabelInfo);
- AddFunctionToInterface(desc, "DoGesture", &BridgeAccessible::DoGesture);
- AddFunctionToInterface(desc, "GetReadingMaterial", &BridgeAccessible::GetReadingMaterial);
- AddFunctionToInterface(desc, "GetRelationSet", &BridgeAccessible::GetRelationSet);
- dbusServer.addInterface("/", desc, true);
-}
-
static bool AcceptObjectCheckRelations(Component* obj)
{
- auto r = obj->GetRelationSet();
+ auto relations = obj->GetRelationSet();
- for(const auto& it : r)
+ for(const auto& it : relations)
+ {
if(it.relationType == RelationType::CONTROLLED_BY)
+ {
return false;
-
+ }
+ }
return true;
}
obj = obj->GetParent();
auto comp = dynamic_cast<Component*>(obj);
if(comp && comp->IsScrollable())
+ {
return comp;
+ }
}
return nullptr;
}
-static bool ObjectIsItem(Component* obj)
+static bool IsObjectItem(Component* obj)
{
if(!obj)
+ {
return false;
+ }
auto role = obj->GetRole();
return role == Role::LIST_ITEM || role == Role::MENU_ITEM;
}
-static bool ObjectIsCollapsed(Component* obj)
+static bool IsObjectCollapsed(Component* obj)
{
if(!obj)
+ {
return false;
+ }
const auto states = obj->GetStates();
return states[State::EXPANDABLE] && !states[State::EXPANDED];
}
-static bool ObjectIsZeroSize(Component* obj)
+static bool IsObjectZeroSize(Component* obj)
{
if(!obj)
+ {
return false;
+ }
auto extents = obj->GetExtents(CoordinateType::WINDOW);
return extents.height == 0 || extents.width == 0;
}
-static bool AcceptObject(Component* obj)
+static bool IsObjectAcceptable(Component* obj)
{
if(!obj)
+ {
return false;
+ }
+
const auto states = obj->GetStates();
if(!states[State::VISIBLE])
+ {
return false;
+ }
if(!AcceptObjectCheckRelations(obj))
+ {
return false;
+ }
if(!states[State::HIGHLIGHTABLE])
+ {
return false;
+ }
if(GetScrollableParent(obj) != nullptr)
{
if(parent)
{
- return !ObjectIsItem(obj) || !ObjectIsCollapsed(parent);
+ return !IsObjectItem(obj) || !IsObjectCollapsed(parent);
}
}
else
{
- if(ObjectIsZeroSize(obj))
+ if(IsObjectZeroSize(obj))
{
return false;
}
return true;
}
-static bool AcceptObject(Accessible* obj)
+static bool IsObjectAcceptable(Accessible* obj)
{
- auto c = dynamic_cast<Component*>(obj);
- return AcceptObject(c);
+ auto component = dynamic_cast<Component*>(obj);
+ return IsObjectAcceptable(component);
}
static int32_t GetItemCountOfList(Accessible* obj)
return itemCount;
}
-static std::string objDump(Component* obj)
+static std::string GetComponentInfo(Component* obj)
{
if(!obj)
+ {
return "nullptr";
- std::ostringstream o;
- auto e = obj->GetExtents(CoordinateType::SCREEN);
- o << "name: " << obj->GetName() << " extent: (" << e.x << ", "
- << e.y << "), [" << e.width << ", " << e.height << "]";
- return o.str();
+ }
+
+ std::ostringstream object;
+ auto extent = obj->GetExtents(CoordinateType::SCREEN);
+ object << "name: " << obj->GetName() << " extent: (" << extent.x << ", "
+ << extent.y << "), [" << extent.width << ", " << extent.height << "]";
+ return object.str();
+}
+
+static std::string MakeIndent(unsigned int maxRecursionDepth)
+{
+ return std::string(GET_NAVIGABLE_AT_POINT_MAX_RECURSION_DEPTH - maxRecursionDepth, ' ');
+}
+
+static bool IsDeputy(Accessible* obj)
+{
+ //TODO: add deputy
+ return false;
+}
+
+static Accessible* GetProxyInParent(Accessible* obj)
+{
+ if(!obj)
+ {
+ return nullptr;
+ }
+
+ auto children = obj->GetChildren();
+ for(auto& child : children)
+ {
+ if(child->IsProxy())
+ {
+ return child;
+ }
+ }
+ return nullptr;
+}
+
+static bool IsRoleAcceptableWhenNavigatingNextPrev(Accessible* obj)
+{
+ if(!obj)
+ {
+ return false;
+ }
+ auto role = obj->GetRole();
+ return role != Role::POPUP_MENU && role != Role::DIALOG;
+}
+
+static Accessible* FindNonDefunctChild(const std::vector<Accessible*>& children, unsigned int currentIndex, unsigned char forward)
+{
+ unsigned int childrenCount = children.size();
+ for(; currentIndex < childrenCount; forward ? ++currentIndex : --currentIndex)
+ {
+ Accessible* object = children[currentIndex];
+ if(object && !object->GetStates()[State::DEFUNCT])
+ {
+ return object;
+ }
+ }
+ return nullptr;
+}
+
+// The auxiliary method for Depth-First Search (DFS) algorithm to find non defunct child directionally
+static Accessible* FindNonDefunctChildWithDepthFirstSearch(Accessible* node, const std::vector<Accessible*>& children, unsigned char forward)
+{
+ if(!node)
+ {
+ return nullptr;
+ }
+
+ auto childrenCount = children.size();
+ if(childrenCount > 0)
+ {
+ const bool isShowing = GetScrollableParent(node) == nullptr ? node->GetStates()[State::SHOWING] : true;
+ if(isShowing)
+ {
+ return FindNonDefunctChild(children, forward ? 0 : childrenCount - 1, forward);
+ }
+ }
+ return nullptr;
+}
+
+static bool CheckChainEndWithAttribute(Accessible* obj, unsigned char forward)
+{
+ if(!obj)
+ {
+ return false;
+ }
+
+ auto attrs = obj->GetAttributes();
+ for(auto& attr : attrs)
+ {
+ if(attr.first == "relation_chain_end")
+ {
+ if((attr.second == "prev,end" && forward == 0) || (attr.second == "next,end" && forward == 1) || attr.second == "prev,next,end")
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+static Accessible* GetDeputyOfProxyInParent(Accessible* obj)
+{
+ return nullptr;
+}
+
+static std::vector<Component*> GetScrollableParents(Accessible *accessible)
+{
+ std::vector<Component*> scrollableParents;
+
+ while(accessible)
+ {
+ accessible = accessible->GetParent();
+ auto component = dynamic_cast<Component*>(accessible);
+ if(component && component->IsScrollable())
+ {
+ scrollableParents.push_back(component);
+ }
+ }
+ return scrollableParents;
+}
+
+static std::vector<Component*> GetNonDuplicatedScrollableParents(Accessible *child, Accessible *start)
+{
+ auto scrollableParentsOfChild = GetScrollableParents(child);
+ auto scrollableParentsOfStart = GetScrollableParents(start);
+
+ // find the first different scrollable parent by comparing from top to bottom.
+ // since it can not be the same after that, there is no need to compare.
+ while(!scrollableParentsOfChild.empty() && !scrollableParentsOfStart.empty() && scrollableParentsOfChild.back() == scrollableParentsOfStart.back())
+ {
+ scrollableParentsOfChild.pop_back();
+ scrollableParentsOfStart.pop_back();
+ }
+
+ return scrollableParentsOfChild;
+}
+
+} // anonymous namespace
+
+
+BridgeAccessible::BridgeAccessible()
+{
}
-Component* BridgeAccessible::GetObjectInRelation(Accessible* obj, RelationType ralationType)
+void BridgeAccessible::RegisterInterfaces()
+{
+ DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceAccessible};
+ AddGetPropertyToInterface(desc, "ChildCount", &BridgeAccessible::GetChildCount);
+ AddGetPropertyToInterface(desc, "Name", &BridgeAccessible::GetName);
+ AddGetPropertyToInterface(desc, "Description", &BridgeAccessible::GetDescription);
+ AddGetPropertyToInterface(desc, "Parent", &BridgeAccessible::GetParent);
+ AddFunctionToInterface(desc, "GetRole", &BridgeAccessible::GetRole);
+ AddFunctionToInterface(desc, "GetRoleName", &BridgeAccessible::GetRoleName);
+ AddFunctionToInterface(desc, "GetLocalizedRoleName", &BridgeAccessible::GetLocalizedRoleName);
+ AddFunctionToInterface(desc, "GetState", &BridgeAccessible::GetStates);
+ AddFunctionToInterface(desc, "GetAttributes", &BridgeAccessible::GetAttributes);
+ AddFunctionToInterface(desc, "GetInterfaces", &BridgeAccessible::GetInterfaces);
+ AddFunctionToInterface(desc, "GetChildAtIndex", &BridgeAccessible::GetChildAtIndex);
+ AddFunctionToInterface(desc, "GetChildren", &BridgeAccessible::GetChildren);
+ AddFunctionToInterface(desc, "GetIndexInParent", &BridgeAccessible::GetIndexInParent);
+ AddFunctionToInterface(desc, "GetNavigableAtPoint", &BridgeAccessible::GetNavigableAtPoint);
+ AddFunctionToInterface(desc, "GetNeighbor", &BridgeAccessible::GetNeighbor);
+ AddFunctionToInterface(desc, "GetDefaultLabelInfo", &BridgeAccessible::GetDefaultLabelInfo);
+ AddFunctionToInterface(desc, "DoGesture", &BridgeAccessible::DoGesture);
+ AddFunctionToInterface(desc, "GetReadingMaterial", &BridgeAccessible::GetReadingMaterial);
+ AddFunctionToInterface(desc, "GetRelationSet", &BridgeAccessible::GetRelationSet);
+ mDbusServer.addInterface("/", desc, true);
+}
+
+Component* BridgeAccessible::GetObjectInRelation(Accessible* obj, RelationType relationType)
{
if(!obj)
+ {
return nullptr;
+ }
+
for(auto& relation : obj->GetRelationSet())
{
- if(relation.relationType == ralationType)
+ if(relation.relationType == relationType)
{
for(auto& address : relation.targets)
{
auto component = dynamic_cast<Component*>(Find(address));
if(component)
+ {
return component;
+ }
}
}
}
return nullptr;
}
-static std::string makeIndent(unsigned int maxRecursionDepth)
-{
- return std::string(GET_NAVIGABLE_AT_POINT_MAX_RECURSION_DEPTH - maxRecursionDepth, ' ');
-}
-
-Component* BridgeAccessible::CalculateNavigableAccessibleAtPoint(Accessible* root, Point p, CoordinateType type, unsigned int maxRecursionDepth)
+Component* BridgeAccessible::CalculateNavigableAccessibleAtPoint(Accessible* root, Point point, CoordinateType type, unsigned int maxRecursionDepth)
{
if(!root || maxRecursionDepth == 0)
{
return nullptr;
}
- auto root_component = dynamic_cast<Component*>(root);
- LOG() << "CalculateNavigableAccessibleAtPoint: checking: " << makeIndent(maxRecursionDepth) << objDump(root_component);
+ auto rootComponent = dynamic_cast<Component*>(root);
+ LOG() << "CalculateNavigableAccessibleAtPoint: checking: " << MakeIndent(maxRecursionDepth) << GetComponentInfo(rootComponent);
- if(root_component && !root_component->IsAccessibleContainedAtPoint(p, type))
+ if(rootComponent && !rootComponent->IsAccessibleContainingPoint(point, type))
{
return nullptr;
}
for(auto childIt = children.rbegin(); childIt != children.rend(); childIt++)
{
//check recursively all children first
- auto result = CalculateNavigableAccessibleAtPoint(*childIt, p, type, maxRecursionDepth - 1);
+ auto result = CalculateNavigableAccessibleAtPoint(*childIt, point, type, maxRecursionDepth - 1);
if(result)
{
return result;
}
}
- if(root_component)
+ if(rootComponent)
{
//Found a candidate, all its children are already checked
- auto controledBy = GetObjectInRelation(root_component, RelationType::CONTROLLED_BY);
+ auto controledBy = GetObjectInRelation(rootComponent, RelationType::CONTROLLED_BY);
if(!controledBy)
{
- controledBy = root_component;
+ controledBy = rootComponent;
}
- if(controledBy->IsProxy() || AcceptObject(controledBy))
+ if(controledBy->IsProxy() || IsObjectAcceptable(controledBy))
{
- LOG() << "CalculateNavigableAccessibleAtPoint: found: " << makeIndent(maxRecursionDepth) << objDump(root_component);
+ LOG() << "CalculateNavigableAccessibleAtPoint: found: " << MakeIndent(maxRecursionDepth) << GetComponentInfo(rootComponent);
return controledBy;
}
}
void BridgeAccessible::SuppressScreenReader(bool suppress)
{
- suppressScreenReader = suppress;
+ mIsScreenReaderSuppressed = suppress;
}
-DBus::ValueOrError<bool> BridgeAccessible::DoGesture(Dali::Accessibility::Gesture type, int32_t xBeg, int32_t yBeg, int32_t xEnd, int32_t yEnd, Dali::Accessibility::GestureState state, uint32_t eventTime)
+DBus::ValueOrError<bool> 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)
{
- return FindSelf()->DoGesture(Dali::Accessibility::GestureInfo{type, xBeg, xEnd, yBeg, yEnd, state, eventTime});
+ // Please be aware of sending GestureInfo point in the different order with parameters
+ return FindSelf()->DoGesture(Dali::Accessibility::GestureInfo{type, startPositionX, endPositionX, startPositionY, endPositionY, state, eventTime});
}
DBus::ValueOrError<Accessible*, uint8_t, Accessible*> BridgeAccessible::GetNavigableAtPoint(int32_t x, int32_t y, uint32_t coordinateType)
return {component, recurse, deputy};
}
-static bool CheckChainEndWithAttribute(Accessible* obj, unsigned char forward)
-{
- if(!obj)
- return false;
- auto attrs = obj->GetAttributes();
- for(auto& attr : attrs)
- {
- if(attr.first == "relation_chain_end")
- {
- if((attr.second == "prev,end" && forward == 0) || (attr.second == "next,end" && forward == 1) || attr.second == "prev,next,end")
- {
- return true;
- }
- }
- }
- return false;
-}
-
-static Accessible* DeputyOfProxyInParentGet(Accessible* obj)
-{
- return nullptr;
-}
-
Accessible* BridgeAccessible::GetCurrentlyHighlighted()
{
//TODO: add currently highlighted object
return nullptr;
}
-std::vector<Accessible*> BridgeAccessible::ValidChildrenGet(const std::vector<Accessible*>& children, Accessible* start, Accessible* root)
+std::vector<Accessible*> BridgeAccessible::GetValidChildren(const std::vector<Accessible*>& children, Accessible* start)
{
+ if(children.empty())
+ {
+ return children;
+ }
+
std::vector<Component*> vec;
std::vector<Accessible*> ret;
+ Dali::Rect<> scrollableParentExtents;
+ auto nonDuplicatedScrollableParents = GetNonDuplicatedScrollableParents(children.front(), start);
+ if (!nonDuplicatedScrollableParents.empty())
+ {
+ scrollableParentExtents = nonDuplicatedScrollableParents.front()->GetExtents(CoordinateType::WINDOW);
+ }
+
for(auto child : children)
{
- if(auto* component = dynamic_cast<Component*>(child); component)
+ auto* component = dynamic_cast<Component*>(child);
+ if(component)
{
- vec.push_back(component);
+ if(nonDuplicatedScrollableParents.empty() || scrollableParentExtents.Intersects(component->GetExtents(CoordinateType::WINDOW)))
+ {
+ vec.push_back(component);
+ }
}
}
return ret;
}
-static bool DeputyIs(Accessible* obj)
-{
- //TODO: add deputy
- return false;
-}
-
-static Accessible* ProxyInParentGet(Accessible* obj)
-{
- if(!obj)
- return nullptr;
- auto children = obj->GetChildren();
- for(auto& child : children)
- {
- if(child->IsProxy())
- return child;
- }
- return nullptr;
-}
-
-static bool ObjectRoleIsAcceptableWhenNavigatingNextPrev(Accessible* obj)
-{
- if(!obj)
- return false;
- auto role = obj->GetRole();
- return role != Role::POPUP_MENU && role != Role::DIALOG;
-}
template<class T>
struct CycleDetection
{
CycleDetection(const T value)
- : key(value),
- currentSearchSize(1),
- counter(1)
+ : mKey(value),
+ mCurrentSearchSize(1),
+ mCounter(1)
{
}
- bool check(const T value)
+
+ bool Check(const T value)
{
- if(key == value)
+ if(mKey == value)
+ {
return true;
- if(--counter == 0)
+ }
+
+ if(--mCounter == 0)
{
- currentSearchSize <<= 1;
- if(currentSearchSize == 0)
+ mCurrentSearchSize <<= 1;
+ if(mCurrentSearchSize == 0)
+ {
return true; // UNDEFINED BEHAVIOR
- counter = currentSearchSize;
- key = value;
+ }
+ mCounter = mCurrentSearchSize;
+ mKey = value;
}
return false;
}
- T key;
- unsigned int currentSearchSize;
- unsigned int counter;
+
+ T mKey;
+ unsigned int mCurrentSearchSize;
+ unsigned int mCounter;
};
-static Accessible* FindNonDefunctChild(const std::vector<Accessible*>& children, unsigned int currentIndex, unsigned char forward)
+Accessible* BridgeAccessible::GetNextNonDefunctSibling(Accessible* obj, Accessible* start, unsigned char forward)
{
- unsigned int childrenCount = children.size();
- for(; currentIndex < childrenCount; forward ? ++currentIndex : --currentIndex)
+ if(!obj)
{
- Accessible* n = children[currentIndex];
- if(n && !n->GetStates()[State::DEFUNCT])
- return n;
- }
- return nullptr;
-}
-
-static Accessible* DirectionalDepthFirstSearchTryNonDefunctChild(Accessible* node, const std::vector<Accessible*>& children, unsigned char forward)
-{
- if(!node)
return nullptr;
- auto childrenCount = children.size();
- if(childrenCount > 0)
- {
- const bool isShowing = GetScrollableParent(node) == nullptr ? node->GetStates()[State::SHOWING] : true;
- if(isShowing)
- {
- return FindNonDefunctChild(children, forward ? 0 : childrenCount - 1, forward);
- }
}
- return nullptr;
-}
-Accessible* BridgeAccessible::GetNextNonDefunctSibling(Accessible* obj, Accessible* start, Accessible* root, unsigned char forward)
-{
- if(!obj)
- return nullptr;
auto parent = obj->GetParent();
if(!parent)
+ {
return nullptr;
+ }
- auto children = ValidChildrenGet(parent->GetChildren(), start, root);
+ auto children = GetValidChildren(parent->GetChildren(), start);
- unsigned int children_count = children.size();
- if(children_count == 0)
+ unsigned int childrenCount = children.size();
+ if(childrenCount == 0)
{
return nullptr;
}
+
unsigned int current = 0;
- for(; current < children_count && children[current] != obj; ++current)
- ;
- if(current >= children_count)
+ for(; current < childrenCount && children[current] != obj; ++current)
+ {
+ }
+
+ if(current >= childrenCount)
{
return nullptr;
}
+
forward ? ++current : --current;
auto ret = FindNonDefunctChild(children, current, forward);
return ret;
}
-Accessible* BridgeAccessible::DirectionalDepthFirstSearchTryNonDefunctSibling(bool& all_children_visited, Accessible* node, Accessible* start, Accessible* root, unsigned char forward)
+Accessible* BridgeAccessible::FindNonDefunctSibling(bool& areAllChildrenVisited, Accessible* node, Accessible* start, Accessible* root, unsigned char forward)
{
while(true)
{
- Accessible* sibling = GetNextNonDefunctSibling(node, start, root, forward);
+ Accessible* sibling = GetNextNonDefunctSibling(node, start, forward);
if(sibling)
{
- node = sibling;
- all_children_visited = false;
+ node = sibling;
+ areAllChildrenVisited = false; // Note that this is passed by non-const reference, so it is the caller that can determine whether this search exhausted all children.
break;
}
// walk up...
node = node->GetParent();
if(node == nullptr || node == root)
+ {
return nullptr;
+ }
// in backward traversing stop the walk up on parent
if(!forward)
+ {
break;
+ }
}
+
return node;
}
-Accessible* BridgeAccessible::CalculateNeighbor(Accessible* root, Accessible* start, unsigned char forward, BridgeAccessible::GetNeighborSearchMode search_mode)
+Accessible* BridgeAccessible::CalculateNeighbor(Accessible* root, Accessible* start, unsigned char forward, BridgeAccessible::NeighborSearchMode searchMode)
{
if(start && CheckChainEndWithAttribute(start, forward))
+ {
return start;
+ }
if(root && root->GetStates()[State::DEFUNCT])
+ {
return NULL;
+ }
if(start && start->GetStates()[State::DEFUNCT])
{
start = NULL;
forward = 1;
}
- if(search_mode == BridgeAccessible::GetNeighborSearchMode::recurseToOutside)
+ if(searchMode == BridgeAccessible::NeighborSearchMode::RECURSE_TO_OUTSIDE)
{
// This only works if we navigate backward, and it is not possible to
// find in embedded process. In this case the deputy should be used */
- return DeputyOfProxyInParentGet(start);
+ return GetDeputyOfProxyInParent(start);
}
Accessible* node = start ? start : root;
if(!node)
+ {
return nullptr;
+ }
// initialization of all-children-visited flag for start node - we assume
// that when we begin at start node and we navigate backward, then all children
// are visited, so navigation will ignore start's children and go to
// previous sibling available.
// Regarding condtion (start != root):
- // The last object can be found only if all_children_visited is false.
+ // The last object can be found only if areAllChildrenVisited is false.
// The start is same with root, when looking for the last object.
- bool all_children_visited = (start != root) && (search_mode != BridgeAccessible::GetNeighborSearchMode::recurseFromRoot && !forward);
+ bool areAllChildrenVisited = (start != root) && (searchMode != BridgeAccessible::NeighborSearchMode::RECURSE_FROM_ROOT && !forward);
+
// true, if starting element should be ignored. this is only used in rare case of
// recursive search failing to find an object.
// consider tree, where element A on bus BUS_A has child B on bus BUS_B. when going "next" from
// element A algorithm has to descend into BUS_B and search element B and its children. this is done
// by returning to our caller object B with special flag set (meaning - continue the search from B on bus BUS_B).
// if next object will be found there (on BUS_B), then search ends. but if not, then our caller will find it out
- // and will call us again with object A and flag search_mode set to NEIGHBOR_SEARCH_MODE_CONTINUE_AFTER_FAILED_RECURSING.
+ // and will call us again with object A and flag searchMode set to NEIGHBOR_SEARCH_MODE_CONTINUE_AFTER_FAILED_RECURSING.
// this flag means, that object A was already checked previously and we should skip it and its children.
- bool force_next = (search_mode == BridgeAccessible::GetNeighborSearchMode::continueAfterFailedRecursion);
+ bool forceNext = (searchMode == BridgeAccessible::NeighborSearchMode::CONTINUE_AFTER_FAILED_RECURSION);
CycleDetection<Accessible*> cycleDetection(node);
while(node)
{
if(node->GetStates()[State::DEFUNCT])
+ {
return nullptr;
+ }
// always accept proxy object from different world
- if(!force_next && node->IsProxy())
+ if(!forceNext && node->IsProxy())
+ {
return node;
+ }
auto children = node->GetChildren();
- children = ValidChildrenGet(children, start, root);
+ children = GetValidChildren(children, start);
// do accept:
// 1. not start node
// 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 all_children_visited_or_moving_forward = (children.size() == 0 || forward || all_children_visited);
- if(!force_next && node != start && all_children_visited_or_moving_forward && AcceptObject(node))
+ bool areAllChildrenVisitedOrMovingForward= (children.size() == 0 || forward || areAllChildrenVisited);
+
+ if(!forceNext && node != start && areAllChildrenVisitedOrMovingForward && IsObjectAcceptable(node))
{
- if(start == NULL || ObjectRoleIsAcceptableWhenNavigatingNextPrev(node))
+ if(start == NULL || IsRoleAcceptableWhenNavigatingNextPrev(node))
+ {
return node;
+ }
}
- Accessible* next_related_in_direction = !force_next ? GetObjectInRelation(node, forward ? RelationType::FLOWS_TO : RelationType::FLOWS_FROM) : nullptr;
- // force_next means that the search_mode is NEIGHBOR_SEARCH_MODE_CONTINUE_AFTER_FAILED_RECURSING
+ Accessible* nextRelatedInDirection = !forceNext ? GetObjectInRelation(node, forward ? RelationType::FLOWS_TO : RelationType::FLOWS_FROM) : nullptr;
+ // forceNext means that the searchMode is NEIGHBOR_SEARCH_MODE_CONTINUE_AFTER_FAILED_RECURSING
// in this case the node is elm_layout which is parent of proxy object.
// There is an access object working for the proxy object, and the access
// object could have relation information. This relation information should
// be checked first before using the elm_layout as a node.
- if(force_next && forward)
+ if(forceNext && forward)
{
- auto deputy = DeputyOfProxyInParentGet(node);
- next_related_in_direction =
- GetObjectInRelation(deputy, RelationType::FLOWS_TO);
+ auto deputy = GetDeputyOfProxyInParent(node);
+ nextRelatedInDirection = GetObjectInRelation(deputy, RelationType::FLOWS_TO);
}
- if(next_related_in_direction && start && start->GetStates()[State::DEFUNCT])
+ if(nextRelatedInDirection && start && start->GetStates()[State::DEFUNCT])
{
- next_related_in_direction = NULL;
+ nextRelatedInDirection = NULL;
}
- unsigned char want_cycle_detection = 0;
- if(next_related_in_direction)
+ unsigned char wantCycleDetection = 0;
+ if(nextRelatedInDirection)
{
- // Check next_related_in_direction is deputy object
+ // Check whether nextRelatedInDirection is deputy object or not
Accessible* parent;
if(!forward)
{
// If the prev object is deputy, then go to inside of its proxy first
- if(DeputyIs(next_related_in_direction))
+ if(IsDeputy(nextRelatedInDirection))
{
- parent = next_related_in_direction->GetParent();
- next_related_in_direction = ProxyInParentGet(parent);
+ parent = nextRelatedInDirection->GetParent();
+ nextRelatedInDirection = GetProxyInParent(parent);
}
}
else
{
// If current object is deputy, and it has relation next object,
// then do not use the relation next object, and use proxy first
- if(DeputyIs(node))
+ if(IsDeputy(node))
{
- parent = node->GetParent();
- next_related_in_direction = ProxyInParentGet(parent);
+ parent = node->GetParent();
+ nextRelatedInDirection = GetProxyInParent(parent);
}
}
- node = next_related_in_direction;
- want_cycle_detection = 1;
+ node = nextRelatedInDirection;
+ wantCycleDetection = 1;
}
else
{
- auto child = !force_next && !all_children_visited ? DirectionalDepthFirstSearchTryNonDefunctChild(node, children, forward) : nullptr;
+ auto child = !forceNext && !areAllChildrenVisited ? FindNonDefunctChildWithDepthFirstSearch(node, children, forward) : nullptr;
if(child)
{
- want_cycle_detection = 1;
+ wantCycleDetection = 1;
}
else
{
- if(!force_next && node == root)
+ if(!forceNext && node == root)
+ {
return NULL;
- all_children_visited = true;
- child = DirectionalDepthFirstSearchTryNonDefunctSibling(all_children_visited, node, start, root, forward);
+ }
+ areAllChildrenVisited = true;
+ child = FindNonDefunctSibling(areAllChildrenVisited, node, start, root, forward);
}
node = child;
}
- force_next = 0;
- if(want_cycle_detection && cycleDetection.check(node))
+
+ forceNext = 0;
+ if(wantCycleDetection && cycleDetection.Check(node))
{
return NULL;
}
return NULL;
}
-DBus::ValueOrError<Accessible*, uint8_t> BridgeAccessible::GetNeighbor(std::string rootPath, int32_t direction, int32_t search_mode)
+DBus::ValueOrError<Accessible*, uint8_t> BridgeAccessible::GetNeighbor(std::string rootPath, int32_t direction, int32_t searchMode)
{
auto start = FindSelf();
rootPath = StripPrefix(rootPath);
auto root = !rootPath.empty() ? Find(rootPath) : nullptr;
- auto accessible = CalculateNeighbor(root, start, direction == 1, static_cast<GetNeighborSearchMode>(search_mode));
+ auto accessible = CalculateNeighbor(root, start, direction == 1, static_cast<NeighborSearchMode>(searchMode));
unsigned char recurse = 0;
if(accessible)
{
// only element set as application root might return nullptr from GetParent
// if you want more, then you need to change setApplicationRoot to
// add/remove ApplicationRoot and make roots a vector.
- auto p = FindSelf()->GetParent();
+ auto parent = FindSelf()->GetParent();
- return p;
+ return parent;
}
+
DBus::ValueOrError<std::vector<Accessible*>> BridgeAccessible::GetChildren()
{
return FindSelf()->GetChildren();
}
+
std::string BridgeAccessible::GetDescription()
{
return FindSelf()->GetDescription();
}
+
DBus::ValueOrError<uint32_t> BridgeAccessible::GetRole()
{
return static_cast<unsigned int>(FindSelf()->GetRole());
}
+
DBus::ValueOrError<std::string> BridgeAccessible::GetRoleName()
{
return FindSelf()->GetRoleName();
}
+
DBus::ValueOrError<std::string> BridgeAccessible::GetLocalizedRoleName()
{
return FindSelf()->GetLocalizedRoleName();
}
+
DBus::ValueOrError<int32_t> BridgeAccessible::GetIndexInParent()
{
return FindSelf()->GetIndexInParent();
}
+
DBus::ValueOrError<std::array<uint32_t, 2>> BridgeAccessible::GetStates()
{
return FindSelf()->GetStates().GetRawData();
}
+
DBus::ValueOrError<std::unordered_map<std::string, std::string>> BridgeAccessible::GetAttributes()
{
std::unordered_map<std::string, std::string> attributes = FindSelf()->GetAttributes();
- if(suppressScreenReader)
+
+ if(mIsScreenReaderSuppressed)
{
attributes.insert({"suppress-screen-reader", "true"});
}
return attributes;
}
+
DBus::ValueOrError<std::vector<std::string>> BridgeAccessible::GetInterfaces()
{
return FindSelf()->GetInterfaces();
}
+
int BridgeAccessible::GetChildCount()
{
return FindSelf()->GetChildCount();
}
+
DBus::ValueOrError<Accessible*> BridgeAccessible::GetChildAtIndex(int index)
{
if(index < 0)
+ {
throw std::domain_error{"negative index (" + std::to_string(index) + ")"};
+ }
return FindSelf()->GetChildAtIndex(static_cast<size_t>(index));
}
DBus::ValueOrError<Accessible*, uint32_t, std::unordered_map<std::string, std::string>> BridgeAccessible::GetDefaultLabelInfo()
{
auto defaultLabel = FindSelf()->GetDefaultLabel();
+ // By default, the text is taken from navigation context root's accessibility properties name and description.
return {defaultLabel, static_cast<uint32_t>(defaultLabel->GetRole()), defaultLabel->GetAttributes()};
}
std::vector<BridgeAccessible::Relation> ret;
for(auto& it : relations)
+ {
ret.emplace_back(Relation{static_cast<uint32_t>(it.relationType), it.targets});
+ }
return ret;
}
// INTERNAL INCLUDES
#include "bridge-base.h"
+/**
+ * @brief The BridgeAccessible class is to correspond with Dali::Accessibility::Accessible.
+ */
class BridgeAccessible : public virtual BridgeBase
{
protected:
+
+ /**
+ * @brief Constructor.
+ */
BridgeAccessible();
+ /**
+ * @brief Registers Accessible functions to dbus interfaces.
+ */
void RegisterInterfaces();
- bool suppressScreenReader = false;
public:
- enum class GetNeighborSearchMode
+ /**
+ * @brief Enumeration for NeighborSearchMode.
+ */
+ enum class NeighborSearchMode
{
- normal = 0,
- recurseFromRoot = 1,
- continueAfterFailedRecursion = 2,
- recurseToOutside = 3,
+ 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
};
- int GetChildCount();
- DBus::ValueOrError<Dali::Accessibility::Accessible*> GetChildAtIndex(int index);
- Dali::Accessibility::Accessible* GetParent();
- DBus::ValueOrError<std::vector<Dali::Accessibility::Accessible*>> GetChildren();
- std::string GetName();
- std::string GetDescription();
- DBus::ValueOrError<uint32_t> GetRole();
- DBus::ValueOrError<std::string> GetRoleName();
- DBus::ValueOrError<std::string> GetLocalizedRoleName();
- DBus::ValueOrError<int32_t> GetIndexInParent();
- DBus::ValueOrError<std::array<uint32_t, 2>> GetStates();
- DBus::ValueOrError<std::unordered_map<std::string, std::string>> GetAttributes();
- DBus::ValueOrError<std::vector<std::string>> GetInterfaces();
- DBus::ValueOrError<Dali::Accessibility::Accessible*, uint8_t, Dali::Accessibility::Accessible*> GetNavigableAtPoint(int32_t x, int32_t y, uint32_t coordinateType);
- DBus::ValueOrError<Dali::Accessibility::Accessible*, uint8_t> GetNeighbor(std::string root_path, int32_t direction, int32_t search_mode);
- DBus::ValueOrError<Dali::Accessibility::Accessible*, uint32_t, std::unordered_map<std::string, std::string>> GetDefaultLabelInfo();
+
using ReadingMaterialType = DBus::ValueOrError<
std::unordered_map<std::string, std::string>, // attributes
std::string, // name
Dali::Accessibility::Accessible* // describedByObject
>;
+ using Relation = std::tuple<uint32_t, std::vector<Dali::Accessibility::Address>>;
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetChildCount()
+ */
+ int GetChildCount();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetChildAtIndex()
+ */
+ DBus::ValueOrError<Dali::Accessibility::Accessible*> GetChildAtIndex(int index);
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetParent()
+ */
+ Dali::Accessibility::Accessible* GetParent();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetChildren()
+ */
+ DBus::ValueOrError<std::vector<Dali::Accessibility::Accessible*>> GetChildren();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetName()
+ */
+ std::string GetName();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetDescription()
+ */
+ std::string GetDescription();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetRole()
+ */
+ DBus::ValueOrError<uint32_t> GetRole();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetRoleName()
+ */
+ DBus::ValueOrError<std::string> GetRoleName();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetLocalizedRoleName()
+ */
+ DBus::ValueOrError<std::string> GetLocalizedRoleName();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetIndexInParent()
+ */
+ DBus::ValueOrError<int32_t> GetIndexInParent();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetStates()
+ */
+ DBus::ValueOrError<std::array<uint32_t, 2>> GetStates();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetAttributes()
+ */
+ DBus::ValueOrError<std::unordered_map<std::string, std::string>> GetAttributes();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetInterfaces()
+ */
+ DBus::ValueOrError<std::vector<std::string>> GetInterfaces();
+
+ /**
+ * @brief Gets Accessible object on which surface lies the point with given coordinates.
+ *
+ * @param[in] x X coordinate of a point
+ * @param[in] y Y coordinate of a point
+ * @param[in] coordinateType The coordinate type
+ * @return The array containing the Accessible object, recursive status, and deputy Accessible
+ */
+ DBus::ValueOrError<Dali::Accessibility::Accessible*, uint8_t, Dali::Accessibility::Accessible*> GetNavigableAtPoint(int32_t x, int32_t y, uint32_t coordinateType);
+
+ /**
+ * @brief Gets Accessible object that, dependently to the given direction parameter,
+ * stands in navigation order immediately before/after the Accessible object being a target of this dbus call.
+ *
+ * The 'direction' parameter denotes if the neighbor object search is done forward or backward in UI elements navigation order.
+ * @param[in] rootPath The path of root Accessible object
+ * @param[in] direction 1 is forward, 0 is backward
+ * @param[in] searchMode BridgeAccessible::NeighborSearchMode enum
+ * @return The array containing the neighbor Accessible object and recursive status
+ */
+ DBus::ValueOrError<Dali::Accessibility::Accessible*, uint8_t> GetNeighbor(std::string rootPath, int32_t direction, int32_t searchMode);
+
+ /**
+ * @brief Gets the default label information.
+ *
+ * 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
+ * @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".
+ */
+ DBus::ValueOrError<Dali::Accessibility::Accessible*, uint32_t, std::unordered_map<std::string, std::string>> GetDefaultLabelInfo();
+
+ /**
+ * @brief Gets Reading material information of the self object.
+ * @return Reading material information
+ */
ReadingMaterialType GetReadingMaterial();
- void SuppressScreenReader(bool) override;
- DBus::ValueOrError<bool> DoGesture(Dali::Accessibility::Gesture type, int32_t xBeg, int32_t yBeg, int32_t xEnd, int32_t yEnd, Dali::Accessibility::GestureState state, uint32_t eventTime);
+ /**
+ * @copydoc Dali::Accessibility::Bridge::SuppressScreenReader()
+ */
+ void SuppressScreenReader(bool) override;
- using Relation = std::tuple<uint32_t, std::vector<Dali::Accessibility::Address>>;
+ /**
+ * @copydoc Dali::Accessibility::Accessible::DoGesture()
+ */
+ DBus::ValueOrError<bool> DoGesture(Dali::Accessibility::Gesture type, int32_t startPositionX, int32_t startPositionY, int32_t endPositionX, int32_t endPositionY, Dali::Accessibility::GestureState state, uint32_t eventTime);
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetRelationSet()
+ */
DBus::ValueOrError<std::vector<Relation>> GetRelationSet();
private:
- Dali::Accessibility::Accessible* CalculateNeighbor(Dali::Accessibility::Accessible* root, Dali::Accessibility::Accessible* start, unsigned char forward, GetNeighborSearchMode search_mode);
- std::vector<Dali::Accessibility::Accessible*> ValidChildrenGet(const std::vector<Dali::Accessibility::Accessible*>& children, Dali::Accessibility::Accessible* start, Dali::Accessibility::Accessible* root);
- Dali::Accessibility::Accessible* GetCurrentlyHighlighted();
- Dali::Accessibility::Accessible* DirectionalDepthFirstSearchTryNonDefunctSibling(bool& all_children_visited, Dali::Accessibility::Accessible* node, Dali::Accessibility::Accessible* start, Dali::Accessibility::Accessible* root, unsigned char forward);
- Dali::Accessibility::Accessible* GetNextNonDefunctSibling(Dali::Accessibility::Accessible* obj, Dali::Accessibility::Accessible* start, Dali::Accessibility::Accessible* root, unsigned char forward);
- Dali::Accessibility::Component* CalculateNavigableAccessibleAtPoint(Dali::Accessibility::Accessible* root, Dali::Accessibility::Point p, Dali::Accessibility::CoordinateType type, unsigned int maxRecursionDepth);
- Dali::Accessibility::Component* GetObjectInRelation(Dali::Accessibility::Accessible* obj, Dali::Accessibility::RelationType ralationType);
+ /**
+ * @brief Calculates Neighbor candidate object in root node.
+ *
+ * The DFS algorithm in the method is implemented in iterative way.
+ * @param root The accessible root object
+ * @param start The start node
+ * @param forward If forward is 1, then it navigates forward, otherwise backward.
+ * @param searchMode BridgeAccessible::NeighborSearchMode enum
+ * @return The neighbor Accessible object
+ */
+ Dali::Accessibility::Accessible* CalculateNeighbor(Dali::Accessibility::Accessible* root, Dali::Accessibility::Accessible* start, unsigned char forward, NeighborSearchMode searchMode);
+
+ /**
+ * @brief Gets valid children accessible.
+ *
+ * @param[in] children Children accessible objects
+ * @param start The start node // NEED TO UPDATE! It seems not to be used anywhere in this function.
+ * @return The valid children
+ */
+ std::vector<Dali::Accessibility::Accessible*> GetValidChildren(const std::vector<Dali::Accessibility::Accessible*>& children, Dali::Accessibility::Accessible* start);
+
+ /**
+ * @brief Gets the currently highlighted accessible.
+ *
+ * @return The highlighted accessible
+ * @remarks This is an experimental feature and might not be supported now.
+ */
+ Dali::Accessibility::Accessible* GetCurrentlyHighlighted();
+
+ /**
+ * @brief Finds the non defunct sibling of the node.
+ *
+ * @param[out] areAllChildrenVisited True if all children are visited
+ * @param[in] node The accessible object to find its non defunct sibling
+ * @param[in] start The start node
+ * @param[in] root The root node
+ * @param[in] forward If forward is 1, then it navigates forward, otherwise backward.
+ * @return The non defunct sibling accessible
+ *
+ * @note This function performs a Depth-First Search (DFS) on all children within the node.
+ */
+ Dali::Accessibility::Accessible* FindNonDefunctSibling(bool& areAllChildrenVisited, Dali::Accessibility::Accessible* node, Dali::Accessibility::Accessible* start, Dali::Accessibility::Accessible* root, unsigned char forward);
+
+ /**
+ * @brief Gets the next non defunct sibling.
+ *
+ * @param obj The accessible object to find its non defunct sibling
+ * @param start The start node
+ * @param forward If forward is 1, then it navigates forward, otherwise backward.
+ * @return The non defunct sibling accessible
+ */
+ Dali::Accessibility::Accessible* GetNextNonDefunctSibling(Dali::Accessibility::Accessible* obj, Dali::Accessibility::Accessible* start, unsigned char forward);
+
+ /**
+ * @brief Gets Component object in relation.
+ * @param obj The accessible object to find component in its address
+ * @param relationType Accessibility::RelationType enum
+ * @return The Component object
+ */
+ Dali::Accessibility::Component* GetObjectInRelation(Dali::Accessibility::Accessible* obj, Dali::Accessibility::RelationType relationType);
+
+ /**
+ * @brief Calculates and gets Component object that can be navigable at given coordinates.
+ *
+ * This method calculates which Component should be addressed if user hits certain point in a screen.
+ * @param root The root node
+ * @param point The coordinate of a point
+ * @param type This type says if the coordinates of a point refer to the device screen or current window.
+ * @param maxRecursionDepth The maximum recursion depth count
+ * @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
AddFunctionToInterface(desc, "GetKeyBinding", &BridgeAction::GetActionKeyBinding);
AddFunctionToInterface(desc, "DoAction", &BridgeAction::DoAction);
AddFunctionToInterface(desc, "DoActionName", &BridgeAction::DoActionName);
- dbusServer.addInterface("/", desc, true);
+ mDbusServer.addInterface("/", desc, true);
}
Action* BridgeAction::FindSelf() const
{
- auto s = BridgeBase::FindSelf();
- assert(s);
- auto s2 = dynamic_cast<Action*>(s);
- if(!s2)
- throw std::domain_error{"object " + s->GetAddress().ToString() + " doesn't have Action interface"};
- return s2;
+ auto self = BridgeBase::FindSelf();
+ assert(self);
+ auto actionInterface = dynamic_cast<Action*>(self);
+ if(!actionInterface)
+ {
+ throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Action interface"};
+ }
+ return actionInterface;
}
DBus::ValueOrError<std::string> BridgeAction::GetActionName(int32_t index)
DBus::ValueOrError<int32_t> BridgeAction::GetActionCount()
{
return FindSelf()->GetActionCount();
- ;
}
DBus::ValueOrError<bool> BridgeAction::DoAction(int32_t index)
DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceApplication};
AddGetPropertyToInterface(desc, "ToolkitName", &BridgeApplication::GetToolkitName);
AddGetPropertyToInterface(desc, "Version", &BridgeApplication::GetVersion);
- dbusServer.addInterface("/", desc, true);
+ mDbusServer.addInterface("/", desc, true);
}
Application* BridgeApplication::FindSelf() const
{
}
-void BridgeBase::addFilteredEvent(FilteredEvents kind, Dali::Accessibility::Accessible* obj, float delay, std::function<void()> functor)
+void BridgeBase::AddFilteredEvent(FilteredEvents kind, Dali::Accessibility::Accessible* obj, float delay, std::function<void()> functor)
{
if(delay < 0)
{
delay = 0;
}
- auto it = filteredEvents.insert({{kind, obj}, {static_cast<unsigned int>(delay * 10), {}}});
+ auto it = mFilteredEvents.insert({{kind, obj}, {static_cast<unsigned int>(delay * 10), {}}});
if(it.second)
{
functor();
if(!tickTimer)
{
tickTimer = Dali::Timer::New(100);
- tickTimer.TickSignal().Connect(this, &BridgeBase::tickFilteredEvents);
+ tickTimer.TickSignal().Connect(this, &BridgeBase::TickFilteredEvents);
}
}
-bool BridgeBase::tickFilteredEvents()
+bool BridgeBase::TickFilteredEvents()
{
- for(auto it = filteredEvents.begin(); it != filteredEvents.end();)
+ for(auto it = mFilteredEvents.begin(); it != mFilteredEvents.end();)
{
if(it->second.first)
{
}
else
{
- it = filteredEvents.erase(it);
+ it = mFilteredEvents.erase(it);
continue;
}
}
++it;
}
- return !filteredEvents.empty();
+ return !mFilteredEvents.empty();
}
-void BridgeBase::RegisteredEventsUpdate()
+void BridgeBase::UpdateRegisteredEvents()
{
using ReturnType = std::vector<std::tuple<std::string, std::string>>;
- registry.method<DBus::ValueOrError<ReturnType>()>("GetRegisteredEvents").asyncCall([this](DBus::ValueOrError<ReturnType> msg) {
+ mRegistry.method<DBus::ValueOrError<ReturnType>()>("GetRegisteredEvents").asyncCall([this](DBus::ValueOrError<ReturnType> msg) {
if(!msg)
{
LOG() << "Get registered events failed";
return;
}
- allowObjectBoundsChangedEvent = false;
+ IsBoundsChangedEventAllowed = false;
ReturnType values = std::get<ReturnType>(msg.getValues());
for(long unsigned int i = 0; i < values.size(); i++)
{
if(!std::get<1>(values[i]).compare("Object:BoundsChanged"))
{
- allowObjectBoundsChangedEvent = true;
+ IsBoundsChangedEventAllowed = true;
}
}
});
throw std::domain_error{std::string("failed at call '") + dbusLocators::atspi::GET_ADDRESS + "': " + addr.getError().message};
}
- con = DBusWrapper::Installed()->eldbus_address_connection_get_impl(std::get<0>(addr));
- mData->mBusName = DBus::getConnectionName(con);
- dbusServer = {con};
+ mConnectionPtr = DBusWrapper::Installed()->eldbus_address_connection_get_impl(std::get<0>(addr));
+ mData->mBusName = DBus::getConnectionName(mConnectionPtr);
+ mDbusServer = {mConnectionPtr};
{
- DBus::DBusInterfaceDescription desc{"org.a11y.atspi.Cache"};
+ DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceCache};
AddFunctionToInterface(desc, "GetItems", &BridgeBase::GetItems);
- dbusServer.addInterface("/org/a11y/atspi/cache", desc);
+ mDbusServer.addInterface(AtspiDbusPathCache, desc);
}
{
- DBus::DBusInterfaceDescription desc{"org.a11y.atspi.Application"};
- AddGetSetPropertyToInterface(desc, "Id", &BridgeBase::IdGet, &BridgeBase::IdSet);
- dbusServer.addInterface(AtspiPath, desc);
+ DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceApplication};
+ AddGetSetPropertyToInterface(desc, "Id", &BridgeBase::GetId, &BridgeBase::SetId);
+ mDbusServer.addInterface(AtspiPath, desc);
}
- registry = {AtspiDbusNameRegistry, AtspiDbusPathRegistry, AtspiDbusInterfaceRegistry, con};
+ mRegistry = {AtspiDbusNameRegistry, AtspiDbusPathRegistry, AtspiDbusInterfaceRegistry, mConnectionPtr};
- RegisteredEventsUpdate();
+ UpdateRegisteredEvents();
- registry.addSignal<void(void)>("EventListenerRegistered", [this](void) {
- RegisteredEventsUpdate();
+ mRegistry.addSignal<void(void)>("EventListenerRegistered", [this](void) {
+ UpdateRegisteredEvents();
});
- registry.addSignal<void(void)>("EventListenerDeregistered", [this](void) {
- RegisteredEventsUpdate();
+ mRegistry.addSignal<void(void)>("EventListenerDeregistered", [this](void) {
+ UpdateRegisteredEvents();
});
return ForceUpResult::JUST_STARTED;
void BridgeBase::ForceDown()
{
Bridge::ForceDown();
- registry = {};
- dbusServer = {};
- con = {};
+ mRegistry = {};
+ mDbusServer = {};
+ mConnectionPtr = {};
}
const std::string& BridgeBase::GetBusName() const
void BridgeBase::AddPopup(Accessible* object)
{
- if(std::find(popups.begin(), popups.end(), object) != popups.end())
+ if(std::find(mPopups.begin(), mPopups.end(), object) != mPopups.end())
{
return;
}
- popups.push_back(object);
+ mPopups.push_back(object);
if(IsUp())
{
object->Emit(WindowEvent::ACTIVATE, 0);
void BridgeBase::RemovePopup(Accessible* object)
{
- auto it = std::find(popups.begin(), popups.end(), object);
- if(it == popups.end())
+ auto it = std::find(mPopups.begin(), mPopups.end(), object);
+ if(it == mPopups.end())
{
return;
}
- popups.erase(it);
+ mPopups.erase(it);
+
if(IsUp())
{
object->Emit(WindowEvent::DEACTIVATE, 0);
- if(popups.empty())
+ if(mPopups.empty())
{
- application.children.back()->Emit(WindowEvent::ACTIVATE, 0);
+ mApplication.mChildren.back()->Emit(WindowEvent::ACTIVATE, 0);
}
else
{
- popups.back()->Emit(WindowEvent::ACTIVATE, 0);
+ mPopups.back()->Emit(WindowEvent::ACTIVATE, 0);
}
}
}
void BridgeBase::AddTopLevelWindow(Accessible* root)
{
- application.children.push_back(root);
+ mApplication.mChildren.push_back(root);
SetIsOnRootLevel(root);
}
void BridgeBase::RemoveTopLevelWindow(Accessible* root)
{
- for(auto i = 0u; i < application.children.size(); ++i)
+ for(auto i = 0u; i < mApplication.mChildren.size(); ++i)
{
- if(application.children[i] == root)
+ if(mApplication.mChildren[i] == root)
{
- application.children.erase(application.children.begin() + i);
+ mApplication.mChildren.erase(mApplication.mChildren.begin() + i);
break;
}
}
{
if(path == "root")
{
- return &application;
+ return &mApplication;
}
void* accessible;
return Find(StripPrefix(path));
}
-void BridgeBase::IdSet(int id)
+void BridgeBase::SetId(int id)
{
- this->id = id;
+ this->mId = id;
}
-int BridgeBase::IdGet()
+int BridgeBase::GetId()
{
- return this->id;
+ return this->mId;
}
auto BridgeBase::GetItems() -> DBus::ValueOrError<std::vector<CacheElementType>>
{
- auto root = &application;
+ auto root = &mApplication;
std::vector<CacheElementType> res;
return {};
}
- auto root = &application;
+ auto root = &mApplication;
auto parent = item->GetParent();
std::vector<Address> children;
// INTERNAL INCLUDES
#include <dali/internal/accessibility/bridge/accessibility-common.h>
+/**
+ * @brief The AppAccessible class is to define Accessibility Application.
+ */
class AppAccessible : public virtual Dali::Accessibility::Accessible, public virtual Dali::Accessibility::Collection, public virtual Dali::Accessibility::Application
{
public:
- Dali::Accessibility::EmptyAccessibleWithAddress parent;
- std::vector<Dali::Accessibility::Accessible*> children;
- std::string name;
+ Dali::Accessibility::EmptyAccessibleWithAddress mParent;
+ std::vector<Dali::Accessibility::Accessible*> mChildren;
+ std::string mName;
std::string GetName() override
{
- return name;
+ return mName;
}
std::string GetDescription() override
Dali::Accessibility::Accessible* GetParent() override
{
- return &parent;
+ return &mParent;
}
size_t GetChildCount() override
{
- return children.size();
+ return mChildren.size();
}
Dali::Accessibility::Accessible* GetChildAtIndex(size_t index) override
{
- auto s = children.size();
- if(index >= s)
- throw std::domain_error{"invalid index " + std::to_string(index) + " for object with " + std::to_string(s) + " children"};
- return children[index];
+ auto size = mChildren.size();
+ if(index >= size)
+ {
+ throw std::domain_error{"invalid index " + std::to_string(index) + " for object with " + std::to_string(size) + " children"};
+ }
+ return mChildren[index];
}
size_t GetIndexInParent() override
return {};
}
- Dali::Accessibility::Accessible* getActiveWindow()
+ /**
+ * @brief Gets the active window.
+ *
+ * @return Null if mChildren is empty, otherwise the active window
+ * @note Currently, the default window would be returned when mChildren is not empty.
+ */
+ Dali::Accessibility::Accessible* GetActiveWindow()
{
- return children.empty() ? nullptr : children[0];
+ return mChildren.empty() ? nullptr : mChildren[0];
}
bool DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo) override
}
};
+/**
+ * @brief Enumeration for FilteredEvents.
+ */
enum class FilteredEvents
{
- boundsChanged
+ BOUNDS_CHANGED ///< Bounds changed
};
+// Custom specialization of std::hash
namespace std
{
template<>
struct hash<std::pair<FilteredEvents, Dali::Accessibility::Accessible*>>
{
- size_t operator()(std::pair<FilteredEvents, Dali::Accessibility::Accessible*> v) const
+ size_t operator()(std::pair<FilteredEvents, Dali::Accessibility::Accessible*> value) const
{
- return (static_cast<size_t>(v.first) * 131) ^ reinterpret_cast<size_t>(v.second);
+ return (static_cast<size_t>(value.first) * 131) ^ reinterpret_cast<size_t>(value.second);
}
};
} // namespace std
+/**
+ * @brief The BridgeBase class is basic class for Bridge functions.
+ */
class BridgeBase : public Dali::Accessibility::Bridge, public Dali::ConnectionTracker
{
- std::unordered_map<std::pair<FilteredEvents, Dali::Accessibility::Accessible*>, std::pair<unsigned int, std::function<void()>>> filteredEvents;
+ std::unordered_map<std::pair<FilteredEvents, Dali::Accessibility::Accessible*>, std::pair<unsigned int, std::function<void()>>> mFilteredEvents;
- bool tickFilteredEvents();
+ /**
+ * @brief Removes all FilteredEvents using Tick signal.
+ *
+ * @return False if mFilteredEvents is empty, otherwise true.
+ */
+ bool TickFilteredEvents();
public:
- void addFilteredEvent(FilteredEvents kind, Dali::Accessibility::Accessible* obj, float delay, std::function<void()> functor);
-
+ /**
+ * @brief Adds FilteredEvents, Accessible, and delay time to mFilteredEvents.
+ *
+ * @param[in] kind FilteredEvents enum value
+ * @param[in] obj Accessible object
+ * @param[in] delay The delay time
+ * @param[in] functor The function to be called // NEED TO UPDATE!
+ */
+ void AddFilteredEvent(FilteredEvents kind, Dali::Accessibility::Accessible* obj, float delay, std::function<void()> functor);
+
+ /**
+ * @copydoc Dali::Accessibility::Bridge::GetBusName()
+ */
const std::string& GetBusName() const override;
- void AddTopLevelWindow(Dali::Accessibility::Accessible* window) override;
- void RemoveTopLevelWindow(Dali::Accessibility::Accessible* window) override;
- void AddPopup(Dali::Accessibility::Accessible* object) override;
- void RemovePopup(Dali::Accessibility::Accessible* object) override;
+ /**
+ * @copydoc Dali::Accessibility::Bridge::AddTopLevelWindow()
+ */
+ void AddTopLevelWindow(Dali::Accessibility::Accessible* window) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Bridge::RemoveTopLevelWindow()
+ */
+ void RemoveTopLevelWindow(Dali::Accessibility::Accessible* window) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Bridge::AddPopup()
+ */
+ void AddPopup(Dali::Accessibility::Accessible* object) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Bridge::RemovePopup()
+ */
+ void RemovePopup(Dali::Accessibility::Accessible* object) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Bridge::GetApplication()
+ */
Dali::Accessibility::Accessible* GetApplication() const override
{
- return &application;
+ return &mApplication;
}
+ /**
+ * @brief Adds function to dbus interface.
+ */
template<typename SELF, typename... RET, typename... ARGS>
void AddFunctionToInterface(
DBus::DBusInterfaceDescription& desc, const std::string& funcName, DBus::ValueOrError<RET...> (SELF::*funcPtr)(ARGS...))
});
}
+ /**
+ * @brief Adds 'Get' property to dbus interface.
+ */
template<typename T, typename SELF>
void AddGetPropertyToInterface(DBus::DBusInterfaceDescription& desc,
const std::string& funcName,
{});
}
+ /**
+ * @brief Adds 'Set' property to dbus interface.
+ */
template<typename T, typename SELF>
void AddSetPropertyToInterface(DBus::DBusInterfaceDescription& desc,
const std::string& funcName,
});
}
+ /**
+ * @brief Adds 'Set' and 'Get' properties to dbus interface.
+ */
template<typename T, typename T1, typename SELF>
void AddGetSetPropertyToInterface(DBus::DBusInterfaceDescription& desc,
const std::string& funcName,
}
});
}
+
+ /**
+ * @brief Adds 'Get' and 'Set' properties to dbus interface.
+ */
template<typename T, typename T1, typename SELF>
void AddGetSetPropertyToInterface(DBus::DBusInterfaceDescription& desc,
const std::string& funcName,
}
});
}
+
+ /**
+ * @brief Gets the string of the path excluding the specified prefix.
+ *
+ * @param path The path to get
+ * @return The string stripped of the specific prefix
+ */
static std::string StripPrefix(const std::string& path);
+ /**
+ * @brief Finds the Accessible object according to the path.
+ *
+ * @param[in] path The path for Accessible object
+ * @return The Accessible object corresponding to the path
+ */
Dali::Accessibility::Accessible* Find(const std::string& path) const;
+
+ /**
+ * @brief Finds the Accessible object with the given address.
+ *
+ * @param[in] ptr The unique Address of the object
+ * @return The Accessible object corresponding to the path
+ */
Dali::Accessibility::Accessible* Find(const Dali::Accessibility::Address& ptr) const;
+
+ /**
+ * @brief Returns the target object of the currently executed DBus method call.
+ *
+ * And any subclasses redefine `FindSelf` with a different return type as a convenient wrapper around dynamic_cast.
+ * @return The Accessible object
+ * @note When a DBus method is called on some object, this target object (`currentObject`) is temporarily saved by the bridge,
+ * because DBus handles the invocation target separately from the method arguments.
+ * We then use the saved object inside the 'glue' method (e.g. BridgeValue::GetMinimum)
+ * to call the equivalent method on the respective C++ object (this could be ScrollBar::AccessibleImpl::GetMinimum in the example given).
+ */
Dali::Accessibility::Accessible* FindSelf() const;
+
+ /**
+ * @copydoc Dali::Accessibility::Bridge::FindByPath()
+ */
Dali::Accessibility::Accessible* FindByPath(const std::string& name) const override;
- void SetApplicationName(std::string name) override
+
+ /**
+ * @copydoc Dali::Accessibility::Bridge::SetApplicationName()
+ */
+ void SetApplicationName(std::string name) override
{
- application.name = std::move(name);
+ mApplication.mName = std::move(name);
}
protected:
- mutable AppAccessible application;
- std::vector<Dali::Accessibility::Accessible*> popups;
+ mutable AppAccessible mApplication;
+ std::vector<Dali::Accessibility::Accessible*> mPopups;
private:
- void IdSet(int id);
- int IdGet();
- void RegisteredEventsUpdate();
+
+ /**
+ * @brief Sets an ID.
+ * @param[in] id An ID (integer value)
+ */
+ void SetId(int id);
+
+ /**
+ * @brief Gets the ID.
+ * @return The ID to be set
+ */
+ int GetId();
+
+ /**
+ * @brief Update registered events.
+ */
+ void UpdateRegisteredEvents();
using CacheElementType = std::tuple<
Dali::Accessibility::Address,
Dali::Accessibility::Role,
std::string,
std::array<uint32_t, 2>>;
+
+ /**
+ * @brief Gets Items // NEED TO UPDATE!
+ *
+ * @return
+ */
DBus::ValueOrError<std::vector<CacheElementType>> GetItems();
- CacheElementType CreateCacheElement(Dali::Accessibility::Accessible* item);
+
+ /**
+ * @brief Creates CacheElement.
+ *
+ * CreateCacheElement method works for GetItems which is a part of ATSPI protocol.
+ * ATSPI client library (libatspi from at-spi2-core) depending on cacheing policy configuration uses GetItems
+ * to pre-load entire accessible tree from application to its own cache in single dbus call.
+ * Otherwise the particular nodes in a tree are cached lazily when client library tries to access them.
+ * @param item Accessible to get information
+ * @return The elements to be cached
+ */
+ CacheElementType CreateCacheElement(Dali::Accessibility::Accessible* item);
protected:
BridgeBase();
virtual ~BridgeBase();
+ /**
+ * @copydoc Dali::Accessibility::Bridge::ForceUp()
+ */
ForceUpResult ForceUp() override;
- void ForceDown() override;
- DBus::DBusServer dbusServer;
- DBusWrapper::ConnectionPtr con;
- int id = 0;
- DBus::DBusClient registry;
- bool allowObjectBoundsChangedEvent{false};
+ /**
+ * @copydoc Dali::Accessibility::Bridge::ForceDown()
+ */
+ void ForceDown() override;
+
+ DBus::DBusServer mDbusServer;
+ DBusWrapper::ConnectionPtr mConnectionPtr;
+ int mId = 0;
+ DBus::DBusClient mRegistry;
+ bool IsBoundsChangedEventAllowed{false};
};
#endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_BASE_H
{
DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceCollection};
AddFunctionToInterface(desc, "GetMatches", &BridgeCollection::GetMatches);
- dbusServer.addInterface("/", desc, true);
+ mDbusServer.addInterface("/", desc, true);
}
Collection* BridgeCollection::FindSelf() const
{
- auto s = BridgeBase::FindSelf();
- assert(s);
- auto s2 = dynamic_cast<Collection*>(s);
- if(!s2)
- throw std::domain_error{"object " + s->GetAddress().ToString() + " doesn't have Collection interface"};
- return s2;
+ auto self = BridgeBase::FindSelf();
+ assert(self);
+ auto collectionInterface = dynamic_cast<Collection*>(self);
+ if(!collectionInterface)
+ {
+ throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Collection interface"};
+ }
+ return collectionInterface;
}
enum
{
requested = {std::get<Index::Interfaces>(*rule).begin(), std::get<Index::Interfaces>(*rule).end()};
}
+
void Update(Accessible* obj)
{
object.clear();
- for(auto& q : obj->GetInterfaces())
- object.insert(std::move(q));
+ for(auto& interface : obj->GetInterfaces())
+ {
+ object.insert(std::move(interface));
+ }
}
+
bool RequestEmpty() const
{
return requested.empty();
}
+
bool ObjectEmpty() const
{
return object.empty();
}
+
bool Compare(CompareFuncExit exit)
{
bool foundAny = false;
{
bool found = (object.find(iname) != object.end());
if(found)
+ {
foundAny = true;
+ }
+
if(found == (exit == CompareFuncExit::FIRST_FOUND))
+ {
return found;
+ }
}
return foundAny;
}
- };
+ }; // ComparerInterfaces struct
+
struct ComparerAttributes
{
std::unordered_map<std::string, std::string> requested, object;
{
requested = std::get<Index::Attributes>(*rule);
}
+
void Update(Accessible* obj)
{
object = obj->GetAttributes();
}
+
bool RequestEmpty() const
{
return requested.empty();
}
+
bool ObjectEmpty() const
{
return object.empty();
}
+
bool Compare(CompareFuncExit exit)
{
bool foundAny = false;
auto it = object.find(iname.first);
bool found = it != object.end() && iname.second == it->second;
if(found)
+ {
foundAny = true;
+ }
+
if(found == (exit == CompareFuncExit::FIRST_FOUND))
{
return found;
}
return foundAny;
}
- };
+ }; // ComparerAttributes struct
+
struct ComparerRoles
{
using Roles = BitSets<4, Role>;
{
requested = Roles{std::get<Index::Roles>(*rule)};
}
+
void Update(Accessible* obj)
{
object = {};
object[obj->GetRole()] = true;
assert(object);
}
+
bool RequestEmpty() const
{
return !requested;
}
+
bool ObjectEmpty() const
{
return !object;
}
+
bool Compare(CompareFuncExit exit)
{
switch(mode)
}
return false;
}
- };
+ }; // ComparerRoles struct
+
struct ComparerStates
{
States requested, object;
{
requested = States{std::get<Index::States>(*rule)};
}
+
void Update(Accessible* obj)
{
object = obj->GetStates();
}
+
bool RequestEmpty() const
{
return !requested;
}
+
bool ObjectEmpty() const
{
return !object;
}
+
bool Compare(CompareFuncExit exit)
{
switch(mode)
}
return false;
}
- };
+ }; // ComparerStates struct
template<typename T>
- bool compareFunc(T& cmp, Accessible* obj)
+ bool CompareFunc(T& cmp, Accessible* obj)
{
if(cmp.mode == Mode::INVALID)
+ {
return true;
+ }
+
cmp.Update(obj);
switch(cmp.mode)
{
case Mode::ANY:
{
if(cmp.RequestEmpty() || cmp.ObjectEmpty())
+ {
return false;
+ }
break;
}
case Mode::ALL:
{
if(cmp.RequestEmpty())
+ {
return true;
+ }
if(cmp.ObjectEmpty())
+ {
return false;
+ }
break;
}
case Mode::NONE:
{
if(cmp.RequestEmpty() || cmp.ObjectEmpty())
+ {
return true;
+ }
break;
}
case Mode::EMPTY:
{
if(cmp.RequestEmpty() && cmp.ObjectEmpty())
+ {
return true;
+ }
if(cmp.RequestEmpty() || cmp.ObjectEmpty())
+ {
return false;
+ }
break;
}
case Mode::INVALID:
case Mode::ALL:
{
if(!cmp.Compare(CompareFuncExit::FIRST_NOT_FOUND))
+ {
return false;
+ }
break;
}
case Mode::ANY:
{
if(cmp.Compare(CompareFuncExit::FIRST_FOUND))
+ {
return true;
+ }
break;
}
case Mode::NONE:
{
if(cmp.Compare(CompareFuncExit::FIRST_FOUND))
+ {
return false;
+ }
break;
}
case Mode::INVALID:
return false;
}
- ComparerInterfaces ci;
- ComparerAttributes ca;
- ComparerRoles cr;
- ComparerStates cs;
+ ComparerInterfaces interface;
+ ComparerAttributes attribute;
+ ComparerRoles role;
+ ComparerStates state;
Comparer(MatchRule* mr)
- : ci(mr),
- ca(mr),
- cr(mr),
- cs(mr)
+ : interface(mr),
+ attribute(mr),
+ role(mr),
+ state(mr)
{
}
bool operator()(Accessible* obj)
{
- return compareFunc(ci, obj) &&
- compareFunc(ca, obj) &&
- compareFunc(cr, obj) &&
- compareFunc(cs, obj);
+ return CompareFunc(interface, obj) &&
+ CompareFunc(attribute, obj) &&
+ CompareFunc(role, obj) &&
+ CompareFunc(state, obj);
}
-};
+}; // BridgeCollection::Comparer struct
void BridgeCollection::VisitNodes(Accessible* obj, std::vector<Accessible*>& result, Comparer& cmp, size_t maxCount)
{
if(maxCount > 0 && result.size() >= maxCount)
+ {
return;
+ }
if(cmp(obj))
+ {
result.emplace_back(obj);
+ }
for(auto i = 0u; i < obj->GetChildCount(); ++i)
+ {
VisitNodes(obj->GetChildAtIndex(i), result, cmp, maxCount);
+ }
}
DBus::ValueOrError<std::vector<Accessible*> > BridgeCollection::GetMatches(MatchRule rule, uint32_t sortBy, int32_t count, bool traverse)
// https://gitlab.gnome.org/GNOME/at-spi2-core/-/blob/master/xml/Component.xml
DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceComponent};
- AddFunctionToInterface(desc, "Contains", &BridgeComponent::IsAccessibleContainedAtPoint);
+ AddFunctionToInterface(desc, "Contains", &BridgeComponent::IsAccessibleContainingPoint);
AddFunctionToInterface(desc, "GetAccessibleAtPoint", &BridgeComponent::GetAccessibleAtPoint);
AddFunctionToInterface(desc, "GetExtents", &BridgeComponent::GetExtents);
AddFunctionToInterface(desc, "GetPosition", &BridgeComponent::GetPosition);
AddFunctionToInterface(desc, "GrabHighlight", &BridgeComponent::GrabHighlight);
AddFunctionToInterface(desc, "GrabFocus", &BridgeComponent::GrabFocus);
AddFunctionToInterface(desc, "ClearHighlight", &BridgeComponent::ClearHighlight);
- dbusServer.addInterface("/", desc, true);
+ mDbusServer.addInterface("/", desc, true);
}
Component* BridgeComponent::FindSelf() const
{
- auto s = BridgeBase::FindSelf();
- assert(s);
- auto s2 = dynamic_cast<Component*>(s);
- if(!s2)
- throw std::domain_error{"object " + s->GetAddress().ToString() + " doesn't have Component interface"};
- return s2;
+ auto self = BridgeBase::FindSelf();
+ assert(self);
+ auto componentInterface = dynamic_cast<Component*>(self);
+ if(!componentInterface)
+ {
+ throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Component interface"};
+ }
+ return componentInterface;
}
-DBus::ValueOrError<bool> BridgeComponent::IsAccessibleContainedAtPoint(int32_t x, int32_t y, uint32_t coordType)
+DBus::ValueOrError<bool> BridgeComponent::IsAccessibleContainingPoint(int32_t x, int32_t y, uint32_t coordType)
{
- return FindSelf()->IsAccessibleContainedAtPoint({x, y}, static_cast<CoordinateType>(coordType));
+ return FindSelf()->IsAccessibleContainingPoint({x, y}, static_cast<CoordinateType>(coordType));
}
+
DBus::ValueOrError<Accessible*> BridgeComponent::GetAccessibleAtPoint(int32_t x, int32_t y, uint32_t coordType)
{
return FindSelf()->GetAccessibleAtPoint({x, y}, static_cast<CoordinateType>(coordType));
}
+
DBus::ValueOrError<std::tuple<int32_t, int32_t, int32_t, int32_t> > BridgeComponent::GetExtents(uint32_t coordType)
{
- auto p = FindSelf()->GetExtents(static_cast<CoordinateType>(coordType));
- return std::tuple<int32_t, int32_t, int32_t, int32_t>{p.x, p.y, p.width, p.height};
+ auto rect = FindSelf()->GetExtents(static_cast<CoordinateType>(coordType));
+ return std::tuple<int32_t, int32_t, int32_t, int32_t>{rect.x, rect.y, rect.width, rect.height};
}
+
DBus::ValueOrError<int32_t, int32_t> BridgeComponent::GetPosition(uint32_t coordType)
{
- auto p = FindSelf()->GetExtents(static_cast<CoordinateType>(coordType));
- return {static_cast<int32_t>(p.x), static_cast<int32_t>(p.y)};
+ auto rect = FindSelf()->GetExtents(static_cast<CoordinateType>(coordType));
+ return {static_cast<int32_t>(rect.x), static_cast<int32_t>(rect.y)};
}
+
DBus::ValueOrError<int32_t, int32_t> BridgeComponent::GetSize(uint32_t coordType)
{
- auto p = FindSelf()->GetExtents(static_cast<CoordinateType>(coordType));
- return {static_cast<int32_t>(p.width), static_cast<int32_t>(p.height)};
+ auto rect = FindSelf()->GetExtents(static_cast<CoordinateType>(coordType));
+ return {static_cast<int32_t>(rect.width), static_cast<int32_t>(rect.height)};
}
+
DBus::ValueOrError<ComponentLayer> BridgeComponent::GetLayer()
{
return FindSelf()->GetLayer();
}
+
DBus::ValueOrError<double> BridgeComponent::GetAlpha()
{
return FindSelf()->GetAlpha();
}
+
DBus::ValueOrError<bool> BridgeComponent::GrabFocus()
{
return FindSelf()->GrabFocus();
}
+
DBus::ValueOrError<bool> BridgeComponent::GrabHighlight()
{
return FindSelf()->GrabHighlight();
}
+
DBus::ValueOrError<bool> BridgeComponent::ClearHighlight()
{
return FindSelf()->ClearHighlight();
}
+
DBus::ValueOrError<int16_t> BridgeComponent::GetMdiZOrder()
{
return FindSelf()->GetMdiZOrder();
Dali::Accessibility::Component* FindSelf() const;
public:
- DBus::ValueOrError<bool> IsAccessibleContainedAtPoint(int32_t x, int32_t y, uint32_t coordType);
+ DBus::ValueOrError<bool> IsAccessibleContainingPoint(int32_t x, int32_t y, uint32_t coordType);
DBus::ValueOrError<Dali::Accessibility::Accessible*> GetAccessibleAtPoint(int32_t x, int32_t y, uint32_t coordType);
DBus::ValueOrError<std::tuple<int32_t, int32_t, int32_t, int32_t> > GetExtents(uint32_t coordType);
DBus::ValueOrError<int32_t, int32_t> GetPosition(uint32_t coordType);
AddFunctionToInterface(desc, "InsertText", &BridgeEditableText::InsertText);
AddFunctionToInterface(desc, "PasteText", &BridgeEditableText::PasteText);
AddFunctionToInterface(desc, "SetTextContents", &BridgeEditableText::SetTextContents);
- dbusServer.addInterface("/", desc, true);
+ mDbusServer.addInterface("/", desc, true);
}
EditableText* BridgeEditableText::FindSelf() const
{
- auto s = BridgeBase::FindSelf();
- assert(s);
- auto s2 = dynamic_cast<EditableText*>(s);
- if(!s2)
- throw std::domain_error{"object " + s->GetAddress().ToString() + " doesn't have Text interface"};
- return s2;
+ auto self = BridgeBase::FindSelf();
+ assert(self);
+ auto editableTextInterface = dynamic_cast<EditableText*>(self);
+ if(!editableTextInterface)
+ {
+ throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Text interface"};
+ }
+ return editableTextInterface;
}
DBus::ValueOrError<bool> BridgeEditableText::CopyText(int32_t startPos, int32_t endPos)
using namespace Dali::Accessibility;
+/**
+ * @brief The BridgeImpl class is to implement some Bridge functions.
+ */
class BridgeImpl : public virtual BridgeBase,
public BridgeAccessible,
public BridgeObject,
public BridgeSelection,
public BridgeApplication
{
- DBus::DBusClient accessibilityStatusClient;
- DBus::DBusClient registryClient, directReadingClient;
- bool screenReaderEnabled = false;
- bool isEnabled = false;
- bool isShown = false;
- std::unordered_map<int32_t, std::function<void(std::string)>> directReadingCallbacks;
- Dali::Actor highlightedActor;
- std::function<void(Dali::Actor)> highlightClearAction;
- Dali::CallbackBase* mIdleCallback = NULL;
+ DBus::DBusClient mAccessibilityStatusClient;
+ DBus::DBusClient mRegistryClient;
+ DBus::DBusClient mDirectReadingClient;
+ bool mIsScreenReaderEnabled = false;
+ bool mIsEnabled = false;
+ bool mIsShown = false;
+ std::unordered_map<int32_t, std::function<void(std::string)>> mDirectReadingCallbacks;
+ Dali::Actor mHighlightedActor;
+ std::function<void(Dali::Actor)> mHighlightClearAction;
+ Dali::CallbackBase* mIdleCallback = NULL;
public:
BridgeImpl()
{
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::Emit()
+ */
Consumed Emit(KeyEventType type, unsigned int keyCode, const std::string& keyName, unsigned int timeStamp, bool isText) override
{
if(!IsUp())
return Consumed::NO;
}
}
- auto m = registryClient.method<bool(std::tuple<uint32_t, int32_t, int32_t, int32_t, int32_t, std::string, bool>)>("NotifyListenersSync");
- auto result = m.call(std::tuple<uint32_t, int32_t, int32_t, int32_t, int32_t, std::string, bool>{keyType, 0, static_cast<int32_t>(keyCode), 0, static_cast<int32_t>(timeStamp), keyName, isText ? 1 : 0});
+
+ auto methodObject = mRegistryClient.method<bool(std::tuple<uint32_t, int32_t, int32_t, int32_t, int32_t, std::string, bool>)>("NotifyListenersSync");
+ auto result = methodObject.call(std::tuple<uint32_t, int32_t, int32_t, int32_t, int32_t, std::string, bool>{keyType, 0, static_cast<int32_t>(keyCode), 0, static_cast<int32_t>(timeStamp), keyName, isText ? 1 : 0});
if(!result)
{
LOG() << result.getError().message;
return std::get<0>(result) ? Consumed::YES : Consumed::NO;
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::Pause()
+ */
void Pause() override
{
if(!IsUp())
return;
}
- directReadingClient.method<DBus::ValueOrError<void>(bool)>("PauseResume").asyncCall([](DBus::ValueOrError<void> msg) {
+ mDirectReadingClient.method<DBus::ValueOrError<void>(bool)>("PauseResume").asyncCall([](DBus::ValueOrError<void> msg) {
if(!msg)
{
LOG() << "Direct reading command failed (" << msg.getError().message << ")";
true);
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::Resume()
+ */
void Resume() override
{
if(!IsUp())
return;
}
- directReadingClient.method<DBus::ValueOrError<void>(bool)>("PauseResume").asyncCall([](DBus::ValueOrError<void> msg) {
+ mDirectReadingClient.method<DBus::ValueOrError<void>(bool)>("PauseResume").asyncCall([](DBus::ValueOrError<void> msg) {
if(!msg)
{
LOG() << "Direct reading command failed (" << msg.getError().message << ")";
false);
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::StopReading()
+ */
void StopReading(bool alsoNonDiscardable) override
{
if(!IsUp())
return;
}
- directReadingClient.method<DBus::ValueOrError<void>(bool)>("StopReading").asyncCall([](DBus::ValueOrError<void> msg) {
+ mDirectReadingClient.method<DBus::ValueOrError<void>(bool)>("StopReading").asyncCall([](DBus::ValueOrError<void> msg) {
if(!msg)
{
LOG() << "Direct reading command failed (" << msg.getError().message << ")";
alsoNonDiscardable);
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::Say()
+ */
void Say(const std::string& text, bool discardable, std::function<void(std::string)> callback) override
{
if(!IsUp())
return;
}
- directReadingClient.method<DBus::ValueOrError<std::string, bool, int32_t>(std::string, bool)>("ReadCommand").asyncCall([=](DBus::ValueOrError<std::string, bool, int32_t> msg) {
+ mDirectReadingClient.method<DBus::ValueOrError<std::string, bool, int32_t>(std::string, bool)>("ReadCommand").asyncCall([=](DBus::ValueOrError<std::string, bool, int32_t> msg) {
if(!msg)
{
LOG() << "Direct reading command failed (" << msg.getError().message << ")";
}
else if(callback)
{
- directReadingCallbacks.emplace(std::get<2>(msg), callback);
+ mDirectReadingCallbacks.emplace(std::get<2>(msg), callback);
}
},
text,
discardable);
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::ForceDown()
+ */
void ForceDown() override
{
if(mData)
mData->mCurrentlyHighlightedActor = {};
mData->mHighlightActor = {};
}
- highlightedActor = {};
- highlightClearAction = {};
+ mHighlightedActor = {};
+ mHighlightClearAction = {};
BridgeAccessible::ForceDown();
- registryClient = {};
- directReadingClient = {};
- directReadingCallbacks.clear();
+ mRegistryClient = {};
+ mDirectReadingClient = {};
+ mDirectReadingCallbacks.clear();
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::Terminate()
+ */
void Terminate() override
{
if(mData)
{
Dali::Adaptor::Get().RemoveIdle(mIdleCallback);
}
- accessibilityStatusClient = {};
- dbusServer = {};
- con = {};
+ mAccessibilityStatusClient = {};
+ mDbusServer = {};
+ mConnectionPtr = {};
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::ForceUp()
+ */
ForceUpResult ForceUp() override
{
if(BridgeAccessible::ForceUp() == ForceUpResult::ALREADY_UP)
BridgeSelection::RegisterInterfaces();
BridgeApplication::RegisterInterfaces();
- RegisterOnBridge(&application);
+ RegisterOnBridge(&mApplication);
+
+ mRegistryClient = {AtspiDbusNameRegistry, AtspiDbusPathDec, AtspiDbusInterfaceDec, mConnectionPtr};
+ mDirectReadingClient = DBus::DBusClient{DirectReadingDBusName, DirectReadingDBusPath, DirectReadingDBusInterface, mConnectionPtr};
- registryClient = {AtspiDbusNameRegistry, AtspiDbusPathDec, AtspiDbusInterfaceDec, con};
- directReadingClient = DBus::DBusClient{DirectReadingDBusName, DirectReadingDBusPath, DirectReadingDBusInterface, con};
- directReadingClient.addSignal<void(int32_t, std::string)>("ReadingStateChanged", [=](int32_t id, std::string readingState) {
- auto it = directReadingCallbacks.find(id);
- if(it != directReadingCallbacks.end())
+ mDirectReadingClient.addSignal<void(int32_t, std::string)>("ReadingStateChanged", [=](int32_t id, std::string readingState) {
+ auto it = mDirectReadingCallbacks.find(id);
+ if(it != mDirectReadingCallbacks.end())
{
it->second(readingState);
if(readingState != "ReadingPaused" && readingState != "ReadingResumed" && readingState != "ReadingStarted")
- directReadingCallbacks.erase(it);
+ {
+ mDirectReadingCallbacks.erase(it);
+ }
}
});
- auto proxy = DBus::DBusClient{AtspiDbusNameRegistry, AtspiDbusPathRoot, AtspiDbusInterfaceSocket, con};
+ auto proxy = DBus::DBusClient{AtspiDbusNameRegistry, AtspiDbusPathRoot, AtspiDbusInterfaceSocket, mConnectionPtr};
Address root{"", "root"};
auto res = proxy.method<Address(Address)>("Embed").call(root);
if(!res)
LOG() << "Call to Embed failed: " << res.getError().message;
}
assert(res);
- application.parent.SetAddress(std::move(std::get<0>(res)));
- if(isShown)
+
+ mApplication.mParent.SetAddress(std::move(std::get<0>(res)));
+ if(mIsShown)
{
EmitActivate();
}
return ForceUpResult::JUST_STARTED;
}
+ /**
+ * @brief Sends a signal to dbus that the default window is activated.
+ *
+ * TODO : This is subject to change if/when we implement multi-window support.
+ * @see BridgeObject::Emit()
+ */
void EmitActivate()
{
- auto win = application.getActiveWindow();
+ auto win = mApplication.GetActiveWindow();
if(win)
{
win->Emit(WindowEvent::ACTIVATE, 0);
}
}
+ /**
+ * @brief Sends a signal to dbus that the default window is deactivated.
+ *
+ * TODO : This is subject to change if/when we implement multi-window support.
+ * @see BridgeObject::Emit()
+ */
void EmitDeactivate()
{
- auto win = application.getActiveWindow();
+ auto win = mApplication.GetActiveWindow();
if(win)
{
win->Emit(WindowEvent::DEACTIVATE, 0);
}
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::WindowHidden()
+ */
void WindowHidden() override
{
- if(isShown && IsUp())
+ if(mIsShown && IsUp())
{
EmitDeactivate();
}
- isShown = false;
+ mIsShown = false;
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::WindowShown()
+ */
void WindowShown() override
{
- if(!isShown && IsUp())
+ if(!mIsShown && IsUp())
{
EmitActivate();
}
- isShown = true;
+ mIsShown = true;
}
void ReadAndListenProperty()
{
// read property
- auto enabled = accessibilityStatusClient.property<bool>("ScreenReaderEnabled").get();
+ auto enabled = mAccessibilityStatusClient.property<bool>("ScreenReaderEnabled").get();
if(enabled)
{
- screenReaderEnabled = std::get<0>(enabled);
+ mIsScreenReaderEnabled = std::get<0>(enabled);
}
- enabled = accessibilityStatusClient.property<bool>("IsEnabled").get();
+
+ enabled = mAccessibilityStatusClient.property<bool>("IsEnabled").get();
if(enabled)
{
- isEnabled = std::get<0>(enabled);
+ mIsEnabled = std::get<0>(enabled);
}
- if(screenReaderEnabled || isEnabled)
+
+ if(mIsScreenReaderEnabled || mIsEnabled)
{
ForceUp();
}
// listen property change
- accessibilityStatusClient.addPropertyChangedEvent<bool>("ScreenReaderEnabled", [this](bool res) {
- screenReaderEnabled = res;
- if(screenReaderEnabled || isEnabled)
+ mAccessibilityStatusClient.addPropertyChangedEvent<bool>("ScreenReaderEnabled", [this](bool res) {
+ mIsScreenReaderEnabled = res;
+ if(mIsScreenReaderEnabled || mIsEnabled)
{
ForceUp();
}
}
});
- accessibilityStatusClient.addPropertyChangedEvent<bool>("IsEnabled", [this](bool res) {
- isEnabled = res;
- if(screenReaderEnabled || isEnabled)
+ mAccessibilityStatusClient.addPropertyChangedEvent<bool>("IsEnabled", [this](bool res) {
+ mIsEnabled = res;
+ if(mIsScreenReaderEnabled || mIsEnabled)
{
ForceUp();
}
bool InitializeAccessibilityStatusClient()
{
- accessibilityStatusClient = DBus::DBusClient{A11yDbusName, A11yDbusPath, A11yDbusStatusInterface, DBus::ConnectionType::SESSION};
+ mAccessibilityStatusClient = DBus::DBusClient{A11yDbusName, A11yDbusPath, A11yDbusStatusInterface, DBus::ConnectionType::SESSION};
- if (!accessibilityStatusClient)
+ if (!mAccessibilityStatusClient)
{
DALI_LOG_ERROR("Accessibility Status DbusClient is not ready\n");
return false;
return true;
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::Initialize()
+ */
void Initialize() override
{
if ( InitializeAccessibilityStatusClient() )
}
}
- bool GetScreenReaderEnabled()
+ /**
+ * @copydoc Dali::Accessibility::Bridge::GetScreenReaderEnabled()
+ */
+ bool GetScreenReaderEnabled() override
{
- return screenReaderEnabled;
+ return mIsScreenReaderEnabled;
}
- bool IsEnabled()
+ /**
+ * @copydoc Dali::Accessibility::Bridge::IsEnabled()
+ */
+ bool IsEnabled() override
{
- return isEnabled;
+ return mIsEnabled;
}
-};
+}; // BridgeImpl
-static bool bridgeInitialized;
+namespace // unnamed namespace
+{
+
+bool INITIALIZED_BRIDGE = false;
-static Bridge* CreateBridge()
+/**
+ * @brief Creates BridgeImpl instance.
+ *
+ * @return The BridgeImpl instance
+ * @note This method is to check environment variable first. If ATSPI is disable using env, it returns dummy bridge instance.
+ */
+Bridge* CreateBridge()
{
- bridgeInitialized = true;
+ INITIALIZED_BRIDGE = true;
try
{
}
}
+} // unnamed namespace
+
+// Dali::Accessibility::Bridge class implementation
+
Bridge* Bridge::GetCurrentBridge()
{
static Bridge* bridge;
{
return bridge;
}
- else if(autoInitState == AutoInitState::ENABLED)
+ else if(mAutoInitState == AutoInitState::ENABLED)
{
bridge = CreateBridge();
void Bridge::DisableAutoInit()
{
- if(bridgeInitialized)
+ if(INITIALIZED_BRIDGE)
{
DALI_LOG_ERROR("Bridge::DisableAutoInit() called after bridge auto-initialization");
}
- autoInitState = AutoInitState::DISABLED;
+ mAutoInitState = AutoInitState::DISABLED;
}
void Bridge::EnableAutoInit()
{
- autoInitState = AutoInitState::ENABLED;
+ mAutoInitState = AutoInitState::ENABLED;
- if(bridgeInitialized)
+ if(INITIALIZED_BRIDGE)
{
return;
}
{
// DBus::DBusInterfaceDescription desc{ AtspiDbusInterfaceEventObject };
// stateChanged = addSignal<std::string, int, int, DBus::EldbusVariant<int>, Accessible*>(desc, "StateChanged");
- // dbusServer.addInterface("/", desc, true);
+ // mDbusServer.addInterface("/", desc, true);
}
void BridgeObject::EmitActiveDescendantChanged(Accessible* obj, Accessible* child)
if(!IsUp()) return;
auto index = child->GetIndexInParent();
- auto addr = obj->GetAddress();
- const auto prefixPath = "/org/a11y/atspi/accessible/";
- const auto nullPath = "/org/a11y/atspi/null";
- std::string p;
- if(addr)
- p = prefixPath + addr.GetPath();
- else
- p = nullPath;
- dbusServer.emit2<std::string, int, int, DBus::EldbusVariant<Address>, Address>(
- p,
+ auto addr = obj->GetAddress();
+ std::string path = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
+
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<Address>, Address>(
+ path,
AtspiDbusInterfaceEventObject,
"ActiveDescendantChanged",
"",
{
if(!IsUp()) return;
const char* name = nullptr;
+
switch(ev)
{
case ObjectPropertyChangeEvent::NAME:
break;
}
}
+
if(name)
{
auto addr = obj->GetAddress();
- std::string p;
- if(addr)
- p = ATSPI_PREFIX_PATH + addr.GetPath();
- else
- p = ATSPI_NULL_PATH;
- dbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
- p,
+ std::string path = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
+
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
+ path,
AtspiDbusInterfaceEventObject,
"PropertyChange",
name,
{
if(!IsUp()) return;
const char* name = nullptr;
+
switch(event)
{
case WindowEvent::PROPERTY_CHANGE:
break;
}
}
+
if(name)
{
auto addr = obj->GetAddress();
- std::string p;
- if(addr)
- p = ATSPI_PREFIX_PATH + addr.GetPath();
- else
- p = ATSPI_NULL_PATH;
- dbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
- p,
+ std::string path = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
+
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
+ path,
AtspiDbusInterfaceEventWindow,
name,
"",
{
if(!IsUp()) return;
const char* stateName = nullptr;
+
switch(state)
{
case State::INVALID:
break;
}
}
+
if(stateName)
{
auto addr = obj->GetAddress();
- std::string p;
- if(addr)
- p = ATSPI_PREFIX_PATH + addr.GetPath();
- else
- p = ATSPI_NULL_PATH;
- dbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
- p,
+ std::string path = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
+
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
+ path,
AtspiDbusInterfaceEventObject,
"StateChanged",
stateName,
void BridgeObject::EmitBoundsChanged(Accessible* obj, Dali::Rect<> rect)
{
- if(!allowObjectBoundsChangedEvent) return;
+ if(!IsBoundsChangedEventAllowed) return;
+
+ auto addr = obj->GetAddress();
+ std::string path = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
- auto addr = obj->GetAddress();
- const auto prefixPath = "/org/a11y/atspi/accessible/";
- const auto nullPath = "/org/a11y/atspi/null";
- std::string p;
- if(addr)
- p = prefixPath + addr.GetPath();
- else
- p = nullPath;
DBus::EldbusVariant<std::tuple<int32_t, int32_t, int32_t, int32_t> > tmp{
std::tuple<int32_t, int32_t, int32_t, int32_t>{rect.x, rect.y, rect.width, rect.height}};
- addFilteredEvent(FilteredEvents::boundsChanged, obj, 1.0f, [=]() {
- dbusServer.emit2<std::string, int, int, DBus::EldbusVariant<std::tuple<int32_t, int32_t, int32_t, int32_t> >, Address>(
- p,
+
+ AddFilteredEvent(FilteredEvents::BOUNDS_CHANGED, obj, 1.0f, [=]() {
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<std::tuple<int32_t, int32_t, int32_t, int32_t> >, Address>(
+ path,
AtspiDbusInterfaceEventObject,
"BoundsChanged",
"",
void BridgeObject::EmitCursorMoved(Accessible* obj, unsigned int cursorPosition)
{
auto addr = obj->GetAddress();
- std::string p = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
- dbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
- p,
+ std::string path = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
+
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
+ path,
AtspiDbusInterfaceEventObject,
"TextCaretMoved",
"",
break;
}
}
+
if(stateName)
{
auto addr = obj->GetAddress();
- std::string p = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
- dbusServer.emit2<std::string, int, int, DBus::EldbusVariant<std::string>, Address>(
- p,
+ std::string path = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
+
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<std::string>, Address>(
+ path,
AtspiDbusInterfaceEventObject,
"TextChanged",
stateName,
void BridgeObject::EmitMovedOutOfScreen(Accessible* obj, ScreenRelativeMoveType type)
{
auto addr = obj->GetAddress();
- std::string p = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
- dbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
- p,
+ std::string path = addr ? ATSPI_PREFIX_PATH + addr.GetPath() : ATSPI_NULL_PATH;
+
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
+ path,
AtspiDbusInterfaceEventObject,
"MoveOuted",
"",
AddFunctionToInterface(desc, "SelectAll", &BridgeSelection::SelectAll);
AddFunctionToInterface(desc, "ClearSelection", &BridgeSelection::ClearSelection);
AddFunctionToInterface(desc, "DeselectChild", &BridgeSelection::DeselectChild);
- dbusServer.addInterface("/", desc, true);
+ mDbusServer.addInterface("/", desc, true);
}
Selection* BridgeSelection::FindSelf() const
{
- auto s = BridgeBase::FindSelf();
- assert(s);
- auto s2 = dynamic_cast<Selection*>(s);
- if(!s2)
- throw std::domain_error{"object " + s->GetAddress().ToString() + " doesn't have Selection interface"};
- return s2;
+ auto self = BridgeBase::FindSelf();
+ assert(self);
+ auto selectionInterface = dynamic_cast<Selection*>(self);
+ if(!selectionInterface)
+ {
+ throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Selection interface"};
+ }
+ return selectionInterface;
}
DBus::ValueOrError<int32_t> BridgeSelection::GetSelectedChildrenCount()
AddFunctionToInterface(desc, "GetSelection", &BridgeText::GetRangeOfSelection);
AddFunctionToInterface(desc, "SetSelection", &BridgeText::SetRangeOfSelection);
AddFunctionToInterface(desc, "RemoveSelection", &BridgeText::RemoveSelection);
- dbusServer.addInterface("/", desc, true);
+ mDbusServer.addInterface("/", desc, true);
}
Text* BridgeText::FindSelf() const
{
auto self = BridgeBase::FindSelf();
assert(self);
- auto textObject = dynamic_cast<Text*>(self);
- if(!textObject)
+ auto textInterface = dynamic_cast<Text*>(self);
+ if(!textInterface)
{
throw std::domain_error{"Object " + self->GetAddress().ToString() + " doesn't have Text interface"};
}
- return textObject;
+ return textInterface;
}
DBus::ValueOrError<std::string> BridgeText::GetText(int startOffset, int endOffset)
AddGetPropertyToInterface(desc, "MaximumValue", &BridgeValue::GetMaximumValue);
AddGetPropertyToInterface(desc, "MinimumIncrement", &BridgeValue::GetMinimumIncrement);
AddGetPropertyToInterface(desc, "MinimumValue", &BridgeValue::GetMinimumValue);
- dbusServer.addInterface("/", desc, true);
+ mDbusServer.addInterface("/", desc, true);
}
Value* BridgeValue::FindSelf() const
{
- auto s = BridgeBase::FindSelf();
- assert(s);
- auto s2 = dynamic_cast<Value*>(s);
- if(!s2)
- throw std::domain_error{"object " + s->GetAddress().ToString() + " doesn't have Value interface"};
- return s2;
+ auto self = BridgeBase::FindSelf();
+ assert(self);
+ auto valueInterface = dynamic_cast<Value*>(self);
+ if(!valueInterface)
+ {
+ throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Value interface"};
+ }
+ return valueInterface;
}
+
double BridgeValue::GetCurrentValue()
{
return FindSelf()->GetCurrent();
}
-void BridgeValue::SetCurrentValue(double new_value)
+
+void BridgeValue::SetCurrentValue(double newValue)
{
- FindSelf()->SetCurrent(new_value);
+ FindSelf()->SetCurrent(newValue);
}
+
double BridgeValue::GetMaximumValue()
{
return FindSelf()->GetMaximum();
}
+
double BridgeValue::GetMinimumIncrement()
{
return FindSelf()->GetMinimumIncrement();
}
+
double BridgeValue::GetMinimumValue()
{
return FindSelf()->GetMinimum();
public:
double GetCurrentValue();
- void SetCurrentValue(double new_value);
+ void SetCurrentValue(double newValue);
double GetMaximumValue();
double GetMinimumIncrement();
double GetMinimumValue();
using namespace Dali::Accessibility;
-bool Component::IsAccessibleContainedAtPoint(Point point, Dali::Accessibility::CoordinateType type)
+bool Component::IsAccessibleContainingPoint(Point point, Dali::Accessibility::CoordinateType type)
{
auto extents = GetExtents(type);
return point.x >= extents.x && point.y >= extents.y && point.x <= extents.x + extents.width && point.y <= extents.y + extents.height;
for(auto childIt = children.rbegin(); childIt != children.rend(); childIt++)
{
auto component = dynamic_cast<Component*>(*childIt);
- if(component && component->IsAccessibleContainedAtPoint(point, type))
+ if(component && component->IsAccessibleContainingPoint(point, type))
{
return component;
}
return false;
}
-bool Accessibility::Component::IsAccessibleContainedAtPoint(Point point, CoordinateType type)
+bool Accessibility::Component::IsAccessibleContainingPoint(Point point, CoordinateType type)
{
return false;
}
{
Impl()
{
+#ifdef DALI_ELDBUS_AVAILABLE
Eldbus_Object* eldbus_obj;
eldbus_init();
cbhm_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
eldbus_proxy = eldbus_proxy_get(eldbus_obj, CBHM_DBUS_INTERFACE);
eldbus_name_owner_changed_callback_add(cbhm_conn, CBHM_DBUS_INTERFACE, NULL, cbhm_conn, EINA_TRUE);
eldbus_proxy_signal_handler_add(eldbus_proxy, "ItemClicked", _on_item_clicked, this);
+#endif // DALI_ELDBUS_AVAILABLE
mVisible = false;
mIsFirstTimeHidden = true;
}
~Impl()
{
+#ifdef DALI_ELDBUS_AVAILABLE
if(cbhm_conn)
eldbus_connection_unref(cbhm_conn);
eldbus_shutdown();
+#endif // DALI_ELDBUS_AVAILABLE
}
+#ifdef DALI_ELDBUS_AVAILABLE
Eldbus_Proxy* cbhm_proxy_get()
{
return eldbus_proxy;
{
return cbhm_conn;
}
+#endif // DALI_ELDBUS_AVAILABLE
void SetItem(const std::string& itemData)
{
int GetCount()
{
+#ifdef DALI_ELDBUS_AVAILABLE
Eldbus_Message *reply, *req;
const char * errname = NULL, *errmsg = NULL;
- int count = -1;
+#endif // DALI_ELDBUS_AVAILABLE
+ int count = -1;
+#ifdef DALI_ELDBUS_AVAILABLE
if(!(req = eldbus_proxy_method_call_new(eldbus_proxy, "CbhmGetCount")))
{
DALI_LOG_ERROR("Failed to create method call on org.freedesktop.DBus.Properties.Get");
eldbus_message_unref(req);
eldbus_message_unref(reply);
DALI_LOG_ERROR("cbhm item count(%d)", count);
+#endif // DALI_ELDBUS_AVAILABLE
return count;
}
void ShowClipboard()
{
+#ifdef DALI_ELDBUS_AVAILABLE
eldbus_proxy_call(cbhm_proxy_get(), "CbhmShow", NULL, NULL, -1, "s", "0");
+#endif // DALI_ELDBUS_AVAILABLE
mIsFirstTimeHidden = true;
mVisible = true;
}
mIsFirstTimeHidden = false;
return;
}
+#ifdef DALI_ELDBUS_AVAILABLE
eldbus_proxy_call(cbhm_proxy_get(), "CbhmHide", NULL, NULL, -1, "");
+#endif // DALI_ELDBUS_AVAILABLE
mIsFirstTimeHidden = false;
mVisible = false;
}
return mVisible;
}
+#ifdef DALI_ELDBUS_AVAILABLE
static void _on_item_clicked(void* data, const Eldbus_Message* msg EINA_UNUSED)
{
static_cast<Clipboard::Impl*>(data)->RequestItem();
Eldbus_Proxy* eldbus_proxy;
Eldbus_Connection* cbhm_conn;
+#endif // DALI_ELDBUS_AVAILABLE
std::string mSendBuffer;
bool mVisible;
if(newBlendState->colorBlendOp == newBlendState->alphaBlendOp)
{
gl.BlendEquation(GLBlendOp(newBlendState->colorBlendOp));
+ if(newBlendState->colorBlendOp >= Graphics::ADVANCED_BLEND_OPTIONS_START)
+ {
+ gl.BlendBarrier();
+ }
}
else
{
glBlendOp = GL_MAX;
break;
}
+ case Graphics::BlendOp::MULTIPLY:
+ {
+ glBlendOp = GL_MULTIPLY;
+ break;
+ }
+ case Graphics::BlendOp::SCREEN:
+ {
+ glBlendOp = GL_SCREEN;
+ break;
+ }
+ case Graphics::BlendOp::OVERLAY:
+ {
+ glBlendOp = GL_OVERLAY;
+ break;
+ }
+ case Graphics::BlendOp::DARKEN:
+ {
+ glBlendOp = GL_DARKEN;
+ break;
+ }
+ case Graphics::BlendOp::LIGHTEN:
+ {
+ glBlendOp = GL_LIGHTEN;
+ break;
+ }
+ case Graphics::BlendOp::COLOR_DODGE:
+ {
+ glBlendOp = GL_COLORDODGE;
+ break;
+ }
+ case Graphics::BlendOp::COLOR_BURN:
+ {
+ glBlendOp = GL_COLORBURN;
+ break;
+ }
+ case Graphics::BlendOp::HARD_LIGHT:
+ {
+ glBlendOp = GL_HARDLIGHT;
+ break;
+ }
+ case Graphics::BlendOp::SOFT_LIGHT:
+ {
+ glBlendOp = GL_SOFTLIGHT;
+ break;
+ }
+ case Graphics::BlendOp::DIFFERENCE:
+ {
+ glBlendOp = GL_DIFFERENCE;
+ break;
+ }
+ case Graphics::BlendOp::EXCLUSION:
+ {
+ glBlendOp = GL_EXCLUSION;
+ break;
+ }
+ case Graphics::BlendOp::HUE:
+ {
+ glBlendOp = GL_HSL_HUE;
+ break;
+ }
+ case Graphics::BlendOp::SATURATION:
+ {
+ glBlendOp = GL_HSL_SATURATION;
+ break;
+ }
+ case Graphics::BlendOp::COLOR:
+ {
+ glBlendOp = GL_HSL_COLOR;
+ break;
+ }
+ case Graphics::BlendOp::LUMINOSITY:
+ {
+ glBlendOp = GL_HSL_LUMINOSITY;
+ break;
+ }
}
}
return image;
}
-NativeImageSourceAndroid::NativeImageSourceAndroid(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource)
+NativeImageSourceAndroid::NativeImageSourceAndroid( uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource )
: mWidth(width),
- mHeight(height),
+ mHeight(height ),
mOwnPixmap(true),
mPixmap(NULL),
mBlendingRequired(false),
mColorDepth(depth),
mEglImageKHR(NULL),
- mEglImageExtensions(NULL)
+ mEglImageExtensions(NULL),
+ mResourceDestructionCallback()
{
DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
mEglImageExtensions->DestroyImageKHR(mEglImageKHR);
mEglImageKHR = NULL;
+
+ if(mResourceDestructionCallback)
+ {
+ mResourceDestructionCallback->Trigger();
+ }
}
uint32_t NativeImageSourceAndroid::TargetTexture()
return false;
}
+void NativeImageSourceAndroid::SetResourceDestructionCallback(EventThreadCallback* callback)
+{
+ mResourceDestructionCallback = std::unique_ptr<EventThreadCallback>(callback);
+}
+
} // namespace Adaptor
} // namespace Internal
*/
bool ReleaseBuffer() override;
+ /**
+ * @copydoc Dali::NativeImageSource::SetResourceDestructionCallback()
+ */
+ void SetResourceDestructionCallback(EventThreadCallback* callback) override;
+
private:
/**
* Private constructor; @see NativeImageSource::New()
void GetPixmapDetails();
private:
- uint32_t mWidth; ///< image width
- uint32_t mHeight; ///< image heights
- bool mOwnPixmap; ///< Whether we created pixmap or not
- AHardwareBuffer* mPixmap; ///<
- bool mBlendingRequired; ///< Whether blending is required
- Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image
- void* mEglImageKHR; ///< From EGL extension
- EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions
+ uint32_t mWidth; ///< image width
+ uint32_t mHeight; ///< image heights
+ bool mOwnPixmap; ///< Whether we created pixmap or not
+ AHardwareBuffer* mPixmap; ///<
+ bool mBlendingRequired; ///< Whether blending is required
+ Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image
+ void* mEglImageKHR; ///< From EGL extension
+ EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions
+ std::unique_ptr<EventThreadCallback> mResourceDestructionCallback; ///< The Resource Destruction Callback
};
} // namespace Adaptor
// INTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/bitmap-saver.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
+#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
+
namespace Dali
{
virtual bool ReleaseBuffer() = 0;
/**
+ * @brief Dali::DevelNativeImageSource::SetResourceDestructionCallback()
+ */
+ virtual void SetResourceDestructionCallback(EventThreadCallback* callback) = 0;
+
+ /**
* @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& )
*/
inline bool EncodeToFile(const std::string& filename) const
unsigned int height,
Dali::NativeImageSource::ColorDepth depth,
Any nativeImageSource)
-: mImage(MakeRef<CGImageRef>(nullptr))
+: mImage(MakeRef<CGImageRef>(nullptr)),
+ mResourceDestructionCallback()
{
DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
DALI_ASSERT_ALWAYS(nativeImageSource.Empty());
return false;
}
+void NativeImageSourceCocoa::SetResourceDestructionCallback(EventThreadCallback* callback)
+{
+ mResourceDestructionCallback = std::unique_ptr<EventThreadCallback>(callback);
+}
+
} // namespace Dali::Internal::Adaptor
*/
bool ReleaseBuffer() override;
+ /**
+ * @copydoc Dali::NativeImageSource::SetResourceDestructionCallback()
+ */
+ void SetResourceDestructionCallback(EventThreadCallback* callback) override;
+
private:
/**
* Private constructor; @see NativeImageSource::New()
private:
CFRef<CGImageRef> mImage;
+ std::unique_ptr<EventThreadCallback> mResourceDestructionCallback; ///< The Resource Destruction Callback
};
} // namespace Dali::Internal::Adaptor
mEglImageExtensions(NULL),
mSetSource(false),
mMutex(),
- mIsBufferAcquired(false)
+ mIsBufferAcquired(false),
+ mResourceDestructionCallback()
+
{
DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
mEglImageKHR = NULL;
}
+
+ if(mResourceDestructionCallback)
+ {
+ mResourceDestructionCallback->Trigger();
+ }
}
uint32_t NativeImageSourceTizen::TargetTexture()
return ret;
}
+void NativeImageSourceTizen::SetResourceDestructionCallback(EventThreadCallback* callback)
+{
+ mResourceDestructionCallback = std::unique_ptr<EventThreadCallback>(callback);
+}
+
} // namespace Adaptor
} // namespace Internal
*/
bool ReleaseBuffer() override;
+ /**
+ * @copydoc Dali::NativeImageSource::SetResourceDestructionCallback()
+ */
+ void SetResourceDestructionCallback(EventThreadCallback* callback) override;
+
private:
/**
* Private constructor; @see NativeImageSource::New()
void DestroySurface();
private:
- uint32_t mWidth; ///< image width
- uint32_t mHeight; ///< image height
- bool mOwnTbmSurface; ///< Whether we created pixmap or not
- tbm_surface_h mTbmSurface;
- tbm_format mTbmFormat;
- bool mBlendingRequired; ///< Whether blending is required
- Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image
- void* mEglImageKHR; ///< From EGL extension
- EglGraphics* mEglGraphics; ///< EGL Graphics
- EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions
- bool mSetSource;
- mutable Dali::Mutex mMutex;
- bool mIsBufferAcquired; ///< Whether AcquireBuffer is called
+ uint32_t mWidth; ///< image width
+ uint32_t mHeight; ///< image height
+ bool mOwnTbmSurface; ///< Whether we created pixmap or not
+ tbm_surface_h mTbmSurface;
+ tbm_format mTbmFormat;
+ bool mBlendingRequired; ///< Whether blending is required
+ Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image
+ void* mEglImageKHR; ///< From EGL extension
+ EglGraphics* mEglGraphics; ///< EGL Graphics
+ EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions
+ bool mSetSource;
+ mutable Dali::Mutex mMutex;
+ bool mIsBufferAcquired; ///< Whether AcquireBuffer is called
+ std::unique_ptr<EventThreadCallback> mResourceDestructionCallback; ///< The Resource Destruction Callback
};
} // namespace Adaptor
mBlendingRequired(false),
mColorDepth(depth),
mEglImageKHR(NULL),
- mEglImageExtensions(NULL)
+ mEglImageExtensions(NULL),
+ mResourceDestructionCallback()
{
DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
mEglImageExtensions->DestroyImageKHR(mEglImageKHR);
mEglImageKHR = NULL;
+
+ if(mResourceDestructionCallback)
+ {
+ mResourceDestructionCallback->Trigger();
+ }
}
uint32_t NativeImageSourceX::TargetTexture()
return false;
}
+void NativeImageSourceX::SetResourceDestructionCallback(EventThreadCallback* callback)
+{
+ mResourceDestructionCallback = std::unique_ptr<EventThreadCallback>(callback);
+}
+
} // namespace Adaptor
} // namespace Internal
*/
bool ReleaseBuffer() override;
+ /**
+ * @copydoc Dali::NativeImageSource::SetResourceDestructionCallback()
+ */
+ void SetResourceDestructionCallback(EventThreadCallback* callback) override;
+
private:
/**
* Private constructor; @see NativeImageSource::New()
void GetPixmapDetails();
private:
- uint32_t mWidth; ///< image width
- uint32_t mHeight; ///< image heights
- bool mOwnPixmap; ///< Whether we created pixmap or not
- Ecore_X_Pixmap mPixmap; ///< From Xlib
- bool mBlendingRequired; ///< Whether blending is required
- Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image
- void* mEglImageKHR; ///< From EGL extension
- EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions
+ uint32_t mWidth; ///< image width
+ uint32_t mHeight; ///< image heights
+ bool mOwnPixmap; ///< Whether we created pixmap or not
+ Ecore_X_Pixmap mPixmap; ///< From Xlib
+ bool mBlendingRequired; ///< Whether blending is required
+ Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image
+ void* mEglImageKHR; ///< From EGL extension
+ EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions
+ std::unique_ptr<EventThreadCallback> mResourceDestructionCallback; ///< The Resource Destruction Callback
};
} // namespace Adaptor
mBlendingRequired(false),
mColorDepth(depth),
mEglImageKHR(NULL),
- mEglImageExtensions(NULL)
+ mEglImageExtensions(NULL),
+ mResourceDestructionCallback()
{
DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
mEglImageExtensions->DestroyImageKHR(mEglImageKHR);
mEglImageKHR = NULL;
+
+ if(mResourceDestructionCallback)
+ {
+ mResourceDestructionCallback->Trigger();
+ }
}
unsigned int NativeImageSourceWin::TargetTexture()
return false;
}
+void NativeImageSourceWin::SetResourceDestructionCallback(EventThreadCallback* callback)
+{
+ mResourceDestructionCallback = std::unique_ptr<EventThreadCallback>(callback);
+}
+
} // namespace Adaptor
} // namespace Internal
*/
bool ReleaseBuffer() override;
+ /**
+ * @copydoc Dali::NativeImageSource::SetResourceDestructionCallback()
+ */
+ void SetResourceDestructionCallback(EventThreadCallback* callback) override;
+
private:
/**
* Private constructor; @see NativeImageSource::New()
void GetPixmapDetails();
private:
- unsigned int mWidth; ///< image width
- unsigned int mHeight; ///< image heights
- bool mOwnPixmap; ///< Whether we created pixmap or not
- unsigned int mPixmap; ///< From Windows
- bool mBlendingRequired; ///< Whether blending is required
- Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image
- void* mEglImageKHR; ///< From EGL extension
- EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions
+ unsigned int mWidth; ///< image width
+ unsigned int mHeight; ///< image heights
+ bool mOwnPixmap; ///< Whether we created pixmap or not
+ unsigned int mPixmap; ///< From Windows
+ bool mBlendingRequired; ///< Whether blending is required
+ Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image
+ void* mEglImageKHR; ///< From EGL extension
+ EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions
+ std::unique_ptr<EventThreadCallback> mResourceDestructionCallback; ///< The Resource Destruction Callback
};
} // namespace Adaptor
mPlugin->Destroy();
}
-Dali::NativeImageInterfacePtr WebEngine::GetNativeImageSource()
+Dali::NativeImageSourcePtr WebEngine::GetNativeImageSource()
{
return mPlugin->GetNativeImageSource();
}
/**
* @copydoc Dali::WebEngine::GetNativeImageSource()
*/
- Dali::NativeImageInterfacePtr GetNativeImageSource();
+ Dali::NativeImageSourcePtr GetNativeImageSource();
/**
* @copydoc Dali::WebEngine::GetSettings()
return;
}
+ mGraphics->ActivateSurfaceContext(this);
+
EGLint bufferAge = eglImpl.GetBufferAge(mEGLSurface);
// Buffer age 0 means the back buffer in invalid and requires full swap
const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
+#ifdef DALI_ELDBUS_AVAILABLE
// DBUS accessibility
const char* BUS = "org.enlightenment.wm-screen-reader";
const char* INTERFACE = "org.tizen.GestureNavigation";
const char* PATH = "/org/tizen/GestureNavigation";
+#endif // DALI_ELDBUS_AVAILABLE
struct KeyCodeMap
{
mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
}
+#ifdef DALI_ELDBUS_AVAILABLE
void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message)
{
-#ifdef DALI_ELDBUS_AVAILABLE
AccessibilityInfo info;
// The string defines the arg-list's respective types.
}
mAccessibilitySignal.Emit(info);
-#endif
}
+#endif // DALI_ELDBUS_AVAILABLE
void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
{
{
const unsigned int ADAPTOR_MAJOR_VERSION = 2;
const unsigned int ADAPTOR_MINOR_VERSION = 0;
-const unsigned int ADAPTOR_MICRO_VERSION = 45;
+const unsigned int ADAPTOR_MICRO_VERSION = 47;
const char* const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-adaptor
Summary: The DALi Tizen Adaptor
-Version: 2.0.45
+Version: 2.0.47
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT
cmake_flags+=" -DENABLE_TRACE=ON"
%endif
+%if 0%{?enable_logging}
+cmake_flags+=" -DENABLE_NETWORK_LOGGING=ON"
+%endif
+
libtoolize --force
cd %{_builddir}/%{name}-%{version}/build/tizen