namespace Accessibility
{
class Accessible;
+class ProxyAccessible;
/**
* @brief Base class for different accessibility bridges.
virtual void UnembedSocket(const Address& plug, const Address& socket) = 0;
/**
+ * @brief Calls socket.SetOffset(x, y) via D-Bus.
+ *
+ * The "SetOffset" D-Bus method is a DALi extension. It can be used to inform a DALi widget about
+ * its position on the screen.
+ *
+ * @param[in] socket The socket
+ * @param[in] x Horizontal offset
+ * @param[in] y Vertical offset
+ *
+ * @note Remote object pointed to by 'socket' must implement 'org.a11y.atspi.Socket'.
+ * @see EmbedSocket()
+ * @see SetExtentsOffset()
+ */
+ virtual void SetSocketOffset(ProxyAccessible* socket, std::int32_t x, std::int32_t y) = 0;
+
+ /**
+ * @brief Sets the global extents offset.
+ *
+ * This offset will be added during serialization of GetExtents() return value to D-Bus.
+ * Local calls to GetExtents() are unaffected.
+ *
+ * @param[in] x Horizontal offset
+ * @param[in] y Vertical offset
+ *
+ * @see SetSocketOffset()
+ * @see Dali::Accessibility::Component::GetExtents()
+ */
+ virtual void SetExtentsOffset(std::int32_t x, std::int32_t y) = 0;
+
+ /**
* @brief Sets the preferred bus name.
*
* If the Bridge is enabled, it will immediately release the previous name and request the new one.
Bridge* mBridge = nullptr;
Actor mHighlightActor;
Actor mCurrentlyHighlightedActor;
+ std::pair<std::int32_t, std::int32_t> mExtentsOffset{0, 0};
};
std::shared_ptr<Data> mData;
friend class Accessible;
virtual void Unembed(Address plug) = 0;
/**
+ * @brief Set the offset (position information).
+ *
+ * @param[in] x Horizontal offset
+ * @param[in] y Vertical offset
+ */
+ virtual void SetOffset(std::int32_t x, std::int32_t y) = 0;
+
+ /**
* @brief Downcasts an Accessible to a Socket.
*
* @param obj The Accessible
Accessible* deputy = nullptr;
auto accessible = FindSelf();
auto cType = static_cast<CoordinateType>(coordinateType);
+
+ x -= mData->mExtentsOffset.first;
+ y -= mData->mExtentsOffset.second;
+
LOG() << "GetNavigableAtPoint: " << x << ", " << y << " type: " << coordinateType;
auto component = CalculateNavigableAccessibleAtPoint(accessible, {x, y}, cType, GET_NAVIGABLE_AT_POINT_MAX_RECURSION_DEPTH);
bool recurse = false;
tickTimer = Dali::Timer::New(100);
tickTimer.TickSignal().Connect(this, &BridgeBase::TickFilteredEvents);
}
+
+ if(!tickTimer.IsRunning())
+ {
+ tickTimer.Start();
+ }
}
bool BridgeBase::TickFilteredEvents()
{
mIsEmbedded = false;
mParent.SetAddress({});
+ Dali::Accessibility::Bridge::GetCurrentBridge()->SetExtentsOffset(0, 0);
}
}
+ void SetOffset(std::int32_t x, std::int32_t y) override
+ {
+ if(!mIsEmbedded)
+ {
+ return;
+ }
+
+ Dali::Accessibility::Bridge::GetCurrentBridge()->SetExtentsOffset(x, y);
+ }
+
// Component
Dali::Rect<> GetExtents(Dali::Accessibility::CoordinateType type) const override
*/
enum class FilteredEvents
{
- BOUNDS_CHANGED ///< Bounds changed
+ BOUNDS_CHANGED, ///< Bounds changed
+ SET_OFFSET, ///< Set offset
};
// Custom specialization of std::hash
DBus::ValueOrError<std::tuple<int32_t, int32_t, int32_t, int32_t> > BridgeComponent::GetExtents(uint32_t coordType)
{
auto rect = FindSelf()->GetExtents(static_cast<CoordinateType>(coordType));
+
+ rect.x += mData->mExtentsOffset.first;
+ rect.y += mData->mExtentsOffset.second;
+
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 rect = FindSelf()->GetExtents(static_cast<CoordinateType>(coordType));
+
+ rect.x += mData->mExtentsOffset.first;
+ rect.y += mData->mExtentsOffset.second;
+
return {static_cast<int32_t>(rect.x), static_cast<int32_t>(rect.y)};
}
client.method<void(Address)>("Unembed").call(plug);
}
+ void SetSocketOffset(ProxyAccessible* socket, std::int32_t x, std::int32_t y) override
+ {
+ AddFilteredEvent(FilteredEvents::SET_OFFSET, socket, 1.0f, [=]() {
+ auto client = CreateSocketClient(socket->GetAddress());
+
+ client.method<void(std::int32_t, std::int32_t)>("SetOffset").asyncCall([](DBus::ValueOrError<void>) {}, x, y);
+ });
+ }
+
+ void SetExtentsOffset(std::int32_t x, std::int32_t y) override
+ {
+ if(mData)
+ {
+ mData->mExtentsOffset = {x, y};
+ }
+ }
+
void SetPreferredBusName(std::string_view preferredBusName) override
{
if(preferredBusName == mPreferredBusName)
AddFunctionToInterface(desc, "Embed", &BridgeSocket::Embed);
AddFunctionToInterface(desc, "Unembed", &BridgeSocket::Unembed);
+ AddFunctionToInterface(desc, "SetOffset", &BridgeSocket::SetOffset);
mDbusServer.addInterface("/", desc, true);
}
FindSelf()->Unembed(plug);
return {};
}
+
+DBus::ValueOrError<void> BridgeSocket::SetOffset(std::int32_t x, std::int32_t y)
+{
+ FindSelf()->SetOffset(x, y);
+ return {};
+}
* @copydoc Dali::Accessibility::Socket::Unembed()
*/
DBus::ValueOrError<void> Unembed(Dali::Accessibility::Address plug);
+
+ /**
+ * @copydoc Dali::Accessibility::Socket::SetOffset()
+ */
+ DBus::ValueOrError<void> SetOffset(std::int32_t x, std::int32_t y);
};
#endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_SOCKET_H
{
}
+ void SetSocketOffset(ProxyAccessible* socket, std::int32_t x, std::int32_t y) override
+ {
+ }
+
+ void SetExtentsOffset(std::int32_t x, std::int32_t y) override
+ {
+ }
+
void SetPreferredBusName(std::string_view preferredBusName) override
{
}