#include <e_screen_reader_config.h>
#include <e_screen_reader_private.h>
+#define E_A11Y_SERVICE_BUS_NAME "org.enlightnement.wm-screen-reader"
+#define E_A11Y_SERVICE_NAVI_IFC_NAME "org.tizen.GestureNavigation"
+#define E_A11Y_SERVICE_NAVI_OBJ_PATH "/org/tizen/GestureNavigation"
+#define E_A11Y_SERVICE_TRACKER_IFC_NAME "org.tizen.WindowTracker"
+#define E_A11Y_SERVICE_TRACKER_OBJ_PATH "/org/tizen/WindowTracker"
+
+#define E_ATSPI_BUS_TIMEOUT 4000
+
#undef DBG
int _eina_log_dom = -1;
#define DBG(...) do EINA_LOG_DOM_DBG(_eina_log_dom, __VA_ARGS__); while(0)
static Eina_Bool g_gesture_navi;
static Eina_List *handlers;
+Eldbus_Connection *conn = NULL;
EAPI E_Module_Api e_modapi =
{
int _e_mod_atspi_dbus_broadcast(Gesture_Info *gi)
{
/* Implement this for gesture broadcast */
+ DEBUG("atspi bus broadcast callback");
const char *name;
+ Eldbus_Message *msg;
+ if (!conn) return -1;
name = _gesture_enum_to_string(gi->type);
if (!name) return -1;
- INFO("GestureDetected %s (%d %d %d %d %d)", name, gi->x_beg, gi->y_beg, gi->x_end, gi->y_end, gi->state);
+ msg = eldbus_message_signal_new(E_A11Y_SERVICE_NAVI_OBJ_PATH,
+ E_A11Y_SERVICE_NAVI_IFC_NAME, "GestureDetected");
+ if (!msg) return -1;
+
+ if (!eldbus_message_arguments_append(msg, "iiiiiiu", (int)gi->type, gi->x_beg, gi->y_beg, gi->x_end, gi->y_end, gi->state, gi->event_time))
+ {
+ eldbus_message_unref(msg);
+ INFO("Append failed");
+ return -1;
+ }
+
+ eldbus_connection_send(conn, msg, NULL, NULL, 0);
+ INFO("GestureDetected %s %d (%d %d %d %d %d %u)", name, (int)gi->type, gi->x_beg, gi->y_beg, gi->x_end, gi->y_end, gi->state, gi->event_time);
return 0;
}
void *event)
{
Gesture_Info *gi = event;
-
+ DEBUG("Gesture cb hit\n");
if (g_gesture_navi)
_e_mod_atspi_dbus_broadcast(gi);
handlers, ecore_event_handler_add(event, cb, NULL));
HANDLER_APPEND(E_EVENT_ATSPI_GESTURE_DETECTED, _gesture_cb);
/* Use this list for other handlers */
-#undef APPEND_HANDLER
+#undef HANDLER_APPEND
}
static void
E_FREE_LIST(handlers, ecore_event_handler_del);
}
+static void
+_on_name_cb(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
+{
+ DEBUG("On_name_cb");
+}
+
+static void
+_on_name_release_cb(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
+{
+ DEBUG("On_name_release_cb");
+}
+
+static int
+_fetch_a11y_bus_address(void)
+{
+ if (conn) return 0;
+ conn = eldbus_address_connection_get("unix:path=/var/run/dbus/system_bus_socket");
+ if (!conn)
+ {
+ ERROR("unable to get system bus");
+ goto fail;
+ }
+ INFO("Connected to: unix:path=/var/run/dbus/system_bus_socket");
+
+ if (!conn) return 0;
+ eldbus_name_request(conn, E_A11Y_SERVICE_BUS_NAME,
+ ELDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE, _on_name_cb, NULL);
+
+ INFO("AT-SPI dbus service initialized.");
+ return 0;
+fail:
+ INFO("Failed in _fetch_a11y_bus_address");
+ return -1;
+}
+
+int _a11y_bus_unregister(void)
+{
+ if (!conn) return 0;
+
+ eldbus_name_release(conn, E_A11Y_SERVICE_BUS_NAME, _on_name_release_cb, NULL);
+ eldbus_connection_unref(conn);
+ conn = NULL;
+
+ return 0;
+}
+
+void _e_mod_atspi_dbus_shutdown()
+{
+ DEBUG("dbus shutdown");
+
+ _a11y_bus_unregister();
+
+ eldbus_shutdown();
+}
+
+int _e_mod_atspi_dbus_init(void)
+{
+ DEBUG("dbus init");
+
+ eldbus_init();
+ return _fetch_a11y_bus_address();
+}
+
EAPI void *
e_modapi_init(E_Module *m)
{
goto fail;
if (_e_mod_atspi_gestures_init())
goto fail_gestures;
+ if (_e_mod_atspi_dbus_init())
+ goto fail_dbus;
_events_init();
g_gesture_navi = EINA_TRUE;
_e_mod_atspi_config_shutdown();
fail:
ERROR("Module initialization failed.");
+fail_dbus:
+ ERROR("Dbus submodule initialization failed.");
return NULL;
}
_e_mod_atspi_config_save();
_e_mod_atspi_config_shutdown();
_e_mod_atspi_gestures_shutdown();
+ _e_mod_atspi_dbus_shutdown();
return 1;
}
free(data);
}
-static void _event_emit(Gesture g, int x, int y, int x_e, int y_e, int state)
+static void _event_emit(Gesture g, int x, int y, int x_e, int y_e, int state, unsigned int event_time)
{
Gesture_Info *info = calloc(sizeof(Gesture_Info), 1);
EINA_SAFETY_ON_NULL_RETURN(info);
info->y_beg = y;
info->y_end = y_e;
info->state = state;
+ info->event_time = event_time;
ecore_event_add(E_EVENT_ATSPI_GESTURE_DETECTED, info, _gesture_info_free, NULL);
}
if (cov->flick_gesture.n_fingers == 3)
type = THREE_FINGERS_FLICK_RIGHT_RETURN;
}
- _event_emit(type, ax, ay, axe, aye, 2);
+ _event_emit(type, ax, ay, axe, aye, 2, cov->event_time);
}
static void
switch (cov->hover_gesture.n_fingers)
{
case 1:
- _event_emit(ONE_FINGER_HOVER, ax, ay, ax, ay, state);
+ _event_emit(ONE_FINGER_HOVER, ax, ay, ax, ay, state, cov->event_time);
break;
case 2:
- _event_emit(TWO_FINGERS_HOVER, ax, ay, ax, ay, state);
+ _event_emit(TWO_FINGERS_HOVER, ax, ay, ax, ay, state, cov->event_time);
break;
default:
break;
_event_emit(ONE_FINGER_SINGLE_TAP,
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
- 2);
+ 2, cov->event_time);
}
else if(cov->tap_gesture_data.tap_type == TWO_FINGERS_GESTURE)
{
_event_emit(TWO_FINGERS_SINGLE_TAP,
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
cov->tap_gesture_data.x_org[1], cov->tap_gesture_data.y_org[1],
- 2);
+ 2, cov->event_time);
}
else if(cov->tap_gesture_data.tap_type == THREE_FINGERS_GESTURE)
{
_event_emit(THREE_FINGERS_SINGLE_TAP,
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
cov->tap_gesture_data.x_org[2], cov->tap_gesture_data.y_org[2],
- 2);
+ 2, cov->event_time);
}
else
{
_event_emit(ONE_FINGER_DOUBLE_TAP,
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
- 2);
+ 2, cov->event_time);
}
else if(cov->tap_gesture_data.tap_type == TWO_FINGERS_GESTURE)
{
_event_emit(TWO_FINGERS_DOUBLE_TAP,
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
cov->tap_gesture_data.x_org[1], cov->tap_gesture_data.y_org[1],
- 2);
+ 2, cov->event_time);
}
else if(cov->tap_gesture_data.tap_type == THREE_FINGERS_GESTURE)
{
_event_emit(THREE_FINGERS_DOUBLE_TAP,
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
cov->tap_gesture_data.x_org[2], cov->tap_gesture_data.y_org[2],
- 2);
+ 2, cov->event_time);
}
else
{
_event_emit(ONE_FINGER_TRIPLE_TAP,
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
- 2);
+ 2, cov->event_time);
}
else if(cov->tap_gesture_data.tap_type == TWO_FINGERS_GESTURE)
{
_event_emit(TWO_FINGERS_TRIPLE_TAP,
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
cov->tap_gesture_data.x_org[1], cov->tap_gesture_data.y_org[1],
- 2);
+ 2, cov->event_time);
}
else if(cov->tap_gesture_data.tap_type == THREE_FINGERS_GESTURE)
{
_event_emit(THREE_FINGERS_TRIPLE_TAP,
cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
cov->tap_gesture_data.x_org[2], cov->tap_gesture_data.y_org[2],
- 2);
+ 2, cov->event_time);
}
else
{