gclient->grabbed_gesture |= mode;
}
+static char *
+_e_gesture_util_type_to_string(unsigned int type)
+{
+ switch (type)
+ {
+ case E_GESTURE_TYPE_EDGE_SWIPE:
+ return "edge_swipe";
+ case E_GESTURE_TYPE_TAP:
+ return "tap";
+ case E_GESTURE_TYPE_PALM_COVER:
+ return "palm_cover";
+ case E_GESTURE_TYPE_PAN:
+ return "pan";
+ case E_GESTURE_TYPE_PINCH:
+ return "pinch";
+ default:
+ return "unknown";
+ }
+}
+
/* Function for registering wl_client destroy listener */
int
e_gesture_add_client_destroy_listener(struct wl_client *client, int mode, int fingers, unsigned int edge, unsigned int repeat, int sp, int ep)
Eina_List *l;
E_Gesture_Grabbed_Client *grabbed_client, *data;
+ if (client == E_GESTURE_SERVER_CLIENT) return TIZEN_GESTURE_ERROR_NONE;
+
EINA_LIST_FOREACH(gesture->grab_client_list, l, data)
{
if (data->client == client)
}
}
+static int
+_e_gesture_add_surface_destroy_listener(struct wl_resource *surface, int type)
+{
+ struct wl_listener *destroy_listener = NULL;
+ Eina_List *l;
+ struct wl_resource *surface_data;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(surface, TIZEN_GESTURE_ERROR_INVALID_DATA);
+ if (type != E_GESTURE_TYPE_PALM_COVER)
+ return TIZEN_GESTURE_ERROR_INVALID_DATA;
+
+ EINA_LIST_FOREACH(gesture->select_surface_list, l, surface_data)
+ {
+ if (surface_data == surface)
+ {
+ return TIZEN_GESTURE_ERROR_NONE;
+ }
+ }
+
+ destroy_listener = E_NEW(struct wl_listener, 1);
+ if (!destroy_listener)
+ {
+ GTERR("Failed to allocate memory for wl_client destroy listener !\n");
+ return TIZEN_GESTURE_ERROR_NO_SYSTEM_RESOURCES;
+ }
+
+ destroy_listener->notify = _e_gesture_wl_surface_cb_destroy;
+ wl_resource_add_destroy_listener(surface, destroy_listener);
+
+ gesture->select_surface_list = eina_list_append(gesture->select_surface_list, surface);
+
+ return TIZEN_GESTURE_ERROR_NONE;
+}
+
static void
_e_gesture_remove_client_destroy_listener(struct wl_client *client, unsigned int mode, unsigned int fingers, unsigned int edge, unsigned int repeat, int sp, int ep)
{
}
}
-#if 0
-static int
-_e_gesture_grab_pan(struct wl_client *client, struct wl_resource *resource, uint32_t fingers)
+static void
+_e_gesture_remove_surface_destroy_listener(struct wl_resource *surface, int type)
{
- E_Gesture_Event *gev;
- int ret = TIZEN_GESTURE_ERROR_NONE;
+ Eina_List *l, *l_next;
+ struct wl_resource *surface_data;
+ struct wl_listener *destroy_listener;
- GTINF("The client %p request to grab pan gesture, fingers: %d\n", client, fingers);
+ EINA_SAFETY_ON_NULL_RETURN(surface);
+ if (type != E_GESTURE_TYPE_PALM_COVER) return;
- if (fingers > E_GESTURE_FINGER_MAX)
+ destroy_listener = wl_resource_get_destroy_listener(surface, _e_gesture_wl_surface_cb_destroy);
+ if (!destroy_listener)
{
- GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto finish;
+ GTWRN("surface(%p) is not gesture selected surface\n", surface);
}
- gev = &gesture->gesture_events;
-
- if (gev->pans.fingers[fingers].client)
+ EINA_LIST_FOREACH_SAFE(gesture->select_surface_list, l, l_next, surface_data)
{
- GTWRN("%d finger is already grabbed by %p client\n", fingers, gev->pans.fingers[fingers].client);
- ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
- goto finish;
+ if (surface_data == surface)
+ {
+ gesture->select_surface_list = eina_list_remove_list(gesture->select_surface_list, l);
+ break;
+ }
}
- e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_PAN, fingers, 0, 0);
+ wl_list_remove(&destroy_listener->link);
+ E_FREE(destroy_listener);
+}
- gev->pans.fingers[fingers].client = client;
- gev->pans.fingers[fingers].res = resource;
- gev->pans.state = E_GESTURE_PANPINCH_STATE_READY;
+static Eina_Bool
+_e_gesture_edge_grabbed_client_check(struct wl_client *client)
+{
+ Eina_List *l;
+ E_Gesture_Event *gev;
+ int i, j;
+ E_Gesture_Event_Edge_Finger_Edge *edata;
- gesture->grabbed_gesture |= E_GESTURE_TYPE_PAN;
- gesture->gesture_filter = E_GESTURE_TYPE_ALL & ~gesture->grabbed_gesture;
+ gev = &gesture->gesture_events;
-finish:
- return ret;
+ for (i = 1; i < E_GESTURE_FINGER_MAX + 1; i++)
+ {
+ for (j = 1; j < E_GESTURE_EDGE_MAX + 1; j++)
+ {
+ EINA_LIST_FOREACH(gev->edge_swipes.base.fingers[i].edge[j], l, edata)
+ {
+ if (edata->client == client) return EINA_TRUE;
+ }
+ }
+ }
+ return EINA_FALSE;
}
static int
-_e_gesture_ungrab_pan(struct wl_client *client, struct wl_resource *resource, uint32_t fingers)
+_e_gesture_grab_edge_swipe(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t fingers, uint32_t edge, uint32_t edge_size,
+ uint32_t start_point, uint32_t end_point)
{
E_Gesture_Event *gev;
+ int sp = 0, ep = 0;
int ret = TIZEN_GESTURE_ERROR_NONE;
+ E_Gesture_Conf_Edd *conf = gesture->config->conf;
- GTINF("The client %p request to ungrab pan gesture, fingers: %d\n", client, fingers);
-
+ GTINF("client %p is request grab gesture, fingers: %d, edge: 0x%x, edge_size: %d, point( %d - %d)\n", client, fingers, edge, edge_size, start_point, end_point);
if (fingers > E_GESTURE_FINGER_MAX)
{
GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto finish;
+ return ret;
}
gev = &gesture->gesture_events;
- if (gev->pans.fingers[fingers].client == client)
+ if (edge < TIZEN_GESTURE_EDGE_TOP || edge > TIZEN_GESTURE_EDGE_LEFT)
{
- gev->pans.fingers[fingers].client = NULL;
- gev->pans.fingers[fingers].res = NULL;
+ GTWRN("Invalid edge(%d)\n", edge);
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ return ret;
}
- _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_PAN, fingers, 0, 0);
- _e_gesture_pan_current_list_check();
-
-finish:
- return ret;
-}
-
-static int
-_e_gesture_grab_pinch(struct wl_client *client, struct wl_resource *resource, uint32_t fingers)
-{
- E_Gesture_Event *gev;
- int ret = TIZEN_GESTURE_ERROR_NONE;
-
- GTINF("The client %p request to grab pinch gesture, fingers: %d\n", client, fingers);
-
- if (fingers > E_GESTURE_FINGER_MAX)
+ if (edge_size == TIZEN_GESTURE_EDGE_SIZE_PARTIAL)
{
- GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
+ sp = start_point;
+ ep = end_point;
+ if (((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM)) &&
+ (ep > e_comp->w))
+ ep = e_comp->w;
+ else if (((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT)) &&
+ (ep > e_comp->h))
+ ep = e_comp->h;
+ }
+ else if (edge_size == TIZEN_GESTURE_EDGE_SIZE_FULL)
+ {
+ sp = 0;
+ if ((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM))
+ ep = e_comp->w;
+ else if ((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT))
+ ep = e_comp->h;
+ }
+ else
+ {
+ GTWRN("Invalid edge_size(%d)\n", edge_size);
ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto finish;
+ return ret;
}
- gev = &gesture->gesture_events;
-
- if (gev->pinchs.fingers[fingers].client)
+ if ((conf->edge_swipe.default_enable_back) &&
+ (edge == E_GESTURE_EDGE_TOP))
{
- GTWRN("%d finger is already grabbed by %p client\n", fingers, gev->pinchs.fingers[fingers].client);
ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
- goto finish;
}
+ else if (_e_gesture_edge_boundary_check(&gev->edge_swipes.base.fingers[fingers], edge, sp, ep))
+ {
+ _e_gesture_edge_grab_add(&gev->edge_swipes.base.fingers[fingers], client, resource, edge, sp, ep);
- e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_PINCH, fingers, 0, 0);
+ e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_EDGE_SWIPE, fingers, edge, 0, sp, ep);
- gev->pinchs.fingers[fingers].client = client;
- gev->pinchs.fingers[fingers].res = resource;
+ gesture->grabbed_gesture |= E_GESTURE_TYPE_EDGE_SWIPE;
+ gev->edge_swipes.base.fingers[fingers].enabled = EINA_TRUE;
+ if (gev->event_keep) gesture->event_state = E_GESTURE_EVENT_STATE_KEEP;
+ gev->edge_swipes.base.enabled_edge |= (1 << edge);
- gev->pinchs.state = E_GESTURE_PANPINCH_STATE_READY;
- gesture->grabbed_gesture |= E_GESTURE_TYPE_PINCH;
- gesture->gesture_filter = E_GESTURE_TYPE_ALL & ~gesture->grabbed_gesture;
+ ret = TIZEN_GESTURE_ERROR_NONE;
+ }
+ else
+ {
+ ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
+ }
-finish:
return ret;
}
static int
-_e_gesture_ungrab_pinch(struct wl_client *client, struct wl_resource *resource, uint32_t fingers)
+_e_gesture_ungrab_edge_swipe(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t fingers, uint32_t edge, uint32_t edge_size,
+ uint32_t start_point, uint32_t end_point)
{
E_Gesture_Event *gev;
int ret = TIZEN_GESTURE_ERROR_NONE;
+ int i;
+ Eina_List *l, *l_next;
+ E_Gesture_Event_Edge_Finger_Edge *edata;
+ Eina_Bool flag_removed = EINA_FALSE;
+ int sp = 0, ep = 0;
- GTINF("The client %p request to ungrab pinch gesture, fingers: %d\n", client, fingers);
+ GTINF("client %p is request ungrab edge swipe gesture, fingers: %d, edge: 0x%x, edge_size: %d, (%d ~ %d)\n", client, fingers, edge, edge_size, start_point, end_point);
if (fingers > E_GESTURE_FINGER_MAX)
{
GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto finish;
+ return ret;
}
gev = &gesture->gesture_events;
- if (gev->pinchs.fingers[fingers].client == client)
+ if (edge_size == TIZEN_GESTURE_EDGE_SIZE_PARTIAL)
{
- gev->pinchs.fingers[fingers].client = NULL;
- gev->pinchs.fingers[fingers].res = NULL;
+ sp = start_point;
+ ep = end_point;
+ if (((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM)) &&
+ (ep > e_comp->w))
+ ep = e_comp->w;
+ else if (((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT)) &&
+ (ep > e_comp->h))
+ ep = e_comp->h;
}
-
- _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_PINCH, fingers, 0, 0);
- _e_gesture_pinch_current_list_check();
-
-finish:
- return ret;
-}
-#endif
-
-static int
-_e_gesture_grab_palm_cover(struct wl_client *client, struct wl_resource *resource)
-{
- E_Gesture_Event *gev;
- int ret = TIZEN_GESTURE_ERROR_NONE;
-
- gev = &gesture->gesture_events;
-
- GTINF("The client %p request to grab palm hover gesture\n", client);
-
- if (gev->palm_covers.client_info.client)
+ else if (edge_size == TIZEN_GESTURE_EDGE_SIZE_FULL)
{
- GTWRN("Palm hover is already grabbed by %p client\n", gev->palm_covers.client_info.client);
- goto finish;
+ sp = 0;
+ if ((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM))
+ ep = e_comp->w;
+ else if ((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT))
+ ep = e_comp->h;
+ }
+ else
+ {
+ GTWRN("Invalid edge_size(%d)\n", edge_size);
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ return ret;
}
- e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_PALM_COVER, 0, 0, 0, 0, 0);
-
- gev->palm_covers.client_info.client = client;
- gev->palm_covers.client_info.res = resource;
-
- gesture->grabbed_gesture |= E_GESTURE_TYPE_PALM_COVER;
- gesture->gesture_filter = E_GESTURE_TYPE_ALL & ~gesture->grabbed_gesture;
-
-finish:
- return ret;
-}
-
-static int
-_e_gesture_ungrab_palm_cover(struct wl_client *client, struct wl_resource *resource)
-{
- E_Gesture_Event *gev;
- int ret = TIZEN_GESTURE_ERROR_NONE;
-
- GTINF("The client %p request to ungrab palm hover gesture\n", client);
-
- gev = &gesture->gesture_events;
-
- if (gev->palm_covers.client_info.client == client)
+ EINA_LIST_FOREACH_SAFE(gev->edge_swipes.base.fingers[fingers].edge[edge], l, l_next, edata)
{
- gev->palm_covers.client_info.client = NULL;
- gev->palm_covers.client_info.client = NULL;
+ if ((edata->client == client) && (edata->sp == sp) && (edata->ep == ep))
+ {
+ gev->edge_swipes.base.fingers[fingers].edge[edge] = eina_list_remove_list(
+ gev->edge_swipes.base.fingers[fingers].edge[edge], l);
+ E_FREE(edata);
+ flag_removed = EINA_TRUE;
+ }
}
- _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_PALM_COVER, 0, 0, 0, 0, 0);
- gesture->grabbed_gesture &= ~E_GESTURE_TYPE_PALM_COVER;
- gesture->gesture_filter = E_GESTURE_TYPE_ALL & ~gesture->grabbed_gesture;
-
- return ret;
-}
-
-static int
-_e_gesture_add_surface_destroy_listener(struct wl_resource *surface, int type)
-{
- struct wl_listener *destroy_listener = NULL;
- Eina_List *l;
- struct wl_resource *surface_data;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(surface, TIZEN_GESTURE_ERROR_INVALID_DATA);
- if (type != E_GESTURE_TYPE_PALM_COVER)
- return TIZEN_GESTURE_ERROR_INVALID_DATA;
-
- EINA_LIST_FOREACH(gesture->select_surface_list, l, surface_data)
+ if (flag_removed)
{
- if (surface_data == surface)
+ if (!_e_gesture_edge_grabbed_client_check(client))
{
- return TIZEN_GESTURE_ERROR_NONE;
+ _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_EDGE_SWIPE, fingers, edge, 0, sp, ep);
+ _e_gesture_edge_swipe_current_list_check();
}
}
- destroy_listener = E_NEW(struct wl_listener, 1);
- if (!destroy_listener)
+ gev->edge_swipes.base.enabled_edge &= ~( 1 << edge);
+ for (i = 0; i < E_GESTURE_FINGER_MAX+1; i++)
{
- GTERR("Failed to allocate memory for wl_client destroy listener !\n");
- return TIZEN_GESTURE_ERROR_NO_SYSTEM_RESOURCES;
+ if (eina_list_count(gev->edge_swipes.base.fingers[i].edge[edge]) > 0)
+ {
+ gev->edge_swipes.base.enabled_edge |= (1 << edge);
+ break;
+ }
}
- destroy_listener->notify = _e_gesture_wl_surface_cb_destroy;
- wl_resource_add_destroy_listener(surface, destroy_listener);
-
- gesture->select_surface_list = eina_list_append(gesture->select_surface_list, surface);
-
- return TIZEN_GESTURE_ERROR_NONE;
+ return ret;
}
-
static int
-_e_gesture_select_palm_cover(struct wl_client *client, struct wl_resource *resource,
- struct wl_resource *surface)
+_e_gesture_grab_edge_drag(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t fingers, uint32_t edge, uint32_t edge_size,
+ uint32_t start_point, uint32_t end_point)
{
+ E_Gesture_Event *gev;
+ int sp = 0, ep = 0;
int ret = TIZEN_GESTURE_ERROR_NONE;
- Eina_List *l;
- E_Gesture_Event_Palm_Cover *palm_covers = &gesture->gesture_events.palm_covers;
- E_Gesture_Select_Surface *sdata;
- EINA_LIST_FOREACH(palm_covers->select_surface_list, l, sdata)
+ GTINF("client %p is request edge_drag grab, fingers: %d, edge: 0x%x, edge_size: %d, point( %d - %d)\n", client, fingers, edge, edge_size, start_point, end_point);
+ if (fingers > E_GESTURE_FINGER_MAX)
{
- if (sdata->surface == surface)
- {
- ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
- goto out;
- }
+ GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ goto out;
}
- sdata = E_NEW(E_Gesture_Select_Surface, 1);
- if (!sdata)
+ if (edge < TIZEN_GESTURE_EDGE_TOP || edge > TIZEN_GESTURE_EDGE_LEFT)
{
- ret = TIZEN_GESTURE_ERROR_NO_SYSTEM_RESOURCES;
+ GTWRN("Invalid edge(%d)\n", edge);
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
goto out;
}
- sdata->surface = surface;
- sdata->res = resource;
+ if (edge_size == TIZEN_GESTURE_EDGE_SIZE_PARTIAL)
+ {
+ sp = start_point;
+ ep = end_point;
+ if (((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM)) &&
+ (ep > e_comp->w))
+ ep = e_comp->w;
+ else if (((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT)) &&
+ (ep > e_comp->h))
+ ep = e_comp->h;
+ }
+ else if (edge_size == TIZEN_GESTURE_EDGE_SIZE_FULL)
+ {
+ sp = 0;
+ if ((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM))
+ ep = e_comp->w;
+ else if ((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT))
+ ep = e_comp->h;
+ }
+ else
+ {
+ GTWRN("Invalid edge_size(%d)\n", edge_size);
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ goto out;
+ }
- palm_covers->select_surface_list = eina_list_append(palm_covers->select_surface_list, sdata);
+ gev = &gesture->gesture_events;
- _e_gesture_add_surface_destroy_listener(surface, E_GESTURE_TYPE_PALM_COVER);
+ if (_e_gesture_edge_boundary_check(&gev->edge_drags.base.fingers[fingers], edge, sp, ep))
+ {
+ _e_gesture_edge_grab_add(&gev->edge_drags.base.fingers[fingers], client, resource, edge, sp, ep);
+
+ e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_EDGE_DRAG, fingers, edge, 0, sp, ep);
+
+ gesture->grabbed_gesture |= E_GESTURE_TYPE_EDGE_DRAG;
+ gev->edge_drags.base.fingers[fingers].enabled = EINA_TRUE;
+ if (gev->event_keep) gesture->event_state = E_GESTURE_EVENT_STATE_KEEP;
+ gev->edge_drags.base.enabled_edge |= (1 << edge);
+
+ ret = TIZEN_GESTURE_ERROR_NONE;
+ }
+ else
+ {
+ ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
+ }
out:
return ret;
}
-static void
-_e_gesture_remove_surface_destroy_listener(struct wl_resource *surface, int type)
+static int
+_e_gesture_ungrab_edge_drag(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t fingers, uint32_t edge, uint32_t edge_size,
+ uint32_t start_point, uint32_t end_point)
{
+ E_Gesture_Event *gev;
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+ int i;
Eina_List *l, *l_next;
- struct wl_resource *surface_data;
- struct wl_listener *destroy_listener;
+ E_Gesture_Event_Edge_Finger_Edge *edata;
+ Eina_Bool flag_removed = EINA_FALSE;
+ int sp = 0, ep = 0;
- EINA_SAFETY_ON_NULL_RETURN(surface);
- if (type != E_GESTURE_TYPE_PALM_COVER) return;
+ GTINF("client %p is request ungrab edge drag gesture, fingers: %d, edge: 0x%x, edge_size: %d, (%d ~ %d)\n", client, fingers, edge, edge_size, start_point, end_point);
- destroy_listener = wl_resource_get_destroy_listener(surface, _e_gesture_wl_surface_cb_destroy);
- if (!destroy_listener)
+ if (fingers > E_GESTURE_FINGER_MAX)
{
- GTWRN("surface(%p) is not gesture selected surface\n", surface);
+ GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ goto out;
}
- EINA_LIST_FOREACH_SAFE(gesture->select_surface_list, l, l_next, surface_data)
+ if (edge_size == TIZEN_GESTURE_EDGE_SIZE_PARTIAL)
{
- if (surface_data == surface)
+ sp = start_point;
+ ep = end_point;
+ if (((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM)) &&
+ (ep > e_comp->w))
+ ep = e_comp->w;
+ else if (((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT)) &&
+ (ep > e_comp->h))
+ ep = e_comp->h;
+ }
+ else if (edge_size == TIZEN_GESTURE_EDGE_SIZE_FULL)
+ {
+ sp = 0;
+ if ((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM))
+ ep = e_comp->w;
+ else if ((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT))
+ ep = e_comp->h;
+ }
+ else
+ {
+ GTWRN("Invalid edge_size(%d)\n", edge_size);
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ goto out;
+ }
+
+ gev = &gesture->gesture_events;
+
+ EINA_LIST_FOREACH_SAFE(gev->edge_drags.base.fingers[fingers].edge[edge], l, l_next, edata)
+ {
+ if ((edata->client == client) && (edata->sp == sp) && (edata->ep == ep))
{
- gesture->select_surface_list = eina_list_remove_list(gesture->select_surface_list, l);
- break;
+ gev->edge_drags.base.fingers[fingers].edge[edge] = eina_list_remove_list(
+ gev->edge_drags.base.fingers[fingers].edge[edge], l);
+ E_FREE(edata);
+ flag_removed = EINA_TRUE;
}
}
- wl_list_remove(&destroy_listener->link);
- E_FREE(destroy_listener);
-}
-
-static int
-_e_gesture_deselect_palm_cover(struct wl_client *client, struct wl_resource *resource,
- struct wl_resource *surface)
-{
- int ret = TIZEN_GESTURE_ERROR_NONE;
- Eina_List *l, *l_next;
- E_Gesture_Event_Palm_Cover *palm_covers = &gesture->gesture_events.palm_covers;
- E_Gesture_Select_Surface *sdata;
+ if (flag_removed)
+ {
+ if (!_e_gesture_edge_grabbed_client_check(client))
+ {
+ _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_EDGE_DRAG, fingers, edge, 0, sp, ep);
+ _e_gesture_edge_drag_current_list_check();
+ }
+ }
- EINA_LIST_FOREACH_SAFE(palm_covers->select_surface_list, l, l_next, sdata)
+ gev->edge_drags.base.enabled_edge &= ~( 1 << edge);
+ for (i = 0; i < E_GESTURE_FINGER_MAX+1; i++)
{
- if (sdata->surface == surface)
+ if (eina_list_count(gev->edge_drags.base.fingers[i].edge[edge]) > 0)
{
- palm_covers->select_surface_list = eina_list_remove_list(palm_covers->select_surface_list, l);
- E_FREE(sdata);
+ gev->edge_drags.base.enabled_edge |= (1 << edge);
break;
}
}
- _e_gesture_remove_surface_destroy_listener(surface, E_GESTURE_TYPE_PALM_COVER);
-
+out:
return ret;
}
-static Eina_Bool
-_e_gesture_deactivate_find_surface(Eina_List *list, struct wl_resource *surface)
+static int
+_e_gesture_grab_tap(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t fingers, uint32_t repeats)
{
- Eina_List *l;
- E_Gesture_Activate_Surface_Info *idata;
+ E_Gesture_Event *gev;
+ int ret = TIZEN_GESTURE_ERROR_NONE;
- EINA_LIST_FOREACH(list, l, idata)
+ GTINF("client %p requested to grab tap gesture (fingers: %d, repeats: %d)\n", client, fingers, repeats);
+
+ if (fingers > E_GESTURE_FINGER_MAX || repeats > E_GESTURE_TAP_REPEATS_MAX)
{
- if (surface == idata->surface)
- {
- return EINA_TRUE;
- }
+ GTWRN("Not supported fingers /repeats bigger than their maximum values\n");
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ return ret;
}
- return EINA_FALSE;
-}
-static char *
-_e_gesture_util_type_to_string(unsigned int type)
-{
- switch (type)
- {
- case E_GESTURE_TYPE_EDGE_SWIPE:
- return "edge_swipe";
- case E_GESTURE_TYPE_TAP:
- return "tap";
- case E_GESTURE_TYPE_PALM_COVER:
- return "palm_cover";
- case E_GESTURE_TYPE_PAN:
- return "pan";
- case E_GESTURE_TYPE_PINCH:
- return "pinch";
- default:
- return "unknown";
- }
-}
-
-static void
-_e_gesture_deactivate_list_unset(struct wl_client *client, struct wl_resource *surface, E_Gesture_Activate_Info *info, unsigned int type)
-{
- Eina_List *l, *l_next;
- struct wl_resource *surface_data;
+ gev = &gesture->gesture_events;
- if (surface)
- {
- EINA_LIST_FOREACH_SAFE(info->surfaces, l, l_next, surface_data)
- {
- if (surface_data == surface)
- {
- info->surfaces = eina_list_remove_list(info->surfaces, l);
- break;
- }
- }
- }
- else if (info->client && (info->client == client))
- {
- info->client = NULL;
- info->active = EINA_TRUE;
- }
- else
+ if (gev->taps.fingers[fingers].repeats[repeats].client)
{
- GTWRN("Failed to unset %s deactivate. surface: %p, client: %p (already deactivated client: %p)\n", _e_gesture_util_type_to_string(type), surface, client, info->client);
+ GTWRN("%d finger %d repeats is already grabbed by %p client\n", fingers, repeats, gev->taps.fingers[fingers].repeats[repeats].client);
+ ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
+ return ret;
}
-}
-static void
-_e_gesture_deactivate_cb_client_listener(struct wl_listener *l, void *data)
-{
- struct wl_client *client = data;
-
- _e_gesture_deactivate_list_unset(client, NULL, &gesture->gesture_events.edge_swipes.base.activation, E_GESTURE_TYPE_EDGE_SWIPE);
- _e_gesture_deactivate_list_unset(client, NULL, &gesture->gesture_events.taps.activation, E_GESTURE_TYPE_TAP);
- _e_gesture_deactivate_list_unset(client, NULL, &gesture->gesture_events.palm_covers.activation, E_GESTURE_TYPE_PALM_COVER);
- _e_gesture_deactivate_list_unset(client, NULL, &gesture->gesture_events.pans.activation, E_GESTURE_TYPE_PAN);
- _e_gesture_deactivate_list_unset(client, NULL, &gesture->gesture_events.pinchs.activation, E_GESTURE_TYPE_PINCH);
+ gev->taps.fingers[fingers].repeats[repeats].client = client;
+ gev->taps.fingers[fingers].repeats[repeats].res = resource;
+ gev->taps.fingers[fingers].enabled = EINA_TRUE;
- wl_list_remove(&l->link);
- E_FREE(l);
-}
+ e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_TAP, fingers, 0, repeats, 0, 0);
-static void
-_e_gesture_deactivate_cb_surface_listener(struct wl_listener *l, void *data)
-{
- struct wl_resource *surface = data;
+ if (gev->taps.max_fingers < fingers)
+ gev->taps.max_fingers = fingers;
+ if (gev->taps.fingers[fingers].max_repeats < repeats)
+ gev->taps.fingers[fingers].max_repeats = repeats;
- _e_gesture_deactivate_list_unset(NULL, surface, &gesture->gesture_events.edge_swipes.base.activation, E_GESTURE_TYPE_EDGE_SWIPE);
- _e_gesture_deactivate_list_unset(NULL, surface, &gesture->gesture_events.taps.activation, E_GESTURE_TYPE_TAP);
- _e_gesture_deactivate_list_unset(NULL, surface, &gesture->gesture_events.palm_covers.activation, E_GESTURE_TYPE_PALM_COVER);
- _e_gesture_deactivate_list_unset(NULL, surface, &gesture->gesture_events.pans.activation, E_GESTURE_TYPE_PAN);
- _e_gesture_deactivate_list_unset(NULL, surface, &gesture->gesture_events.pinchs.activation, E_GESTURE_TYPE_PINCH);
+ gesture->grabbed_gesture |= E_GESTURE_TYPE_TAP;
+ gev->taps.state = E_GESTURE_TAP_STATE_READY;
+ gesture->event_state = E_GESTURE_EVENT_STATE_KEEP;
+ gesture->gesture_filter = E_GESTURE_TYPE_ALL & ~gesture->grabbed_gesture;
- wl_list_remove(&l->link);
- E_FREE(l);
+ return ret;
}
static int
-_e_gesture_deactivate_listener_add(struct wl_client *client, struct wl_resource * surface)
+_e_gesture_ungrab_tap(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t fingers, uint32_t repeats)
{
- struct wl_listener *destroy_listener = NULL;
+ int i;
+ E_Gesture_Event *gev;
+ int ret = TIZEN_GESTURE_ERROR_NONE;
- EINA_SAFETY_ON_FALSE_RETURN_VAL(client || surface, TIZEN_GESTURE_ERROR_INVALID_DATA);
+ GTINF("client %p requested to ungrab tap gesture (fingers: %d, repeats: %d)\n", client, fingers, fingers);
- destroy_listener = E_NEW(struct wl_listener, 1);
- if (!destroy_listener)
+ if (fingers > E_GESTURE_FINGER_MAX || repeats > E_GESTURE_TAP_REPEATS_MAX)
{
- GTERR("Failed to allocate memory for deactivate destroy listener !\n");
- return TIZEN_GESTURE_ERROR_NO_SYSTEM_RESOURCES;
+ GTWRN("Not supported fingers /repeats bigger than their maximum values\n");
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ return ret;
}
- if (surface)
- {
- destroy_listener->notify = _e_gesture_deactivate_cb_surface_listener;
- wl_resource_add_destroy_listener(surface, destroy_listener);
- }
- else
+ gev = &gesture->gesture_events;
+
+ if (gev->taps.fingers[fingers].repeats[repeats].client == client)
{
- destroy_listener->notify = _e_gesture_deactivate_cb_client_listener;
- wl_client_add_destroy_listener(client, destroy_listener);
+ gev->taps.fingers[fingers].repeats[repeats].client = NULL;
+ gev->taps.fingers[fingers].repeats[repeats].res = NULL;
}
- return TIZEN_GESTURE_ERROR_NONE;
-}
-
-static int
-_e_gesture_deactivate_list_set(struct wl_client *client, struct wl_resource *surface, E_Gesture_Activate_Info *info, unsigned int type)
-{
- int ret = TIZEN_GESTURE_ERROR_NONE;
-
- if (surface)
+ gev->taps.fingers[fingers].enabled = EINA_FALSE;
+ for (i = 0; i < E_GESTURE_TAP_REPEATS_MAX; i++)
{
- if (!_e_gesture_deactivate_find_surface(info->surfaces, surface))
+ if (gev->taps.fingers[fingers].repeats[i].client)
{
- info->surfaces = eina_list_append(info->surfaces, surface);
- _e_gesture_deactivate_listener_add(client, surface);
+ gev->taps.fingers[fingers].enabled = EINA_TRUE;
+ break;
}
}
- else if (!info->client)
- {
- info->client = client;
- info->active = EINA_FALSE;
- _e_gesture_deactivate_listener_add(client, surface);
- }
- else
- {
- GTWRN("Failed to deactivate %s !(request surface: %p, client: %p), already deactivated client: %p\n",
- _e_gesture_util_type_to_string(type), surface, client, info->client);
- ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
- }
+ gev->taps.fingers[fingers].max_repeats = e_gesture_util_tap_max_repeats_get(fingers);
+
+ _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_TAP, fingers, 0, repeats, 0, 0);
+ _e_gesture_tap_current_list_check();
return ret;
}
static int
-_e_gesture_deactivate_set(struct wl_client *client,
- struct wl_resource *resource,
- struct wl_resource *surface,
- uint32_t type)
+_e_gesture_grab_pan(struct wl_client *client, struct wl_resource *resource, uint32_t fingers)
{
+ E_Gesture_Event *gev;
int ret = TIZEN_GESTURE_ERROR_NONE;
- if (type & E_GESTURE_TYPE_EDGE_SWIPE)
- {
- ret = _e_gesture_deactivate_list_set(client, surface, &gesture->gesture_events.edge_swipes.base.activation, E_GESTURE_TYPE_EDGE_SWIPE);
- }
- if (type & E_GESTURE_TYPE_TAP)
- {
- ret = _e_gesture_deactivate_list_set(client, surface, &gesture->gesture_events.taps.activation, E_GESTURE_TYPE_TAP);
- }
- if (type & E_GESTURE_TYPE_PALM_COVER)
- {
- ret = _e_gesture_deactivate_list_set(client, surface, &gesture->gesture_events.palm_covers.activation, E_GESTURE_TYPE_PALM_COVER);
- }
- if (type & E_GESTURE_TYPE_PAN)
+ GTINF("The client %p request to grab pan gesture, fingers: %d\n", client, fingers);
+
+ if (fingers > E_GESTURE_FINGER_MAX)
{
- ret = _e_gesture_deactivate_list_set(client, surface, &gesture->gesture_events.pans.activation, E_GESTURE_TYPE_PAN);
+ GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ goto finish;
}
- if (type & E_GESTURE_TYPE_PINCH)
+
+ gev = &gesture->gesture_events;
+
+ if (gev->pans.fingers[fingers].client)
{
- ret = _e_gesture_deactivate_list_set(client, surface, &gesture->gesture_events.pinchs.activation, E_GESTURE_TYPE_PINCH);
+ GTWRN("%d finger is already grabbed by %p client\n", fingers, gev->pans.fingers[fingers].client);
+ ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
+ goto finish;
}
+ e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_PAN, fingers, 0, 0, 0, 0);
+
+ gev->pans.fingers[fingers].client = client;
+ gev->pans.fingers[fingers].res = resource;
+ gev->pans.state = E_GESTURE_PANPINCH_STATE_READY;
+
+ gesture->grabbed_gesture |= E_GESTURE_TYPE_PAN;
+ gesture->gesture_filter = E_GESTURE_TYPE_ALL & ~gesture->grabbed_gesture;
+
+finish:
return ret;
}
static int
-_e_gesture_deactivate_unset(struct wl_client *client,
- struct wl_resource *resource,
- struct wl_resource *surface,
- uint32_t type)
+_e_gesture_ungrab_pan(struct wl_client *client, struct wl_resource *resource, uint32_t fingers)
{
+ E_Gesture_Event *gev;
int ret = TIZEN_GESTURE_ERROR_NONE;
- if (type & E_GESTURE_TYPE_EDGE_SWIPE)
- {
- _e_gesture_deactivate_list_unset(client, surface, &gesture->gesture_events.edge_swipes.base.activation, E_GESTURE_TYPE_EDGE_SWIPE);
- }
- if (type & E_GESTURE_TYPE_TAP)
- {
- _e_gesture_deactivate_list_unset(client, surface, &gesture->gesture_events.taps.activation, E_GESTURE_TYPE_TAP);
- }
- if (type & E_GESTURE_TYPE_PALM_COVER)
- {
- _e_gesture_deactivate_list_unset(client, surface, &gesture->gesture_events.palm_covers.activation, E_GESTURE_TYPE_PALM_COVER);
- }
- if (type & E_GESTURE_TYPE_PAN)
+ GTINF("The client %p request to ungrab pan gesture, fingers: %d\n", client, fingers);
+
+ if (fingers > E_GESTURE_FINGER_MAX)
{
- _e_gesture_deactivate_list_unset(client, surface, &gesture->gesture_events.pans.activation, E_GESTURE_TYPE_PAN);
+ GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ goto finish;
}
- if (type & E_GESTURE_TYPE_PINCH)
+
+ gev = &gesture->gesture_events;
+
+ if (gev->pans.fingers[fingers].client == client)
{
- _e_gesture_deactivate_list_unset(client, surface, &gesture->gesture_events.pinchs.activation, E_GESTURE_TYPE_PINCH);
+ gev->pans.fingers[fingers].client = NULL;
+ gev->pans.fingers[fingers].res = NULL;
}
+ _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_PAN, fingers, 0, 0, 0, 0);
+ _e_gesture_pan_current_list_check();
+
+finish:
return ret;
}
-static void
-_e_gesture_cb_grab_edge_swipe(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers, uint32_t edge, uint32_t edge_size,
- uint32_t start_point, uint32_t end_point)
+static int
+_e_gesture_grab_pinch(struct wl_client *client, struct wl_resource *resource, uint32_t fingers)
{
E_Gesture_Event *gev;
- int sp = 0, ep = 0;
- unsigned int ret = TIZEN_GESTURE_ERROR_NONE;
- E_Gesture_Conf_Edd *conf = gesture->config->conf;
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ GTINF("The client %p request to grab pinch gesture, fingers: %d\n", client, fingers);
- GTINF("client %p is request grab gesture, fingers: %d, edge: 0x%x, edge_size: %d, point( %d - %d)\n", client, fingers, edge, edge_size, start_point, end_point);
if (fingers > E_GESTURE_FINGER_MAX)
{
GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto out;
+ goto finish;
}
gev = &gesture->gesture_events;
- if (edge < TIZEN_GESTURE_EDGE_TOP || edge > TIZEN_GESTURE_EDGE_LEFT)
+ if (gev->pinchs.fingers[fingers].client)
{
- GTWRN("Invalid edge(%d)\n", edge);
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto out;
+ GTWRN("%d finger is already grabbed by %p client\n", fingers, gev->pinchs.fingers[fingers].client);
+ ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
+ goto finish;
}
- if (edge_size == TIZEN_GESTURE_EDGE_SIZE_PARTIAL)
- {
- sp = start_point;
- ep = end_point;
- if (((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM)) &&
- (ep > e_comp->w))
- ep = e_comp->w;
- else if (((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT)) &&
- (ep > e_comp->h))
- ep = e_comp->h;
- }
- else if (edge_size == TIZEN_GESTURE_EDGE_SIZE_FULL)
- {
- sp = 0;
- if ((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM))
- ep = e_comp->w;
- else if ((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT))
- ep = e_comp->h;
- }
- else
- {
- GTWRN("Invalid edge_size(%d)\n", edge_size);
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto out;
- }
+ e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_PINCH, fingers, 0, 0, 0, 0);
- if ((conf->edge_swipe.default_enable_back) &&
- (edge == E_GESTURE_EDGE_TOP))
- {
- ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
- }
- else if (_e_gesture_edge_boundary_check(&gev->edge_swipes.base.fingers[fingers], edge, sp, ep))
- {
- _e_gesture_edge_grab_add(&gev->edge_swipes.base.fingers[fingers], client, resource, edge, sp, ep);
+ gev->pinchs.fingers[fingers].client = client;
+ gev->pinchs.fingers[fingers].res = resource;
- e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_EDGE_SWIPE, fingers, edge, 0, sp, ep);
+ gev->pinchs.state = E_GESTURE_PANPINCH_STATE_READY;
+ gesture->grabbed_gesture |= E_GESTURE_TYPE_PINCH;
+ gesture->gesture_filter = E_GESTURE_TYPE_ALL & ~gesture->grabbed_gesture;
- gesture->grabbed_gesture |= E_GESTURE_TYPE_EDGE_SWIPE;
- gev->edge_swipes.base.fingers[fingers].enabled = EINA_TRUE;
- if (gev->event_keep) gesture->event_state = E_GESTURE_EVENT_STATE_KEEP;
- gev->edge_swipes.base.enabled_edge |= (1 << edge);
+finish:
+ return ret;
+}
- ret = TIZEN_GESTURE_ERROR_NONE;
+static int
+_e_gesture_ungrab_pinch(struct wl_client *client, struct wl_resource *resource, uint32_t fingers)
+{
+ E_Gesture_Event *gev;
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ GTINF("The client %p request to ungrab pinch gesture, fingers: %d\n", client, fingers);
+
+ if (fingers > E_GESTURE_FINGER_MAX)
+ {
+ GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
+ ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
+ goto finish;
}
- else
+
+ gev = &gesture->gesture_events;
+
+ if (gev->pinchs.fingers[fingers].client == client)
{
- ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
+ gev->pinchs.fingers[fingers].client = NULL;
+ gev->pinchs.fingers[fingers].res = NULL;
}
-out:
- tizen_gesture_send_grab_edge_swipe_notify(resource, fingers, edge, edge_size, start_point, end_point, ret);
- return;
+ _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_PINCH, fingers, 0, 0, 0, 0);
+ _e_gesture_pinch_current_list_check();
+
+finish:
+ return ret;
}
-static Eina_Bool
-_e_gesture_edge_grabbed_client_check(struct wl_client *client)
+static int
+_e_gesture_grab_palm_cover(struct wl_client *client, struct wl_resource *resource)
{
- Eina_List *l;
E_Gesture_Event *gev;
- int i, j;
- E_Gesture_Event_Edge_Finger_Edge *edata;
+ int ret = TIZEN_GESTURE_ERROR_NONE;
gev = &gesture->gesture_events;
- for (i = 1; i < E_GESTURE_FINGER_MAX + 1; i++)
+ GTINF("The client %p request to grab palm hover gesture\n", client);
+
+ if (gev->palm_covers.client_info.client)
{
- for (j = 1; j < E_GESTURE_EDGE_MAX + 1; j++)
- {
- EINA_LIST_FOREACH(gev->edge_swipes.base.fingers[i].edge[j], l, edata)
- {
- if (edata->client == client) return EINA_TRUE;
- }
- }
+ GTWRN("Palm hover is already grabbed by %p client\n", gev->palm_covers.client_info.client);
+ goto finish;
}
- return EINA_FALSE;
+
+ e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_PALM_COVER, 0, 0, 0, 0, 0);
+
+ gev->palm_covers.client_info.client = client;
+ gev->palm_covers.client_info.res = resource;
+
+ gesture->grabbed_gesture |= E_GESTURE_TYPE_PALM_COVER;
+ gesture->gesture_filter = E_GESTURE_TYPE_ALL & ~gesture->grabbed_gesture;
+
+finish:
+ return ret;
}
-static void
-_e_gesture_cb_ungrab_edge_swipe(struct wl_client *client,
- struct wl_resource *resouce,
- uint32_t fingers, uint32_t edge, uint32_t edge_size,
- uint32_t start_point, uint32_t end_point)
+static int
+_e_gesture_ungrab_palm_cover(struct wl_client *client, struct wl_resource *resource)
{
E_Gesture_Event *gev;
int ret = TIZEN_GESTURE_ERROR_NONE;
- int i;
- Eina_List *l, *l_next;
- E_Gesture_Event_Edge_Finger_Edge *edata;
- Eina_Bool flag_removed = EINA_FALSE;
- int sp = 0, ep = 0;
-
- GTINF("client %p is request ungrab edge swipe gesture, fingers: %d, edge: 0x%x, edge_size: %d, (%d ~ %d)\n", client, fingers, edge, edge_size, start_point, end_point);
- if (fingers > E_GESTURE_FINGER_MAX)
- {
- GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto notify;
- }
+ GTINF("The client %p request to ungrab palm hover gesture\n", client);
gev = &gesture->gesture_events;
- if (edge_size == TIZEN_GESTURE_EDGE_SIZE_PARTIAL)
- {
- sp = start_point;
- ep = end_point;
- if (((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM)) &&
- (ep > e_comp->w))
- ep = e_comp->w;
- else if (((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT)) &&
- (ep > e_comp->h))
- ep = e_comp->h;
- }
- else if (edge_size == TIZEN_GESTURE_EDGE_SIZE_FULL)
- {
- sp = 0;
- if ((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM))
- ep = e_comp->w;
- else if ((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT))
- ep = e_comp->h;
- }
- else
+ if (gev->palm_covers.client_info.client == client)
{
- GTWRN("Invalid edge_size(%d)\n", edge_size);
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto notify;
+ gev->palm_covers.client_info.client = NULL;
+ gev->palm_covers.client_info.client = NULL;
}
- EINA_LIST_FOREACH_SAFE(gev->edge_swipes.base.fingers[fingers].edge[edge], l, l_next, edata)
+ _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_PALM_COVER, 0, 0, 0, 0, 0);
+ gesture->grabbed_gesture &= ~E_GESTURE_TYPE_PALM_COVER;
+ gesture->gesture_filter = E_GESTURE_TYPE_ALL & ~gesture->grabbed_gesture;
+
+ return ret;
+}
+
+static int
+_e_gesture_select_palm_cover(struct wl_client *client, struct wl_resource *resource,
+ struct wl_resource *surface)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+ Eina_List *l;
+ E_Gesture_Event_Palm_Cover *palm_covers = &gesture->gesture_events.palm_covers;
+ E_Gesture_Select_Surface *sdata;
+
+ EINA_LIST_FOREACH(palm_covers->select_surface_list, l, sdata)
{
- if ((edata->client == client) && (edata->sp == sp) && (edata->ep == ep))
+ if (sdata->surface == surface)
{
- gev->edge_swipes.base.fingers[fingers].edge[edge] = eina_list_remove_list(
- gev->edge_swipes.base.fingers[fingers].edge[edge], l);
- E_FREE(edata);
- flag_removed = EINA_TRUE;
+ ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
+ goto out;
}
}
- if (flag_removed)
+ sdata = E_NEW(E_Gesture_Select_Surface, 1);
+ if (!sdata)
{
- if (!_e_gesture_edge_grabbed_client_check(client))
- {
- _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_EDGE_SWIPE, fingers, edge, 0, sp, ep);
- _e_gesture_edge_swipe_current_list_check();
- }
+ ret = TIZEN_GESTURE_ERROR_NO_SYSTEM_RESOURCES;
+ goto out;
}
- gev->edge_swipes.base.enabled_edge &= ~( 1 << edge);
- for (i = 0; i < E_GESTURE_FINGER_MAX+1; i++)
+ sdata->surface = surface;
+ sdata->res = resource;
+
+ palm_covers->select_surface_list = eina_list_append(palm_covers->select_surface_list, sdata);
+
+ _e_gesture_add_surface_destroy_listener(surface, E_GESTURE_TYPE_PALM_COVER);
+
+out:
+ return ret;
+}
+
+static int
+_e_gesture_deselect_palm_cover(struct wl_client *client, struct wl_resource *resource,
+ struct wl_resource *surface)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+ Eina_List *l, *l_next;
+ E_Gesture_Event_Palm_Cover *palm_covers = &gesture->gesture_events.palm_covers;
+ E_Gesture_Select_Surface *sdata;
+
+ EINA_LIST_FOREACH_SAFE(palm_covers->select_surface_list, l, l_next, sdata)
{
- if (eina_list_count(gev->edge_swipes.base.fingers[i].edge[edge]) > 0)
+ if (sdata->surface == surface)
{
- gev->edge_swipes.base.enabled_edge |= (1 << edge);
+ palm_covers->select_surface_list = eina_list_remove_list(palm_covers->select_surface_list, l);
+ E_FREE(sdata);
break;
}
}
-notify:
- tizen_gesture_send_grab_edge_swipe_notify(resouce, fingers, edge, edge_size, start_point, end_point, ret);
- return;
+ _e_gesture_remove_surface_destroy_listener(surface, E_GESTURE_TYPE_PALM_COVER);
+
+ return ret;
}
static int
-_e_gesture_grab_edge_drag(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers, uint32_t edge, uint32_t edge_size,
- uint32_t start_point, uint32_t end_point)
+_e_gesture_server_grab_edge_swipe(unsigned int fingers,
+ unsigned int edge, unsigned int edge_size,
+ unsigned int start_point, unsigned int end_point)
{
- E_Gesture_Event *gev;
- int sp = 0, ep = 0;
int ret = TIZEN_GESTURE_ERROR_NONE;
- GTINF("client %p is request edge_drag grab, fingers: %d, edge: 0x%x, edge_size: %d, point( %d - %d)\n", client, fingers, edge, edge_size, start_point, end_point);
- if (fingers > E_GESTURE_FINGER_MAX)
+ ret = _e_gesture_grab_edge_swipe(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT,
+ fingers, edge, edge_size, start_point, end_point);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_ungrab_edge_swipe(unsigned int fingers,
+ unsigned int edge, unsigned int edge_size,
+ unsigned int start_point, unsigned int end_point)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_ungrab_edge_swipe(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT, fingers, edge, edge_size, start_point, end_point);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_grab_edge_drag(unsigned int fingers,
+ unsigned int edge, unsigned int edge_size,
+ unsigned int start_point, unsigned int end_point)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_grab_edge_drag(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT, fingers, edge, edge_size, start_point, end_point);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_ungrab_edge_drag(unsigned int fingers, unsigned int edge, unsigned int edge_size,
+ unsigned int start_point, unsigned int end_point)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_ungrab_edge_drag(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT, fingers, edge, edge_size, start_point, end_point);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_grab_tap(unsigned int fingers, unsigned int repeats)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_grab_tap(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT, fingers, repeats);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_ungrab_tap(unsigned int fingers, unsigned int repeats)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_ungrab_tap(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT, fingers, repeats);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_grab_palm_cover(void)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_grab_palm_cover(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_ungrab_palm_cover(void)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_ungrab_palm_cover(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_grab_pan(unsigned int fingers)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_grab_pan(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT, fingers);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_ungrab_pan(unsigned int fingers)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_ungrab_pan(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT, fingers);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_grab_pinch(unsigned int fingers)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_grab_pinch(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT, fingers);
+
+ return ret;
+}
+
+static int
+_e_gesture_server_ungrab_pinch(unsigned int fingers)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_ungrab_pinch(E_GESTURE_SERVER_CLIENT, E_GESTURE_SERVER_CLIENT, fingers);
+
+ return ret;
+}
+
+static Eina_Bool
+_e_gesture_deactivate_find_surface(Eina_List *list, struct wl_resource *surface)
+{
+ Eina_List *l;
+ E_Gesture_Activate_Surface_Info *idata;
+
+ EINA_LIST_FOREACH(list, l, idata)
{
- GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto out;
+ if (surface == idata->surface)
+ {
+ return EINA_TRUE;
+ }
}
+ return EINA_FALSE;
+}
- if (edge < TIZEN_GESTURE_EDGE_TOP || edge > TIZEN_GESTURE_EDGE_LEFT)
+static void
+_e_gesture_deactivate_list_unset(struct wl_client *client, struct wl_resource *surface, E_Gesture_Activate_Info *info, unsigned int type)
+{
+ Eina_List *l, *l_next;
+ struct wl_resource *surface_data;
+
+ if (surface)
{
- GTWRN("Invalid edge(%d)\n", edge);
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto out;
+ EINA_LIST_FOREACH_SAFE(info->surfaces, l, l_next, surface_data)
+ {
+ if (surface_data == surface)
+ {
+ info->surfaces = eina_list_remove_list(info->surfaces, l);
+ break;
+ }
+ }
}
+ else if (info->client && (info->client == client))
+ {
+ info->client = NULL;
+ info->active = EINA_TRUE;
+ }
+ else
+ {
+ GTWRN("Failed to unset %s deactivate. surface: %p, client: %p (already deactivated client: %p)\n", _e_gesture_util_type_to_string(type), surface, client, info->client);
+ }
+}
- if (edge_size == TIZEN_GESTURE_EDGE_SIZE_PARTIAL)
+static void
+_e_gesture_deactivate_cb_client_listener(struct wl_listener *l, void *data)
+{
+ struct wl_client *client = data;
+
+ _e_gesture_deactivate_list_unset(client, NULL, &gesture->gesture_events.edge_swipes.base.activation, E_GESTURE_TYPE_EDGE_SWIPE);
+ _e_gesture_deactivate_list_unset(client, NULL, &gesture->gesture_events.taps.activation, E_GESTURE_TYPE_TAP);
+ _e_gesture_deactivate_list_unset(client, NULL, &gesture->gesture_events.palm_covers.activation, E_GESTURE_TYPE_PALM_COVER);
+ _e_gesture_deactivate_list_unset(client, NULL, &gesture->gesture_events.pans.activation, E_GESTURE_TYPE_PAN);
+ _e_gesture_deactivate_list_unset(client, NULL, &gesture->gesture_events.pinchs.activation, E_GESTURE_TYPE_PINCH);
+
+ wl_list_remove(&l->link);
+ E_FREE(l);
+}
+
+static void
+_e_gesture_deactivate_cb_surface_listener(struct wl_listener *l, void *data)
+{
+ struct wl_resource *surface = data;
+
+ _e_gesture_deactivate_list_unset(NULL, surface, &gesture->gesture_events.edge_swipes.base.activation, E_GESTURE_TYPE_EDGE_SWIPE);
+ _e_gesture_deactivate_list_unset(NULL, surface, &gesture->gesture_events.taps.activation, E_GESTURE_TYPE_TAP);
+ _e_gesture_deactivate_list_unset(NULL, surface, &gesture->gesture_events.palm_covers.activation, E_GESTURE_TYPE_PALM_COVER);
+ _e_gesture_deactivate_list_unset(NULL, surface, &gesture->gesture_events.pans.activation, E_GESTURE_TYPE_PAN);
+ _e_gesture_deactivate_list_unset(NULL, surface, &gesture->gesture_events.pinchs.activation, E_GESTURE_TYPE_PINCH);
+
+ wl_list_remove(&l->link);
+ E_FREE(l);
+}
+
+static int
+_e_gesture_deactivate_listener_add(struct wl_client *client, struct wl_resource * surface)
+{
+ struct wl_listener *destroy_listener = NULL;
+
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(client || surface, TIZEN_GESTURE_ERROR_INVALID_DATA);
+
+ destroy_listener = E_NEW(struct wl_listener, 1);
+ if (!destroy_listener)
{
- sp = start_point;
- ep = end_point;
- if (((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM)) &&
- (ep > e_comp->w))
- ep = e_comp->w;
- else if (((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT)) &&
- (ep > e_comp->h))
- ep = e_comp->h;
+ GTERR("Failed to allocate memory for deactivate destroy listener !\n");
+ return TIZEN_GESTURE_ERROR_NO_SYSTEM_RESOURCES;
}
- else if (edge_size == TIZEN_GESTURE_EDGE_SIZE_FULL)
+
+ if (surface)
{
- sp = 0;
- if ((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM))
- ep = e_comp->w;
- else if ((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT))
- ep = e_comp->h;
+ destroy_listener->notify = _e_gesture_deactivate_cb_surface_listener;
+ wl_resource_add_destroy_listener(surface, destroy_listener);
}
else
{
- GTWRN("Invalid edge_size(%d)\n", edge_size);
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto out;
+ destroy_listener->notify = _e_gesture_deactivate_cb_client_listener;
+ wl_client_add_destroy_listener(client, destroy_listener);
}
- gev = &gesture->gesture_events;
-
- if (_e_gesture_edge_boundary_check(&gev->edge_drags.base.fingers[fingers], edge, sp, ep))
- {
- _e_gesture_edge_grab_add(&gev->edge_drags.base.fingers[fingers], client, resource, edge, sp, ep);
-
- e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_EDGE_DRAG, fingers, edge, 0, sp, ep);
+ return TIZEN_GESTURE_ERROR_NONE;
+}
- gesture->grabbed_gesture |= E_GESTURE_TYPE_EDGE_DRAG;
- gev->edge_drags.base.fingers[fingers].enabled = EINA_TRUE;
- if (gev->event_keep) gesture->event_state = E_GESTURE_EVENT_STATE_KEEP;
- gev->edge_drags.base.enabled_edge |= (1 << edge);
+static int
+_e_gesture_deactivate_list_set(struct wl_client *client, struct wl_resource *surface, E_Gesture_Activate_Info *info, unsigned int type)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
- ret = TIZEN_GESTURE_ERROR_NONE;
+ if (surface)
+ {
+ if (!_e_gesture_deactivate_find_surface(info->surfaces, surface))
+ {
+ info->surfaces = eina_list_append(info->surfaces, surface);
+ _e_gesture_deactivate_listener_add(client, surface);
+ }
+ }
+ else if (!info->client)
+ {
+ info->client = client;
+ info->active = EINA_FALSE;
+ _e_gesture_deactivate_listener_add(client, surface);
}
else
{
+ GTWRN("Failed to deactivate %s !(request surface: %p, client: %p), already deactivated client: %p\n",
+ _e_gesture_util_type_to_string(type), surface, client, info->client);
ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
}
-out:
return ret;
}
static int
-_e_gesture_ungrab_edge_drag(struct wl_client *client,
- struct wl_resource *resouce,
- uint32_t fingers, uint32_t edge, uint32_t edge_size,
- uint32_t start_point, uint32_t end_point)
+_e_gesture_deactivate_set(struct wl_client *client,
+ struct wl_resource *resource,
+ struct wl_resource *surface,
+ uint32_t type)
{
- E_Gesture_Event *gev;
int ret = TIZEN_GESTURE_ERROR_NONE;
- int i;
- Eina_List *l, *l_next;
- E_Gesture_Event_Edge_Finger_Edge *edata;
- Eina_Bool flag_removed = EINA_FALSE;
- int sp = 0, ep = 0;
-
- GTINF("client %p is request ungrab edge drag gesture, fingers: %d, edge: 0x%x, edge_size: %d, (%d ~ %d)\n", client, fingers, edge, edge_size, start_point, end_point);
- if (fingers > E_GESTURE_FINGER_MAX)
+ if (type & E_GESTURE_TYPE_EDGE_SWIPE)
{
- GTWRN("Do not support %d fingers (max: %d)\n", fingers, E_GESTURE_FINGER_MAX);
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto out;
+ ret = _e_gesture_deactivate_list_set(client, surface, &gesture->gesture_events.edge_swipes.base.activation, E_GESTURE_TYPE_EDGE_SWIPE);
}
-
- if (edge_size == TIZEN_GESTURE_EDGE_SIZE_PARTIAL)
+ if (type & E_GESTURE_TYPE_TAP)
{
- sp = start_point;
- ep = end_point;
- if (((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM)) &&
- (ep > e_comp->w))
- ep = e_comp->w;
- else if (((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT)) &&
- (ep > e_comp->h))
- ep = e_comp->h;
+ ret = _e_gesture_deactivate_list_set(client, surface, &gesture->gesture_events.taps.activation, E_GESTURE_TYPE_TAP);
}
- else if (edge_size == TIZEN_GESTURE_EDGE_SIZE_FULL)
+ if (type & E_GESTURE_TYPE_PALM_COVER)
{
- sp = 0;
- if ((edge == TIZEN_GESTURE_EDGE_TOP) || (edge == TIZEN_GESTURE_EDGE_BOTTOM))
- ep = e_comp->w;
- else if ((edge == TIZEN_GESTURE_EDGE_RIGHT) || (edge == TIZEN_GESTURE_EDGE_LEFT))
- ep = e_comp->h;
+ ret = _e_gesture_deactivate_list_set(client, surface, &gesture->gesture_events.palm_covers.activation, E_GESTURE_TYPE_PALM_COVER);
}
- else
+ if (type & E_GESTURE_TYPE_PAN)
{
- GTWRN("Invalid edge_size(%d)\n", edge_size);
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto out;
+ ret = _e_gesture_deactivate_list_set(client, surface, &gesture->gesture_events.pans.activation, E_GESTURE_TYPE_PAN);
+ }
+ if (type & E_GESTURE_TYPE_PINCH)
+ {
+ ret = _e_gesture_deactivate_list_set(client, surface, &gesture->gesture_events.pinchs.activation, E_GESTURE_TYPE_PINCH);
}
- gev = &gesture->gesture_events;
+ return ret;
+}
- EINA_LIST_FOREACH_SAFE(gev->edge_drags.base.fingers[fingers].edge[edge], l, l_next, edata)
+static int
+_e_gesture_deactivate_unset(struct wl_client *client,
+ struct wl_resource *resource,
+ struct wl_resource *surface,
+ uint32_t type)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ if (type & E_GESTURE_TYPE_EDGE_SWIPE)
{
- if ((edata->client == client) && (edata->sp == sp) && (edata->ep == ep))
- {
- gev->edge_drags.base.fingers[fingers].edge[edge] = eina_list_remove_list(
- gev->edge_drags.base.fingers[fingers].edge[edge], l);
- E_FREE(edata);
- flag_removed = EINA_TRUE;
- }
+ _e_gesture_deactivate_list_unset(client, surface, &gesture->gesture_events.edge_swipes.base.activation, E_GESTURE_TYPE_EDGE_SWIPE);
}
-
- if (flag_removed)
+ if (type & E_GESTURE_TYPE_TAP)
{
- if (!_e_gesture_edge_grabbed_client_check(client))
- {
- _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_EDGE_DRAG, fingers, edge, 0, sp, ep);
- _e_gesture_edge_drag_current_list_check();
- }
+ _e_gesture_deactivate_list_unset(client, surface, &gesture->gesture_events.taps.activation, E_GESTURE_TYPE_TAP);
}
-
- gev->edge_drags.base.enabled_edge &= ~( 1 << edge);
- for (i = 0; i < E_GESTURE_FINGER_MAX+1; i++)
+ if (type & E_GESTURE_TYPE_PALM_COVER)
{
- if (eina_list_count(gev->edge_drags.base.fingers[i].edge[edge]) > 0)
- {
- gev->edge_drags.base.enabled_edge |= (1 << edge);
- break;
- }
+ _e_gesture_deactivate_list_unset(client, surface, &gesture->gesture_events.palm_covers.activation, E_GESTURE_TYPE_PALM_COVER);
+ }
+ if (type & E_GESTURE_TYPE_PAN)
+ {
+ _e_gesture_deactivate_list_unset(client, surface, &gesture->gesture_events.pans.activation, E_GESTURE_TYPE_PAN);
+ }
+ if (type & E_GESTURE_TYPE_PINCH)
+ {
+ _e_gesture_deactivate_list_unset(client, surface, &gesture->gesture_events.pinchs.activation, E_GESTURE_TYPE_PINCH);
}
-out:
return ret;
}
+static void
+_e_gesture_cb_grab_edge_swipe(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t fingers, uint32_t edge, uint32_t edge_size,
+ uint32_t start_point, uint32_t end_point)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_grab_edge_swipe(client, resource, fingers, edge, edge_size, start_point, end_point);
+
+ tizen_gesture_send_grab_edge_swipe_notify(resource, fingers, edge, edge_size, start_point, end_point, ret);
+}
+
+static void
+_e_gesture_cb_ungrab_edge_swipe(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t fingers, uint32_t edge, uint32_t edge_size,
+ uint32_t start_point, uint32_t end_point)
+{
+ int ret = TIZEN_GESTURE_ERROR_NONE;
+
+ ret = _e_gesture_ungrab_edge_swipe(client, resource, fingers, edge, edge_size, start_point, end_point);
+
+ tizen_gesture_send_grab_edge_swipe_notify(resource, fingers, edge, edge_size, start_point, end_point, ret);
+}
static void
_e_gesture_cb_grab_edge_drag(struct wl_client *client,
struct wl_resource *resource,
uint32_t fingers, uint32_t repeats)
{
- E_Gesture_Event *gev;
int ret = TIZEN_GESTURE_ERROR_NONE;
- GTINF("client %p requested to grab tap gesture (fingers: %d, repeats: %d)\n", client, fingers, repeats);
-
- if (fingers > E_GESTURE_FINGER_MAX || repeats > E_GESTURE_TAP_REPEATS_MAX)
- {
- GTWRN("Not supported fingers /repeats bigger than their maximum values\n");
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto finish;
- }
-
- gev = &gesture->gesture_events;
-
- if (gev->taps.fingers[fingers].repeats[repeats].client)
- {
- GTWRN("%d finger %d repeats is already grabbed by %p client\n", fingers, repeats, gev->taps.fingers[fingers].repeats[repeats].client);
- ret = TIZEN_GESTURE_ERROR_GRABBED_ALREADY;
- goto finish;
- }
-
- gev->taps.fingers[fingers].repeats[repeats].client = client;
- gev->taps.fingers[fingers].repeats[repeats].res = resource;
- gev->taps.fingers[fingers].enabled = EINA_TRUE;
-
- e_gesture_add_client_destroy_listener(client, E_GESTURE_TYPE_TAP, fingers, 0, repeats, 0, 0);
-
- if (gev->taps.max_fingers < fingers)
- gev->taps.max_fingers = fingers;
- if (gev->taps.fingers[fingers].max_repeats < repeats)
- gev->taps.fingers[fingers].max_repeats = repeats;
-
- gesture->grabbed_gesture |= E_GESTURE_TYPE_TAP;
- gev->taps.state = E_GESTURE_TAP_STATE_READY;
- gesture->event_state = E_GESTURE_EVENT_STATE_KEEP;
- gesture->gesture_filter = E_GESTURE_TYPE_ALL & ~gesture->grabbed_gesture;
+ ret = _e_gesture_grab_tap(client, resource, fingers, repeats);
-finish:
tizen_gesture_send_tap_notify(resource, fingers, repeats, ret);
}
struct wl_resource *resource,
uint32_t fingers, uint32_t repeats)
{
- int i;
- E_Gesture_Event *gev;
int ret = TIZEN_GESTURE_ERROR_NONE;
- GTINF("client %p requested to ungrab tap gesture (fingers: %d, repeats: %d)\n", client, fingers, fingers);
-
- if (fingers > E_GESTURE_FINGER_MAX || repeats > E_GESTURE_TAP_REPEATS_MAX)
- {
- GTWRN("Not supported fingers /repeats bigger than their maximum values\n");
- ret = TIZEN_GESTURE_ERROR_INVALID_DATA;
- goto finish;
- }
-
- gev = &gesture->gesture_events;
-
- if (gev->taps.fingers[fingers].repeats[repeats].client == client)
- {
- gev->taps.fingers[fingers].repeats[repeats].client = NULL;
- gev->taps.fingers[fingers].repeats[repeats].res = NULL;
- }
-
- gev->taps.fingers[fingers].enabled = EINA_FALSE;
- for (i = 0; i < E_GESTURE_TAP_REPEATS_MAX; i++)
- {
- if (gev->taps.fingers[fingers].repeats[i].client)
- {
- gev->taps.fingers[fingers].enabled = EINA_TRUE;
- break;
- }
- }
- gev->taps.fingers[fingers].max_repeats = e_gesture_util_tap_max_repeats_get(fingers);
-
- _e_gesture_remove_client_destroy_listener(client, E_GESTURE_TYPE_TAP, fingers, 0, repeats, 0, 0);
- _e_gesture_tap_current_list_check();
+ ret = _e_gesture_ungrab_tap(client, resource, fingers, repeats);
-finish:
tizen_gesture_send_tap_notify(resource, fingers, repeats, ret);
}
gesture->hooks = eina_list_append(gesture->hooks,
e_client_hook_add(E_CLIENT_HOOK_AUX_HINT_CHANGE,
_e_gesture_cb_aux_hint_change, NULL));
+
+ if (e_gesture)
+ {
+ e_gesture->edge_swipe.grab = _e_gesture_server_grab_edge_swipe;
+ e_gesture->edge_swipe.ungrab = _e_gesture_server_ungrab_edge_swipe;
+ e_gesture->edge_drag.grab = _e_gesture_server_grab_edge_drag;
+ e_gesture->edge_drag.ungrab = _e_gesture_server_ungrab_edge_drag;
+ e_gesture->tap.grab = _e_gesture_server_grab_tap;
+ e_gesture->tap.ungrab = _e_gesture_server_ungrab_tap;
+ e_gesture->palm_cover.grab = _e_gesture_server_grab_palm_cover;
+ e_gesture->palm_cover.ungrab = _e_gesture_server_ungrab_palm_cover;
+ e_gesture->pan.grab = _e_gesture_server_grab_pan;
+ e_gesture->pan.ungrab = _e_gesture_server_ungrab_pan;
+ e_gesture->pinch.grab = _e_gesture_server_grab_pinch;
+ e_gesture->pinch.ungrab = _e_gesture_server_ungrab_pinch;
+ }
}
static void
{
e_client_hook_del(hook);
}
+ if (e_gesture)
+ {
+ e_gesture->edge_swipe.grab = NULL;
+ e_gesture->edge_swipe.ungrab = NULL;
+ e_gesture->edge_drag.grab = NULL;
+ e_gesture->edge_drag.ungrab = NULL;
+ e_gesture->tap.grab = NULL;
+ e_gesture->tap.ungrab = NULL;
+ e_gesture->palm_cover.grab = NULL;
+ e_gesture->palm_cover.ungrab = NULL;
+ e_gesture->pan.grab = NULL;
+ e_gesture->pan.ungrab = NULL;
+ e_gesture->pinch.grab = NULL;
+ e_gesture->pinch.ungrab = NULL;
+ }
}
static E_Gesture_Config_Data *