summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2017-04-07 15:57:19 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2017-05-29 15:38:44 +0200
commit8e03d7af3bbc511d181b965f8cdcf0281a274fa6 (patch)
treeeade8e16ff7f095f69664172362e4d8248a14c16
parent99a55b439a949f200312ae4b9b727840740bf569 (diff)
downloadefl-8e03d7af3bbc511d181b965f8cdcf0281a274fa6.tar.gz
elementary: add atspi proxy class
The purpose of this class is to represent reference to accessible object in external process.
-rw-r--r--src/Makefile_Elementary.am3
-rw-r--r--src/lib/elementary/Elementary.h1
-rw-r--r--src/lib/elementary/elm_atspi_bridge.c55
-rw-r--r--src/lib/elementary/elm_atspi_bridge.eo1
-rw-r--r--src/lib/elementary/elm_atspi_proxy.c41
-rw-r--r--src/lib/elementary/elm_atspi_proxy.eo34
-rw-r--r--src/lib/elementary/elm_atspi_proxy.h8
7 files changed, 124 insertions, 19 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 234a02cb08..b6c0c6e100 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -4,6 +4,7 @@
elm_public_eolian_files = \
lib/elementary/elm_atspi_bridge.eo \
lib/elementary/elm_atspi_app_object.eo \
+ lib/elementary/elm_atspi_proxy.eo \
lib/elementary/elm_bg.eo \
lib/elementary/efl_ui_button.eo \
lib/elementary/elm_calendar.eo \
@@ -204,6 +205,7 @@ includesdir = $(includedir)/elementary-@VMAJ@
includesunstable_HEADERS = \
lib/elementary/elm_gen_common.h \
lib/elementary/elm_atspi_bridge.h \
+ lib/elementary/elm_atspi_proxy.h \
lib/elementary/elm_interface_atspi_accessible.h \
lib/elementary/elm_interface_atspi_text.h \
lib/elementary/elm_interface_atspi_widget_action.h \
@@ -551,6 +553,7 @@ lib_elementary_libelementary_la_SOURCES = \
lib/elementary/elm_actionslider.c \
lib/elementary/elm_atspi_app_object.c \
lib/elementary/elm_atspi_bridge.c \
+ lib/elementary/elm_atspi_proxy.c \
lib/elementary/elm_bg.c \
lib/elementary/elm_box.c \
lib/elementary/elm_bubble.c \
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index 4ec11f3c2c..e05cd690f1 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -190,6 +190,7 @@ EAPI extern Elm_Version *elm_version;
#include <elm_actionslider.h>
#include <elm_app.h>
#include <elm_atspi_app_object.h>
+#include <elm_atspi_proxy.h>
#include <elm_atspi_bridge.h>
#include <elm_bg.h>
#include <elm_box.h>
diff --git a/src/lib/elementary/elm_atspi_bridge.c b/src/lib/elementary/elm_atspi_bridge.c
index 7b1c17eea2..1f418d47f5 100644
--- a/src/lib/elementary/elm_atspi_bridge.c
+++ b/src/lib/elementary/elm_atspi_bridge.c
@@ -135,7 +135,7 @@ static void _text_selection_changed_send(void *data, const Efl_Event *event);
// bridge private methods
static void _bridge_object_register(Eo *bridge, Eo *obj);
static void _bridge_object_unregister(Eo *bridge, Eo *obj);
-static const char * _bridge_path_from_object(Eo *bridge, const Eo *eo);
+static void _elm_atspi_bridge_address_from_object(Eo *bridge, const Eo *eo, const char **bus, const char **path);
static void _bridge_signal_send(Eo *bridge, Eo *obj, const char *ifc, const Eldbus_Signal *signal, const char *minor, unsigned int det1, unsigned int det2, const char *variant_sig, ...);
static Eo * _bridge_object_from_path(Eo *bridge, const char *path);
static void _bridge_iter_object_reference_append(Eo *bridge, Eldbus_Message_Iter *iter, const Eo *obj);
@@ -2034,21 +2034,35 @@ _bridge_object_from_path(Eo *bridge, const char *path)
return ret;
}
-static const char *
-_bridge_path_from_object(Eo *bridge, const Eo *eo)
+static void
+_elm_atspi_bridge_address_from_object(Eo *bridge, const Eo *eo, const char **bus, const char **path)
{
- static char path[64];
+ static char buf[64];
- ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, NULL);
+ ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
if (!eo)
- return ATSPI_DBUS_PATH_NULL;
-
- if (eo == pd->root)
- snprintf(path, sizeof(path), "%s%s", ELM_ACCESS_OBJECT_PATH_PREFIX, ELM_ACCESS_OBJECT_PATH_ROOT);
+ {
+ if (bus) *bus = eldbus_connection_unique_name_get(pd->a11y_bus);
+ if (path) *path = ATSPI_DBUS_PATH_NULL;
+ }
+ else if (eo == pd->root)
+ {
+ snprintf(buf, sizeof(buf), "%s%s", ELM_ACCESS_OBJECT_PATH_PREFIX, ELM_ACCESS_OBJECT_PATH_ROOT);
+ if (bus) *bus = eldbus_connection_unique_name_get(pd->a11y_bus);
+ if (path) *path = buf;
+ }
+ else if (efl_isa(eo, ELM_ATSPI_PROXY_CLASS))
+ {
+ if (bus) *bus = elm_atspi_proxy_bus_name_get(eo);
+ if (path) *path = elm_atspi_proxy_path_get(eo);
+ }
else
- snprintf(path, sizeof(path), ELM_ACCESS_OBJECT_REFERENCE_TEMPLATE, (unsigned long long)(uintptr_t)eo);
- return path;
+ {
+ snprintf(buf, sizeof(buf), ELM_ACCESS_OBJECT_REFERENCE_TEMPLATE, (unsigned long long)(uintptr_t)eo);
+ if (bus) *bus = eldbus_connection_unique_name_get(pd->a11y_bus);
+ if (path) *path = buf;
+ }
}
static Eina_Bool
@@ -3076,11 +3090,14 @@ static const Eldbus_Service_Interface_Desc collection_iface_desc = {
static void
_bridge_iter_object_reference_append(Eo *bridge, Eldbus_Message_Iter *iter, const Eo *obj)
{
+ const char *path, *bus;
ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
Eldbus_Message_Iter *iter_struct = eldbus_message_iter_container_new(iter, 'r', NULL);
EINA_SAFETY_ON_NULL_RETURN(iter);
- const char *path = _bridge_path_from_object(bridge, obj);
- eldbus_message_iter_basic_append(iter_struct, 's', eldbus_connection_unique_name_get(pd->a11y_bus));
+
+ _elm_atspi_bridge_address_from_object(bridge, obj, &bus, &path);
+
+ eldbus_message_iter_basic_append(iter_struct, 's', bus);
eldbus_message_iter_basic_append(iter_struct, 'o', path);
eldbus_message_iter_container_close(iter, iter_struct);
}
@@ -3605,7 +3622,7 @@ _on_elm_atspi_bridge_root_register(void *data, const Eldbus_Message *msg, Eldbus
}
pd->registered = EINA_TRUE;
_elm_atspi_bridge_pending_del(bridge, pending);
- ERR("Application successfuly registered at ATSPI2 bus.");
+ DBG("Application successfuly registered at ATSPI2 bus.");
}
EAPI void
@@ -4036,7 +4053,7 @@ static void _bridge_signal_send(Eo *bridge, Eo *obj, const char *infc, const Eld
Eldbus_Message_Iter *iter , *iter_stack[64], *iter_struct;
va_list va;
Eo *atspi_obj;
- const char *path;
+ const char *path, *bus;
int top = 0;
EINA_SAFETY_ON_NULL_RETURN(infc);
@@ -4045,7 +4062,7 @@ static void _bridge_signal_send(Eo *bridge, Eo *obj, const char *infc, const Eld
EINA_SAFETY_ON_NULL_RETURN(obj);
ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
- path = _bridge_path_from_object(bridge, obj);
+ _elm_atspi_bridge_address_from_object(bridge, obj, NULL, &path);
msg = eldbus_message_signal_new(path, infc, signal->name);
if (!msg) return;
@@ -4076,7 +4093,7 @@ static void _bridge_signal_send(Eo *bridge, Eo *obj, const char *infc, const Eld
break;
case 'o':
atspi_obj = va_arg(va, Eo*);
- path = _bridge_path_from_object(bridge, atspi_obj);
+ _elm_atspi_bridge_address_from_object(bridge, atspi_obj, NULL, &path);
eldbus_message_iter_basic_append(iter_stack[top], 'o', path);
break;
case ')':
@@ -4103,8 +4120,8 @@ static void _bridge_signal_send(Eo *bridge, Eo *obj, const char *infc, const Eld
eldbus_message_iter_container_close(iter, iter_stack[0]);
iter_struct = eldbus_message_iter_container_new(iter, 'r', NULL);
- path = _bridge_path_from_object(bridge, pd->root);
- eldbus_message_iter_basic_append(iter_struct, 's', eldbus_connection_unique_name_get(pd->a11y_bus));
+ _elm_atspi_bridge_address_from_object(bridge, pd->root, &bus, &path);
+ eldbus_message_iter_basic_append(iter_struct, 's', bus);
eldbus_message_iter_basic_append(iter_struct, 'o', path);
eldbus_message_iter_container_close(iter, iter_struct);
diff --git a/src/lib/elementary/elm_atspi_bridge.eo b/src/lib/elementary/elm_atspi_bridge.eo
index 13a9fce906..3e8ef5dce5 100644
--- a/src/lib/elementary/elm_atspi_bridge.eo
+++ b/src/lib/elementary/elm_atspi_bridge.eo
@@ -33,3 +33,4 @@ class Elm.Atspi.Bridge (Efl.Object)
disconnected; [[Disconnected from AT-SPI2 bus]]
}
}
+
diff --git a/src/lib/elementary/elm_atspi_proxy.c b/src/lib/elementary/elm_atspi_proxy.c
new file mode 100644
index 0000000000..102bcf03d6
--- /dev/null
+++ b/src/lib/elementary/elm_atspi_proxy.c
@@ -0,0 +1,41 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <Elementary.h>
+#include <elm_priv.h>
+#include <assert.h>
+
+typedef struct _Elm_Atspi_Proxy_Data {
+ const char *bus;
+ const char *path;
+} Elm_Atspi_Proxy_Data;
+
+EOLIAN void
+_elm_atspi_proxy_efl_object_destructor(Eo *obj EINA_UNUSED, Elm_Atspi_Proxy_Data *pd)
+{
+ eina_stringshare_del(pd->bus);
+ eina_stringshare_del(pd->path);
+}
+
+EOLIAN const char*
+_elm_atspi_proxy_path_get(Eo *obj EINA_UNUSED, Elm_Atspi_Proxy_Data *pd)
+{
+ return pd->path;
+}
+
+EOLIAN const char*
+_elm_atspi_proxy_bus_name_get(Eo *obj EINA_UNUSED, Elm_Atspi_Proxy_Data *pd)
+{
+ return pd->bus;
+}
+
+EOLIAN void
+_elm_atspi_proxy_constructor(Eo *obj EINA_UNUSED, Elm_Atspi_Proxy_Data *pd, const char *bus, const char *path)
+{
+ pd->bus = eina_stringshare_add(bus);
+ pd->path = eina_stringshare_add(path);
+}
+
+
+#include "elm_atspi_proxy.eo.c"
diff --git a/src/lib/elementary/elm_atspi_proxy.eo b/src/lib/elementary/elm_atspi_proxy.eo
new file mode 100644
index 0000000000..43ee235622
--- /dev/null
+++ b/src/lib/elementary/elm_atspi_proxy.eo
@@ -0,0 +1,34 @@
+class Elm.Atspi.Proxy (Efl.Object, Elm.Interface.Atspi_Accessible)
+{
+ [[AT-SPI Proxy class. Represents out-of-process accessibility object]]
+ legacy_prefix: elm_atspi_proxy;
+ eo_prefix: elm_obj_atspi_proxy;
+ methods {
+ @property path {
+ get {
+ values {
+ ret: string;
+ }
+ }
+ }
+ @property bus_name {
+ get {
+ values {
+ ret: string;
+ }
+ }
+ }
+ constructor {
+ params {
+ @in bus: string;
+ @in path: string;
+ }
+ }
+ }
+ implements {
+ Efl.Object.destructor;
+ }
+ constructors {
+ .constructor;
+ }
+}
diff --git a/src/lib/elementary/elm_atspi_proxy.h b/src/lib/elementary/elm_atspi_proxy.h
new file mode 100644
index 0000000000..e3615e6437
--- /dev/null
+++ b/src/lib/elementary/elm_atspi_proxy.h
@@ -0,0 +1,8 @@
+#ifdef EFL_BETA_API_SUPPORT
+#ifdef EFL_EO_API_SUPPORT
+#include "elm_atspi_proxy.eo.h"
+#endif
+#ifndef EFL_NOLEGACY_API_SUPPORT
+#include "elm_atspi_proxy.eo.legacy.h"
+#endif
+#endif