From 615236b99864ab8aa66665b83291105a2f774925 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Fri, 19 May 2017 19:48:06 +0900 Subject: [PATCH] Reduce action related IPC If there are more than 10 actions on an object, then more than 10 IPC occurs for doing more than 10th action. Change-Id: Ide01c3f871684163d53c52f17ac10bdd65a73a49 --- atk-adaptor/adaptors/action-adaptor.c | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/atk-adaptor/adaptors/action-adaptor.c b/atk-adaptor/adaptors/action-adaptor.c index a6c409d..b74a033 100644 --- a/atk-adaptor/adaptors/action-adaptor.c +++ b/atk-adaptor/adaptors/action-adaptor.c @@ -22,6 +22,7 @@ * Boston, MA 02111-1307, USA. */ +#include #include #include #include "bridge.h" @@ -227,6 +228,46 @@ impl_DoAction (DBusConnection * bus, DBusMessage * message, void *user_data) return NULL; } +static DBusMessage * +impl_DoActionName (DBusConnection * bus, DBusMessage * message, void *user_data) +{ + AtkAction *action = (AtkAction *) user_data; + const char *action_name = NULL; + gint count; + gint i, index = -1; + dbus_bool_t rv = TRUE; + DBusMessage *reply; + + g_return_val_if_fail (ATK_IS_ACTION (user_data), + droute_not_yet_handled_error (message)); + if (!dbus_message_get_args + (message, NULL, DBUS_TYPE_STRING, &action_name, DBUS_TYPE_INVALID)) + { + return droute_invalid_arguments_error (message); + } + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + dbus_connection_send (bus, reply, NULL); + dbus_message_unref (reply); + + count = atk_action_get_n_actions (action); + for (i = 0; i < count; i++) + { + const char *name = atk_action_get_name (action, i); + if (name && !strcmp(name, action_name)) + { + index = i; + break; + } + } + atk_action_do_action (action, index); + return NULL; +} + DRouteMethod methods[] = { {impl_get_description, "GetDescription"} , @@ -240,6 +281,8 @@ DRouteMethod methods[] = { , {impl_DoAction, "DoAction"} , + {impl_DoActionName, "DoActionName"} + , {NULL, NULL} }; -- 2.34.1