Add API eext_gesture_event_dispatch 14/127914/5
authorShinwoo Kim <cinoo.kim@samsung.com>
Tue, 2 May 2017 09:51:38 +0000 (18:51 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Mon, 4 Sep 2017 11:32:16 +0000 (20:32 +0900)
This patch set will work with platform/core/uifw/e-mod-tizen-screen-reader
(https://review.tizen.org/gerrit/#/c/127916/)

Change-Id: I9b34879ec57521af189006f251adc14843f8f3a9

inc/efl_extension_events.h
src/efl_extension_events.c

index 7fc995aaf25e27e22a0a4a94797ea2dd1a59dd3d..ba57b1b48f0d4458b06e2a5ed2115a0c93f76698 100644 (file)
@@ -353,6 +353,29 @@ eext_entry_selection_back_event_allow_set(Evas_Object *obj, Eina_Bool allow)
      }
 }
 
+/**
+ * An enum of gesture type
+ */
+typedef enum _Eext_Gesture_Event_Type
+{
+   EEXT_GESTURE_TAP,         /**< Tap Gesture */
+   EEXT_GESTURE_SWIPE_RIGHT, /**< Swipe Right Gesutre */
+   EEXT_GESTURE_SWIPE_LEFT,  /**< Swipe Left Gesutre */
+   EEXT_GESTURE_SWIPE_UP,    /**< Swipe Up Gesutre */
+   EEXT_GESTURE_SWIPE_DOWN,  /**< Swipe Down Gesutre */
+   EEXT_GESTURE_ZOOM_IN,     /**< Zoom In Gesutre */
+   EEXT_GESTURE_ZOOM_OUT     /**< Zoom Out Gesutre */
+} Eext_Gesture_Event_Type;
+
+/**
+ * @brief Dispatch gesture event given type and x, y position.
+ *
+ * @param[in] type Gesture type
+ * @param[in] x The x coordinate gesture event starts at
+ * @param[in] y The y coordinate gesture event starts at
+ */
+EAPI void eext_gesture_event_dispatch(Eext_Gesture_Event_Type type, int x, int y);
+
 /**
  * @}
  */
index 5722e79bbcb45730af7f4362fb2a400e99392212..e9b2cba11b04f6d1b60fd7d449361521bac62863 100644 (file)
 #include "efl_extension.h"
 #include "efl_extension_private.h"
 
+#define E_A11Y_SERVICE_BUS_NAME "org.enlightenment.wm-screen-reader"
+#define E_A11Y_SERVICE_NAVI_OBJ_PATH "/org/tizen/GestureNavigation"
+#define E_A11Y_SERVICE_NAVI_IFC_NAME "org.tizen.GestureNavigation"
+
 typedef struct _Eext_Event_Mgr Eext_Event_Mgr;
 
 struct _Eext_Event_Mgr
@@ -512,3 +516,37 @@ eext_object_event_callback_add(Evas_Object *obj, Eext_Callback_Type type, Eext_E
 
    obj_event->callbacks = eina_list_append(obj_event->callbacks, callback);
 }
+
+EAPI void
+eext_gesture_event_dispatch(Eext_Gesture_Event_Type type, int x, int y)
+{
+   Eldbus_Connection *conn;
+   Eldbus_Object *dobj;
+   Eldbus_Proxy *proxy;
+
+   eldbus_init();
+   if (!(conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM)))
+     {
+        ERR("Connection to system bus failed");
+        return;
+     }
+   if (!(dobj = eldbus_object_get(conn, E_A11Y_SERVICE_BUS_NAME, E_A11Y_SERVICE_NAVI_OBJ_PATH)))
+     {
+        ERR("Failed to create eldbus object");
+        goto fail_obj;
+     }
+   if (!(proxy = eldbus_proxy_get(dobj, E_A11Y_SERVICE_NAVI_IFC_NAME)))
+     {
+        ERR("Failed to create proxy object for 'org.tizen.GestureNavigation'");
+        goto fail_proxy;
+     }
+   eldbus_proxy_call(proxy, "DispatchGestureEvent", NULL, NULL, -1, "iii", type, x, y);
+
+fail_proxy:
+   eldbus_object_unref(dobj);
+fail_obj:
+   eldbus_connection_unref(conn);
+
+   eldbus_shutdown();
+   return;
+}