atspi accessible object has an "action" interface.
and it is used for invoking event such as "click" for an object through atspi.
this patch implement an atspi action for uiobject
Change-Id: I9289ccfb6bfd0fe994f08fd8dff57fd94603a890
*/
bool isActive() const;
+ /**
+ * @brief TBD
+ * @since_tizen 5.5
+ */
+ std::vector<std::string> getActions() const;
+
public:
/**
* @brief TBD
*/
void setValue(std::string text) const;
+ /**
+ * @brief TBD
+ * @since_tizen 5.5
+ */
+ bool doAction(std::string action) const;
+
private:
/**
* @brief TBD
* @brief TBD
* @since_tizen 5.5
*/
+ bool DoAtspiActivate() const;
+
+ /**
+ * @brief TBD
+ * @since_tizen 5.5
+ */
void refresh() const;
private:
#include "AccessibleNode.h"
#include <string.h>
#include <iostream>
+#include <vector>
#include <loguru.hpp>
#include "config.h"
NULL);
}
}
+
+std::vector<std::string> AccessibleNode::getActions() const
+{
+ std::vector<std::string> result{};
+ const char *name;
+ AtspiAction *action;
+
+ action = atspi_accessible_get_action_iface(mNode.get());
+ if (action) {
+ int a;
+ int n_actions = atspi_action_get_n_actions(action, NULL);
+
+ for (a = 0; a < n_actions; a++) {
+ char *action_name = atspi_action_get_action_name(action, a, NULL);
+ if (!action_name) continue;
+ result.push_back(std::string{action_name});
+ g_free(action_name);
+ }
+ g_object_unref(action);
+ }
+ return result;
+}
+
+bool AccessibleNode::doAction(std::string actionName) const
+{
+ const char *name;
+ AtspiAction *action;
+
+ action = atspi_accessible_get_action_iface(mNode.get());
+ if (action) {
+ int a;
+ int n_actions = atspi_action_get_n_actions(action, NULL);
+
+ for (a = 0; a < n_actions; a++) {
+ char *action_name = atspi_action_get_action_name(action, a, NULL);
+ if (!action_name) return false;
+
+ if (!strcmp(actionName.c_str(), action_name)) {
+ atspi_action_do_action(action, a, NULL);
+ g_free(action_name);
+ g_object_unref(action);
+ return true;
+ }
+ g_free(action_name);
+ }
+ g_object_unref(action);
+ }
+ return false;
+}
\ No newline at end of file
const_cast<UiDevice *>(mDevice)->click(midPoint.x, midPoint.y, intv);
}
+bool UiObject::DoAtspiActivate() const
+{
+ return mNode->doAction("activate");
+}
+
+
const AccessibleNode *UiObject::getAccessibleNode() const
{
if (mNode == nullptr) throw;
{
ObjectMapper* mObjMap = ObjectMapper::getInstance();
UiObject* obj = mObjMap->getElement(mRequest->elementid());
+ LOG_SCOPE_F(INFO, "ClickElementCommand execute %p", obj);
if (obj) {
obj->click();
{
UiDevice* obj = UiDevice::getInstance(DeviceType::DEFAULT);
const ::aurum::Point& point = mRequest->coordination();
+ LOG_SCOPE_F(INFO, "ClickCoordCommand execute %p @ (%d, %d)", obj, point.x(), point.y());
obj->click(point.x(), point.y());
mResponse->set_status(::aurum::RspStatus::OK);
return grpc::Status::OK;
::grpc::Status ClickAtspiCommand::execute()
{
- return grpc::Status::CANCELLED;
+ ObjectMapper* mObjMap = ObjectMapper::getInstance();
+ UiObject* obj = mObjMap->getElement(mRequest->elementid());
+
+ LOG_SCOPE_F(INFO, "ClickAtspiCommand execute %p", obj);
+
+ if (obj) {
+ if (obj->DoAtspiActivate()) mResponse->set_status(::aurum::RspStatus::OK);
+ else mResponse->set_status(::aurum::RspStatus::ERROR);
+ } else {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ }
+
+ return grpc::Status::OK;
}