Add new accessibility event path
[apps/native/widget/widget-edje.git] / src / script_port.c
index 979f41d..2e4b7ae 100644 (file)
 
 #define PUBLIC __attribute__((visibility("default")))
 
+#define ACCESS_TYPE_DOWN 0
+#define ACCESS_TYPE_MOVE 1
+#define ACCESS_TYPE_UP 2
+#define ACCESS_TYPE_CUR 0
+#define ACCESS_TYPE_NEXT 1
+#define ACCESS_TYPE_PREV 2
+#define ACCESS_TYPE_OFF 3
+
 struct image_option {
        int orient;
        int aspect;
@@ -1107,7 +1115,7 @@ static inline Evas_Object *get_highlighted_object(Evas_Object *obj)
        LB_ACCESS_ACTION                4
        LB_ACCESS_SCROLL                5
 */
-PUBLIC int script_feed_event(void *h, int event_type, int x, int y, int down, unsigned int keycode, double timestamp)
+PUBLIC int script_feed_event(void *h, int event_type, int x, int y, int type, unsigned int keycode, double timestamp)
 {
        struct info *handle = h;
        Evas_Object *edje;
@@ -1168,38 +1176,42 @@ PUBLIC int script_feed_event(void *h, int event_type, int x, int y, int down, un
                        DbgPrint("ACCESS_ACTIVATE, returns %d\n", ret);
                        ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
                } else if ((event_type & LB_SCRIPT_ACCESS_ACTION) == LB_SCRIPT_ACCESS_ACTION) {
-                       if (down == 0) {
+                       switch (type) {
+                       case ACCESS_TYPE_UP:
                                action = ELM_ACCESS_ACTION_UP;
                                ret = elm_access_action(edje, action, &info);
-                               DbgPrint("ACCESS_ACTION(%d), returns %d\n", down, ret);
+                               DbgPrint("ACCESS_ACTION(%d), returns %d\n", type, ret);
                                ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
-                       } else if (down == 1) {
+                               break;
+                       case ACCESS_TYPE_DOWN:
                                action = ELM_ACCESS_ACTION_DOWN;
                                ret = elm_access_action(edje, action, &info);
-                               DbgPrint("ACCESS_ACTION(%d), returns %d\n", down, ret);
+                               DbgPrint("ACCESS_ACTION(%d), returns %d\n", type, ret);
                                ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
-                       } else {
+                               break;
+                       default:
                                ErrPrint("Invalid access event\n");
                                ret = LB_ACCESS_STATUS_ERROR;
+                               break;
                        }
                } else if ((event_type & LB_SCRIPT_ACCESS_SCROLL) == LB_SCRIPT_ACCESS_SCROLL) {
                        action = ELM_ACCESS_ACTION_SCROLL;
                        info.x = x;
                        info.y = y;
-                       switch (down) {
-                       case 0:
+                       switch (type) {
+                       case ACCESS_TYPE_DOWN:
                                info.mouse_type = 0;
                                ret = elm_access_action(edje, action, &info);
                                DbgPrint("ACCESS_HIGHLIGHT_SCROLL, returns %d\n", ret);
                                ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
                                break;
-                       case -1:
+                       case ACCESS_TYPE_MOVE:
                                info.mouse_type = 1;
                                ret = elm_access_action(edje, action, &info);
                                DbgPrint("ACCESS_HIGHLIGHT_SCROLL, returns %d\n", ret);
                                ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
                                break;
-                       case 1:
+                       case ACCESS_TYPE_UP:
                                info.mouse_type = 2;
                                ret = elm_access_action(edje, action, &info);
                                DbgPrint("ACCESS_HIGHLIGHT_SCROLL, returns %d\n", ret);
@@ -1214,6 +1226,55 @@ PUBLIC int script_feed_event(void *h, int event_type, int x, int y, int down, un
                        ret = elm_access_action(edje, action, &info);
                        DbgPrint("ACCESS_UNHIGHLIGHT, returns %d\n", ret);
                        ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+               } else if ((event_type & LB_SCRIPT_ACCESS_VALUE_CHANGE) == LB_SCRIPT_ACCESS_VALUE_CHANGE) {
+                       action = ELM_ACCESS_ACTION_VALUE_CHANGE;
+                       info.mouse_type = type;
+                       info.x = x;
+                       info.y = y;
+                       ret = elm_access_action(edje, action, &info);
+                       ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+               } else if ((event_type & LB_SCRIPT_ACCESS_MOUSE) == LB_SCRIPT_ACCESS_MOUSE) {
+                       action = ELM_ACCESS_ACTION_MOUSE;
+                       info.mouse_type = type;
+                       info.x = x;
+                       info.y = y;
+                       ret = elm_access_action(edje, action, &info);
+                       ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+               } else if ((event_type & LB_SCRIPT_ACCESS_BACK) == LB_SCRIPT_ACCESS_BACK) {
+                       action = ELM_ACCESS_ACTION_BACK;
+                       info.mouse_type = type;
+                       info.x = x;
+                       info.y = y;
+                       ret = elm_access_action(edje, action, &info);
+                       ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+               } else if ((event_type & LB_SCRIPT_ACCESS_OVER) == LB_SCRIPT_ACCESS_OVER) {
+                       action = ELM_ACCESS_ACTION_OVER;
+                       info.mouse_type = type;
+                       info.x = x;
+                       info.y = y;
+                       ret = elm_access_action(edje, action, &info);
+                       ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+               } else if ((event_type & LB_SCRIPT_ACCESS_READ) == LB_SCRIPT_ACCESS_READ) {
+                       action = ELM_ACCESS_ACTION_READ;
+                       info.mouse_type = type;
+                       info.x = x;
+                       info.y = y;
+                       ret = elm_access_action(edje, action, &info);
+                       ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+               } else if ((event_type & LB_SCRIPT_ACCESS_ENABLE) == LB_SCRIPT_ACCESS_ENABLE) {
+                       action = ELM_ACCESS_ACTION_ENABLE;
+                       info.mouse_type = type;
+                       info.x = x;
+                       info.y = y;
+                       ret = elm_access_action(edje, action, &info);
+                       ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+               } else if ((event_type & LB_SCRIPT_ACCESS_DISABLE) == LB_SCRIPT_ACCESS_DISABLE) {
+                       action = ELM_ACCESS_ACTION_ENABLE;
+                       info.mouse_type = type;
+                       info.x = x;
+                       info.y = y;
+                       ret = elm_access_action(edje, action, &info);
+                       ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
                } else {
                        DbgPrint("Invalid event\n");
                        ret = LB_ACCESS_STATUS_ERROR;