aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>2017-12-18 23:09:18 +0100
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>2017-12-18 23:09:18 +0100
commitdfe0eb87c4291fcd192dd358848cafc10aa48350 (patch)
treed2c7fd84052d2283485c1e39936a7ec568549076
parentefl_ui_image: apply load_size when API is called (diff)
downloadefl-devs/stanluk/adaptor.tar.gz
-rw-r--r--src/Makefile_Eldbus.am6
-rw-r--r--src/lib/eldbus/eldbus_model_service.c0
-rw-r--r--src/lib/eldbus/eldbus_model_service.eo207
-rw-r--r--src/lib/elementary/elm_atspi_adaptor.c140
-rw-r--r--src/lib/elementary/elm_atspi_adaptor.eo84
5 files changed, 435 insertions, 2 deletions
diff --git a/src/Makefile_Eldbus.am b/src/Makefile_Eldbus.am
index 99831d55b5..c0dabbb54d 100644
--- a/src/Makefile_Eldbus.am
+++ b/src/Makefile_Eldbus.am
@@ -10,7 +10,8 @@ eldbus_eolian_files = \
lib/eldbus/eldbus_model_proxy.eo \
lib/eldbus/eldbus_model_method.eo \
lib/eldbus/eldbus_model_arguments.eo \
- lib/eldbus/eldbus_model_signal.eo
+ lib/eldbus/eldbus_model_signal.eo \
+ lib/eldbus/eldbus_model_service.eo
eldbus_eolian_c = $(eldbus_eolian_files:%.eo=%.eo.c)
eldbus_eolian_h = $(eldbus_eolian_files:%.eo=%.eo.h) \
@@ -74,7 +75,8 @@ lib/eldbus/eldbus_model_proxy.c \
lib/eldbus/eldbus_model_method.c \
lib/eldbus/eldbus_model_arguments.c \
lib/eldbus/eldbus_model_signal.c \
-lib/eldbus/eldbus_introspection.c
+lib/eldbus/eldbus_introspection.c \
+lib/eldbus/eldbus_model_service.c
lib_eldbus_libeldbus_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-include $(top_builddir)/config.h \
diff --git a/src/lib/eldbus/eldbus_model_service.c b/src/lib/eldbus/eldbus_model_service.c
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/src/lib/eldbus/eldbus_model_service.c
diff --git a/src/lib/eldbus/eldbus_model_service.eo b/src/lib/eldbus/eldbus_model_service.eo
new file mode 100644
index 0000000000..94eda80d08
--- /dev/null
+++ b/src/lib/eldbus/eldbus_model_service.eo
@@ -0,0 +1,207 @@
+import eldbus_types;
+
+class Eldbus.Model.Service (Efl.Object, Efl.Model) {
+ methods {
+ constructor {
+ params {
+ @in conn: ptr(Eldbus.Connection);
+ @in path: string;
+ }
+ }
+ constructor_from_xml {
+ params {
+ @in xml: string;
+ }
+ }
+ fallback_constructor {
+ params {
+ @in conn: ptr(Eldbus.Connection);
+ @in prefix: string;
+ }
+ }
+ [[ Accessible also through "name" property ]]
+ @property name {
+ values {
+ name: string;
+ }
+ }
+ @property path {
+ values {
+ path: string;
+ }
+ }
+ @property context {
+ values {
+ obj: Efl.Model;
+ }
+ }
+ @property interface {
+ keys {
+ name: string;
+ }
+ get {
+ }
+ values {
+ ret: Eldbus.Model.Service.Interface;
+ }
+ }
+ @property node {
+ keys {
+ name: string;
+ }
+ get {
+ }
+ params {
+ @in: Eldbus.Model.Service.Object;
+ }
+ }
+ }
+ implements {
+ }
+ constructors {
+ .constructor;
+ .fallback_constructor;
+ }
+ events {
+ }
+}
+
+class Eldbus.Model.Service.Interface (Efl.Object, Efl.Model)
+{
+ methods {
+ constructor {
+ params {
+ @in desc: Eldbus.Introspection.Interface;
+ }
+ }
+ [[ accessibile also through "name" property ]]
+ @property name {
+ values {
+ ret: string;
+ }
+ }
+ @property context {
+ values {
+ obj: Efl.Model;
+ }
+ }
+ @property method {
+ keys {
+ name: string;
+ }
+ get {
+ }
+ params {
+ @in: Eldbus.Model.Service.Method;
+ }
+ }
+ @property signal {
+ keys {
+ name: string;
+ }
+ get {
+ }
+ params {
+ @in: Eldbus.Model.Service.Signal;
+ }
+ }
+ @property property {
+ keys {
+ name: string;
+ }
+ get {
+ }
+ params {
+ @in: Eldbus.Model.Service.Property;
+ }
+ }
+ }
+ constructors {
+ .constructor;
+ }
+}
+
+class Eldbus.Model.Service.Property (Efl.Object, Efl.Model)
+{
+ methods {
+ constructor {
+ params {
+ @in desc: Eldbus.Introspection.Property;
+ }
+ }
+ [[ accessibile also through property "name" ]]
+ @property name {
+ values {
+ ret : string;
+ }
+ }
+ @property context {
+ values {
+ obj: Efl.Model;
+ }
+ }
+ }
+ constructors {
+ .constructor;
+ }
+}
+
+class Eldbus.Model.Service.Method (Efl.Object, Efl.Model)
+{
+ methods {
+ constructor {
+ params {
+ @in desc: Eldbus.Introspection.Method;
+ }
+ }
+ @property name {
+ values {
+ }
+ }
+ bind {
+ params {
+ @in: void_ptr;
+ }
+ }
+ @property context {
+ values {
+ obj: Efl.Model;
+ }
+ }
+ }
+ constructors {
+ .constructor;
+ }
+}
+
+class Eldbus.Model.Service.Signal ()
+{
+ methods {
+ constructor {
+ params {
+ @in desc: Eldbus.Introspection.Signal;
+ }
+ }
+ call {
+ params {
+ @in args: Eldbus.Model.Arguments;
+ }
+ }
+ bind {
+ params {
+ @in: Efl.Event.Description;
+ }
+ }
+ @property context {
+ values {
+ obj: Efl.Model;
+ }
+ }
+ }
+ constructors {
+ .constructor;
+ }
+ events {
+ signal,called;
+ }
+}
diff --git a/src/lib/elementary/elm_atspi_adaptor.c b/src/lib/elementary/elm_atspi_adaptor.c
new file mode 100644
index 0000000000..234e99323d
--- /dev/null
+++ b/src/lib/elementary/elm_atspi_adaptor.c
@@ -0,0 +1,140 @@
+#ifdef HAVE_CONFIG_H
+ #include "elementary_config.h"
+#endif
+
+#define ELM_ATSPI_ADAPTOR_PROTECTED
+
+#include <Elementary.h>
+#include "elm_priv.h"
+#include "elm_atspi_adaptor.eo.h"
+
+#define ELM_ACCESS_OBJECT_PATH_PREFIX "/org/a11y/atspi/accessible/"
+#define ELM_ACCESS_OBJECT_PATH_ROOT "root"
+
+const char *Accessible_Interface_Desc = "\
+<interface name=\"org.a11y.atspi.Accessible\">\
+ <method name=\"SetPosition\">\
+ <arg type=\"i\" name=\"x\" direction=\"in\" />\
+ <arg type=\"i\" name=\"y\" direction=\"in\" />\
+ <arg type=\"u\" name=\"coord_type\" direction=\"in\" />\
+ <arg type=\"b\" name=\"result\" direction=\"out\" />\
+ <annotation name=\"org.enlightenment.eldbus.method\" value=\"Elm.Atspi.Access.Adaptor.position_set\">\
+ </method>\
+ <signal name=\"AttributesChanged\">\
+ <arg direction=\"in\" type=\"(suuv)\"/>\
+ <annotation name=\"org.enlightenment.eldbus.type.in0\" value=\"Efl_Access_Event\"/>\
+ <annotation name=\"org.enlightenment.eldbus.event\" value=\"EFL_ACCESS_EVENT_CHILDREN_CHANGED\">\
+ </signal>\
+</interface>";
+
+typedef struct _Elm_Atspi_Adaptor_Data
+{
+ Efl_Access_Cache *cache;
+ Eldbus_Service_Interface *service;
+ Eldbus_Service_Interface_Desc *interface;
+ Elm_Atspi_Service_Interface_Desc *atspi_interface_desc;
+} Elm_Atspi_Adaptor_Data;
+
+static Eina_Bool
+_set_extents_handler(void *data, const char *path, int x, int y, unsigned coort_type)
+{
+ Eina_Coord x, y;
+}
+
+EOLIAN static void
+_elm_atspi_adaptor_constructor(Eo *obj, Elm_Atspi_Adaptor_Data *pd)
+{
+ // set bindings to itself so it will be propagated to all children
+ eldbus_model_service_interface_bind_context_set(obj, obj);
+ eldbus_model_service_interface_constructor(obj, Accessible_Interface_Desc);
+}
+
+EOLIAN static Eo*
+_elm_atspi_adaptor_efl_object_constructor(Eo *obj, Elm_Atspi_Adaptor_Data *pd)
+{
+ return efl_constructor(efl_super(obj, ELM_ATSPI_ADAPTOR_CLASS));
+}
+
+static Eldbus_Message*
+_elm_atspi_adaptor_method_callback(Eldbus_Service_Interface *service, Eldbus_Message *msg)
+{
+ Elm_Atspi_Adaptor *obj = eldbus_service_interface_data_get(service, "__adaptor");
+ if (!obj) return NULL;
+
+ Elm_Atspi_Service_Interface_Desc *desc = elm_atspi_adaptor_interface_get(obj);
+ if (!desc || !desc->methods) return NULL;
+
+ const char *method_name = eldbus_message_member_get(msg);
+ const char *path = eldbus_message_path_get(msg);
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(method_name, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
+
+ Efl_Access *access = elm_atspi_adaptor_object_from_path(obj, path);
+ Elm_Atspi_Method *m = eina_hash_find(desc->methods, method_name);
+ if (!m) return NULL; //invalid method name error
+
+ return m->cb ? m->cb(NULL, obj, access, eldbus_service_connection_get(service), msg) : NULL;
+}
+
+static Eldbus_Message*
+_elm_atspi_adaptor_property_get_callback(Eldbus_Service_Interface *service, Eldbus_Message *msg)
+{
+}
+
+static Eldbus_Message*
+_elm_atspi_adaptor_property_set_callback(Eldbus_Service_Interface *service, Eldbus_Message *msg)
+{
+}
+
+EOLIAN static void
+_elm_atspi_adaptor_efl_object_destructor(Eo *obj, Elm_Atspi_Adaptor_Data *pd EINA_UNUSED)
+{
+ elm_atspi_adaptor_unregister(obj);
+ efl_destructor(efl_super(obj, ELM_ATSPI_ADAPTOR_CLASS));
+}
+
+EOLIAN static Efl_Access_Cache*
+_elm_atspi_adaptor_cache_get(Eo *obj, Elm_Atspi_Adaptor_Data *pd)
+{
+ return pd->cache;
+}
+
+EOLIAN static void
+_elm_atspi_adaptor_cache_set(Eo *obj, Elm_Atspi_Adaptor_Data *pd, Efl_Access_Cache *cache)
+{
+ EINA_SAFETY_ON_NULL_RETURN(cache);
+ pd->cache = cache;
+}
+
+EOLIAN static void
+_elm_atspi_adaptor_register(Eo *obj, Elm_Atspi_Adaptor_Data *pd, Eldbus_Connection *conn, const char *path)
+{
+ EINA_SAFETY_ON_NULL_RETURN(conn);
+ EINA_SAFETY_ON_NULL_RETURN(path);
+ EINA_SAFETY_ON_NULL_RETURN(pd->interface);
+
+ pd->service = eldbus_service_interface_fallback_register(conn, path, pd->interface);
+}
+
+EOLIAN static void
+_elm_atspi_adaptor_unregister(Eo *obj, Elm_Atspi_Adaptor_Data *pd)
+{
+ if (pd->service)
+ eldbus_service_interface_unregister(pd->service);
+}
+
+EOLIAN static void
+_elm_atspi_adaptor_interface_set(Eo *obj, Elm_Atspi_Adaptor_Data *pd, const Elm_Atspi_Service_Interface_Desc *desc)
+{
+ pd->atspi_interface_desc = desc;
+}
+
+EOLIAN static const Elm_Atspi_Service_Interface_Desc*
+_elm_atspi_adaptor_interface_get(Eo *obj, Elm_Atspi_Adaptor_Data *pd)
+{
+ return pd->atspi_interface_desc;
+}
+
+
+#include "elm_atspi_adaptor.eo.c"
diff --git a/src/lib/elementary/elm_atspi_adaptor.eo b/src/lib/elementary/elm_atspi_adaptor.eo
new file mode 100644
index 0000000000..8a1f2f8701
--- /dev/null
+++ b/src/lib/elementary/elm_atspi_adaptor.eo
@@ -0,0 +1,84 @@
+import eldbus_types;
+
+function Elm.Atspi.Method.Callback
+{
+ params {
+ @in obj: Elm.Atspi.Adaptor;
+ @in access: Efl.Access;
+ @in conn: ptr(Eldbus.Connection);
+ @in msg: ptr(Eldbus.Message);
+ }
+ return: ptr(Eldbus.Message);
+};
+
+struct Elm.Arg.Info
+{
+ signature: string;
+ name: string;
+}
+
+struct Elm.Atspi.Method
+{
+ arg_in: Elm.Arg.Info;
+ arg_out: Elm.Arg.Info;
+ cb: Elm.Atspi.Method.Callback;
+}
+
+struct Elm.Atspi.Signal
+{
+ name: string;
+}
+
+struct Elm.Atspi.Property
+{
+ name: string;
+}
+
+struct Elm.Atspi.Service.Interface.Desc
+{
+ name: string;
+ methods: hash<string, ptr(Elm.Atspi.Method)>;
+ properties: hash<string, ptr(Elm.Atspi.Property)>;
+ signals: array<ptr(Elm.Atspi.Signal)>;
+}
+
+abstract Elm.Atspi.Adaptor (Efl.Object)
+{
+ [[Base class for accessibility adaptors]]
+ methods {
+ @property cache {
+ get {
+ }
+ set {
+ }
+ values {
+ cache: Efl.Access.Cache;
+ }
+ }
+ @property interface @protected {
+ set {
+ }
+ get {
+ }
+ values {
+ desc: const(ptr(Elm.Atspi.Service.Interface.Desc));
+ }
+ }
+ register {
+ params {
+ @in conn: ptr(Eldbus.Connection);
+ @in path_prefix: string;
+ }
+ }
+ unregister {
+ }
+ }
+ implements {
+ Efl.Object.constructor;
+ Efl.Object.destructor;
+ }
+ constructors {
+ .cache;
+ .interface;
+ }
+}