Evas_Object *obj;
void *data; /**< Holds gesture intemidiate processing data */
Func_Data fn[ELM_GESTURE_STATE_ABORT + 1]; /**< Callback info for states */
+<<<<<<< HEAD
Elm_Gesture_Types g_type; /**< gesture type */
+=======
+ Elm_Gesture_Type g_type; /**< gesture type */
+>>>>>>> remotes/origin/upstream
Elm_Gesture_State state; /**< gesture state */
void *info; /**< Data for the state callback */
Eina_Bool test; /**< if true this gesture should be tested on input */
static void _reset_states(Widget_Data *wd);
static void _key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
static void _key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
+<<<<<<< HEAD
static void _zoom_with_wheel_test(Evas_Object *obj, void *event_info, Evas_Callback_Type event_type, Elm_Gesture_Types g_type);
+=======
+static void _zoom_with_wheel_test(Evas_Object *obj, void *event_info, Evas_Callback_Type event_type, Elm_Gesture_Type g_type);
+>>>>>>> remotes/origin/upstream
static void _mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
static void _mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
}
static Eina_Bool
+<<<<<<< HEAD
_inside(Evas_Coord x1, Evas_Coord y1, Evas_Coord x2, Evas_Coord y2)
{
int w = elm_finger_size_get() >> 1; /* Finger size devided by 2 */
return EINA_FALSE;
if (y1 > (y2 + w))
+=======
+_inside(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2)
+{
+ int w = _elm_config->finger_size >> 1; /* Finger size devided by 2 */
+ if (xx1 < (xx2 - w))
+ return EINA_FALSE;
+
+ if (xx1 > (xx2 + w))
+ return EINA_FALSE;
+
+ if (yy1 < (yy2 - w))
+ return EINA_FALSE;
+
+ if (yy1 > (yy2 + w))
+>>>>>>> remotes/origin/upstream
return EINA_FALSE;
return EINA_TRUE;
Eina_List *l;
Pointer_Event *p;
EINA_LIST_FOREACH(st->touched, l, p)
+<<<<<<< HEAD
free(p);
eina_list_free(st->touched);
if (st->timeout) ecore_timer_del(st->timeout);
+=======
+ free(p);
+
+ eina_list_free(st->touched);
+ if (st->timeout)
+ {
+ ecore_timer_del(st->timeout);
+ st->timeout = NULL;
+ }
+>>>>>>> remotes/origin/upstream
memset(gesture->data, 0, sizeof(Long_Tap_Type));
}
}
if (!eina_list_search_unsorted_list(list, device_in_pending_list,
+<<<<<<< HEAD
(intptr_t*) device))
{
return eina_list_append(list, (intptr_t*) device);
+=======
+ (void *)(intptr_t)device))
+ {
+ return eina_list_append(list, (void *)(intptr_t)device);
+>>>>>>> remotes/origin/upstream
}
return list;
}
return eina_list_search_unsorted_list(list, device_in_pending_list,
+<<<<<<< HEAD
(intptr_t *) device);
+=======
+ (void *)(intptr_t)device);
+>>>>>>> remotes/origin/upstream
}
/**
Gesture_Info *p;
Evas *e = evas_object_evas_get(obj);
Eina_Bool gesture_found = EINA_FALSE;
+<<<<<<< HEAD
for (i = ELM_GESTURE_FIRST ; i < ELM_GESTURE_LAST; i++)
+=======
+ for (i = ELM_GESTURE_FIRST; i < ELM_GESTURE_LAST; i++)
+>>>>>>> remotes/origin/upstream
{
p = wd->gesture[i];
if (p)
Pointer_Event *data;
EINA_LIST_FREE(wd->touched, data)
+<<<<<<< HEAD
free(data);
+=======
+ free(data);
+>>>>>>> remotes/origin/upstream
if (!elm_widget_disabled_get(obj))
_unregister_callbacks(obj);
(pe1->event_type != EVAS_CALLBACK_MOUSE_DOWN))
return 1;
+<<<<<<< HEAD
+=======
+>>>>>>> remotes/origin/upstream
if (pe1->device == pe2->device)
return 0;
else if (pe1->device < pe2->device)
static void
_n_long_tap_test(Evas_Object *obj, Pointer_Event *pe,
void *event_info, Evas_Callback_Type event_type,
+<<<<<<< HEAD
Elm_Gesture_Types g_type)
+=======
+ Elm_Gesture_Type g_type)
+>>>>>>> remotes/origin/upstream
{ /* Here we fill Recent_Taps struct and fire-up click/tap timers */
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
* @ingroup Elm_Gesture_Layer
*/
static void
+<<<<<<< HEAD
_set_momentum(Elm_Gesture_Momentum_Info *momentum, Evas_Coord x1, Evas_Coord y1,
Evas_Coord x2, Evas_Coord y2, unsigned int t1x, unsigned int t1y,
unsigned int t2)
Evas_Coord velx = 0, vely = 0, vel;
Evas_Coord dx = x2 - x1;
Evas_Coord dy = y2 - y1;
+=======
+_set_momentum(Elm_Gesture_Momentum_Info *momentum,
+ Evas_Coord xx1, Evas_Coord yy1,
+ Evas_Coord xx2, Evas_Coord yy2,
+ unsigned int t1x, unsigned int t1y, unsigned int t2)
+{
+ Evas_Coord velx = 0, vely = 0, vel;
+ Evas_Coord dx = xx2 - xx1;
+ Evas_Coord dy = yy2 - yy1;
+>>>>>>> remotes/origin/upstream
int dtx = t2 - t1x;
int dty = t2 - t1y;
if (dtx > 0)
* @ingroup Elm_Gesture_Layer
*/
static double
+<<<<<<< HEAD
get_angle(Evas_Coord x1, Evas_Coord y1, Evas_Coord x2, Evas_Coord y2)
{
double a, xx, yy, rt = (-1);
{
rt = 180 - a;
}
+=======
+get_angle(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2)
+{
+ double a, xx, yy, rt = (-1);
+ xx = fabs(xx2 - xx1);
+ yy = fabs(yy2 - yy1);
+
+ if (((int)xx) && ((int)yy))
+ {
+ rt = a = RAD2DEG(atan(yy / xx));
+ if (xx1 < xx2)
+ {
+ if (yy1 < yy2) rt = 360 - a;
+ else rt = a;
+ }
+ else
+ {
+ if (yy1 < yy2) rt = 180 + a;
+ else rt = 180 - a;
+>>>>>>> remotes/origin/upstream
}
}
if (rt < 0)
{ /* Do this only if rt is not set */
+<<<<<<< HEAD
if (((int) xx))
{ /* Horizontal line */
if (x2 < x1)
{
rt = 270;
}
+=======
+ if (((int)xx))
+ { /* Horizontal line */
+ if (xx2 < xx1) rt = 180;
+ else rt = 0.0;
+ }
+ else
+ { /* Vertical line */
+ if (yy2 < yy1) rt = 90;
+ else rt = 270;
+>>>>>>> remotes/origin/upstream
}
}
* original circle 180 0 We want: 270 90
* 270 180
*/
+<<<<<<< HEAD
rt = 450 - rt;
if (rt >= 360)
rt -= 360;
+=======
+ rt = 450 - rt;
+ if (rt >= 360) rt -= 360;
+>>>>>>> remotes/origin/upstream
return rt;
}
* @ingroup Elm_Gesture_Layer
*/
static void
+<<<<<<< HEAD
get_vector(Evas_Coord x1, Evas_Coord y1, Evas_Coord x2, Evas_Coord y2,
Evas_Coord *l, double *a)
{
if (x2 > x1)
return 1;
+=======
+get_vector(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2,
+ Evas_Coord *l, double *a)
+{
+ Evas_Coord xx, yy;
+ xx = xx2 - xx1;
+ yy = yy2 - yy1;
+ *l = (Evas_Coord) sqrt((xx * xx) + (yy * yy));
+ *a = get_angle(xx1, yy1, xx2, yy2);
+}
+
+static int
+_get_direction(Evas_Coord xx1, Evas_Coord xx2)
+{
+ if (xx2 < xx1) return -1;
+ if (xx2 > xx1) return 1;
+>>>>>>> remotes/origin/upstream
return 0;
}
/**
*/
static void
_momentum_test(Evas_Object *obj, Pointer_Event *pe,
+<<<<<<< HEAD
void *event_info, Evas_Callback_Type event_type,
Elm_Gesture_Types g_type)
+=======
+ void *event_info, Evas_Callback_Type event_type,
+ Elm_Gesture_Type g_type)
+>>>>>>> remotes/origin/upstream
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
*/
static void
_n_line_test(Evas_Object *obj, Pointer_Event *pe, void *event_info,
+<<<<<<< HEAD
Evas_Callback_Type event_type, Elm_Gesture_Types g_type)
+=======
+ Evas_Callback_Type event_type, Elm_Gesture_Type g_type)
+>>>>>>> remotes/origin/upstream
{
if (!pe)
return;
/* We report ABORT if lines length are NOT matching when fingers are up */
+<<<<<<< HEAD
if ((longest_line_len - shortest_line_len) > (elm_finger_size_get()*2))
+=======
+ if ((longest_line_len - shortest_line_len) > (_elm_config->finger_size * 2))
+>>>>>>> remotes/origin/upstream
{
ev_flag = _set_state(gesture, ELM_GESTURE_STATE_ABORT, &st->info,
EINA_FALSE);
* @ingroup Elm_Gesture_Layer
*/
static Evas_Coord
+<<<<<<< HEAD
get_finger_gap_length(Evas_Coord x1, Evas_Coord y1, Evas_Coord x2,
Evas_Coord y2, Evas_Coord *x, Evas_Coord *y)
{
xx = fabs(x2 - x1);
yy = fabs(y2 - y1);
gap = sqrt(xx*xx + yy*yy);
+=======
+get_finger_gap_length(Evas_Coord xx1, Evas_Coord yy1,
+ Evas_Coord xx2, Evas_Coord yy2,
+ Evas_Coord *x, Evas_Coord *y)
+{
+ double a, b, xx, yy, gap;
+ xx = fabs(xx2 - xx1);
+ yy = fabs(yy2 - yy1);
+ gap = sqrt((xx * xx) + (yy * yy));
+>>>>>>> remotes/origin/upstream
/* START - Compute zoom center point */
/* The triangle defined as follows:
* b
* http://en.wikipedia.org/wiki/Trigonometric_functions
*************************************/
+<<<<<<< HEAD
if (((int) xx) && ((int) yy))
+=======
+ if (((int)xx) && ((int)yy))
+>>>>>>> remotes/origin/upstream
{
double A = atan((yy / xx));
#if defined(DEBUG_GESTURE_LAYER)
#endif
a = (Evas_Coord) ((gap / 2) * sin(A));
b = (Evas_Coord) ((gap / 2) * cos(A));
+<<<<<<< HEAD
*x = (Evas_Coord) ((x2 > x1) ? (x1 + b) : (x2 + b));
*y = (Evas_Coord) ((y2 > y1) ? (y1 + a) : (y2 + a));
}
else
{
if ((int) xx)
+=======
+ *x = (Evas_Coord) ((xx2 > xx1) ? (xx1 + b) : (xx2 + b));
+ *y = (Evas_Coord) ((yy2 > yy1) ? (yy1 + a) : (yy2 + a));
+ }
+ else
+ {
+ if ((int)xx)
+>>>>>>> remotes/origin/upstream
{ /* horiz line, take half width */
#if defined(DEBUG_GESTURE_LAYER)
printf("==== HORIZ ====\n");
#endif
+<<<<<<< HEAD
*x = (Evas_Coord) (xx / 2);
*y = (Evas_Coord) (y1);
}
if ((int) yy)
+=======
+ *x = (Evas_Coord) ((xx1 + xx2) / 2);
+ *y = (Evas_Coord) (yy1);
+ }
+
+ if ((int)yy)
+>>>>>>> remotes/origin/upstream
{ /* vert line, take half width */
#if defined(DEBUG_GESTURE_LAYER)
printf("==== VERT ====\n");
#endif
+<<<<<<< HEAD
*x = (Evas_Coord) (x1);
*y = (Evas_Coord) (yy / 2);
+=======
+ *x = (Evas_Coord) (xx1);
+ *y = (Evas_Coord) ((yy1 + yy2) / 2);
+>>>>>>> remotes/origin/upstream
}
}
/* END - Compute zoom center point */
* @ingroup Elm_Gesture_Layer
*/
static double
+<<<<<<< HEAD
compute_zoom(Zoom_Type *st, Evas_Coord x1, Evas_Coord y1,
Evas_Coord x2, Evas_Coord y2, double zoom_finger_factor)
{
Evas_Coord diam = get_finger_gap_length(x1, y1, x2, y2,
&st->info.x, &st->info.y);
+=======
+compute_zoom(Zoom_Type *st,
+ Evas_Coord xx1, Evas_Coord yy1,
+ Evas_Coord xx2, Evas_Coord yy2,
+ double zoom_finger_factor)
+{
+ double rt = 1.0;
+ unsigned int tm_end = (st->zoom_mv.timestamp > st->zoom_mv1.timestamp) ?
+ st->zoom_mv.timestamp : st->zoom_mv1.timestamp;
+
+ Evas_Coord diam = get_finger_gap_length(xx1, yy1, xx2, yy2,
+ &st->info.x, &st->info.y);
+>>>>>>> remotes/origin/upstream
st->info.radius = diam / 2;
/* We use factor only on the difference between gap-base */
/* if gap=120, base=100, we get ((120-100)/100)=0.2*factor */
rt = ((1.0) + ((((float) diam - (float) st->zoom_base) /
+<<<<<<< HEAD
(float) st->zoom_base) * zoom_finger_factor));
+=======
+ (float) st->zoom_base) * zoom_finger_factor));
+>>>>>>> remotes/origin/upstream
/* Momentum: zoom per second: */
st->info.momentum = _zoom_momentum_get(st, tm_end, rt);
*/
static void
_zoom_with_wheel_test(Evas_Object *obj, void *event_info,
+<<<<<<< HEAD
Evas_Callback_Type event_type, Elm_Gesture_Types g_type)
+=======
+ Evas_Callback_Type event_type, Elm_Gesture_Type g_type)
+>>>>>>> remotes/origin/upstream
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
*/
static void
_zoom_test(Evas_Object *obj, Pointer_Event *pe, void *event_info,
+<<<<<<< HEAD
Evas_Callback_Type event_type, Elm_Gesture_Types g_type)
+=======
+ Evas_Callback_Type event_type, Elm_Gesture_Type g_type)
+>>>>>>> remotes/origin/upstream
{
if (!pe)
return;
static void
_get_rotate_properties(Rotate_Type *st,
+<<<<<<< HEAD
Evas_Coord x1, Evas_Coord y1,
Evas_Coord x2, Evas_Coord y2,
double *angle)
*angle = get_angle(x1, y1, x2, y2);
+=======
+ Evas_Coord xx1, Evas_Coord yy1,
+ Evas_Coord xx2, Evas_Coord yy2,
+ double *angle)
+{ /* FIXME: Fix momentum computation, it's wrong */
+ double prev_angle = *angle;
+ st->info.radius = get_finger_gap_length(xx1, yy1, xx2, yy2,
+ &st->info.x, &st->info.y) / 2;
+
+ *angle = get_angle(xx1, yy1, xx2, yy2);
+
+>>>>>>> remotes/origin/upstream
if (angle == &st->info.angle)
{ /* Fingers are moving, compute momentum */
unsigned int tm_start =
*/
static void
_rotate_test(Evas_Object *obj, Pointer_Event *pe, void *event_info,
+<<<<<<< HEAD
Evas_Callback_Type event_type, Elm_Gesture_Types g_type)
+=======
+ Evas_Callback_Type event_type, Elm_Gesture_Type g_type)
+>>>>>>> remotes/origin/upstream
{
if (!pe)
return;
if (rotation_broke_tolerance(st))
{ /* Rotation broke tolerance, report move */
double d = st->info.angle - st->next_step;
+<<<<<<< HEAD
if (d < 0.0)
+=======
+ if (d < 0)
+>>>>>>> remotes/origin/upstream
d = (-d);
if (d >= wd->rotate_step)
*
* @ingroup Elm_Gesture_Layer
*/
+<<<<<<< HEAD
void continues_gestures_restart(void *data, Eina_Bool states_reset)
+=======
+static void
+continues_gestures_restart(void *data, Eina_Bool states_reset)
+>>>>>>> remotes/origin/upstream
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
Pointer_Event _pe;
Pointer_Event *pe = NULL;
Widget_Data *wd = elm_widget_data_get(data);
+<<<<<<< HEAD
if (!wd) return;
+=======
+>>>>>>> remotes/origin/upstream
#if defined(DEBUG_GESTURE_LAYER)
int i;
}
EAPI Eina_Bool
+<<<<<<< HEAD
elm_gesture_layer_hold_events_get(Evas_Object *obj)
{
+=======
+elm_gesture_layer_hold_events_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+
+>>>>>>> remotes/origin/upstream
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE;
}
EAPI void
+<<<<<<< HEAD
elm_gesture_layer_hold_events_set(Evas_Object *obj, Eina_Bool r)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!t)
return EINA_FALSE;
+=======
+elm_gesture_layer_hold_events_set(Evas_Object *obj, Eina_Bool hold_events)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ wd->repeat_events = !(!!hold_events);
+}
+
+EAPI double
+elm_gesture_layer_zoom_step_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) 0;
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return 0;
+
+ return wd->zoom_step;
+}
+
+EAPI void
+elm_gesture_layer_zoom_step_set(Evas_Object *obj, double step)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ if (step < 0) return;
+
+ wd->zoom_step = step;
+}
+
+EAPI double
+elm_gesture_layer_rotate_step_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) 0;
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return 0;
+
+ return wd->rotate_step;
+}
+
+EAPI void
+elm_gesture_layer_rotate_step_set(Evas_Object *obj, double step)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ if (step < 0) return;
+
+ wd->rotate_step = step;
+}
+
+EAPI Eina_Bool
+elm_gesture_layer_attach(Evas_Object *obj, Evas_Object *target)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+
+ if (!target) return EINA_FALSE;
+>>>>>>> remotes/origin/upstream
/* if was attached before, unregister callbacks first */
if (wd->target)
_unregister_callbacks(obj);
+<<<<<<< HEAD
wd->target = t;
+=======
+ wd->target = target;
+>>>>>>> remotes/origin/upstream
_register_callbacks(obj);
return EINA_TRUE;
}
EAPI void
+<<<<<<< HEAD
elm_gesture_layer_cb_set(Evas_Object *obj, Elm_Gesture_Types idx,
Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data)
{
+=======
+elm_gesture_layer_cb_set(Evas_Object *obj, Elm_Gesture_Type idx,
+ Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+
+>>>>>>> remotes/origin/upstream
Widget_Data *wd = elm_widget_data_get(obj);
Gesture_Info *p;
if (!wd) return;
elm_widget_disable_hook_set(obj, _disable_hook);
wd->target = NULL;
+<<<<<<< HEAD
wd->line_min_length =_elm_config->glayer_line_min_length * elm_finger_size_get();
wd->zoom_distance_tolerance = _elm_config->glayer_zoom_distance_tolerance * elm_finger_size_get();
wd->line_distance_tolerance = _elm_config->glayer_line_distance_tolerance * elm_finger_size_get();
+=======
+ wd->line_min_length =_elm_config->glayer_line_min_length * _elm_config->finger_size;
+ wd->zoom_distance_tolerance = _elm_config->glayer_zoom_distance_tolerance * _elm_config->finger_size;
+ wd->line_distance_tolerance = _elm_config->glayer_line_distance_tolerance * _elm_config->finger_size;
+>>>>>>> remotes/origin/upstream
wd->zoom_finger_factor = _elm_config->glayer_zoom_finger_factor;
wd->zoom_wheel_factor = _elm_config->glayer_zoom_wheel_factor; /* mouse wheel zoom steps */
wd->rotate_angular_tolerance = _elm_config->glayer_rotate_angular_tolerance;