* @param[in] newValue Whether the state value is changed to new value or not.
* @param[in] reserved Reserved. (Currently, this argument is not implemented in dali)
**/
- virtual void EmitStateChanged(Accessible* obj, State state, int newValue, int reserved = 0) = 0;
+ virtual void EmitStateChanged(std::shared_ptr<Accessible> obj, State state, int newValue, int reserved = 0) = 0;
/**
* @brief Emits window event on at-spi bus.
* @param[in] obj The accessible object
* @param[in] event Property changed event
**/
- virtual void Emit(Accessible* obj, ObjectPropertyChangeEvent event) = 0;
+ virtual void Emit(std::shared_ptr<Accessible> obj, ObjectPropertyChangeEvent event) = 0;
/**
* @brief Emits bounds-changed event on at-spi bus.
* @param[in] obj The accessible object
* @param[in] rect The rectangle for changed bounds
**/
- virtual void EmitBoundsChanged(Accessible* obj, Rect<> rect) = 0;
+ virtual void EmitBoundsChanged(std::shared_ptr<Accessible> obj, Rect<> rect) = 0;
/**
* @brief Emits org.a11y.atspi.Event.Window.PostRender on the AT-SPI bus.
* The actual number of events emitted during a given time interval may be smaller
* than the number of calls to this method, but at least one is guaranteed.
*/
- virtual void EmitPostRender(Accessible* obj) = 0;
+ virtual void EmitPostRender(std::shared_ptr<Accessible> obj) = 0;
/**
* @brief Emits key event on at-spi bus.
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
if(auto bridgeData = GetBridgeData())
{
- bridgeData->mBridge->EmitStateChanged(this, state, newValue, reserved);
+ bridgeData->mBridge->EmitStateChanged(shared_from_this(), state, newValue, reserved);
}
}
{
if(auto bridgeData = GetBridgeData())
{
- bridgeData->mBridge->EmitStateChanged(this, State::SHOWING, isShowing ? 1 : 0, 0);
+ bridgeData->mBridge->EmitStateChanged(shared_from_this(), State::SHOWING, isShowing ? 1 : 0, 0);
}
}
{
if(auto bridgeData = GetBridgeData())
{
- bridgeData->mBridge->EmitStateChanged(this, State::VISIBLE, isVisible ? 1 : 0, 0);
+ bridgeData->mBridge->EmitStateChanged(shared_from_this(), State::VISIBLE, isVisible ? 1 : 0, 0);
}
}
{
if(auto bridgeData = GetBridgeData())
{
- bridgeData->mBridge->EmitStateChanged(this, State::HIGHLIGHTED, isHighlighted ? 1 : 0, 0);
+ bridgeData->mBridge->EmitStateChanged(shared_from_this(), State::HIGHLIGHTED, isHighlighted ? 1 : 0, 0);
}
}
{
if(auto bridgeData = GetBridgeData())
{
- bridgeData->mBridge->EmitStateChanged(this, State::FOCUSED, isFocused ? 1 : 0, 0);
+ bridgeData->mBridge->EmitStateChanged(shared_from_this(), State::FOCUSED, isFocused ? 1 : 0, 0);
}
}
void Accessible::EmitTextInserted(unsigned int position, unsigned int length, const std::string& content)
{
if(auto bridgeData = GetBridgeData())
{
- bridgeData->mBridge->Emit(this, event);
+ bridgeData->mBridge->Emit(shared_from_this(), event);
}
}
{
if(auto bridgeData = GetBridgeData())
{
- bridgeData->mBridge->EmitBoundsChanged(this, rect);
+ bridgeData->mBridge->EmitBoundsChanged(shared_from_this(), rect);
}
}
auto index = static_cast<Dali::Accessibility::State>(i);
if(states[index])
{
- data->mBridge->EmitStateChanged(this, index, GetStates()[index], 0);
+ data->mBridge->EmitStateChanged(shared_from_this(), index, GetStates()[index], 0);
}
}
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{"", "root"});
}
-void BridgeObject::Emit(Accessible* obj, ObjectPropertyChangeEvent event)
+void BridgeObject::Emit(std::shared_ptr<Accessible> obj, ObjectPropertyChangeEvent event)
{
static const std::unordered_map<ObjectPropertyChangeEvent, std::string_view> eventMap{
{ObjectPropertyChangeEvent::NAME, "accessible-name"},
if(eventName != eventMap.end())
{
- AddCoalescableMessage(static_cast<CoalescableMessages>(static_cast<int>(CoalescableMessages::PROPERTY_CHANGED_BEGIN) + static_cast<int>(event)), obj, 1.0f, [=]() {
- mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
- GetAccessiblePath(obj),
- Accessible::GetInterfaceName(AtspiInterface::EVENT_OBJECT),
- "PropertyChange",
- std::string{eventName->second},
- 0,
- 0,
- {0},
- {"", "root"});
+ AddCoalescableMessage(static_cast<CoalescableMessages>(static_cast<int>(CoalescableMessages::PROPERTY_CHANGED_BEGIN) + static_cast<int>(event)), obj.get(), 1.0f, [weakObj = std::weak_ptr<Accessible>(obj), eventName, this]() {
+ if(auto obj = weakObj.lock())
+ {
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
+ GetAccessiblePath(obj.get()),
+ Accessible::GetInterfaceName(AtspiInterface::EVENT_OBJECT),
+ "PropertyChange",
+ std::string{eventName->second},
+ 0,
+ 0,
+ {0},
+ {"", "root"});
+ }
});
}
}
}
}
-void BridgeObject::EmitStateChanged(Accessible* obj, State state, int newValue, int reserved)
+void BridgeObject::EmitStateChanged(std::shared_ptr<Accessible> obj, State state, int newValue, int reserved)
{
static const std::unordered_map<State, std::string_view> stateMap{
{State::INVALID, "invalid"},
if(stateName != stateMap.end())
{
- AddCoalescableMessage(static_cast<CoalescableMessages>(static_cast<int>(CoalescableMessages::STATE_CHANGED_BEGIN) + static_cast<int>(state)), obj, 1.0f, [=]() {
- mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
- GetAccessiblePath(obj),
- Accessible::GetInterfaceName(AtspiInterface::EVENT_OBJECT),
- "StateChanged",
- std::string{stateName->second},
- newValue,
- reserved,
- {0},
- {"", "root"});
+ AddCoalescableMessage(static_cast<CoalescableMessages>(static_cast<int>(CoalescableMessages::STATE_CHANGED_BEGIN) + static_cast<int>(state)), obj.get(), 1.0f, [weakObj = std::weak_ptr<Accessible>(obj), stateName, newValue, reserved, this]() {
+ if(auto obj = weakObj.lock())
+ {
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<int>, Address>(
+ GetAccessiblePath(obj.get()),
+ Accessible::GetInterfaceName(AtspiInterface::EVENT_OBJECT),
+ "StateChanged",
+ std::string{stateName->second},
+ newValue,
+ reserved,
+ {0},
+ {"", "root"});
+ }
});
}
}
-void BridgeObject::EmitBoundsChanged(Accessible* obj, Dali::Rect<> rect)
+void BridgeObject::EmitBoundsChanged(std::shared_ptr<Accessible> obj, Dali::Rect<> rect)
{
if(!IsUp() || !IsBoundsChangedEventAllowed || obj->IsHidden() || obj->GetSuppressedEvents()[AtspiEvent::BOUNDS_CHANGED])
{
return;
}
- 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}};
+ AddCoalescableMessage(CoalescableMessages::BOUNDS_CHANGED, obj.get(), 1.0f, [weakObj = std::weak_ptr<Accessible>(obj), rect = std::move(rect), this]() {
+ if(auto obj = weakObj.lock())
+ {
+ 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}};
- AddCoalescableMessage(CoalescableMessages::BOUNDS_CHANGED, obj, 1.0f, [=]() {
- mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<std::tuple<int32_t, int32_t, int32_t, int32_t> >, Address>(
- GetAccessiblePath(obj),
- Accessible::GetInterfaceName(AtspiInterface::EVENT_OBJECT),
- "BoundsChanged",
- "",
- 0,
- 0,
- tmp,
- {"", "root"});
+ mDbusServer.emit2<std::string, int, int, DBus::EldbusVariant<std::tuple<int32_t, int32_t, int32_t, int32_t> >, Address>(
+ GetAccessiblePath(obj.get()),
+ Accessible::GetInterfaceName(AtspiInterface::EVENT_OBJECT),
+ "BoundsChanged",
+ "",
+ 0,
+ 0,
+ tmp,
+ {"", "root"});
+ }
});
}
-void BridgeObject::EmitPostRender(Accessible *obj)
+void BridgeObject::EmitPostRender(std::shared_ptr<Accessible> obj)
{
if(!IsUp() || obj->IsHidden())
{
return;
}
- AddCoalescableMessage(CoalescableMessages::POST_RENDER, obj, 0.5f, [=]() {
- Emit(obj, WindowEvent::POST_RENDER);
+ AddCoalescableMessage(CoalescableMessages::POST_RENDER, obj.get(), 0.5f, [weakObj = std::weak_ptr<Accessible>(obj), this]() {
+ if(auto obj = weakObj.lock())
+ {
+ Emit(obj.get(), WindowEvent::POST_RENDER);
+ }
});
}
#define DALI_INTERNAL_ACCESSIBILITY_BRIDGE_OBJECT_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @copydoc Dali::Accessibility::Bridge::EmitStateChanged()
*/
- void EmitStateChanged(Dali::Accessibility::Accessible* obj, Dali::Accessibility::State state, int newValue, int reserved) override;
+ void EmitStateChanged(std::shared_ptr<Dali::Accessibility::Accessible> obj, Dali::Accessibility::State state, int newValue, int reserved) override;
/**
* @copydoc Dali::Accessibility::Bridge::Emit()
/**
* @copydoc Dali::Accessibility::Bridge::Emit()
*/
- void Emit(Dali::Accessibility::Accessible* obj, Dali::Accessibility::ObjectPropertyChangeEvent event) override;
+ void Emit(std::shared_ptr<Dali::Accessibility::Accessible> obj, Dali::Accessibility::ObjectPropertyChangeEvent event) override;
/**
* @copydoc Dali::Accessibility::Bridge::EmitBoundsChanged()
*/
- void EmitBoundsChanged(Dali::Accessibility::Accessible* obj, Dali::Rect<> rect) override;
+ void EmitBoundsChanged(std::shared_ptr<Dali::Accessibility::Accessible> obj, Dali::Rect<> rect) override;
/**
* @copydoc Dali::Accessibility::Bridge::EmitPostRender()
*/
- void EmitPostRender(Dali::Accessibility::Accessible* obj) override;
+ void EmitPostRender(std::shared_ptr<Dali::Accessibility::Accessible> obj) override;
/**
* @copydoc Dali::Accessibility::Bridge::EmitMovedOutOfScreen()