atspi: do operation if its object is available 42/131642/3
authorShinwoo Kim <cinoo.kim@samsung.com>
Tue, 30 May 2017 08:05:53 +0000 (17:05 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Mon, 12 Jun 2017 04:16:55 +0000 (04:16 +0000)
Operation 1. activate
An object under the naviframe item is accessible even though new naviframe item
is pushed on it. In this case, it is possilbe to do action of the object.
So this patch set is checking SHOWING state before doing action.

Operation 2. selection
It was possible to (de)select even though its one of perent freezes events.
It is impossilbe to (de)select using touch event if freeze_events set to 1.
So it should work same using atspi interface.

Change-Id: I59d69cd117252ef7364fd80536ce6b153c0ce920

src/lib/elm_atspi_bridge.c

index 678ea693354fa340c1cc1b206b070466ebb08dc3..49a844212a4e86a2445529e483ae3017ddc7a107 100644 (file)
@@ -931,6 +931,23 @@ static const Eldbus_Method accessible_methods[] = {
    { NULL, NULL, NULL, NULL, 0 }
 };
 
+static Eina_Bool
+_is_operation_permitted(Eo *obj)
+{
+   Elm_Atspi_State_Set states;
+   eo_do(obj, states = elm_interface_atspi_accessible_state_set_get());
+
+   if (!STATE_TYPE_GET(states, ELM_ATSPI_STATE_SHOWING)) return EINA_FALSE;
+
+   Eo *parent = obj;
+   while (parent)
+     {
+        if (evas_object_freeze_events_get(parent)) return EINA_FALSE;
+        parent = evas_object_smart_parent_get(parent);
+     }
+   return EINA_TRUE;
+}
+
 static Eldbus_Message *
 _selection_selected_child_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
 {
@@ -968,7 +985,7 @@ _selection_child_select(const Eldbus_Service_Interface *iface, const Eldbus_Mess
    Eo *obj = _bridge_object_from_path(bridge, obj_path);
    int idx;
    Eldbus_Message *ret;
-   Eina_Bool result;
+   Eina_Bool result = EINA_FALSE;
 
    ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE, msg);
 
@@ -978,7 +995,8 @@ _selection_child_select(const Eldbus_Service_Interface *iface, const Eldbus_Mess
    ret = eldbus_message_method_return_new(msg);
    EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
 
-   eo_do(obj, result = elm_interface_atspi_selection_child_select(idx));
+   if (_is_operation_permitted(obj))
+     eo_do(obj, result = elm_interface_atspi_selection_child_select(idx));
    eldbus_message_arguments_append(ret, "b", result);
 
    return ret;
@@ -992,7 +1010,7 @@ _selection_selected_child_deselect(const Eldbus_Service_Interface *iface, const
    Eo *obj = _bridge_object_from_path(bridge, obj_path);
    int idx;
    Eldbus_Message *ret;
-   Eina_Bool result;
+   Eina_Bool result = EINA_FALSE;
 
    ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE, msg);
 
@@ -1002,7 +1020,8 @@ _selection_selected_child_deselect(const Eldbus_Service_Interface *iface, const
    ret = eldbus_message_method_return_new(msg);
    EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
 
-   eo_do(obj, result = elm_interface_atspi_selection_selected_child_deselect(idx));
+   if (_is_operation_permitted(obj))
+     eo_do(obj, result = elm_interface_atspi_selection_selected_child_deselect(idx));
    eldbus_message_arguments_append(ret, "b", result);
 
    return ret;
@@ -1039,14 +1058,15 @@ _selection_all_children_select(const Eldbus_Service_Interface *iface, const Eldb
    Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
    Eo *obj = _bridge_object_from_path(bridge, obj_path);
    Eldbus_Message *ret;
-   Eina_Bool result;
+   Eina_Bool result = EINA_FALSE;
 
    ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE, msg);
 
    ret = eldbus_message_method_return_new(msg);
    EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
 
-   eo_do(obj, result = elm_interface_atspi_selection_all_children_select());
+   if (_is_operation_permitted(obj))
+     eo_do(obj, result = elm_interface_atspi_selection_all_children_select());
    eldbus_message_arguments_append(ret, "b", result);
 
    return ret;
@@ -1059,14 +1079,15 @@ _selection_clear(const Eldbus_Service_Interface *iface, const Eldbus_Message *ms
    Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
    Eo *obj = _bridge_object_from_path(bridge, obj_path);
    Eldbus_Message *ret;
-   Eina_Bool result;
+   Eina_Bool result = EINA_FALSE;
 
    ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE, msg);
 
    ret = eldbus_message_method_return_new(msg);
    EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
 
-   eo_do(obj, result = elm_interface_atspi_selection_clear());
+   if (_is_operation_permitted(obj))
+     eo_do(obj, result = elm_interface_atspi_selection_clear());
    eldbus_message_arguments_append(ret, "b", result);
 
    return ret;
@@ -1080,7 +1101,7 @@ _selection_child_deselect(const Eldbus_Service_Interface *iface, const Eldbus_Me
    Eo *obj = _bridge_object_from_path(bridge, obj_path);
    int idx;
    Eldbus_Message *ret;
-   Eina_Bool result;
+   Eina_Bool result = EINA_FALSE;
 
    ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE, msg);
 
@@ -1090,7 +1111,8 @@ _selection_child_deselect(const Eldbus_Service_Interface *iface, const Eldbus_Me
    ret = eldbus_message_method_return_new(msg);
    EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
 
-   eo_do(obj, result = elm_interface_atspi_selection_child_deselect(idx));
+   if (_is_operation_permitted(obj))
+     eo_do(obj, result = elm_interface_atspi_selection_child_deselect(idx));
    eldbus_message_arguments_append(ret, "b", result);
 
    return ret;
@@ -1253,7 +1275,7 @@ _action_action_do(const Eldbus_Service_Interface *iface, const Eldbus_Message *m
    Eo *obj = _bridge_object_from_path(bridge, obj_path);
    int idx;
    Eldbus_Message *ret;
-   Eina_Bool result;
+   Eina_Bool result = EINA_FALSE;
 
    ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, ELM_INTERFACE_ATSPI_ACTION_MIXIN, msg);
 
@@ -1263,7 +1285,9 @@ _action_action_do(const Eldbus_Service_Interface *iface, const Eldbus_Message *m
    ret = eldbus_message_method_return_new(msg);
    EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
 
-   eo_do(obj, result = elm_interface_atspi_action_do(idx));
+   if (_is_operation_permitted(obj))
+     eo_do(obj, result = elm_interface_atspi_action_do(idx));
+
    eldbus_message_arguments_append(ret, "b", result);
 
    return ret;