summaryrefslogtreecommitdiff
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
parenta2309c5083a643011b4e69347d6be4da3a0adee8 (diff)
-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 = \
10 lib/eldbus/eldbus_model_proxy.eo \ 10 lib/eldbus/eldbus_model_proxy.eo \
11 lib/eldbus/eldbus_model_method.eo \ 11 lib/eldbus/eldbus_model_method.eo \
12 lib/eldbus/eldbus_model_arguments.eo \ 12 lib/eldbus/eldbus_model_arguments.eo \
13 lib/eldbus/eldbus_model_signal.eo 13 lib/eldbus/eldbus_model_signal.eo \
14 lib/eldbus/eldbus_model_service.eo
14 15
15eldbus_eolian_c = $(eldbus_eolian_files:%.eo=%.eo.c) 16eldbus_eolian_c = $(eldbus_eolian_files:%.eo=%.eo.c)
16eldbus_eolian_h = $(eldbus_eolian_files:%.eo=%.eo.h) \ 17eldbus_eolian_h = $(eldbus_eolian_files:%.eo=%.eo.h) \
@@ -74,7 +75,8 @@ lib/eldbus/eldbus_model_proxy.c \
74lib/eldbus/eldbus_model_method.c \ 75lib/eldbus/eldbus_model_method.c \
75lib/eldbus/eldbus_model_arguments.c \ 76lib/eldbus/eldbus_model_arguments.c \
76lib/eldbus/eldbus_model_signal.c \ 77lib/eldbus/eldbus_model_signal.c \
77lib/eldbus/eldbus_introspection.c 78lib/eldbus/eldbus_introspection.c \
79lib/eldbus/eldbus_model_service.c
78 80
79lib_eldbus_libeldbus_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ 81lib_eldbus_libeldbus_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
80-include $(top_builddir)/config.h \ 82-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 @@
1import eldbus_types;
2
3class Eldbus.Model.Service (Efl.Object, Efl.Model) {
4 methods {
5 constructor {
6 params {
7 @in conn: ptr(Eldbus.Connection);
8 @in path: string;
9 }
10 }
11 constructor_from_xml {
12 params {
13 @in xml: string;
14 }
15 }
16 fallback_constructor {
17 params {
18 @in conn: ptr(Eldbus.Connection);
19 @in prefix: string;
20 }
21 }
22 [[ Accessible also through "name" property ]]
23 @property name {
24 values {
25 name: string;
26 }
27 }
28 @property path {
29 values {
30 path: string;
31 }
32 }
33 @property context {
34 values {
35 obj: Efl.Model;
36 }
37 }
38 @property interface {
39 keys {
40 name: string;
41 }
42 get {
43 }
44 values {
45 ret: Eldbus.Model.Service.Interface;
46 }
47 }
48 @property node {
49 keys {
50 name: string;
51 }
52 get {
53 }
54 params {
55 @in: Eldbus.Model.Service.Object;
56 }
57 }
58 }
59 implements {
60 }
61 constructors {
62 .constructor;
63 .fallback_constructor;
64 }
65 events {
66 }
67}
68
69class Eldbus.Model.Service.Interface (Efl.Object, Efl.Model)
70{
71 methods {
72 constructor {
73 params {
74 @in desc: Eldbus.Introspection.Interface;
75 }
76 }
77 [[ accessibile also through "name" property ]]
78 @property name {
79 values {
80 ret: string;
81 }
82 }
83 @property context {
84 values {
85 obj: Efl.Model;
86 }
87 }
88 @property method {
89 keys {
90 name: string;
91 }
92 get {
93 }
94 params {
95 @in: Eldbus.Model.Service.Method;
96 }
97 }
98 @property signal {
99 keys {
100 name: string;
101 }
102 get {
103 }
104 params {
105 @in: Eldbus.Model.Service.Signal;
106 }
107 }
108 @property property {
109 keys {
110 name: string;
111 }
112 get {
113 }
114 params {
115 @in: Eldbus.Model.Service.Property;
116 }
117 }
118 }
119 constructors {
120 .constructor;
121 }
122}
123
124class Eldbus.Model.Service.Property (Efl.Object, Efl.Model)
125{
126 methods {
127 constructor {
128 params {
129 @in desc: Eldbus.Introspection.Property;
130 }
131 }
132 [[ accessibile also through property "name" ]]
133 @property name {
134 values {
135 ret : string;
136 }
137 }
138 @property context {
139 values {
140 obj: Efl.Model;
141 }
142 }
143 }
144 constructors {
145 .constructor;
146 }
147}
148
149class Eldbus.Model.Service.Method (Efl.Object, Efl.Model)
150{
151 methods {
152 constructor {
153 params {
154 @in desc: Eldbus.Introspection.Method;
155 }
156 }
157 @property name {
158 values {
159 }
160 }
161 bind {
162 params {
163 @in: void_ptr;
164 }
165 }
166 @property context {
167 values {
168 obj: Efl.Model;
169 }
170 }
171 }
172 constructors {
173 .constructor;
174 }
175}
176
177class Eldbus.Model.Service.Signal ()
178{
179 methods {
180 constructor {
181 params {
182 @in desc: Eldbus.Introspection.Signal;
183 }
184 }
185 call {
186 params {
187 @in args: Eldbus.Model.Arguments;
188 }
189 }
190 bind {
191 params {
192 @in: Efl.Event.Description;
193 }
194 }
195 @property context {
196 values {
197 obj: Efl.Model;
198 }
199 }
200 }
201 constructors {
202 .constructor;
203 }
204 events {
205 signal,called;
206 }
207}
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 @@
1#ifdef HAVE_CONFIG_H
2 #include "elementary_config.h"
3#endif
4
5#define ELM_ATSPI_ADAPTOR_PROTECTED
6
7#include <Elementary.h>
8#include "elm_priv.h"
9#include "elm_atspi_adaptor.eo.h"
10
11#define ELM_ACCESS_OBJECT_PATH_PREFIX "/org/a11y/atspi/accessible/"
12#define ELM_ACCESS_OBJECT_PATH_ROOT "root"
13
14const char *Accessible_Interface_Desc = "\
15<interface name=\"org.a11y.atspi.Accessible\">\
16 <method name=\"SetPosition\">\
17 <arg type=\"i\" name=\"x\" direction=\"in\" />\
18 <arg type=\"i\" name=\"y\" direction=\"in\" />\
19 <arg type=\"u\" name=\"coord_type\" direction=\"in\" />\
20 <arg type=\"b\" name=\"result\" direction=\"out\" />\
21 <annotation name=\"org.enlightenment.eldbus.method\" value=\"Elm.Atspi.Access.Adaptor.position_set\">\
22 </method>\
23 <signal name=\"AttributesChanged\">\
24 <arg direction=\"in\" type=\"(suuv)\"/>\
25 <annotation name=\"org.enlightenment.eldbus.type.in0\" value=\"Efl_Access_Event\"/>\
26 <annotation name=\"org.enlightenment.eldbus.event\" value=\"EFL_ACCESS_EVENT_CHILDREN_CHANGED\">\
27 </signal>\
28</interface>";
29
30typedef struct _Elm_Atspi_Adaptor_Data
31{
32 Efl_Access_Cache *cache;
33 Eldbus_Service_Interface *service;
34 Eldbus_Service_Interface_Desc *interface;
35 Elm_Atspi_Service_Interface_Desc *atspi_interface_desc;
36} Elm_Atspi_Adaptor_Data;
37
38static Eina_Bool
39_set_extents_handler(void *data, const char *path, int x, int y, unsigned coort_type)
40{
41 Eina_Coord x, y;
42}
43
44EOLIAN static void
45_elm_atspi_adaptor_constructor(Eo *obj, Elm_Atspi_Adaptor_Data *pd)
46{
47 // set bindings to itself so it will be propagated to all children
48 eldbus_model_service_interface_bind_context_set(obj, obj);
49 eldbus_model_service_interface_constructor(obj, Accessible_Interface_Desc);
50}
51
52EOLIAN static Eo*
53_elm_atspi_adaptor_efl_object_constructor(Eo *obj, Elm_Atspi_Adaptor_Data *pd)
54{
55 return efl_constructor(efl_super(obj, ELM_ATSPI_ADAPTOR_CLASS));
56}
57
58static Eldbus_Message*
59_elm_atspi_adaptor_method_callback(Eldbus_Service_Interface *service, Eldbus_Message *msg)
60{
61 Elm_Atspi_Adaptor *obj = eldbus_service_interface_data_get(service, "__adaptor");
62 if (!obj) return NULL;
63
64 Elm_Atspi_Service_Interface_Desc *desc = elm_atspi_adaptor_interface_get(obj);
65 if (!desc || !desc->methods) return NULL;
66
67 const char *method_name = eldbus_message_member_get(msg);
68 const char *path = eldbus_message_path_get(msg);
69
70 EINA_SAFETY_ON_NULL_RETURN_VAL(method_name, NULL);
71 EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
72
73 Efl_Access *access = elm_atspi_adaptor_object_from_path(obj, path);
74 Elm_Atspi_Method *m = eina_hash_find(desc->methods, method_name);
75 if (!m) return NULL; //invalid method name error
76
77 return m->cb ? m->cb(NULL, obj, access, eldbus_service_connection_get(service), msg) : NULL;
78}
79
80static Eldbus_Message*
81_elm_atspi_adaptor_property_get_callback(Eldbus_Service_Interface *service, Eldbus_Message *msg)
82{
83}
84
85static Eldbus_Message*
86_elm_atspi_adaptor_property_set_callback(Eldbus_Service_Interface *service, Eldbus_Message *msg)
87{
88}
89
90EOLIAN static void
91_elm_atspi_adaptor_efl_object_destructor(Eo *obj, Elm_Atspi_Adaptor_Data *pd EINA_UNUSED)
92{
93 elm_atspi_adaptor_unregister(obj);
94 efl_destructor(efl_super(obj, ELM_ATSPI_ADAPTOR_CLASS));
95}
96
97EOLIAN static Efl_Access_Cache*
98_elm_atspi_adaptor_cache_get(Eo *obj, Elm_Atspi_Adaptor_Data *pd)
99{
100 return pd->cache;
101}
102
103EOLIAN static void
104_elm_atspi_adaptor_cache_set(Eo *obj, Elm_Atspi_Adaptor_Data *pd, Efl_Access_Cache *cache)
105{
106 EINA_SAFETY_ON_NULL_RETURN(cache);
107 pd->cache = cache;
108}
109
110EOLIAN static void
111_elm_atspi_adaptor_register(Eo *obj, Elm_Atspi_Adaptor_Data *pd, Eldbus_Connection *conn, const char *path)
112{
113 EINA_SAFETY_ON_NULL_RETURN(conn);
114 EINA_SAFETY_ON_NULL_RETURN(path);
115 EINA_SAFETY_ON_NULL_RETURN(pd->interface);
116
117 pd->service = eldbus_service_interface_fallback_register(conn, path, pd->interface);
118}
119
120EOLIAN static void
121_elm_atspi_adaptor_unregister(Eo *obj, Elm_Atspi_Adaptor_Data *pd)
122{
123 if (pd->service)
124 eldbus_service_interface_unregister(pd->service);
125}
126
127EOLIAN static void
128_elm_atspi_adaptor_interface_set(Eo *obj, Elm_Atspi_Adaptor_Data *pd, const Elm_Atspi_Service_Interface_Desc *desc)
129{
130 pd->atspi_interface_desc = desc;
131}
132
133EOLIAN static const Elm_Atspi_Service_Interface_Desc*
134_elm_atspi_adaptor_interface_get(Eo *obj, Elm_Atspi_Adaptor_Data *pd)
135{
136 return pd->atspi_interface_desc;
137}
138
139
140#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 @@
1import eldbus_types;
2
3function Elm.Atspi.Method.Callback
4{
5 params {
6 @in obj: Elm.Atspi.Adaptor;
7 @in access: Efl.Access;
8 @in conn: ptr(Eldbus.Connection);
9 @in msg: ptr(Eldbus.Message);
10 }
11 return: ptr(Eldbus.Message);
12};
13
14struct Elm.Arg.Info
15{
16 signature: string;
17 name: string;
18}
19
20struct Elm.Atspi.Method
21{
22 arg_in: Elm.Arg.Info;
23 arg_out: Elm.Arg.Info;
24 cb: Elm.Atspi.Method.Callback;
25}
26
27struct Elm.Atspi.Signal
28{
29 name: string;
30}
31
32struct Elm.Atspi.Property
33{
34 name: string;
35}
36
37struct Elm.Atspi.Service.Interface.Desc
38{
39 name: string;
40 methods: hash<string, ptr(Elm.Atspi.Method)>;
41 properties: hash<string, ptr(Elm.Atspi.Property)>;
42 signals: array<ptr(Elm.Atspi.Signal)>;
43}
44
45abstract Elm.Atspi.Adaptor (Efl.Object)
46{
47 [[Base class for accessibility adaptors]]
48 methods {
49 @property cache {
50 get {
51 }
52 set {
53 }
54 values {
55 cache: Efl.Access.Cache;
56 }
57 }
58 @property interface @protected {
59 set {
60 }
61 get {
62 }
63 values {
64 desc: const(ptr(Elm.Atspi.Service.Interface.Desc));
65 }
66 }
67 register {
68 params {
69 @in conn: ptr(Eldbus.Connection);
70 @in path_prefix: string;
71 }
72 }
73 unregister {
74 }
75 }
76 implements {
77 Efl.Object.constructor;
78 Efl.Object.destructor;
79 }
80 constructors {
81 .cache;
82 .interface;
83 }
84}