raster pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=a76443453136ccc6749dc0e1c6db4fdc8de28746

commit a76443453136ccc6749dc0e1c6db4fdc8de28746
Author: Lukasz Stanislawski <[email protected]>
Date:   Mon Apr 21 14:58:18 2014 +0900

    atspi: separate atspi mode from access mode.
    
    Since elm_access provides its own support for screen reader, access mode
    and atspi mode must be separated.
    
    https://phab.enlightenment.org/D726
---
 src/bin/config.c           | 26 ++++++++++++++++++++++++++
 src/lib/elm_atspi_bridge.c |  2 +-
 src/lib/elm_config.c       | 31 +++++++++++++++++++++++++++++++
 src/lib/elm_config.h       | 43 +++++++++++++++++++++++++++++++++++++++++++
 src/lib/elm_priv.h         |  4 ++++
 src/lib/elm_win.c          |  2 +-
 6 files changed, 106 insertions(+), 2 deletions(-)

diff --git a/src/bin/config.c b/src/bin/config.c
index 830aa56..1c09355 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -801,6 +801,20 @@ dbg_change(void *data       EINA_UNUSED,
 }
 
 static void
+atspi_change(void *data       EINA_UNUSED,
+          Evas_Object     *obj,
+          void *event_info EINA_UNUSED)
+{
+   Eina_Bool val = elm_check_state_get(obj);
+   Eina_Bool sel = elm_config_atspi_mode_get();
+
+   if (val == sel) return;
+   elm_config_atspi_mode_set(val);
+   elm_config_all_flush();
+   elm_config_save();
+}
+
+static void
 _status_basic(Evas_Object *win,
               Evas_Object *bx0)
 {
@@ -1573,6 +1587,18 @@ _status_config_etc(Evas_Object *win,
 
    evas_object_smart_callback_add(ck, "changed", dbg_change, NULL);
 
+   // atspi
+   ck = elm_check_add(win);
+   elm_object_tooltip_text_set(ck, "Set atspi mode");
+   elm_object_text_set(ck, "Enable ATSPI support.");
+   evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
+   elm_check_state_set(ck, elm_config_atspi_mode_get());
+   elm_box_pack_end(bx, ck);
+   evas_object_show(ck);
+
+   evas_object_smart_callback_add(ck, "changed", atspi_change, NULL);
+
    evas_object_data_set(win, "etc", bx);
 
    elm_naviframe_item_simple_push(naviframe, bx);
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index 429a282..e1b1b22 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -1648,7 +1648,7 @@ _elm_atspi_bridge_init(void)
    Eldbus_Message *msg;
    Eldbus_Connection *session_bus;
 
-   if (!_init_count && (_elm_config->access_mode != ELM_ACCESS_MODE_OFF))
+   if (!_init_count && (_elm_config->atspi_mode != ELM_ATSPI_MODE_OFF))
      {
         _elm_atspi_init();
 
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index c1eabd4..f80a62b 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -586,6 +586,7 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, audio_mute_alert, T_UCHAR);
    ELM_CONFIG_VAL(D, T, audio_mute_all, T_UCHAR);
    ELM_CONFIG_LIST(D, T, bindings, _config_bindings_widget_edd);
+   ELM_CONFIG_VAL(D, T, atspi_mode, T_UCHAR);
 #undef T
 #undef D
 #undef T_INT
@@ -808,6 +809,21 @@ void _elm_config_access_set(Eina_Bool is_access)
    if (!is_access) _elm_access_shutdown();
 }
 
+Eina_Bool _elm_config_atspi_mode_get(void)
+{
+   return _elm_config->atspi_mode;
+}
+
+void _elm_config_atspi_mode_set(Eina_Bool is_enabled)
+{
+   is_enabled = !!is_enabled;
+   if (_elm_config->atspi_mode == is_enabled) return;
+   _elm_config->atspi_mode = is_enabled;
+
+   if (!is_enabled) _elm_atspi_bridge_shutdown();
+   else _elm_atspi_bridge_init();
+}
+
 Eina_Bool _elm_config_selection_unfocused_clear_get(void)
 {
    return _elm_config->selection_clear_enable;
@@ -1576,6 +1592,7 @@ _config_load(void)
    _elm_config->audio_mute_input = 0;
    _elm_config->audio_mute_alert = 0;
    _elm_config->audio_mute_all = 0;
+   _elm_config->atspi_mode = ELM_ATSPI_MODE_OFF;
 }
 
 static const char *
@@ -2178,6 +2195,8 @@ _env_get(void)
    if (s) _elm_config->magnifier_enable = !!atoi(s);
    s = getenv("ELM_MAGNIFIER_SCALE");
    if (s) _elm_config->magnifier_scale = _elm_atof(s);
+   s = getenv("ELM_ATSPI_MODE");
+   if (s) _elm_config->atspi_mode = ELM_ATSPI_MODE_ON;
 }
 
 static void
@@ -2424,6 +2443,18 @@ elm_config_access_set(Eina_Bool is_access)
 }
 
 EAPI Eina_Bool
+elm_config_atspi_mode_get(void)
+{
+   return _elm_config_atspi_mode_get();
+}
+
+EAPI void
+elm_config_atspi_mode_set(Eina_Bool is_enable)
+{
+   _elm_config_atspi_mode_set(is_enable);
+}
+
+EAPI Eina_Bool
 elm_config_selection_unfocused_clear_get(void)
 {
    return _elm_config_selection_unfocused_clear_get();
diff --git a/src/lib/elm_config.h b/src/lib/elm_config.h
index d092441..4478068 100644
--- a/src/lib/elm_config.h
+++ b/src/lib/elm_config.h
@@ -1549,6 +1549,49 @@ EAPI Eina_Bool elm_config_audio_mute_get(Edje_Channel 
channel);
 EAPI void      elm_config_audio_mute_set(Edje_Channel channel, Eina_Bool mute);
 
 /**
+ * @defgroup ATSPI AT-SPI2 Accessibility
+ * @ingroup Elementary
+ *
+ * Elementary widgets support Linux Accessibility standard. For more
+ * information please visit:
+ * 
http://www.linuxfoundation.org/collaborate/workgroups/accessibility/atk/at-spi/at-spi_on_d-bus
+ *
+ * @{
+ */
+
+/**
+ * Gets ATSPI mode
+ *
+ * @return the ATSPI mode
+ *
+ * @since 1.10
+ *
+ * @ingroup ATSPI
+ *
+ * @see elm_config_atspi_mode_set()
+ */
+EAPI Eina_Bool        elm_config_atspi_mode_get(void);
+
+/**
+ * Sets ATSPI mode
+ *
+ * @param is_atspi If @c EINA_TRUE, enables ATSPI2 mode
+ *
+ * @note Enables Linux Accessibility support for Elementary widgets.
+ *
+ * @since 1.10
+ *
+ * @ingroup ATSPI
+ *
+ * @see elm_config_atspi_mode_get()
+ */
+EAPI void             elm_config_atspi_mode_set(Eina_Bool is_atspi);
+
+/**
+ * @}
+ */
+
+/**
  * @}
  */
 
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 1102c0a..f6ddfca 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -162,6 +162,9 @@ extern const char *_elm_engines[];
 #define ELM_ACCESS_MODE_OFF   EINA_FALSE
 #define ELM_ACCESS_MODE_ON    EINA_TRUE
 
+#define ELM_ATSPI_MODE_OFF   EINA_FALSE
+#define ELM_ATSPI_MODE_ON    EINA_TRUE
+
 /* convenience macro to compress code and avoid typos */
 #undef MIN
 #define MIN(x, y) (((x) < (y)) ? (x) : (y))
@@ -287,6 +290,7 @@ struct _Elm_Config
    unsigned char audio_mute_alert;
    unsigned char audio_mute_all;
    Eina_List    *bindings;
+   Eina_Bool     atspi_mode;
 
    /* Not part of the EET file */
    Eina_Bool     is_mirrored : 1;
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 1a8176d..7e982dc 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -3315,7 +3315,7 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const 
char *name, Elm_Win_Type t
    evas_object_event_callback_add(sd->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                   _elm_win_on_resize_obj_changed_size_hints, 
obj);
 
-   if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
+   if (_elm_config->atspi_mode == ELM_ATSPI_MODE_ON)
      {
         eo_do(obj, 
elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_WINDOW));
         
elm_interface_atspi_accessible_children_changed_added_signal_emit(_elm_atspi_root_get(),
 obj);

-- 


Reply via email to