aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2016-01-04 16:39:43 +0100
committerLukasz Stanislawski <l.stanislaws@samsung.com>2016-01-05 17:34:40 +0100
commitc6f3324690caccc9f80cb7d61b2acafde28cd230 (patch)
treeb86cb6c451f444723b96e5234e3e014a157c9967
parentwidget: improve accessibile_at_point getter (diff)
downloadelementary-devs/stanluk/next.tar.gz
atspi: add new API to enable/disable accessibilitydevs/stanluk/next
Some widgets needs to perfrom additional initialization when at-spi stack gets enabled/disabled. To make such initialization as late as possible a "on_access" method is introduced. @feature
-rw-r--r--src/lib/elm_atspi_bridge.c21
-rw-r--r--src/lib/elm_interface_atspi_accessible.c53
-rw-r--r--src/lib/elm_interface_atspi_accessible.eo21
-rw-r--r--src/lib/elm_priv.h1
-rw-r--r--src/lib/elm_win.c31
-rw-r--r--src/lib/elm_win.eo1
6 files changed, 93 insertions, 35 deletions
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index 782d1fdd2..eebb68ecc 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -3779,8 +3779,11 @@ _registered_listeners_get(void *data, const Eldbus_Message *msg, Eldbus_Pending
}
if (!pd->connected)
- eo_do(data, eo_event_callback_call(ELM_ATSPI_BRIDGE_EVENT_CONNECTED, NULL));
- pd->connected = EINA_TRUE;
+ {
+ pd->connected = EINA_TRUE;
+ eo_do(data, eo_event_callback_call(ELM_ATSPI_BRIDGE_EVENT_CONNECTED, NULL));
+ eo_do(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN, elm_interface_atspi_accessible_init());
+ }
}
static void
@@ -4262,8 +4265,12 @@ _a11y_connection_shutdown(Eo *bridge)
eo_do(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN, elm_interface_atspi_accessible_event_handler_del(pd->event_hdlr));
pd->event_hdlr = NULL;
- eo_do(bridge, eo_event_callback_call(ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, NULL));
- pd->connected = EINA_FALSE;
+ if (pd->connected)
+ {
+ pd->connected = EINA_FALSE;
+ eo_do(bridge, eo_event_callback_call(ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, NULL));
+ eo_do(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN, elm_interface_atspi_accessible_shutdown());
+ }
}
static void _disconnect_cb(void *data, Eldbus_Connection *conn EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -4451,12 +4458,6 @@ _elm_atspi_bridge_init(void)
}
}
-EAPI Eo*
-_elm_atspi_bridge_get(void)
-{
- return _instance;
-}
-
void
_elm_atspi_bridge_shutdown(void)
{
diff --git a/src/lib/elm_interface_atspi_accessible.c b/src/lib/elm_interface_atspi_accessible.c
index 19a020f0d..552b79172 100644
--- a/src/lib/elm_interface_atspi_accessible.c
+++ b/src/lib/elm_interface_atspi_accessible.c
@@ -129,6 +129,7 @@ struct _Elm_Interface_Atspi_Accessible_Data
const char *translation_domain;
Elm_Atspi_Relation_Set relations;
Elm_Atspi_Type type: 2;
+ Eina_Bool access : 1;
};
typedef struct _Elm_Interface_Atspi_Accessible_Data Elm_Interface_Atspi_Accessible_Data;
@@ -136,6 +137,7 @@ typedef struct _Elm_Interface_Atspi_Accessible_Data Elm_Interface_Atspi_Accessib
static Eina_List *global_callbacks;
static Eo *root;
+static int init_count;
EOLIAN static int
_elm_interface_atspi_accessible_index_in_parent_get(Eo *obj, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED)
@@ -288,7 +290,9 @@ _elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, Elm_Interface_
EINA_ITERATOR_FOREACH(iter, chld)
{
if (eo_isa(chld, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
- children = eina_list_append(children, chld);
+ {
+ children = eina_list_append(children, chld);
+ }
}
eina_iterator_free(iter);
@@ -584,23 +588,68 @@ EOLIAN void
_elm_interface_atspi_accessible_type_set(Eo *obj, Elm_Interface_Atspi_Accessible_Data *pd, Elm_Atspi_Type val)
{
Elm_Interface_Atspi_Accessible *parent;
+ Eina_Bool accessed;
if (val == pd->type)
return;
- eo_do(obj, parent = elm_interface_atspi_accessible_parent_get());
+ eo_do(obj,
+ parent = elm_interface_atspi_accessible_parent_get(),
+ accessed = elm_interface_atspi_accessible_is_accessed());
switch (val)
{
case ELM_ATSPI_TYPE_DISABLED:
case ELM_ATSPI_TYPE_SKIPPED:
+ if (accessed) eo_do(obj, elm_interface_atspi_accessible_on_access(EINA_FALSE));
if (parent) elm_interface_atspi_accessible_children_changed_del_signal_emit(parent, obj);
elm_interface_atspi_accessible_removed(obj);
break;
case ELM_ATSPI_TYPE_REGULAR:
+ if (!accessed) eo_do(obj, elm_interface_atspi_accessible_on_access(EINA_TRUE));
if (parent) elm_interface_atspi_accessible_children_changed_added_signal_emit(parent, obj);
elm_interface_atspi_accessible_added(obj);
}
pd->type = val;
}
+EOLIAN void
+_elm_interface_atspi_accessible_on_access(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd, Eina_Bool val)
+{
+ pd->access = !!val;
+}
+
+EOLIAN Eina_Bool
+_elm_interface_atspi_accessible_is_accessed(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd)
+{
+ return pd->access;
+}
+
+EOLIAN int
+_elm_interface_atspi_accessible_init(Eo *obj EINA_UNUSED, void *sd EINA_UNUSED)
+{
+ Eo *r;
+ if (!init_count++)
+ {
+ eo_do(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN, r = elm_interface_atspi_accessible_root_get());
+ eo_do(r, elm_interface_atspi_accessible_on_access(EINA_TRUE));
+ }
+ return init_count;
+}
+
+EOLIAN void
+_elm_interface_atspi_accessible_shutdown(Eo *obj EINA_UNUSED, void *sd EINA_UNUSED)
+{
+ if (init_count > 0)
+ {
+ init_count--;
+ if (!init_count)
+ {
+ eo_do(root, elm_interface_atspi_accessible_on_access(EINA_FALSE));
+ eo_del(root);
+ root = NULL;
+ }
+ }
+}
+
+
#include "elm_interface_atspi_accessible.eo.c"
diff --git a/src/lib/elm_interface_atspi_accessible.eo b/src/lib/elm_interface_atspi_accessible.eo
index 378674ee8..feb69c412 100644
--- a/src/lib/elm_interface_atspi_accessible.eo
+++ b/src/lib/elm_interface_atspi_accessible.eo
@@ -210,6 +210,27 @@ mixin Elm_Interface_Atspi_Accessible ()
}
}
}
+ on_access @protected {
+ [[Function invoked when atspi accessible class gets initialized
+ or shutdowned.
+
+ Overwrite to provide custom initialization method for the object.
+
+ By default function traverses all children and invokes "on_activate"
+ method them.]]
+ params {
+ @in state: bool;[[True is atspi accessibily get intitialized, False otherwise]]
+ }
+ }
+ is_accessed @protected {
+ return: bool;
+ }
+ init @class {
+ return: int;
+ }
+ shutdown @class {
+ }
+
}
events {
property,changed: const(char)*;
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index f8ff69351..faa1d5754 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -356,7 +356,6 @@ struct _Elm_Module
int references;
};
-Eo *_elm_atspi_bridge_get(void);
void _elm_atspi_bridge_init(void);
void _elm_atspi_bridge_shutdown(void);
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index f75ba93f2..c8c6d1195 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -3980,9 +3980,6 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
}
eo_do(obj, elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_WINDOW));
- if (_elm_config->atspi_mode)
- elm_interface_atspi_window_created_signal_emit(obj);
-
evas_object_show(sd->edje);
eo_do(obj, eo_event_callback_add(EO_EV_CALLBACK_ADD, _cb_added, sd),
@@ -5726,13 +5723,11 @@ elm_win_window_id_get(const Evas_Object *obj)
return ret;
}
-static Eina_Bool
-_on_atspi_bus_connected(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
+EOLIAN static void
+_elm_win_elm_interface_atspi_accessible_on_access(Eo *obj, Elm_Win_Data *pd EINA_UNUSED, Eina_Bool val)
{
- Evas_Object *win;
- Eina_List *l;
-
- EINA_LIST_FOREACH(_elm_win_list, l, win)
+ eo_do_super(obj, ELM_WIN_CLASS, elm_interface_atspi_accessible_on_access(val));
+ if (val)
{
/**
* Reemit accessibility events when AT-SPI2 connection is begin
@@ -5740,35 +5735,27 @@ _on_atspi_bus_connected(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Ev
* receive all org.a11y.window events and could keep track of active
* windows whithin system.
*/
- elm_interface_atspi_window_created_signal_emit(win);
- if (elm_win_focus_get(win))
+ elm_interface_atspi_window_created_signal_emit(obj);
+ if (elm_win_focus_get(obj))
{
- elm_interface_atspi_window_activated_signal_emit(win);
+ elm_interface_atspi_window_activated_signal_emit(obj);
/** Reemit focused event to inform atspi clients about currently
* focused object **/
unsigned int order = 0;
Evas_Object *target;
- eo_do(win, target = elm_obj_widget_newest_focus_order_get(&order, EINA_TRUE));
+ eo_do(obj, target = elm_obj_widget_newest_focus_order_get(&order, EINA_TRUE));
if (target)
elm_interface_atspi_accessible_state_changed_signal_emit(target, ELM_ATSPI_STATE_FOCUSED, EINA_TRUE);
}
else
- elm_interface_atspi_window_deactivated_signal_emit(win);
+ elm_interface_atspi_window_deactivated_signal_emit(obj);
}
- return EINA_TRUE;
}
EOLIAN static void
_elm_win_class_constructor(Eo_Class *klass)
{
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
-
- if (_elm_config->atspi_mode)
- {
- Eo *bridge = _elm_atspi_bridge_get();
- if (bridge)
- eo_do(bridge, eo_event_callback_add(ELM_ATSPI_BRIDGE_EVENT_CONNECTED, _on_atspi_bus_connected, NULL));
- }
}
EOLIAN static Eo*
diff --git a/src/lib/elm_win.eo b/src/lib/elm_win.eo
index 97fb151e5..52bdc5e62 100644
--- a/src/lib/elm_win.eo
+++ b/src/lib/elm_win.eo
@@ -1284,6 +1284,7 @@ class Elm.Win (Elm.Widget, Elm_Interface_Atspi_Window,
Elm_Interface_Atspi_Accessible.state_set.get;
Elm_Interface_Atspi_Accessible.name.get;
Elm_Interface_Atspi_Widget_Action.elm_actions.get;
+ Elm_Interface_Atspi_Accessible.on_access;
}
constructors {
.name;