Eldbus_Connection *conn = NULL;
Eldbus_Service_Interface *iface = NULL;
Eina_Bool is_slider;
-Eina_Bool is_screen_reader_support;
int highlighted_object_x, highlighted_object_y;
Eina_Bool is_selection_mode;
int object_needs_scroll_from_x, object_needs_scroll_from_y;
static Eldbus_Message *_back_button_interception_enabled(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_is_slider(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_highlighted_object_info(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
-static Eldbus_Message *_is_screen_reader_support(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
+static Eldbus_Message *_is_app_gesture_support(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_is_selection_mode(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_object_needs_scroll_gesture(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_dispatch_drag_event(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
{ "HighlightedObjectInfo", ELDBUS_ARGS({"i", "int"}, {"i", "int"}), NULL,
_highlighted_object_info
},
- { "IsScreenReaderSupport", ELDBUS_ARGS({"b", "bool"}), NULL,
- _is_screen_reader_support
+ { "AppGestureSupport", ELDBUS_ARGS({"s", "string"}), NULL,
+ _is_app_gesture_support
},
{ "IsSelectionMode", ELDBUS_ARGS({"b", "bool"}), NULL,
_is_selection_mode
/* Use this util function for gesture enum to string conversion */
-static const char *_gesture_enum_to_string(Gesture g)
+const char *gesture_enum_to_string(Gesture g)
{
switch(g)
{
eldbus_service_signal_emit(iface, GESTURE_DETECTED_SIGNAL, (int)gi->type, gi->x_beg, gi->y_beg,
gi->x_end, gi->y_end, gi->state, gi->event_time);
- INFO("GestureDetected %s %d (%d %d %d %d %d %u)", _gesture_enum_to_string(gi->type),
+ INFO("GestureDetected %s %d (%d %d %d %d %d %u)", gesture_enum_to_string(gi->type),
(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");
+ DEBUG("Gesture cb hit");
if (g_gesture_navi)
_e_mod_atspi_dbus_broadcast(gi);
}
static Eldbus_Message *
-_is_screen_reader_support(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
+_is_app_gesture_support(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
{
- if (!eldbus_message_arguments_get(msg, "b", &is_screen_reader_support))
+ char *text = "";
+
+ if (!eldbus_message_arguments_get(msg, "s", &text))
+ {
ERROR("eldbus_message_arguments_get() error\n");
+ return NULL;
+ }
- DEBUG("screen reader support :%d", is_screen_reader_support);
- return NULL;
+ app_gesture_support (text);
+
+ return eldbus_message_method_return_new(msg);
}
static Eldbus_Message *
#define HISTORY_MAX 8
double MAGIC_NUMBER = 987654321.0;
+Eina_Bool app_support_gestures;
+Eina_Bool gestures_supported_by_app [ GESTURES_COUNT ];
typedef enum {
FLICK_DIRECTION_UNDEFINED,
unsigned int timestamp; // time of gesture;
unsigned int last_emission_time; // last time of gesture emission
Ecore_Timer *timer;
- Eina_Bool longpressed;
+ Eina_Bool longpressed, atspi_mouse_down_emitted;
+ Ecore_Event_Mouse_Button ev_first_down;
} hover_gesture;
struct {
free(data);
}
+void app_gesture_support (char *msg)
+{
+ if (!strcmp(msg, "all"))
+ {
+ app_support_gestures = EINA_TRUE;
+ DEBUG("App support all gestures");
+
+ return;
+ }
+
+ app_support_gestures = EINA_FALSE;
+ int k;
+ for (k = 0; k < GESTURES_COUNT; ++k)
+ gestures_supported_by_app [k] = EINA_FALSE;
+
+ if (!strcmp(msg, ""))
+ {
+ DEBUG("App support none gestures");
+ return;
+ }
+
+ unsigned int n = 0;
+ char **list = eina_str_split_full(msg, "|", 0, &n);
+ if (list) {
+ int i;
+ for (i = 0; i < n; ++i) {
+ for (k = 0; k < GESTURES_COUNT; ++k)
+ if (strcmp(list[i], gesture_enum_to_string(k)) == 0) {
+ gestures_supported_by_app[k] = EINA_TRUE;
+ break;
+ }
+ if (k >= GESTURES_COUNT)
+ DEBUG("unknown gesture '%s'", list[i]);
+ }
+ free(list[0]);
+ free(list);
+ }
+
+ DEBUG("App support :%s gestures", msg);
+}
+
int gesture_state_enum_to_int(gesture_state_e state)
{
int gesture_state;
return FLICK_DIRECTION_UNDEFINED;
}
-static void
-_flick_event_emit(Cover *cov)
+static int _flick_event_emit_get_type(Cover *cov)
{
- int ax, ay, axe, aye, i, type = -1;
- ax = ay = axe = aye = 0;
-
- for (i = 0; i < cov->flick_gesture.n_fingers; i++)
- {
- ax += cov->flick_gesture.x_org[i];
- ay += cov->flick_gesture.y_org[i];
- axe += cov->flick_gesture.x_end[i];
- aye += cov->flick_gesture.y_end[i];
- }
-
- ax /= cov->flick_gesture.n_fingers;
- ay /= cov->flick_gesture.n_fingers;
- axe /= cov->flick_gesture.n_fingers;
- aye /= cov->flick_gesture.n_fingers;
-
if (cov->flick_gesture.dir == FLICK_DIRECTION_LEFT)
{
if (cov->flick_gesture.n_fingers == 1)
- type = ONE_FINGER_FLICK_LEFT;
+ return ONE_FINGER_FLICK_LEFT;
if (cov->flick_gesture.n_fingers == 2)
- type = TWO_FINGERS_FLICK_LEFT;
+ return TWO_FINGERS_FLICK_LEFT;
if (cov->flick_gesture.n_fingers == 3)
- type = THREE_FINGERS_FLICK_LEFT;
+ return THREE_FINGERS_FLICK_LEFT;
}
else if (cov->flick_gesture.dir == FLICK_DIRECTION_RIGHT)
{
if (cov->flick_gesture.n_fingers == 1)
- type = ONE_FINGER_FLICK_RIGHT;
+ return ONE_FINGER_FLICK_RIGHT;
if (cov->flick_gesture.n_fingers == 2)
- type = TWO_FINGERS_FLICK_RIGHT;
+ return TWO_FINGERS_FLICK_RIGHT;
if (cov->flick_gesture.n_fingers == 3)
- type = THREE_FINGERS_FLICK_RIGHT;
+ return THREE_FINGERS_FLICK_RIGHT;
}
else if (cov->flick_gesture.dir == FLICK_DIRECTION_UP)
{
if (cov->flick_gesture.n_fingers == 1)
- type = ONE_FINGER_FLICK_UP;
+ return ONE_FINGER_FLICK_UP;
if (cov->flick_gesture.n_fingers == 2)
- type = TWO_FINGERS_FLICK_UP;
+ return TWO_FINGERS_FLICK_UP;
if (cov->flick_gesture.n_fingers == 3)
- type = THREE_FINGERS_FLICK_UP;
+ return THREE_FINGERS_FLICK_UP;
}
else if (cov->flick_gesture.dir == FLICK_DIRECTION_DOWN)
{
if (cov->flick_gesture.n_fingers == 1)
- type = ONE_FINGER_FLICK_DOWN;
+ return ONE_FINGER_FLICK_DOWN;
if (cov->flick_gesture.n_fingers == 2)
- type = TWO_FINGERS_FLICK_DOWN;
+ return TWO_FINGERS_FLICK_DOWN;
if (cov->flick_gesture.n_fingers == 3)
- type = THREE_FINGERS_FLICK_DOWN;
+ return THREE_FINGERS_FLICK_DOWN;
}
else if (cov->flick_gesture.dir == FLICK_DIRECTION_DOWN_RETURN)
{
if (cov->flick_gesture.n_fingers == 1)
- type = ONE_FINGER_FLICK_DOWN_RETURN;
+ return ONE_FINGER_FLICK_DOWN_RETURN;
if (cov->flick_gesture.n_fingers == 2)
- type = TWO_FINGERS_FLICK_DOWN_RETURN;
+ return TWO_FINGERS_FLICK_DOWN_RETURN;
if (cov->flick_gesture.n_fingers == 3)
- type = THREE_FINGERS_FLICK_DOWN_RETURN;
+ return THREE_FINGERS_FLICK_DOWN_RETURN;
}
else if (cov->flick_gesture.dir == FLICK_DIRECTION_UP_RETURN)
{
if (cov->flick_gesture.n_fingers == 1)
- type = ONE_FINGER_FLICK_UP_RETURN;
+ return ONE_FINGER_FLICK_UP_RETURN;
if (cov->flick_gesture.n_fingers == 2)
- type = TWO_FINGERS_FLICK_UP_RETURN;
+ return TWO_FINGERS_FLICK_UP_RETURN;
if (cov->flick_gesture.n_fingers == 3)
- type = THREE_FINGERS_FLICK_UP_RETURN;
+ return THREE_FINGERS_FLICK_UP_RETURN;
}
else if (cov->flick_gesture.dir == FLICK_DIRECTION_LEFT_RETURN)
{
if (cov->flick_gesture.n_fingers == 1)
- type = ONE_FINGER_FLICK_LEFT_RETURN;
+ return ONE_FINGER_FLICK_LEFT_RETURN;
if (cov->flick_gesture.n_fingers == 2)
- type = TWO_FINGERS_FLICK_LEFT_RETURN;
+ return TWO_FINGERS_FLICK_LEFT_RETURN;
if (cov->flick_gesture.n_fingers == 3)
- type = THREE_FINGERS_FLICK_LEFT_RETURN;
+ return THREE_FINGERS_FLICK_LEFT_RETURN;
}
else if (cov->flick_gesture.dir == FLICK_DIRECTION_RIGHT_RETURN)
{
if (cov->flick_gesture.n_fingers == 1)
- type = ONE_FINGER_FLICK_RIGHT_RETURN;
+ return ONE_FINGER_FLICK_RIGHT_RETURN;
if (cov->flick_gesture.n_fingers == 2)
- type = TWO_FINGERS_FLICK_RIGHT_RETURN;
+ return TWO_FINGERS_FLICK_RIGHT_RETURN;
if (cov->flick_gesture.n_fingers == 3)
- type = THREE_FINGERS_FLICK_RIGHT_RETURN;
+ return THREE_FINGERS_FLICK_RIGHT_RETURN;
}
+ return 0;
+}
+
+static void
+_flick_event_emit(Cover *cov)
+{
+ int ax, ay, axe, aye, i, type = -1;
+ ax = ay = axe = aye = 0;
+
+ for (i = 0; i < cov->flick_gesture.n_fingers; i++)
+ {
+ ax += cov->flick_gesture.x_org[i];
+ ay += cov->flick_gesture.y_org[i];
+ axe += cov->flick_gesture.x_end[i];
+ aye += cov->flick_gesture.y_end[i];
+ }
+
+ ax /= cov->flick_gesture.n_fingers;
+ ay /= cov->flick_gesture.n_fingers;
+ axe /= cov->flick_gesture.n_fingers;
+ aye /= cov->flick_gesture.n_fingers;
+ type = _flick_event_emit_get_type(cov);
+
_event_emit(type, ax, ay, axe, aye, GESTURE_FINISHED, cov->event_time);
}
cov->hover_gesture.y[0] = ev->root.y;
cov->hover_gesture.finger[0] = ev->multi.device;
cov->hover_gesture.n_fingers = 1;
+ cov->hover_gesture.atspi_mouse_down_emitted = EINA_FALSE;
+ memcpy(&cov->hover_gesture.ev_first_down, ev, sizeof(*ev));
+ cov->hover_gesture.ev_first_down.multi.radius += MAGIC_NUMBER;
_hover_gesture_timer_reset(cov, _e_mod_config->one_finger_hover_longpress_timeout);
}
if (cov->hover_gesture.state == GESTURE_ONGOING &&
switch (cov->hover_gesture.n_fingers)
{
case 1:
- _event_emit(ONE_FINGER_HOVER, ax, ay, ax, ay, state, cov->event_time);
+ if (!gestures_supported_by_app[ONE_FINGER_HOVER])
+ {
+ _event_emit(ONE_FINGER_HOVER, ax, ay, ax, ay, state, cov->event_time);
+ }
+ else
+ {
+ if (!cov->hover_gesture.atspi_mouse_down_emitted) {
+ cov->hover_gesture.atspi_mouse_down_emitted = EINA_TRUE;
+ _emit_mouse_move_event(&cov->hover_gesture.ev_first_down);
+ Ecore_Event_Mouse_Button *ev = malloc(sizeof(Ecore_Event_Mouse_Button));
+ memcpy(ev, &cov->hover_gesture.ev_first_down, sizeof(*ev));
+ ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
+ }
+ Ecore_Event_Mouse_Button ev_move;
+ memcpy(&ev_move, &cov->hover_gesture.ev_first_down, sizeof(ev_move));
+ ev_move.root.x = ev_move.x = ax;
+ ev_move.root.y = ev_move.y = ay;
+ _emit_mouse_move_event(&ev_move);
+ }
break;
case 2:
_event_emit(TWO_FINGERS_HOVER, ax, ay, ax, ay, state, cov->event_time);
_tap_gestures_mouse_up(ev, cover);
DEBUG("single mouse up,taps: %d Multi :%d", cover->n_taps,ev->multi.device);
+ if (cover->hover_gesture.n_fingers == 1 && cover->hover_gesture.atspi_mouse_down_emitted)
+ {
+ cover->hover_gesture.atspi_mouse_down_emitted = EINA_FALSE;
+ return EINA_TRUE;
+ }
return EINA_FALSE;
}
_event_filter(void *data, void *loop_data, int type, void *event)
{
Eina_Bool ret = EINA_TRUE;
- if (!is_screen_reader_support)
+ if (app_support_gestures)
{
- DEBUG("screen reader is not supported");
+ DEBUG("Gestures supported by app");
return ret;
}
}
else if (type == ECORE_EVENT_MOUSE_BUTTON_UP)
{
- ret = _mouse_button_up(type, event);
+ ret = _mouse_button_up(type, event);
}
else if (type == ECORE_EVENT_MOUSE_MOVE)
{
return;
}
is_slider = EINA_FALSE;
- is_screen_reader_support = EINA_TRUE;
+ app_support_gestures = EINA_FALSE;
+ int i;
+ for (i = 0; i < GESTURES_COUNT; ++i)
+ gestures_supported_by_app[i] = EINA_FALSE;
highlighted_object_x = -1;
highlighted_object_y = -1;
object_needs_scroll_from_x = -1;