[access] convey access action info with value - do not send NULL
authorShinwoo Kim <cinoo.kim@samsung.com>
Wed, 17 Apr 2013 03:41:13 +0000 (12:41 +0900)
committerSungho Kwak <sungho1.kwak@samsung.com>
Mon, 29 Apr 2013 11:29:47 +0000 (20:29 +0900)
src/lib/elm_access.c
src/lib/elm_access.h
src/lib/elm_plug.c

index 167ccda..7e032d4 100644 (file)
@@ -50,6 +50,34 @@ _elm_access_smart_on_focus(Evas_Object *obj)
 }
 
 static Eina_Bool
+_access_action_callback_call(Evas_Object *obj,
+                             Elm_Access_Action_Type type,
+                             Elm_Access_Action_Info *action_info)
+{
+   Elm_Access_Action_Info *ai = NULL;
+   Action_Info *a;
+   Eina_Bool ret;
+
+   ret = EINA_FALSE;
+   a = evas_object_data_get(obj, "_elm_access_action_info");
+
+   if (!action_info)
+     {
+        ai = calloc(1, sizeof(Elm_Access_Action_Info));
+        action_info = ai;
+     }
+
+   action_info->action_type = type;
+
+   if (a && (a->fn[type].cb))
+     ret = a->fn[type].cb(a->fn[type].user_data, obj, action_info);
+
+   if (ai) free(ai);
+
+   return ret;
+}
+
+static Eina_Bool
 _elm_access_smart_activate(Evas_Object *obj, Elm_Activate act)
 {
    int type = ELM_ACCESS_ACTION_FIRST;
@@ -82,18 +110,21 @@ _elm_access_smart_activate(Evas_Object *obj, Elm_Activate act)
         break;
 
       default:
+        return EINA_FALSE;
         break;
      }
 
+   /* if an access object has a callback, it would have the intention to do
+      something. so, check here and return EINA_TRUE. */
    if ((a) && (type > ELM_ACCESS_ACTION_FIRST) &&
               (type < ELM_ACCESS_ACTION_LAST) &&
               (a->fn[type].cb))
      {
-        a->fn[type].cb(a->fn[type].user_data, obj, NULL);
+        _access_action_callback_call(obj, type, NULL);
         return EINA_TRUE;
      }
 
-   /* TODO: deprecate below? and change above with _access_action_callback_call(); */
+   /* TODO: deprecate below? */
    if (act != ELM_ACTIVATE_DEFAULT) return EINA_FALSE;
 
    Elm_Access_Info *ac = evas_object_data_get(obj, "_elm_access");
@@ -499,34 +530,6 @@ _elm_access_highlight_object_scroll(Evas_Object *obj, int type, int x, int y)
 }
 
 static Eina_Bool
-_access_action_callback_call(Evas_Object *obj,
-                             Elm_Access_Action_Type type,
-                             Elm_Access_Action_Info *action_info)
-{
-   Elm_Access_Action_Info *ai = NULL;
-   Action_Info *a;
-   Eina_Bool ret;
-
-   ret = EINA_FALSE;
-   a = evas_object_data_get(obj, "_elm_access_action_info");
-
-   if (!action_info)
-     {
-        ai = calloc(1, sizeof(Elm_Access_Action_Info));
-        action_info = ai;
-     }
-
-   action_info->action_type = type;
-
-   if (a && (a->fn[type].cb))
-     ret = a->fn[type].cb(a->fn[type].user_data, obj, action_info);
-
-   if (ai) free(ai);
-
-   return ret;
-}
-
-static Eina_Bool
 _access_highlight_next_get(Evas_Object *obj, Elm_Focus_Direction dir)
 {
    int type;
index 72138d2..078cf82 100644 (file)
@@ -30,16 +30,6 @@ typedef char *(*Elm_Access_Info_Cb)(void *data, Evas_Object *obj);
 typedef void (*Elm_Access_Activate_Cb)(void *data, Evas_Object *part_obj, Elm_Object_Item *item);
 
 /**
- * @typedef Elm_Access_Action_Cb
- * User callback to make access object do specific action
- * @param data user data
- * @param action_info information to classify the action
- * Returns EINA_TRUE on success, EINA FALSE otherwise
- *
- */
-typedef Eina_Bool (*Elm_Access_Action_Cb)(void *data, Evas_Object *obj, void *action_info);
-
-/**
  * @enum _Elm_Access_Action_Type
  * Enum of supported access action types.
  */
@@ -85,6 +75,16 @@ struct _Elm_Access_Action_Info
 typedef struct _Elm_Access_Action_Info Elm_Access_Action_Info;
 
 /**
+ * @typedef Elm_Access_Action_Cb
+ * User callback to make access object do specific action
+ * @param data user data
+ * @param action_info information to classify the action
+ * Returns EINA_TRUE on success, EINA FALSE otherwise
+ *
+ */
+typedef Eina_Bool (*Elm_Access_Action_Cb)(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info);
+
+/**
  * @brief Register evas object as an accessible object.
  * @since 1.8
  *
index 800136a..ba190eb 100644 (file)
@@ -55,7 +55,7 @@ _elm_plug_smart_theme(Evas_Object *obj)
 static Eina_Bool
 _access_action_release_cb(void *data __UNUSED__,
                           Evas_Object *obj __UNUSED__,
-                          void *action_info __UNUSED__)
+                          Elm_Access_Action_Info *action_info __UNUSED__)
 {
    return EINA_FALSE;
 }
@@ -231,23 +231,23 @@ elm_plug_smart_class_get(void)
 static Eina_Bool
 _access_action_highlight_next_cb(void *data __UNUSED__,
                                  Evas_Object *obj,
-                                 void *action_info)
+                                 Elm_Access_Action_Info *action_info)
 {
    Ecore_Evas *ee = NULL;
-   Elm_Access_Action_Info *ai = action_info;
 
    ee = _elm_plug_ecore_evas_get(obj);
    if (!ee) return EINA_TRUE;
 
    ecore_evas_msg_parent_send(ee, MSG_DOMAIN_CONTROL_ACCESS,
-                              ai->action_type,
-                              ai, sizeof(Elm_Access_Action_Info));
+                              action_info->action_type,
+                              action_info, sizeof(Elm_Access_Action_Info));
    return EINA_TRUE;
 }
 
 static Eina_Bool
 _access_action_highlight_cb(void *data __UNUSED__,
-                            Evas_Object *obj, void *action_info)
+                            Evas_Object *obj,
+                            Elm_Access_Action_Info *action_info)
 {
    Ecore_Evas *ee = NULL;