Merge branch 'master' into devs/hermet/lottie

This commit is contained in:
Hermet Park 2020-03-04 12:21:23 +09:00
commit ca1144673b
65 changed files with 1135 additions and 546 deletions

View File

@ -196,7 +196,7 @@
/**
* @page test_bouncing_ball_c test_bouncing_ball.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-bouncing-ball-c test_bouncing_ball.c
@ -271,7 +271,7 @@
/**
* @page test_bouncing_text_c test_bouncing_text.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-bouncing_text-c test_bouncing_text.c
@ -323,7 +323,7 @@
* @skip struct _Camera_Data {
* @until };
*
* @section add-camera Adding a Camera
* # Adding a Camera
*
* To move the camera in this example, we'll use an animator.
*
@ -355,7 +355,7 @@
* @until ephysics_camera_position_set(camera, x, y
* @skipline }
*
* @section add-uptfloor Updating the floor
* # Updating the floor
*
* Here we'll use 2 floor images to give the impression of an infinite ground.
*
@ -402,7 +402,7 @@
/**
* @page test_camera_c test_camera.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-camera-c test_camera.c
@ -454,7 +454,7 @@
* @skip struct _Track_Data {
* @until };
*
* @section add-camera Adding a Camera
* # Adding a Camera
*
* In this example we'll use 3 kinds of tracking, to change this values we'll
* have an Elementary spinner widget and handle it on this function.
@ -480,7 +480,7 @@
* @skip ephysics_camera_body_track(camera, body
* @until }
*
* @section add-uptfloor Updating the floor
* # Updating the floor
*
* Here we'll use 2 floor images to give the impression of an infinite ground.
*
@ -536,7 +536,7 @@
/**
* @page test_camera_track_c test_camera_track.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-camera-track-c test_camera_track.c
@ -583,7 +583,7 @@
* @skip struct _Collision_Data {
* @until };
*
* @section add-callbacks Adding the Callback
* # Adding the Callback
*
* Calling ephysics_body_event_callback_add()
* will register a callback to a type of physics body event.
@ -632,7 +632,7 @@
/**
* @page test_collision_detection_c test_collision_detection.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-collision_detection-c test_collision_detection.c
@ -671,7 +671,7 @@
* already covered in
* @ref tutorial_ephysics_bouncing_ball
*
* @section add-callbacks Adding the balls
* # Adding the balls
* @dontinclude test_collision_filter.c
*
* We'll use two arrays (color and size) to distinguish the groups.
@ -711,7 +711,7 @@
/**
* @page test_collision_filter_c test_collision_filter.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-collision_filter-c test_collision_filter.c
@ -748,7 +748,7 @@
* covered in
* @ref tutorial_ephysics_bouncing_ball
*
* @section add-callbacks Adding Callbacks
* # Adding Callbacks
* @dontinclude test_delete.c
*
* Calling ephysics_body_event_callback_add()
@ -800,7 +800,7 @@
/**
* @page test_delete_c test_delete.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-delete-c test_delete.c
@ -858,7 +858,7 @@
/**
* @page test_constraint_c test_constraint.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-constraint-c test_constraint.c
@ -932,7 +932,7 @@
/**
* @page test_forces_c test_forces.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-forces-c test_forces.c
@ -998,7 +998,7 @@
/**
* @page test_growing_balls_c test_growing_balls.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-growing-balls-c test_growing_balls.c
@ -1069,7 +1069,7 @@
/**
* @page test_no_gravity_c test_no_gravity.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-no-gravity-c test_no_gravity.c
@ -1372,7 +1372,7 @@
/**
* @page test_rotating_forever_c test_rotating_forever.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-rotating-forever-c test_rotating_forever.c
@ -1417,7 +1417,7 @@
* @skip struct _Velocity_Data {
* @until };
*
* @section add-callbacks Adding the Callbacks
* # Adding the Callbacks
*
* Calling ephysics_body_event_callback_add()
* will register a callback to a type of physics body event.
@ -1491,7 +1491,7 @@
/**
* @page test_velocity_c test_velocity.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-velocity-c test_velocity.c
@ -1588,7 +1588,7 @@
/**
* @page test_shapes_c test_shapes.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-shapes-c test_shapes.c
@ -1673,7 +1673,7 @@
/**
* @page test_sleeping_threshold_c test_sleeping_threshold.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-sleeping-threshold-c test_sleeping_threshold.c
@ -1769,7 +1769,7 @@
/**
* @page test_slider_c test_slider.c
*
* @section ephysics-test-h ephysics_test.h
* # ephysics_test.h
* @include ephysics_test.h
*
* @section test-slider-c test_slider.c

View File

@ -6,7 +6,7 @@ option('audio',
option('avahi',
type : 'boolean',
value : true,
value : false,
description : 'Avahi (zeroconf) support in efl'
)

View File

@ -2561,7 +2561,7 @@ _handle_vector_image(void)
free(name);
}
/** @edcsubsection{toplevel_images,
/** @edcsubsection{toplevel_images2,
* Images} */
/**
@ -3848,7 +3848,7 @@ st_size_class_max(void)
/** @edcsection{collections,Collections Blocks} */
/** @edcsubsection{collections,
/** @edcsubsection{sub_collections,
* Collections} */
/**

View File

@ -6,7 +6,7 @@
#define TAP_NAME "tap"
#define DOUBLE_TAP_NAME "double_tap"
#define TRIPLE_TAP_NAME "triple_tap"
#define LONG_TAP_NAME "long_tap"
#define LONG_PRESS_NAME "long_press"
#define FLICK_NAME "flick"
#define LINE_NAME "line"
#define MOMENTUM_NAME "momentum"
@ -17,7 +17,7 @@
#define MAX_DOUBLE_TAP 5
#define MAX_FLICK 5
#define MAX_LINE 5
#define MAX_LONG_TAP 5
#define MAX_LONG_PRESS 5
#define MAX_MOMENTUM 5
#define MAX_ROTATE 1
#define MAX_TAP 5
@ -59,7 +59,7 @@ struct _infra_data
icon_properties *icons;
Ecore_Timer *colortimer;
char buf[1024];
int long_tap_count;
int long_press_count;
};
typedef struct _infra_data infra_data;
@ -223,6 +223,33 @@ finger_flick_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED)
printf("Flick Aborted\n");
}
static void
finger_rotate_start(void *data , Efl_Canvas_Gesture *tap)
{
Eina_Position2D pos = efl_gesture_hotspot_get(tap);
_color_and_icon_set(data, ROTATE_NAME, 1, MAX_TAP, START_COLOR);
printf("Rotate Gesture started x,y=<%d,%d> \n", pos.x, pos.y);
}
static void
finger_rotate_end(void *data , Efl_Canvas_Gesture *tap)
{
Eina_Position2D pos = efl_gesture_hotspot_get(tap);
double angle = efl_gesture_rotate_angle_get(tap);
double radius = efl_gesture_rotate_radius_get(tap);
_color_and_icon_set(data, ROTATE_NAME, 1, MAX_TAP, END_COLOR);
printf("Rotate Gesture ended x,y=<%d,%d> angle=<%g> radius=<%f>\n", pos.x, pos.y, angle, radius);
}
static void
finger_rotate_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED)
{
_color_and_icon_set(data, ROTATE_NAME, 1, MAX_TAP, ABORT_COLOR);
printf("Rotate Aborted\n");
}
static void
finger_zoom_start(void *data , Efl_Canvas_Gesture *tap)
{
@ -360,34 +387,34 @@ finger_double_tap_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED)
}
static void
finger_long_tap_start(void *data , Efl_Canvas_Gesture *tap)
finger_long_press_start(void *data , Efl_Canvas_Gesture *tap)
{
Eina_Position2D pos = efl_gesture_hotspot_get(tap);
_color_and_icon_set(data, LONG_TAP_NAME, 1, MAX_TAP, START_COLOR);
_color_and_icon_set(data, LONG_PRESS_NAME, 1, MAX_TAP, START_COLOR);
printf("Long Tap Gesture started x,y=<%d,%d> \n", pos.x, pos.y);
}
static void
finger_long_tap_update(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED)
finger_long_press_update(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED)
{
_color_and_icon_set(data, LONG_TAP_NAME, 1, MAX_TAP, UPDATE_COLOR);
_color_and_icon_set(data, LONG_PRESS_NAME, 1, MAX_TAP, UPDATE_COLOR);
printf("Long Tap Gesture updated\n");
}
static void
finger_long_tap_end(void *data , Efl_Canvas_Gesture *tap)
finger_long_press_end(void *data , Efl_Canvas_Gesture *tap)
{
Eina_Position2D pos = efl_gesture_hotspot_get(tap);
_color_and_icon_set(data, LONG_TAP_NAME, 1, MAX_TAP, END_COLOR);
_color_and_icon_set(data, LONG_PRESS_NAME, 1, MAX_TAP, END_COLOR);
printf("Long Tap Gesture ended x,y=<%d,%d> \n",pos.x, pos.y);
}
static void
finger_long_tap_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED)
finger_long_press_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED)
{
_color_and_icon_set(data, LONG_TAP_NAME, 1, MAX_TAP, ABORT_COLOR);
_color_and_icon_set(data, LONG_PRESS_NAME, 1, MAX_TAP, ABORT_COLOR);
printf("Long Tap Aborted\n");
}
@ -431,6 +458,26 @@ flick_gesture_cb(void *data , const Efl_Event *ev)
}
}
static void
rotate_gesture_cb(void *data , const Efl_Event *ev)
{
Efl_Canvas_Gesture *g = ev->info;
switch(efl_gesture_state_get(g))
{
case EFL_GESTURE_STATE_STARTED:
finger_rotate_start(data, g);
break;
case EFL_GESTURE_STATE_CANCELED:
finger_rotate_abort(data, g);
break;
case EFL_GESTURE_STATE_FINISHED:
finger_rotate_end(data, g);
break;
default:
break;
}
}
static void
zoom_gesture_cb(void *data , const Efl_Event *ev)
{
@ -521,22 +568,22 @@ double_tap_gesture_cb(void *data , const Efl_Event *ev)
}
static void
long_tap_gesture_cb(void *data , const Efl_Event *ev)
long_press_gesture_cb(void *data , const Efl_Event *ev)
{
Efl_Canvas_Gesture *g = ev->info;
switch(efl_gesture_state_get(g))
{
case EFL_GESTURE_STATE_STARTED:
finger_long_tap_start(data, g);
finger_long_press_start(data, g);
break;
case EFL_GESTURE_STATE_UPDATED:
finger_long_tap_update(data, g);
finger_long_press_update(data, g);
break;
case EFL_GESTURE_STATE_CANCELED:
finger_long_tap_abort(data, g);
finger_long_press_abort(data, g);
break;
case EFL_GESTURE_STATE_FINISHED:
finger_long_tap_end(data, g);
finger_long_press_end(data, g);
break;
default:
break;
@ -625,7 +672,7 @@ test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
elm_table_pack(tb, bx, 2, 0, 1, 1);
/* Box of Long Tap icon and label */
bx = create_gesture_box(win, infra->icons, 3, LONG_TAP_NAME, "Long Tap");
bx = create_gesture_box(win, infra->icons, 3, LONG_PRESS_NAME, "Long Tap");
elm_table_pack(tb, bx, 3, 0, 1, 1);
/* Box of Momentum icon and label */
@ -736,11 +783,12 @@ test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
// LISTEN FOR GESTURES
efl_event_callback_add(target, EFL_EVENT_GESTURE_TAP, tap_gesture_cb, infra);
efl_event_callback_add(target, EFL_EVENT_GESTURE_LONG_TAP, long_tap_gesture_cb, infra);
efl_event_callback_add(target, EFL_EVENT_GESTURE_LONG_PRESS, long_press_gesture_cb, infra);
efl_event_callback_add(target, EFL_EVENT_GESTURE_DOUBLE_TAP, double_tap_gesture_cb, infra);
efl_event_callback_add(target, EFL_EVENT_GESTURE_TRIPLE_TAP, triple_tap_gesture_cb, infra);
efl_event_callback_add(target, EFL_EVENT_GESTURE_MOMENTUM, momentum_gesture_cb, infra);
efl_event_callback_add(target, EFL_EVENT_GESTURE_FLICK, flick_gesture_cb, infra);
efl_event_callback_add(target, EFL_EVENT_GESTURE_ROTATE, rotate_gesture_cb, infra);
efl_event_callback_add(target, EFL_EVENT_GESTURE_ZOOM, zoom_gesture_cb, infra);
/* Update color state 20 times a second */

View File

@ -44,6 +44,7 @@ typedef enum
* Add a compositor widget to the given canvas.
*
* The following smart callbacks will trigger on the compositor object:
* "toplevel_added" - A toplevel surface has been added; event info is Evas_Object *surface @since 1.24
* "child_added" - A toplevel surface with a parent has been added; event info is Evas_Object *surface
* "popup_added" - A popup surface has been added; event info is Evas_Object *surface
* "seat_added" - A compositor seat has been added; event info is Eo *dev
@ -177,6 +178,17 @@ EAPI void *efl_wl_global_add(Evas_Object *obj, const void *interface, uint32_t v
*/
EAPI Eina_Bool efl_wl_surface_extract(Evas_Object *surface);
/**
* Return the pid for the surface's client
*
* Get the pid of the underlying client that created the surface.
*
* @param surface The surface to extract
* @return The pid of the surface, or -1 on failure
* @since 1.24
*/
EAPI int32_t efl_wl_surface_pid_get(Evas_Object *surface);
/**
* Get the Evas_Object for an extracted wl_surface resource created by an efl_wl object
*

View File

@ -3239,7 +3239,8 @@ shell_surface_toplevel_set_parent(struct wl_client *client EINA_UNUSED, struct w
if (parent_resource) pcs = wl_resource_get_user_data(parent_resource);
comp_surface_reparent(cs, pcs);
evas_object_smart_callback_call(cs->c->obj, "child_added", cs->obj);
if (parent_resource)
evas_object_smart_callback_call(cs->c->obj, "child_added", cs->obj);
}
static void
@ -3333,6 +3334,7 @@ shell_surface_toplevel_create(struct wl_client *client EINA_UNUSED, struct wl_re
cs->role = wl_resource_create(client, &xdg_toplevel_interface, 1, id);
wl_resource_set_implementation(cs->role, &shell_surface_toplevel_interface, cs, shell_surface_toplevel_impl_destroy);
cs->shell.new = 1;
evas_object_smart_callback_call(cs->c->obj, "toplevel_added", cs->obj);
}
static void
@ -5909,6 +5911,18 @@ extracted_changed(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event
shell_surface_send_configure(data);
}
int32_t
efl_wl_surface_pid_get(Evas_Object *surface)
{
Comp_Surface *cs;
int32_t pid;
if (!eina_streq(evas_object_type_get(surface), "comp_surface")) abort();
cs = evas_object_smart_data_get(surface);
EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->dead, -1);
wl_client_get_credentials(wl_resource_get_client(cs->res), &pid, NULL, NULL);
return pid;
}
Eina_Bool
efl_wl_surface_extract(Evas_Object *surface)
{

View File

@ -20,24 +20,13 @@
#define EINA_HAMSTER_H_
/**
* @addtogroup Eina_Hamster_Group Hamster
* @defgroup Eina_Hamster_Group Hamster
*
* @brief These functions provide hamster calls.
*
* @{
*/
/**
* @addtogroup Eina_Core_Group Core
*
* @{
*/
/**
* @defgroup Eina_Hamster_Group Hamster
*/
/**
* @brief Gets the hamster count.
*
@ -47,10 +36,6 @@
*/
EAPI int eina_hamster_count(void);
/**
* @}
*/
/**
* @}
*/

View File

@ -12,7 +12,7 @@ extern "C" {
/**
* @brief UI Loading functions.
* @defgroup Init Creating a diff widget to render an Elm Code backend
* @defgroup Elm_Code_Diff_Init Creating a diff widget to render an Elm Code backend
* when it's referencing a diff file
*
* @{

View File

@ -40,7 +40,7 @@ EAPI void elm_code_line_free(Elm_Code_Line *line);
/**
* @brief Line manipulation functions.
* @defgroup Content Elementary Code Line
* @defgroup Elm_Code_Line_Content Elementary Code Line
* @{
*
* Functions for changing the content of lines in an Elm_Code_File

View File

@ -14,7 +14,7 @@ extern "C" {
/**
* @brief Line text handling functions.
* @defgroup Text access and manipulation within lines
* @defgroup Elm_Code_Text access and manipulation within lines
*
* @{
*

View File

@ -325,6 +325,8 @@ _elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd
elm_layout_signal_emit(pd->cursor_rect, "elm,action,focus", "elm");
}
evas_object_smart_calculate(pd->scroller);
evas_object_smart_calculate(pd->gridbox);
evas_object_geometry_get(widget, NULL, &oy, NULL, &oh);
if ((cy < oy) || (cy > (oy + oh - ch)))
@ -412,7 +414,6 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, El
w = elm_code_widget_columns_get(widget);
grid = eina_list_nth(pd->grids, line->number - 1);
cells = evas_object_textgrid_cellrow_get(grid, 0);
length = elm_code_widget_line_text_column_width_get(widget, line);
chrpos = 0;
chr = (char *)elm_code_line_text_get(line, NULL);
@ -701,13 +702,24 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd,
{
Elm_Code *code;
Elm_Code_Line *line_obj;
unsigned int oldrow, position, length;
unsigned int oldrow, position, length, first_row, last_row;
int cw, ch;
const char *text;
oldrow = pd->cursor_line;
pd->cursor_col = col;
pd->cursor_line = line;
if (line > eina_list_count(pd->grids) && !pd->selection && !pd->selection->in_progress)
{
if (_elm_code_widget_viewport_get(widget, pd, &first_row, &last_row))
{
_elm_code_widget_cell_size_get(widget, &cw, &ch);
_elm_code_widget_scroll_by(widget, 0, ch * (line - last_row));
}
}
code = pd->code;
line_obj = elm_code_file_line_get(code->file, line);
position = elm_code_widget_line_text_position_for_column_get(widget, line_obj, col);
@ -727,7 +739,6 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd,
elm_layout_signal_emit(pd->cursor_rect, "elm,action,show,cursor", "elm");
}
EOLIAN static Eina_Bool
_elm_code_widget_position_at_coordinates_get(Eo *obj, Elm_Code_Widget_Data *pd,
Evas_Coord x, Evas_Coord y,
@ -808,8 +819,6 @@ _elm_code_widget_geometry_for_position_get(Elm_Code_Widget *widget, Elm_Code_Wid
gutter = efl_ui_code_widget_text_left_gutter_width_get(widget);
grid = eina_list_nth(pd->grids, row - 1);
evas_object_smart_calculate(pd->scroller);
evas_object_smart_calculate(pd->gridbox);
evas_object_geometry_get(grid, x, y, NULL, NULL);
if (x)
@ -2017,20 +2026,19 @@ _elm_code_widget_ensure_n_grid_rows(Elm_Code_Widget *widget, int rows)
evas_object_textgrid_font_set(grid, pd->font_name, pd->font_size * elm_config_scale_get());
}
elm_box_recalculate(pd->gridbox);
}
static void
_elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline)
{
Eina_List *item, *lines;
Elm_Code_Widget_Data *pd;
Elm_Code_Line *line;
Eina_List *item;
Evas_Object *grid;
Evas_Coord ww, wh, old_width, old_height;
int w, h, cw = 0, ch = 0, gutter;
unsigned int line_width;
Elm_Code_Widget_Data *pd;
int w = 0, h, cw = 0, ch = 0, gutter;
unsigned int i, n, line_width, first_row = 1, last_row = 256;
Eina_Bool viewport = EINA_FALSE;
pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
gutter = efl_ui_code_widget_text_left_gutter_width_get(widget);
@ -2045,18 +2053,34 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline)
old_width = ww;
old_height = wh;
w = 0;
h = elm_code_file_lines_get(pd->code->file);
EINA_LIST_FOREACH(pd->code->file->lines, item, line)
n = h = elm_code_file_lines_get(pd->code->file);
if (_elm_code_widget_viewport_get(widget, pd, &first_row, &last_row))
viewport = EINA_TRUE;
/* Grow by one page at a time where possible. */
n = (last_row + (last_row - first_row)) < n ?
last_row + (last_row - first_row) : n;
/* Calculate the maximum width of our lines. */
lines = eina_list_nth_list(pd->code->file->lines, first_row - 1);
for (i = 0; i < n; i++)
{
line = eina_list_data_get(lines);
if (!line) break;
line_width = elm_code_widget_line_text_column_width_get(widget, line);
if ((int) line_width + gutter + 1 > w)
w = (int) line_width + gutter + 1;
lines = eina_list_next(lines);
}
_elm_code_widget_ensure_n_grid_rows(widget, h);
_elm_code_widget_ensure_n_grid_rows(widget, n);
_elm_code_widget_cell_size_get(widget, &cw, &ch);
if (w*cw > ww)
ww = w*cw;
if (h*ch > wh)
@ -2073,15 +2097,15 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline)
evas_object_size_hint_min_set(grid, ww, ch);
}
if (!newline)
/* Here we expand our scroller when there are less grids than lines of text. */
elm_box_unpack(pd->gridbox, pd->expander);
evas_object_size_hint_min_set(pd->expander, ww, (h * ch) - (eina_list_count(pd->grids) * ch));
elm_box_pack_end(pd->gridbox, pd->expander);
if (!newline && viewport)
{
unsigned int first_row, last_row;
if (!_elm_code_widget_viewport_get(widget, pd, &first_row, &last_row))
return ;
_elm_code_widget_fill_range(widget, pd, first_row, last_row, NULL);
/* Where possible render additional lines to the viewport. */
_elm_code_widget_fill_range(widget, pd, first_row, last_row + 64 < (unsigned int) h ? last_row + 64 : last_row, NULL);
return;
}
@ -2089,7 +2113,6 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline)
_elm_code_widget_scroll_by(widget,
(pd->gravity_x == 1.0 && ww > old_width) ? ww - old_width : 0,
(pd->gravity_y == 1.0 && wh > old_height) ? wh - old_height : 0);
elm_box_recalculate(pd->gridbox);
}
EOAPI void
@ -2430,6 +2453,9 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
elm_object_content_set(scroller, gridrows);
pd->gridbox = gridrows;
pd->expander = evas_object_rectangle_add(evas_object_evas_get(scroller));
elm_box_pack_end(pd->gridbox, pd->expander);
_elm_code_widget_efl_ui_widget_theme_apply(obj, pd);
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj);

View File

@ -24,6 +24,7 @@ typedef struct
Eina_List *grids;
unsigned int col_count;
Evas_Object *scroller, *gridbox, *background;
Evas_Object *expander;
const char *font_name;
Evas_Font_Size font_size;

View File

@ -3,7 +3,6 @@
/**
* @defgroup Elm_Color_Class_Group Color Class Editor
* @ingroup Elm_Color_Class_Group
* @brief This group provides a UI for editing color classes in applications.
*
* @{

View File

@ -521,6 +521,13 @@ EAPI Embryo_Program *embryo_program_load(const char *file);
* @ingroup Embryo_Program_Creation_Group
*/
EAPI void embryo_program_free(Embryo_Program *ep);
/**
* @defgroup Embryo_Func_Group Function Functions
* @ingroup Embryo
*
* Functions that deal with Embryo program functions.
*/
/**
* Adds a native program call to the given Embryo program.
@ -529,20 +536,7 @@ EAPI void embryo_program_free(Embryo_Program *ep);
* @param func The function to use when the call is made.
* @ingroup Embryo_Func_Group
*/
/**
* @defgroup Embryo_Func_Group Function Functions
* @ingroup Embryo
*
* Functions that deal with Embryo program functions.
*/
EAPI void embryo_program_native_call_add(Embryo_Program *ep, const char *name, Embryo_Cell (*func) (Embryo_Program *ep, Embryo_Cell *params));
/**
* Resets the current virtual machine session of the given program.
* @param ep The given program.
* @ingroup Embryo_Program_VM_Group
*/
/**
* @defgroup Embryo_Program_VM_Group Virtual Machine Functions
@ -563,6 +557,12 @@ EAPI void embryo_program_native_call_add(Embryo_Program *ep, const c
* The current virtual machine session can be destroyed by calling
* @ref embryo_program_vm_pop.
*/
/**
* Resets the current virtual machine session of the given program.
* @param ep The given program.
* @ingroup Embryo_Program_VM_Group
*/
EAPI void embryo_program_vm_reset(Embryo_Program *ep);
/**
@ -586,13 +586,6 @@ EAPI void embryo_program_vm_push(Embryo_Program *ep);
* @ingroup Embryo_Program_VM_Group
*/
EAPI void embryo_program_vm_pop(Embryo_Program *ep);
/**
* Ensures that the given unsigned short integer is in the small
* endian format.
* @param v Pointer to the given integer.
* @ingroup Embryo_Swap_Group
*/
/**
* @defgroup Embryo_Swap_Group Byte Swapping Functions
@ -603,6 +596,13 @@ EAPI void embryo_program_vm_pop(Embryo_Program *ep);
* used to ensure that the virtual machine operates correctly on big
* endian machines.
*/
/**
* Ensures that the given unsigned short integer is in the small
* endian format.
* @param v Pointer to the given integer.
* @ingroup Embryo_Swap_Group
*/
EAPI void embryo_swap_16(unsigned short *v);
/**
@ -622,6 +622,15 @@ EAPI void embryo_swap_32(unsigned int *v);
*/
EAPI Embryo_Function embryo_program_function_find(Embryo_Program *ep, const char *name);
/**
* @defgroup Embryo_Public_Variable_Group Public Variable Access Functions
* @ingroup Embryo
*
* In an Embryo program, a global variable can be declared public, as
* described in @ref Small_Scope_Subsection. The functions here allow
* the host program to access these public variables.
*/
/**
* Retrieves the location of the public variable in the given program
* with the given name.
@ -631,15 +640,6 @@ EAPI Embryo_Function embryo_program_function_find(Embryo_Program *ep, const cha
* otherwise.
* @ingroup Embryo_Public_Variable_Group
*/
/**
* @defgroup Embryo_Public_Variable_Group Public Variable Access Functions
* @ingroup Embryo
*
* In an Embryo program, a global variable can be declared public, as
* described in @ref Small_Scope_Subsection. The functions here allow
* the host program to access these public variables.
*/
EAPI Embryo_Cell embryo_program_variable_find(Embryo_Program *ep, const char *name);
/**
@ -660,13 +660,6 @@ EAPI int embryo_program_variable_count_get(Embryo_Program *ep);
* @ingroup Embryo_Public_Variable_Group
*/
EAPI Embryo_Cell embryo_program_variable_get(Embryo_Program *ep, int num);
/**
* Sets the error code for the given program to the given code.
* @param ep The given program.
* @param error The given error code.
* @ingroup Embryo_Error_Group
*/
/**
* @defgroup Embryo_Error_Group Error Functions
@ -674,6 +667,13 @@ EAPI Embryo_Cell embryo_program_variable_get(Embryo_Program *ep, int num);
*
* Functions that set and retrieve error codes in Embryo programs.
*/
/**
* Sets the error code for the given program to the given code.
* @param ep The given program.
* @param error The given error code.
* @ingroup Embryo_Error_Group
*/
EAPI void embryo_program_error_set(Embryo_Program *ep, Embryo_Error error);
/**
@ -683,13 +683,6 @@ EAPI void embryo_program_error_set(Embryo_Program *ep, Embryo_Error
* @ingroup Embryo_Error_Group
*/
EAPI Embryo_Error embryo_program_error_get(Embryo_Program *ep);
/**
* Sets the data associated to the given program.
* @param ep The given program.
* @param data New bytecode data.
* @ingroup Embryo_Program_Data_Group
*/
/**
* @defgroup Embryo_Program_Data_Group Program Data Functions
@ -698,6 +691,13 @@ EAPI Embryo_Error embryo_program_error_get(Embryo_Program *ep);
* Functions that set and retrieve data associated with the given
* program.
*/
/**
* Sets the data associated to the given program.
* @param ep The given program.
* @param data New bytecode data.
* @ingroup Embryo_Program_Data_Group
*/
EAPI void embryo_program_data_set(Embryo_Program *ep, void *data);
/**
@ -715,6 +715,13 @@ EAPI void *embryo_program_data_get(Embryo_Program *ep);
* @ingroup Embryo_Error_Group
*/
EAPI const char *embryo_error_string_get(Embryo_Error error);
/**
* @defgroup Embryo_Data_String_Group Embryo Data String Functions
* @ingroup Embryo
*
* Functions that operate on strings in the memory of a virtual machine.
*/
/**
* Retrieves the length of the string starting at the given cell.
@ -723,13 +730,6 @@ EAPI const char *embryo_error_string_get(Embryo_Error error);
* @return The length of the string. @c 0 is returned if there is an error.
* @ingroup Embryo_Data_String_Group
*/
/**
* @defgroup Embryo_Data_String_Group Embryo Data String Functions
* @ingroup Embryo
*
* Functions that operate on strings in the memory of a virtual machine.
*/
EAPI int embryo_data_string_length_get(Embryo_Program *ep, Embryo_Cell *str_cell);
/**
@ -760,6 +760,15 @@ EAPI void embryo_data_string_set(Embryo_Program *ep, const char *src
* @ingroup Embryo_Data_String_Group
*/
EAPI Embryo_Cell *embryo_data_address_get(Embryo_Program *ep, Embryo_Cell addr);
/**
* @defgroup Embryo_Heap_Group Heap Functions
* @ingroup Embryo
*
* The heap is an area of memory that can be allocated for program
* use at runtime. The heap functions here change the amount of heap
* memory available.
*/
/**
* Increases the size of the heap of the given virtual machine by the given
@ -770,15 +779,6 @@ EAPI Embryo_Cell *embryo_data_address_get(Embryo_Program *ep, Embryo_Cell ad
* @c EMBRYO_CELL_NONE otherwise.
* @ingroup Embryo_Heap_Group
*/
/**
* @defgroup Embryo_Heap_Group Heap Functions
* @ingroup Embryo
*
* The heap is an area of memory that can be allocated for program
* use at runtime. The heap functions here change the amount of heap
* memory available.
*/
EAPI Embryo_Cell embryo_data_heap_push(Embryo_Program *ep, int cells);
/**
@ -789,13 +789,6 @@ EAPI Embryo_Cell embryo_data_heap_push(Embryo_Program *ep, int cells);
* @ingroup Embryo_Heap_Group
*/
EAPI void embryo_data_heap_pop(Embryo_Program *ep, Embryo_Cell down_to);
/**
* Returns the number of virtual machines are running for the given program.
* @param ep The given program.
* @return The number of virtual machines running.
* @ingroup Embryo_Run_Group
*/
/**
* @defgroup Embryo_Run_Group Program Run Functions
@ -804,6 +797,13 @@ EAPI void embryo_data_heap_pop(Embryo_Program *ep, Embryo_Cell down_
* Functions that are involved in actually running functions in an
* Embryo program.
*/
/**
* Returns the number of virtual machines are running for the given program.
* @param ep The given program.
* @return The number of virtual machines running.
* @ingroup Embryo_Run_Group
*/
EAPI int embryo_program_recursion_get(Embryo_Program *ep);
/**
@ -900,6 +900,13 @@ EAPI void embryo_program_max_cycle_run_set(Embryo_Program *ep, int m
*/
EAPI int embryo_program_max_cycle_run_get(Embryo_Program *ep);
/**
* @defgroup Embryo_Parameter_Group Function Parameter Functions
* @ingroup Embryo
*
* Functions that set parameters for the next function that is called.
*/
/**
* Pushes an Embryo_Cell onto the function stack to use as a parameter for
* the next function that is called in the given program.
@ -908,13 +915,6 @@ EAPI int embryo_program_max_cycle_run_get(Embryo_Program *ep);
* @return @c 1 if successful. @c 0 otherwise.
* @ingroup Embryo_Parameter_Group
*/
/**
* @defgroup Embryo_Parameter_Group Function Parameter Functions
* @ingroup Embryo
*
* Functions that set parameters for the next function that is called.
*/
EAPI int embryo_parameter_cell_push(Embryo_Program *ep, Embryo_Cell cell);
/**

View File

@ -336,7 +336,7 @@ EAPI extern Emotion_Version *emotion_version;
* @li "position_update" - Emitted when emotion_object_position_set is called
* @li "decode_stop" - Emitted after the last frame is decoded
*
* @section Examples
* @section Emotion_Examples
*
* The following examples exemplify the emotion usage. There's also the
* emotion_test binary that is distributed with this library and cover the

View File

@ -109,18 +109,20 @@ extern "C" {
#include <gesture/efl_canvas_gesture_double_tap.eo.h>
#include <gesture/efl_canvas_gesture_flick.eo.h>
#include <gesture/efl_canvas_gesture_long_tap.eo.h>
#include <gesture/efl_canvas_gesture_long_press.eo.h>
#include <gesture/efl_canvas_gesture_momentum.eo.h>
#include <gesture/efl_canvas_gesture_recognizer_double_tap.eo.h>
#include <gesture/efl_canvas_gesture_recognizer_flick.eo.h>
#include <gesture/efl_canvas_gesture_recognizer_long_tap.eo.h>
#include <gesture/efl_canvas_gesture_recognizer_long_press.eo.h>
#include <gesture/efl_canvas_gesture_recognizer_momentum.eo.h>
#include <gesture/efl_canvas_gesture_recognizer_tap.eo.h>
#include <gesture/efl_canvas_gesture_recognizer_triple_tap.eo.h>
#include <gesture/efl_canvas_gesture_recognizer_rotate.eo.h>
#include <gesture/efl_canvas_gesture_recognizer_zoom.eo.h>
#include <gesture/efl_canvas_gesture_recognizer_custom.eo.h>
#include <gesture/efl_canvas_gesture_tap.eo.h>
#include <gesture/efl_canvas_gesture_triple_tap.eo.h>
#include <gesture/efl_canvas_gesture_rotate.eo.h>
#include <gesture/efl_canvas_gesture_zoom.eo.h>
#include <gesture/efl_canvas_gesture_custom.eo.h>
#include <gesture/efl_canvas_gesture_events.eo.h>

View File

@ -86,20 +86,22 @@ struct _Efl_Canvas_Object_Animation_Event
#include "gesture/efl_canvas_gesture_touch.eo.h"
#include "gesture/efl_canvas_gesture.eo.h"
#include "gesture/efl_canvas_gesture_tap.eo.h"
#include "gesture/efl_canvas_gesture_long_tap.eo.h"
#include "gesture/efl_canvas_gesture_long_press.eo.h"
#include "gesture/efl_canvas_gesture_double_tap.eo.h"
#include "gesture/efl_canvas_gesture_triple_tap.eo.h"
#include "gesture/efl_canvas_gesture_momentum.eo.h"
#include "gesture/efl_canvas_gesture_flick.eo.h"
#include "gesture/efl_canvas_gesture_rotate.eo.h"
#include "gesture/efl_canvas_gesture_zoom.eo.h"
#include "gesture/efl_canvas_gesture_custom.eo.h"
#include "gesture/efl_canvas_gesture_recognizer.eo.h"
#include "gesture/efl_canvas_gesture_recognizer_tap.eo.h"
#include "gesture/efl_canvas_gesture_recognizer_long_tap.eo.h"
#include "gesture/efl_canvas_gesture_recognizer_long_press.eo.h"
#include "gesture/efl_canvas_gesture_recognizer_double_tap.eo.h"
#include "gesture/efl_canvas_gesture_recognizer_triple_tap.eo.h"
#include "gesture/efl_canvas_gesture_recognizer_momentum.eo.h"
#include "gesture/efl_canvas_gesture_recognizer_flick.eo.h"
#include "gesture/efl_canvas_gesture_recognizer_rotate.eo.h"
#include "gesture/efl_canvas_gesture_recognizer_zoom.eo.h"
#include "gesture/efl_canvas_gesture_recognizer_custom.eo.h"
#include "gesture/efl_canvas_gesture_manager.eo.h"

View File

@ -16,7 +16,7 @@ static void
evas_object_intercept_init(Evas_Object *eo_obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
if (!obj->interceptors)
if (!obj || !obj->interceptors)
obj->interceptors = calloc(1, sizeof(Evas_Intercept_Func));
}
@ -24,7 +24,7 @@ static void
evas_object_intercept_deinit(Evas_Object *eo_obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
if (!obj->interceptors) return;
if (!obj || !obj->interceptors) return;
if ((obj->interceptors->show.func) ||
(obj->interceptors->hide.func) ||
(obj->interceptors->move.func) ||

View File

@ -3,14 +3,6 @@
#define MY_CLASS EFL_CANVAS_GESTURE_CLASS
const Efl_Event_Description *
_efl_gesture_type_get(const Eo *obj)
{
Efl_Canvas_Gesture_Data *pd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS);
return pd->type;
}
EOLIAN static Efl_Canvas_Gesture_State
_efl_canvas_gesture_state_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd)
{

View File

@ -11,19 +11,6 @@ _efl_canvas_gesture_custom_efl_object_destructor(Eo *obj, Efl_Canvas_Gesture_Cus
efl_destructor(efl_super(obj, MY_CLASS));
}
EOLIAN static Efl_Object *
_efl_canvas_gesture_custom_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Custom_Data *pd EINA_UNUSED)
{
Efl_Canvas_Gesture_Data *gd;
obj = efl_constructor(efl_super(obj, MY_CLASS));
gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS);
gd->type = EFL_EVENT_GESTURE_CUSTOM;
return obj;
}
EOLIAN static void
_efl_canvas_gesture_custom_gesture_name_set(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Custom_Data *pd, const char *name)
{

View File

@ -27,7 +27,6 @@ class @beta Efl.Canvas.Gesture_Custom extends Efl.Canvas.Gesture
}
}
implements {
Efl.Object.constructor;
Efl.Object.destructor;
}
}

View File

@ -2,17 +2,4 @@
#define MY_CLASS EFL_CANVAS_GESTURE_DOUBLE_TAP_CLASS
EOLIAN static Efl_Object *
_efl_canvas_gesture_double_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
{
Efl_Canvas_Gesture_Data *gd;
obj = efl_constructor(efl_super(obj, MY_CLASS));
gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS);
gd->type = EFL_EVENT_GESTURE_DOUBLE_TAP;
return obj;
}
#include "efl_canvas_gesture_double_tap.eo.c"

View File

@ -8,7 +8,4 @@ class @beta Efl.Canvas.Gesture_Double_Tap extends Efl.Canvas.Gesture
]]
data: null;
c_prefix: efl_gesture_double_tap;
implements {
Efl.Object.constructor;
}
}

View File

@ -6,7 +6,7 @@ interface @beta Efl.Canvas.Gesture_Events
events {
gesture,tap: Efl.Canvas.Gesture_Tap; [[Emitted when a Tap gesture has been detected.
A Tap gesture consists of a touch of the screen (or click of the mouse) quickly followed by
a release. If the release happens too late a @[Efl.Canvas.Gesture_Events.gesture,long_tap] event will be
a release. If the release happens too late a @[Efl.Canvas.Gesture_Events.gesture,long_press] event will be
emitted instead.
]]
@ -22,7 +22,7 @@ interface @beta Efl.Canvas.Gesture_Events
@[Efl.Canvas.Gesture_Events.gesture,tap] or @[Efl.Canvas.Gesture_Events.gesture,double_tap] events.
]]
gesture,long_tap: Efl.Canvas.Gesture_Long_Tap; [[Emitted when a Long-tap gesture has been detected.
gesture,long_press: Efl.Canvas.Gesture_Long_Press; [[Emitted when a Long-tap gesture has been detected.
A Long-tap gesture consists of a touch of the screen (or click of the mouse) followed by a release
after some time. If the release happens too quickly a @[Efl.Canvas.Gesture_Events.gesture,tap] event will be
emitted instead.
@ -38,6 +38,11 @@ interface @beta Efl.Canvas.Gesture_Events
holding down a mouse button) with the release occurring before slowing down.
]]
gesture,rotate: Efl.Canvas.Gesture_Rotate; [[Emitted when a Rotate gesture has been detected.
A Rotate gesture consists of two fingers touching the screen and performing a motion such that
one finger rotates around the other.
This gesture cannot be performed with a mouse as it requires more than one pointer.
]]
gesture,zoom: Efl.Canvas.Gesture_Zoom; [[Emitted when a Zoom gesture has been detected.
A Zoom gesture consists of two fingers touching the screen and separating ("zoom in") or
getting closer ("zoom out" or "pinch").

View File

@ -2,19 +2,6 @@
#define MY_CLASS EFL_CANVAS_GESTURE_FLICK_CLASS
EOLIAN static Efl_Object *
_efl_canvas_gesture_flick_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Flick_Data *pd EINA_UNUSED)
{
Efl_Canvas_Gesture_Data *gd;
obj = efl_constructor(efl_super(obj, MY_CLASS));
gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS);
gd->type = EFL_EVENT_GESTURE_FLICK;
return obj;
}
EOLIAN static Eina_Vector2
_efl_canvas_gesture_flick_momentum_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Flick_Data *pd)
{

View File

@ -29,7 +29,4 @@ class @beta Efl.Canvas.Gesture_Flick extends Efl.Canvas.Gesture
}
}
}
implements {
Efl.Object.constructor;
}
}

View File

@ -0,0 +1,5 @@
#include "efl_canvas_gesture_private.h"
#define MY_CLASS EFL_CANVAS_GESTURE_LONG_PRESS_CLASS
#include "efl_canvas_gesture_long_press.eo.c"

View File

@ -0,0 +1,11 @@
class @beta Efl.Canvas.Gesture_Long_Press extends Efl.Canvas.Gesture
{
[[Long-tap gesture class holding state information.
See @Efl.Canvas.Gesture to see what this state is and
@[Efl.Canvas.Gesture_Events.gesture,long_press] for a description of the Long-tap gesture.
Application developers receive these objects inside a gesture event and do not typically need to create their own.
]]
data: null;
c_prefix: efl_gesture_long_press;
}

View File

@ -1,23 +0,0 @@
#include "efl_canvas_gesture_private.h"
#define MY_CLASS EFL_CANVAS_GESTURE_LONG_TAP_CLASS
EOLIAN static Efl_Object *
_efl_canvas_gesture_long_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
{
Efl_Canvas_Gesture_Data *gd;
obj = efl_constructor(efl_super(obj, MY_CLASS));
gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS);
gd->type = EFL_EVENT_GESTURE_LONG_TAP;
return obj;
}
EOLIAN static void
_efl_canvas_gesture_long_tap_efl_object_destructor(Eo *obj, void *pd EINA_UNUSED)
{
efl_destructor(efl_super(obj, MY_CLASS));
}
#include "efl_canvas_gesture_long_tap.eo.c"

View File

@ -1,15 +0,0 @@
class @beta Efl.Canvas.Gesture_Long_Tap extends Efl.Canvas.Gesture
{
[[Long-tap gesture class holding state information.
See @Efl.Canvas.Gesture to see what this state is and
@[Efl.Canvas.Gesture_Events.gesture,long_tap] for a description of the Long-tap gesture.
Application developers receive these objects inside a gesture event and do not typically need to create their own.
]]
data: null;
c_prefix: efl_gesture_long_tap;
implements {
Efl.Object.constructor;
Efl.Object.destructor;
}
}

View File

@ -47,12 +47,14 @@ _gesture_recognizer_event_type_get(const Efl_Canvas_Gesture_Recognizer *recogniz
return EFL_EVENT_GESTURE_DOUBLE_TAP;
if (type == EFL_CANVAS_GESTURE_TRIPLE_TAP_CLASS)
return EFL_EVENT_GESTURE_TRIPLE_TAP;
if (type == EFL_CANVAS_GESTURE_LONG_TAP_CLASS)
return EFL_EVENT_GESTURE_LONG_TAP;
if (type == EFL_CANVAS_GESTURE_LONG_PRESS_CLASS)
return EFL_EVENT_GESTURE_LONG_PRESS;
if (type == EFL_CANVAS_GESTURE_MOMENTUM_CLASS)
return EFL_EVENT_GESTURE_MOMENTUM;
if (type == EFL_CANVAS_GESTURE_FLICK_CLASS)
return EFL_EVENT_GESTURE_FLICK;
if (type == EFL_CANVAS_GESTURE_ROTATE_CLASS)
return EFL_EVENT_GESTURE_ROTATE;
if (type == EFL_CANVAS_GESTURE_ZOOM_CLASS)
return EFL_EVENT_GESTURE_ZOOM;
return EFL_EVENT_GESTURE_CUSTOM;
@ -83,8 +85,9 @@ _update_finger_sizes(Efl_Canvas_Gesture_Manager_Data *pd, int finger_size)
Efl_Canvas_Gesture_Recognizer_Tap_Data *td;
Efl_Canvas_Gesture_Recognizer_Double_Tap_Data *dtd;
Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *ttd;
Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *ltd;
Efl_Canvas_Gesture_Recognizer_Long_Press_Data *ltd;
Efl_Canvas_Gesture_Recognizer_Flick_Data *fd;
Efl_Canvas_Gesture_Recognizer_Rotate_Data *rd;
Efl_Canvas_Gesture_Recognizer_Zoom_Data *zd;
const Efl_Event_Description *type;
@ -103,9 +106,9 @@ _update_finger_sizes(Efl_Canvas_Gesture_Manager_Data *pd, int finger_size)
ttd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_TRIPLE_TAP_CLASS);
ttd->finger_size = finger_size;
type = EFL_EVENT_GESTURE_LONG_TAP;
type = EFL_EVENT_GESTURE_LONG_PRESS;
r = eina_hash_find(pd->m_recognizers, &type);
ltd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_LONG_TAP_CLASS);
ltd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_LONG_PRESS_CLASS);
ltd->finger_size = finger_size;
type = EFL_EVENT_GESTURE_FLICK;
@ -113,6 +116,11 @@ _update_finger_sizes(Efl_Canvas_Gesture_Manager_Data *pd, int finger_size)
fd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_FLICK_CLASS);
fd->finger_size = finger_size;
type = EFL_EVENT_GESTURE_ROTATE;
r = eina_hash_find(pd->m_recognizers, &type);
rd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_ROTATE_CLASS);
rd->finger_size = finger_size;
type = EFL_EVENT_GESTURE_ZOOM;
r = eina_hash_find(pd->m_recognizers, &type);
zd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_ZOOM_CLASS);
@ -147,11 +155,12 @@ _efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_M
//Register all types of recognizers at very first time.
efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_TAP_CLASS, obj));
efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_LONG_TAP_CLASS, obj));
efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_LONG_PRESS_CLASS, obj));
efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_DOUBLE_TAP_CLASS, obj));
efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_TRIPLE_TAP_CLASS, obj));
efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_MOMENTUM_CLASS, obj));
efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_FLICK_CLASS, obj));
efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_ROTATE_CLASS, obj));
efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_ZOOM_CLASS, obj));
_update_finger_sizes(pd, EFL_GESTURE_RECOGNIZER_TYPE_TAP_FINGER_SIZE);
@ -237,13 +246,23 @@ _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_
}
}
static void
_recognizer_cleanup_internal(Efl_Canvas_Gesture_Manager_Data *pd, const Efl_Canvas_Gesture_Recognizer *recognizer, const Eo *target, const Efl_Event_Description *type)
{
_cleanup_cached_gestures(pd, target, type, recognizer);
eina_hash_del(pd->m_object_events, &recognizer, NULL);
//FIXME: delete it by object not list.
_cleanup_object(pd->m_gestures_to_delete);
}
static void
_gesture_recognizer_process_internal(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Canvas_Gesture_Recognizer *recognizer,
Eo *target, const Efl_Event_Description *gesture_type, void *event)
{
Efl_Canvas_Gesture_Recognizer_Result recog_result;
Efl_Canvas_Gesture_Recognizer_Result recog_state;
Efl_Canvas_Gesture_Recognizer_Result recog_state = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
Efl_Canvas_Gesture_Touch *touch_event;
Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(recognizer, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS);
//If the gesture canceled or already finished by recognizer.
Efl_Canvas_Gesture *gesture = _get_state(pd, target, recognizer, gesture_type);
if (!gesture) return;
@ -263,7 +282,9 @@ _gesture_recognizer_process_internal(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Ca
//Such as the case of canceling gesture recognition after a mouse down.
if (efl_gesture_touch_state_get(touch_event) == EFL_GESTURE_TOUCH_STATE_UNKNOWN)
return;
if ((!rd->continues) && ((efl_gesture_state_get(gesture) == EFL_GESTURE_STATE_CANCELED) ||
(efl_gesture_state_get(gesture) == EFL_GESTURE_STATE_FINISHED)))
goto post_event;
/* this is the "default" value for the event, recognizers may modify it if necessary */
efl_gesture_touch_count_set(gesture, efl_gesture_touch_points_count_get(touch_event));
@ -272,9 +293,6 @@ _gesture_recognizer_process_internal(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Ca
recog_result = efl_gesture_recognizer_recognize(recognizer, gesture, target, touch_event);
recog_state = recog_result & EFL_GESTURE_RECOGNIZER_RESULT_RESULT_MASK;
Efl_Canvas_Gesture_Recognizer_Data *rd =
efl_data_scope_get(recognizer, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS);
if (recog_state == EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER)
{
if (efl_gesture_state_get(gesture) == EFL_GESTURE_STATE_NONE)
@ -309,15 +327,14 @@ _gesture_recognizer_process_internal(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Ca
efl_gesture_timestamp_set(gesture, efl_gesture_touch_current_timestamp_get(touch_event));
efl_event_callback_call(target, gesture_type, gesture);
post_event:
/* avoid destroying touch tracking before gesture has ended */
if ((!rd->continues) &&
((efl_gesture_touch_state_get(touch_event) != EFL_GESTURE_TOUCH_STATE_END) || efl_gesture_touch_points_count_get(touch_event)))
return;
//If the current event recognizes the gesture continuously, dont delete gesture.
if (((recog_state == EFL_GESTURE_RECOGNIZER_RESULT_FINISH) || (recog_state == EFL_GESTURE_RECOGNIZER_RESULT_CANCEL)) &&
!rd->continues)
{
_cleanup_cached_gestures(pd, target, gesture_type, recognizer);
eina_hash_del(pd->m_object_events, &recognizer, NULL);
//FIXME: delete it by object not list.
_cleanup_object(pd->m_gestures_to_delete);
}
_recognizer_cleanup_internal(pd, recognizer, target, gesture_type);
}
void
@ -439,8 +456,6 @@ _get_state(Efl_Canvas_Gesture_Manager_Data *pd,
Eina_List *l;
Object_Gesture *object_gesture;
Efl_Canvas_Gesture *gesture;
Efl_Canvas_Gesture_Recognizer_Data *rd =
efl_data_scope_get(recognizer, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS);
//If the widget is being deleted we should be careful not to
//Create a new state.
@ -454,16 +469,6 @@ _get_state(Efl_Canvas_Gesture_Manager_Data *pd,
object_gesture->recognizer == recognizer &&
object_gesture->type == type)
{
//The gesture is already processed waiting for cleanup
if (((efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_STATE_FINISHED) ||
(efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_STATE_CANCELED)) &&
(!rd->continues))
{
_cleanup_cached_gestures(pd, target, type, recognizer);
eina_hash_del(pd->m_object_events, &recognizer, NULL);
_cleanup_object(pd->m_gestures_to_delete);
return NULL;
}
return object_gesture->gesture;
}
}
@ -513,9 +518,7 @@ _efl_canvas_gesture_manager_recognizer_cleanup(Eo *obj EINA_UNUSED, Efl_Canvas_G
//Find the type of the recognizer
type = _gesture_recognizer_event_type_get(recognizer);
_cleanup_cached_gestures(pd, target, type, recognizer);
eina_hash_del(pd->m_object_events, &recognizer, NULL);
_cleanup_object(pd->m_gestures_to_delete);
_recognizer_cleanup_internal(pd, recognizer, target, type);
}
#include "efl_canvas_gesture_manager.eo.c"

View File

@ -2,19 +2,6 @@
#define MY_CLASS EFL_CANVAS_GESTURE_MOMENTUM_CLASS
EOLIAN static Efl_Object *
_efl_canvas_gesture_momentum_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Momentum_Data *pd EINA_UNUSED)
{
Efl_Canvas_Gesture_Data *gd;
obj = efl_constructor(efl_super(obj, MY_CLASS));
gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS);
gd->type = EFL_EVENT_GESTURE_MOMENTUM;
return obj;
}
EOLIAN static Eina_Vector2
_efl_canvas_gesture_momentum_momentum_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Momentum_Data *pd)
{

View File

@ -19,7 +19,4 @@ class @beta Efl.Canvas.Gesture_Momentum extends Efl.Canvas.Gesture
}
}
}
implements {
Efl.Object.constructor;
}
}

View File

@ -11,25 +11,29 @@
/* milliseconds */
#define TAP_TOUCH_TIME_THRESHOLD (0.1 * 1000)
const Efl_Event_Description * _efl_gesture_type_get(const Eo *obj);
int _direction_get(Evas_Coord xx1, Evas_Coord xx2);
Eina_Value *_recognizer_config_get(const Eo *obj, const char *name);
Eina_Bool _event_multi_touch_get(const Efl_Canvas_Gesture_Touch *event);
double _angle_get(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2);
Evas_Coord _finger_gap_length_get(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2, Evas_Coord *x, Evas_Coord *y);
typedef struct _Efl_Canvas_Gesture_Manager_Data Efl_Canvas_Gesture_Manager_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Data Efl_Canvas_Gesture_Recognizer_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Tap_Data Efl_Canvas_Gesture_Recognizer_Tap_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Long_Tap_Data Efl_Canvas_Gesture_Recognizer_Long_Tap_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Long_Press_Data Efl_Canvas_Gesture_Recognizer_Long_Press_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Double_Tap_Data Efl_Canvas_Gesture_Recognizer_Double_Tap_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Momentum_Data Efl_Canvas_Gesture_Recognizer_Momentum_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Flick_Data Efl_Canvas_Gesture_Recognizer_Flick_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Rotate_Data Efl_Canvas_Gesture_Recognizer_Rotate_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Zoom_Data Efl_Canvas_Gesture_Recognizer_Zoom_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Custom_Data Efl_Canvas_Gesture_Recognizer_Custom_Data;
typedef struct _Efl_Canvas_Gesture_Data Efl_Canvas_Gesture_Data;
typedef struct _Efl_Canvas_Gesture_Momentum_Data Efl_Canvas_Gesture_Momentum_Data;
typedef struct _Efl_Canvas_Gesture_Flick_Data Efl_Canvas_Gesture_Flick_Data;
typedef struct _Efl_Canvas_Gesture_Zoom_Data Efl_Canvas_Gesture_Zoom_Data;
typedef struct _Efl_Canvas_Gesture_Rotate_Data Efl_Canvas_Gesture_Rotate_Data;
typedef struct _Efl_Canvas_Gesture_Custom_Data Efl_Canvas_Gesture_Custom_Data;
typedef struct _Efl_Canvas_Gesture_Touch_Data
@ -55,7 +59,7 @@ struct _Efl_Canvas_Gesture_Recognizer_Tap_Data
int finger_size;
};
struct _Efl_Canvas_Gesture_Recognizer_Long_Tap_Data
struct _Efl_Canvas_Gesture_Recognizer_Long_Press_Data
{
double start_timeout;
Eina_List *target_timeout;
@ -112,6 +116,24 @@ struct _Efl_Canvas_Gesture_Recognizer_Flick_Data
Eina_Bool touched;
};
struct _Efl_Canvas_Gesture_Recognizer_Rotate_Data
{
Efl_Gesture_Touch_Point_Data rotate_st;
Efl_Gesture_Touch_Point_Data rotate_st1;
Efl_Gesture_Touch_Point_Data rotate_mv;
Efl_Gesture_Touch_Point_Data rotate_mv1;
double rotate_step;
double base_angle; /**< Holds start-angle */
double prev_momentum; /* Snapshot of momentum 0.01
* sec ago */
double accum_momentum;
double rotate_angular_tolerance;
double next_step;
unsigned int prev_momentum_tm; /* timestamp of prev_momentum */
int finger_size;
};
struct _Efl_Canvas_Gesture_Recognizer_Zoom_Data
{
Efl_Gesture_Touch_Point_Data zoom_st;
@ -139,7 +161,6 @@ struct _Efl_Canvas_Gesture_Recognizer_Custom_Data
struct _Efl_Canvas_Gesture_Data
{
Efl_Canvas_Gesture_State state;
const Efl_Event_Description *type;
Eina_Position2D hotspot;
unsigned int timestamp;
unsigned int touch_count;
@ -158,6 +179,14 @@ struct _Efl_Canvas_Gesture_Flick_Data
int id;
};
struct _Efl_Canvas_Gesture_Rotate_Data
{
//Evas_Coord x, y; /**< Holds rotate center point reported to user */
double angle; /**< Rotation value: 0.0 means no rotation */
double momentum; /**< Rotation momentum: rotation done per second (NOT YET SUPPORTED) */
Evas_Coord radius; /**< Holds radius between fingers reported to user */
};
struct _Efl_Canvas_Gesture_Zoom_Data
{
double radius;

View File

@ -1,5 +1,6 @@
#define EFL_CANVAS_GESTURE_RECOGNIZER_PROTECTED
#include "efl_canvas_gesture_private.h"
#define RAD2DEG(x) ((x) * 57.295779513)
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_CLASS
#include "efl_canvas_gesture_recognizer.eo.h"
@ -39,4 +40,104 @@ _event_multi_touch_get(const Efl_Canvas_Gesture_Touch *event)
return efl_gesture_touch_points_count_get(event) > 1;
}
double
_angle_get(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2)
{
double a, xx, yy, rt = (-1);
xx = abs(xx2 - xx1);
yy = abs(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;
}
}
if (rt < 0) /* Do this only if rt is not set */
{
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;
}
}
/* Now we want to change from:
* 90 0
* original circle 180 0 We want: 270 90
* 270 180
*/
rt = 450 - rt;
if (rt >= 360) rt -= 360;
return rt;
}
Evas_Coord
_finger_gap_length_get(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 = abs(xx2 - xx1);
yy = abs(yy2 - yy1);
gap = sqrt((xx * xx) + (yy * yy));
/* START - Compute zoom center point */
/* The triangle defined as follows:
* B
* / |
* / |
* gap / | a
* / |
* A-----C
* b
* http://en.wikipedia.org/wiki/Trigonometric_functions
*************************************/
if (((int)xx) && ((int)yy))
{
double A = atan((yy / xx));
a = (Evas_Coord)((gap / 2) * sin(A));
b = (Evas_Coord)((gap / 2) * cos(A));
*x = (Evas_Coord)((xx2 > xx1) ? (xx1 + b) : (xx2 + b));
*y = (Evas_Coord)((yy2 > yy1) ? (yy1 + a) : (yy2 + a));
}
else
{
if ((int)xx) /* horiz line, take half width */
{
*x = (Evas_Coord)((xx1 + xx2) / 2);
*y = (Evas_Coord)(yy1);
}
if ((int)yy) /* vert line, take half width */
{
*x = (Evas_Coord)(xx1);
*y = (Evas_Coord)((yy1 + yy2) / 2);
}
}
/* END - Compute zoom center point */
return (Evas_Coord)gap;
}
#include "efl_canvas_gesture_recognizer.eo.c"

View File

@ -102,7 +102,7 @@ _efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_recogniz
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
!_event_multi_touch_get(event))
{
dist = efl_gesture_touch_distance(event, 0);
dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id);
length = fabs(dist.x) + fabs(dist.y);
if (length > pd->finger_size)
@ -141,7 +141,7 @@ _efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_recogniz
}
}
}
dist = efl_gesture_touch_distance(event, 0);
dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id);
length = fabs(dist.x) + fabs(dist.y);
if (length <= pd->finger_size)

View File

@ -7,7 +7,6 @@
#define THUMBSCROLL_MOMENTUM_THRESHOLD 100.0
#define EFL_GESTURE_MINIMUM_MOMENTUM 0.001
#define RAD2DEG(x) ((x) * 57.295779513)
#define DEG2RAD(x) ((x) / 57.295779513)
#define memset do not use memset to reset flick data, use _reset_recognizer
@ -114,57 +113,6 @@ _single_line_process(Eo *obj,
pd->t_st, efl_gesture_touch_current_timestamp_get(event));
}
static double
_angle_get(Evas_Coord xx1,
Evas_Coord yy1,
Evas_Coord xx2,
Evas_Coord yy2)
{
double a, xx, yy, rt = (-1);
xx = abs(xx2 - xx1);
yy = abs(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;
}
}
if (rt < 0) /* Do this only if rt is not set */
{
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;
}
}
/* Now we want to change from:
* 90 0
* original circle 180 0 We want: 270 90
* 270 180
*/
rt = 450 - rt;
if (rt >= 360) rt -= 360;
return rt;
}
static void
_vector_get(Eina_Position2D v1,
Eina_Position2D v2,
@ -347,11 +295,12 @@ _efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_recognize(Eo
switch (efl_gesture_touch_state_get(event))
{
case EFL_GESTURE_TOUCH_STATE_BEGIN:
if (!glayer_continues_enable)
fd->id = efl_gesture_touch_current_data_get(event)->id;
fd->id = efl_gesture_touch_current_data_get(event)->id;
EINA_FALLTHROUGH;
case EFL_GESTURE_TOUCH_STATE_UPDATE:
{
if (fd->id == -1)
fd->id = efl_gesture_touch_current_data_get(event)->id;
if (pd->t_st)
{
if (glayer_continues_enable && pd->t_end)

View File

@ -1,18 +1,18 @@
#include "efl_canvas_gesture_private.h"
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_LONG_TAP_CLASS
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_LONG_PRESS_CLASS
#define EFL_GESTURE_LONG_TAP_TIME_OUT 1.2
#define EFL_GESTURE_LONG_PRESS_TIME_OUT 1.2
EOLIAN static const Efl_Class *
_efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd EINA_UNUSED)
_efl_canvas_gesture_recognizer_long_press_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Long_Press_Data *pd EINA_UNUSED)
{
return EFL_CANVAS_GESTURE_LONG_TAP_CLASS;
return EFL_CANVAS_GESTURE_LONG_PRESS_CLASS;
}
EOLIAN static void
_efl_canvas_gesture_recognizer_long_tap_efl_object_destructor(Eo *obj,
Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd)
_efl_canvas_gesture_recognizer_long_press_efl_object_destructor(Eo *obj,
Efl_Canvas_Gesture_Recognizer_Long_Press_Data *pd)
{
if (pd->timeout)
ecore_timer_del(pd->timeout);
@ -21,28 +21,28 @@ _efl_canvas_gesture_recognizer_long_tap_efl_object_destructor(Eo *obj,
}
static Eina_Bool
_long_tap_timeout_cb(void *data)
_long_press_timeout_cb(void *data)
{
Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd = data;
Efl_Canvas_Gesture_Recognizer_Long_Press_Data *pd = data;
/* FIXME: Needs to propagate this event back to evas! */
pd->is_timeout = EINA_TRUE;
efl_gesture_state_set(pd->gesture, EFL_GESTURE_STATE_UPDATED);
efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_LONG_TAP, pd->gesture);
efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_LONG_PRESS, pd->gesture);
return ECORE_CALLBACK_RENEW;
}
EOLIAN static Efl_Canvas_Gesture_Recognizer_Result
_efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize(Eo *obj,
Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd,
_efl_canvas_gesture_recognizer_long_press_efl_canvas_gesture_recognizer_recognize(Eo *obj,
Efl_Canvas_Gesture_Recognizer_Long_Press_Data *pd,
Efl_Canvas_Gesture *gesture,
Efl_Object *watched,
Efl_Canvas_Gesture_Touch *event)
{
double length, start_timeout = pd->start_timeout; // Manhattan distance
double timeout = EFL_GESTURE_LONG_TAP_TIME_OUT;
double timeout = EFL_GESTURE_LONG_PRESS_TIME_OUT;
Eina_Position2D pos;
Eina_Vector2 dist;
Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
@ -76,7 +76,7 @@ _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize(
ecore_timer_del(pd->timeout);
}
pd->timeout = ecore_timer_add(timeout,
_long_tap_timeout_cb, pd);
_long_press_timeout_cb, pd);
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
@ -85,7 +85,7 @@ _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize(
case EFL_GESTURE_TOUCH_STATE_UPDATE:
{
dist = efl_gesture_touch_distance(event, 0);
dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id);
length = fabs(dist.x) + fabs(dist.y);
if ((_event_multi_touch_get(event)) || (length > pd->finger_size))
@ -117,7 +117,7 @@ _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize(
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
!_event_multi_touch_get(event))
{
dist = efl_gesture_touch_distance(event, 0);
dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id);
length = fabs(dist.x) + fabs(dist.y);
if (length <= pd->finger_size && pd->is_timeout)
{
@ -140,4 +140,4 @@ _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize(
return result;
}
#include "efl_canvas_gesture_recognizer_long_tap.eo.c"
#include "efl_canvas_gesture_recognizer_long_press.eo.c"

View File

@ -1,10 +1,10 @@
class @beta Efl.Canvas.Gesture_Recognizer_Long_Tap extends Efl.Canvas.Gesture_Recognizer
class @beta Efl.Canvas.Gesture_Recognizer_Long_Press extends Efl.Canvas.Gesture_Recognizer
{
[[This is the recognizer for Long-tap gestures.
See @Efl.Canvas.Gesture_Long_Tap and @Efl.Canvas.Gesture_Recognizer.
See @Efl.Canvas.Gesture_Long_Press and @Efl.Canvas.Gesture_Recognizer.
For internal use only.
]]
c_prefix: efl_gesture_recognizer_long_tap;
c_prefix: efl_gesture_recognizer_long_press;
implements {
Efl.Object.destructor;
Efl.Canvas.Gesture_Recognizer.type { get; }

View File

@ -67,6 +67,7 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(
Eina_Value *val;
unsigned char glayer_continues_enable;
Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS);
Efl_Canvas_Gesture_Momentum_Data *md = efl_data_scope_get(gesture, EFL_CANVAS_GESTURE_MOMENTUM_CLASS);
val = _recognizer_config_get(obj, "glayer_continues_enable");
@ -83,6 +84,7 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(
if (efl_gesture_touch_points_count_get(event) == 1)
{
pd->touched = EINA_TRUE;
rd->continues = EINA_TRUE;
md->id = -1;
}
}
@ -109,6 +111,7 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(
if ((xdir != pd->xdir) || (ydir != pd->ydir))
{
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Momentum_Data));
rd->continues = EINA_FALSE;
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
}
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
@ -124,20 +127,20 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(
if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_BEGIN ||
glayer_continues_enable)
{
if (efl_gesture_touch_previous_data_get(event))
{
if (efl_gesture_touch_previous_data_get(event)->action == efl_gesture_touch_current_data_get(event)->action)
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
}
pd->t_st = pd->t_end = efl_gesture_touch_current_timestamp_get(event);
pd->st_line = pd->end_line =
efl_gesture_touch_start_point_get(event);
efl_gesture_hotspot_set(gesture, pd->st_line);
if (!glayer_continues_enable)
md->id = efl_gesture_touch_current_data_get(event)->id;
md->id = efl_gesture_touch_current_data_get(event)->id;
if (efl_gesture_touch_previous_data_get(event))
{
/* if multiple fingers are pressed simultaneously, start tracking the latest finger for gesture */
if (efl_gesture_touch_previous_data_get(event)->action == efl_gesture_touch_current_data_get(event)->action)
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
}
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
}
}
@ -186,11 +189,16 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(
case EFL_GESTURE_TOUCH_STATE_END:
{
Eina_Bool touched = !!efl_gesture_touch_points_count_get(event);
if (!pd->t_st)
{
pd->touched = EINA_FALSE;
Eina_Bool prev_touched = pd->touched;
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
rd->continues = pd->touched = touched;
if (prev_touched)
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
}
if ((efl_gesture_touch_current_timestamp_get(event) - MOMENTUM_TIMEOUT) > pd->t_end)
@ -202,6 +210,7 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(
pd->end_line = efl_gesture_touch_current_point_get(event);
pd->t_end = efl_gesture_touch_current_timestamp_get(event);
rd->continues = touched;
efl_gesture_hotspot_set(gesture, pd->end_line);
if ((fabs(md->momentum.x) > EFL_GESTURE_MINIMUM_MOMENTUM) ||
@ -211,6 +220,7 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Momentum_Data));
pd->touched = touched;
break;
}

View File

@ -0,0 +1,269 @@
#include "efl_canvas_gesture_private.h"
#define NEGATIVE_ANGLE (-1.0) /* Magic number */
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_ROTATE_CLASS
static void
_reset_recognizer(Efl_Canvas_Gesture_Recognizer_Rotate_Data *pd)
{
memset(&pd->rotate_st, 0, sizeof(Efl_Gesture_Touch_Point_Data));
memset(&pd->rotate_st1, 0, sizeof(Efl_Gesture_Touch_Point_Data));
memset(&pd->rotate_mv, 0, sizeof(Efl_Gesture_Touch_Point_Data));
memset(&pd->rotate_mv1, 0, sizeof(Efl_Gesture_Touch_Point_Data));
pd->prev_momentum = 0;
pd->base_angle = 0;
pd->next_step = pd->accum_momentum = 0;
}
#define memset do not use memset to reset rotate data, use _reset_recognizer
static void
_rotate_properties_get(Efl_Canvas_Gesture_Recognizer_Rotate_Data *pd,
Efl_Canvas_Gesture_Rotate_Data *gd,
Evas_Coord xx1,
Evas_Coord yy1,
Evas_Coord xx2,
Evas_Coord yy2,
double *angle, Eina_Bool started)
{
/* FIXME: Fix momentum computation, it's wrong */
double prev_angle = *angle;
int x, y;
gd->radius = _finger_gap_length_get(xx1, yy1, xx2, yy2, &x, &y) / 2;
*angle = _angle_get(xx1, yy1, xx2, yy2);
if (!started) /* Fingers are moving, compute momentum */
{
unsigned int tm_start =
(pd->rotate_st.cur.timestamp > pd->rotate_st1.cur.timestamp)
? pd->rotate_st.cur.timestamp : pd->rotate_st1.cur.timestamp;
unsigned int tm_end =
(pd->rotate_mv.cur.timestamp > pd->rotate_mv1.cur.timestamp)
? pd->rotate_mv.cur.timestamp : pd->rotate_mv1.cur.timestamp;
unsigned int tm_total = tm_end - tm_start;
if (tm_total) /* Momentum computed as:
accumulated rotation angle (deg) divided by time */
{
double m = 0;
if (((prev_angle < 90) && ((*angle) > 270)) ||
/* We circle passing ZERO point */
((prev_angle > 270) && ((*angle) < 90)))
{
prev_angle = (*angle);
}
else m = prev_angle - (*angle);
pd->accum_momentum += m;
if ((tm_end - pd->prev_momentum_tm) < 100)
pd->prev_momentum += m;
else
{
if (fabs(pd->prev_momentum) < 0.002)
pd->accum_momentum = 0.0; /* reset momentum */
pd->prev_momentum = 0.0; /* Start again */
}
pd->prev_momentum_tm = tm_end;
gd->momentum = (pd->accum_momentum * 1000) / tm_total;
}
}
else
gd->momentum = 0;
}
static Eina_Bool
_on_rotation_broke_tolerance(Efl_Canvas_Gesture_Recognizer_Rotate_Data *pd, Efl_Canvas_Gesture_Rotate_Data *gd)
{
if (pd->base_angle < 0)
return EINA_FALSE; /* Angle has to be computed first */
if (pd->rotate_angular_tolerance < 0)
return EINA_TRUE;
double low = pd->base_angle - pd->rotate_angular_tolerance;
double high = pd->base_angle + pd->rotate_angular_tolerance;
double t = gd->angle;
if (low < 0)
{
low += 180;
high += 180;
if (t < 180)
t += 180;
else
t -= 180;
}
if (high > 360)
{
low -= 180;
high -= 180;
if (t < 180)
t += 180;
else
t -= 180;
}
if ((t < low) || (t > high)) /* This marks that rotation action has
* started */
{
pd->rotate_angular_tolerance = NEGATIVE_ANGLE;
pd->base_angle = gd->angle; /* Avoid jump in angle value */
return EINA_TRUE;
}
return EINA_FALSE;
}
EOLIAN static const Efl_Class *
_efl_canvas_gesture_recognizer_rotate_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Rotate_Data *pd EINA_UNUSED)
{
return EFL_CANVAS_GESTURE_ROTATE_CLASS;
}
EOLIAN static Efl_Canvas_Gesture_Recognizer_Result
_efl_canvas_gesture_recognizer_rotate_efl_canvas_gesture_recognizer_recognize(Eo *obj,
Efl_Canvas_Gesture_Recognizer_Rotate_Data *pd,
Efl_Canvas_Gesture *gesture,
Efl_Object *watched,
Efl_Canvas_Gesture_Touch *event)
{
Eina_Value *val;
unsigned char glayer_continues_enable;
Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
Efl_Canvas_Gesture_Rotate_Data *gd = efl_data_scope_get(gesture, EFL_CANVAS_GESTURE_ROTATE_CLASS);
Efl_Canvas_Gesture_Touch_Data *td = efl_data_scope_get(event, EFL_CANVAS_GESTURE_TOUCH_CLASS);
Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS);
const Efl_Gesture_Touch_Point_Data *p1 = efl_gesture_touch_data_get(event, 0);
const Efl_Gesture_Touch_Point_Data *p2 = efl_gesture_touch_data_get(event, 1);
//FIXME: Wheel rotate test first here.
val = _recognizer_config_get(obj, "glayer_continues_enable");
if (val) eina_value_get(val, &glayer_continues_enable);
else glayer_continues_enable = 1;
rd->continues = EINA_TRUE;
switch (efl_gesture_touch_state_get(event))
{
case EFL_GESTURE_TOUCH_STATE_UPDATE:
{
if ((!glayer_continues_enable) && (!pd->rotate_st.cur.timestamp))
{
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
}
EINA_FALLTHROUGH;
}
case EFL_GESTURE_TOUCH_STATE_BEGIN:
{
if (td->touch_down > 2)
{
_reset_recognizer(pd);
if (efl_gesture_state_get(gesture) == EFL_GESTURE_STATE_CANCELED)
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
}
if (td->touch_down == 1)
{
return EFL_GESTURE_RECOGNIZER_RESULT_MAYBE;
}
if (!pd->rotate_st.cur.timestamp) /* Now scan touched-devices list
* and find other finger */
{
if (!_event_multi_touch_get(event))
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
pd->base_angle = NEGATIVE_ANGLE;
val = _recognizer_config_get(obj, "glayer_rotate_angular_tolerance");
if (val) eina_value_get(val, &pd->rotate_angular_tolerance);
else pd->rotate_angular_tolerance = 2.0;
memcpy(&pd->rotate_st, p2, sizeof(Efl_Gesture_Touch_Point_Data));
memcpy(&pd->rotate_st1, p1, sizeof(Efl_Gesture_Touch_Point_Data));
memcpy(&pd->rotate_mv, p2, sizeof(Efl_Gesture_Touch_Point_Data));
memcpy(&pd->rotate_mv1, p1, sizeof(Efl_Gesture_Touch_Point_Data));
_rotate_properties_get(pd, gd,
pd->rotate_st.cur.pos.x, pd->rotate_st.cur.pos.y,
pd->rotate_st1.cur.pos.x, pd->rotate_st1.cur.pos.y,
&pd->base_angle, EINA_TRUE);
if ((efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_STARTED) &&
(efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_UPDATED))
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
}
if (p2->id == pd->rotate_mv.id)
memcpy(&pd->rotate_mv, p2, sizeof(Efl_Gesture_Touch_Point_Data));
else if (p2->id == pd->rotate_mv1.id)
memcpy(&pd->rotate_mv1, p2, sizeof(Efl_Gesture_Touch_Point_Data));
_rotate_properties_get(pd, gd,
pd->rotate_mv.cur.pos.x, pd->rotate_mv.cur.pos.y,
pd->rotate_mv1.cur.pos.x, pd->rotate_mv1.cur.pos.y,
&gd->angle, EINA_FALSE);
if (_on_rotation_broke_tolerance(pd, gd)) /* Rotation broke
* tolerance, report
* move */
{
double d = gd->angle - pd->next_step;
if (d < 0.0) d = (-d);
if (d >= pd->rotate_step)
{
pd->next_step = gd->angle;
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
}
}
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
}
case EFL_GESTURE_TOUCH_STATE_END:
{
/* no gesture was started, so no gesture should be detected */
if ((td->touch_down == 0) || (!pd->rotate_st.cur.timestamp))
{
rd->continues = EINA_FALSE;
_reset_recognizer(pd);
efl_gesture_manager_recognizer_cleanup(efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS), obj, watched);
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
}
_reset_recognizer(pd);
if (pd->rotate_angular_tolerance < 0)
{
return EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
}
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE)
{
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
}
}
default:
break;
}
return result;
}
#include "efl_canvas_gesture_recognizer_rotate.eo.c"

View File

@ -0,0 +1,12 @@
class @beta Efl.Canvas.Gesture_Recognizer_Rotate extends Efl.Canvas.Gesture_Recognizer
{
[[This is the recognizer for Rotate gestures.
See @Efl.Canvas.Gesture_Rotate and @Efl.Canvas.Gesture_Recognizer.
For internal use only.
]]
c_prefix: efl_gesture_recognizer_rotate;
implements {
Efl.Canvas.Gesture_Recognizer.type { get; }
Efl.Canvas.Gesture_Recognizer.recognize;
}
}

View File

@ -80,7 +80,7 @@ new_tap:
if (_event_multi_touch_get(event)) return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE)
{
dist = efl_gesture_touch_distance(event, 0);
dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id);
length = fabs(dist.x) + fabs(dist.y);
if (length <= pd->finger_size)
{

View File

@ -101,7 +101,7 @@ _efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_recogniz
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
!_event_multi_touch_get(event))
{
dist = efl_gesture_touch_distance(event, 0);
dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id);
length = fabs(dist.x) + fabs(dist.y);
if (length > pd->finger_size)
@ -140,7 +140,7 @@ _efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_recogniz
}
}
}
dist = efl_gesture_touch_distance(event, 0);
dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id);
length = fabs(dist.x) + fabs(dist.y);
if (length <= pd->finger_size)

View File

@ -16,57 +16,6 @@ _reset_recognizer(Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd)
#define memset do not use memset to reset zoom data, use _reset_recognizer
static Evas_Coord
_finger_gap_length_get(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 = abs(xx2 - xx1);
yy = abs(yy2 - yy1);
gap = sqrt((xx * xx) + (yy * yy));
/* START - Compute zoom center point */
/* The triangle defined as follows:
* B
* / |
* / |
* gap / | a
* / |
* A-----C
* b
* http://en.wikipedia.org/wiki/Trigonometric_functions
*************************************/
if (((int)xx) && ((int)yy))
{
double A = atan((yy / xx));
a = (Evas_Coord)((gap / 2) * sin(A));
b = (Evas_Coord)((gap / 2) * cos(A));
*x = (Evas_Coord)((xx2 > xx1) ? (xx1 + b) : (xx2 + b));
*y = (Evas_Coord)((yy2 > yy1) ? (yy1 + a) : (yy2 + a));
}
else
{
if ((int)xx) /* horiz line, take half width */
{
*x = (Evas_Coord)((xx1 + xx2) / 2);
*y = (Evas_Coord)(yy1);
}
if ((int)yy) /* vert line, take half width */
{
*x = (Evas_Coord)(xx1);
*y = (Evas_Coord)((yy1 + yy2) / 2);
}
}
/* END - Compute zoom center point */
return (Evas_Coord)gap;
}
static double
_zoom_compute(Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd,
Efl_Canvas_Gesture_Zoom_Data *zd,

View File

@ -0,0 +1,17 @@
#include "efl_canvas_gesture_private.h"
#define MY_CLASS EFL_CANVAS_GESTURE_ROTATE_CLASS
EOLIAN static unsigned int
_efl_canvas_gesture_rotate_radius_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Rotate_Data *pd)
{
return pd->radius;
}
EOLIAN static double
_efl_canvas_gesture_rotate_angle_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Rotate_Data *pd)
{
return pd->angle;
}
#include "efl_canvas_gesture_rotate.eo.c"

View File

@ -0,0 +1,28 @@
class @beta Efl.Canvas.Gesture_Rotate extends Efl.Canvas.Gesture
{
[[Rotate gesture class holding state information.
See @Efl.Canvas.Gesture to see what this state is and
@[Efl.Canvas.Gesture_Events.gesture,rotate] for a description of the Rotate gesture.
Application developers receive these objects inside a gesture event and do not typically need to create their own.
]]
c_prefix: efl_gesture_rotate;
methods {
@property radius {
[[The current radius (i.e. the distance between the two fingers) of the gesture.]]
get {
}
values {
radius: uint; [[The radius value in pixels.]]
}
}
@property angle {
[[The current angle of rotation for this gesture.]]
get {
}
values {
rotate: double; [[The angle of the rotation. $[0.0] means no rotation has occurred.]]
}
}
}
}

View File

@ -2,17 +2,4 @@
#define MY_CLASS EFL_CANVAS_GESTURE_TAP_CLASS
EOLIAN static Efl_Object *
_efl_canvas_gesture_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
{
Efl_Canvas_Gesture_Data *gd;
obj = efl_constructor(efl_super(obj, MY_CLASS));
gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS);
gd->type = EFL_EVENT_GESTURE_TAP;
return obj;
}
#include "efl_canvas_gesture_tap.eo.c"

View File

@ -8,7 +8,4 @@ class @beta Efl.Canvas.Gesture_Tap extends Efl.Canvas.Gesture
]]
data: null;
c_prefix: efl_gesture_tap;
implements {
Efl.Object.constructor;
}
}

View File

@ -2,17 +2,4 @@
#define MY_CLASS EFL_CANVAS_GESTURE_TRIPLE_TAP_CLASS
EOLIAN static Efl_Object *
_efl_canvas_gesture_triple_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
{
Efl_Canvas_Gesture_Data *gd;
obj = efl_constructor(efl_super(obj, MY_CLASS));
gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS);
gd->type = EFL_EVENT_GESTURE_TRIPLE_TAP;
return obj;
}
#include "efl_canvas_gesture_triple_tap.eo.c"

View File

@ -8,7 +8,4 @@ class @beta Efl.Canvas.Gesture_Triple_Tap extends Efl.Canvas.Gesture
]]
data: null;
c_prefix: efl_gesture_triple_tap;
implements {
Efl.Object.constructor;
}
}

View File

@ -2,24 +2,6 @@
#define MY_CLASS EFL_CANVAS_GESTURE_ZOOM_CLASS
EOLIAN static Efl_Object *
_efl_canvas_gesture_zoom_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Zoom_Data *pd EINA_UNUSED)
{
Efl_Canvas_Gesture_Data *gd;
obj = efl_constructor(efl_super(obj, MY_CLASS));
gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS);
gd->type = EFL_EVENT_GESTURE_ZOOM;
return obj;
}
EOLIAN static void
_efl_canvas_gesture_zoom_efl_object_destructor(Eo *obj, Efl_Canvas_Gesture_Zoom_Data *pd EINA_UNUSED)
{
efl_destructor(efl_super(obj, MY_CLASS));
}
EOLIAN static double
_efl_canvas_gesture_zoom_radius_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Zoom_Data *pd)
{

View File

@ -28,8 +28,4 @@ class @beta Efl.Canvas.Gesture_Zoom extends Efl.Canvas.Gesture
}
}
}
implements {
Efl.Object.constructor;
Efl.Object.destructor;
}
}

View File

@ -4,18 +4,20 @@ pub_eo_files = [
'efl_canvas_gesture_tap.eo',
'efl_canvas_gesture_double_tap.eo',
'efl_canvas_gesture_triple_tap.eo',
'efl_canvas_gesture_long_tap.eo',
'efl_canvas_gesture_long_press.eo',
'efl_canvas_gesture_momentum.eo',
'efl_canvas_gesture_flick.eo',
'efl_canvas_gesture_rotate.eo',
'efl_canvas_gesture_zoom.eo',
'efl_canvas_gesture_custom.eo',
'efl_canvas_gesture_recognizer.eo',
'efl_canvas_gesture_recognizer_tap.eo',
'efl_canvas_gesture_recognizer_double_tap.eo',
'efl_canvas_gesture_recognizer_triple_tap.eo',
'efl_canvas_gesture_recognizer_long_tap.eo',
'efl_canvas_gesture_recognizer_long_press.eo',
'efl_canvas_gesture_recognizer_momentum.eo',
'efl_canvas_gesture_recognizer_flick.eo',
'efl_canvas_gesture_recognizer_rotate.eo',
'efl_canvas_gesture_recognizer_zoom.eo',
'efl_canvas_gesture_recognizer_custom.eo',
'efl_canvas_gesture_manager.eo',
@ -68,18 +70,20 @@ evas_src += files([
'efl_canvas_gesture_tap.c',
'efl_canvas_gesture_double_tap.c',
'efl_canvas_gesture_triple_tap.c',
'efl_canvas_gesture_long_tap.c',
'efl_canvas_gesture_long_press.c',
'efl_canvas_gesture_momentum.c',
'efl_canvas_gesture_flick.c',
'efl_canvas_gesture_rotate.c',
'efl_canvas_gesture_zoom.c',
'efl_canvas_gesture_custom.c',
'efl_canvas_gesture_recognizer.c',
'efl_canvas_gesture_recognizer_tap.c',
'efl_canvas_gesture_recognizer_double_tap.c',
'efl_canvas_gesture_recognizer_triple_tap.c',
'efl_canvas_gesture_recognizer_long_tap.c',
'efl_canvas_gesture_recognizer_long_press.c',
'efl_canvas_gesture_recognizer_momentum.c',
'efl_canvas_gesture_recognizer_flick.c',
'efl_canvas_gesture_recognizer_rotate.c',
'efl_canvas_gesture_recognizer_zoom.c',
'efl_canvas_gesture_recognizer_custom.c',
'efl_canvas_gesture_manager.c',

View File

@ -0,0 +1,19 @@
#include <Efl_Ui.h>
#include "custom_gesture.eo.h"
#include "custom_gesture.h"
#define MY_CLASS CUSTOM_GESTURE_CLASS
EOLIAN static int
_custom_gesture_x_delta_get(const Eo *obj EINA_UNUSED, Custom_Gesture_Data *pd)
{
return pd->x_delta;
}
EOLIAN static int
_custom_gesture_y_delta_get(const Eo *obj EINA_UNUSED, Custom_Gesture_Data *pd)
{
return pd->y_delta;
}
#include "custom_gesture.eo.c"

View File

@ -0,0 +1,26 @@
import eina_types;
parse efl_canvas_gesture_recognizer;
class @beta Custom_Gesture extends Efl.Canvas.Gesture_Custom
{
[[This is a test class for custom gesture implementations.
]]
methods {
@property x_delta {
[[This is the total change in the X coordinate.]]
get {
}
values {
val: int; [[The change since the start of the gesture.]]
}
}
@property y_delta {
[[This is the total change in the Y coordinate.]]
get {
}
values {
val: int; [[The change since the start of the gesture.]]
}
}
}
}

View File

@ -0,0 +1,16 @@
#ifndef CUSTOM_GESTURE_H
# define CUSTOM_GESTURE_H
typedef struct Custom_Gesture_Data
{
int x_delta;
int y_delta;
} Custom_Gesture_Data;
#endif

View File

@ -1,5 +1,8 @@
#include <Efl_Ui.h>
#include "custom_recognizer.eo.h"
#include "custom_gesture.eo.h"
#include "custom_gesture.h"
#define MY_CLASS CUSTOM_RECOGNIZER_CLASS
typedef struct Custom_Recognizer_Data
@ -7,6 +10,12 @@ typedef struct Custom_Recognizer_Data
} Custom_Recognizer_Data;
EOLIAN static const Efl_Class *
_custom_recognizer_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Custom_Recognizer_Data *pd EINA_UNUSED)
{
return CUSTOM_GESTURE_CLASS;
}
EOLIAN static Eo *
_custom_recognizer_efl_object_finalize(Eo *obj, Custom_Recognizer_Data *pd EINA_UNUSED)
{
@ -16,14 +25,23 @@ _custom_recognizer_efl_object_finalize(Eo *obj, Custom_Recognizer_Data *pd EINA_
EOLIAN static Efl_Canvas_Gesture_Recognizer_Result
_custom_recognizer_efl_canvas_gesture_recognizer_recognize(Eo *obj EINA_UNUSED, Custom_Recognizer_Data *pd EINA_UNUSED,
Efl_Canvas_Gesture *gesture EINA_UNUSED, Efl_Object *watched EINA_UNUSED,
Efl_Canvas_Gesture *gesture, Efl_Object *watched EINA_UNUSED,
Efl_Canvas_Gesture_Touch *event)
{
const Efl_Gesture_Touch_Point_Data *data = efl_gesture_touch_current_data_get(event);
Custom_Gesture_Data *gd;
/* ignore multi-touch */
if (data->id) return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
switch (efl_gesture_touch_state_get(event))
{
case EFL_GESTURE_TOUCH_STATE_BEGIN:
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
case EFL_GESTURE_TOUCH_STATE_UPDATE:
gd = efl_data_scope_get(gesture, CUSTOM_GESTURE_CLASS);
gd->x_delta += data->cur.pos.x - data->prev.pos.x;
gd->y_delta += data->cur.pos.y - data->prev.pos.y;
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
case EFL_GESTURE_TOUCH_STATE_END:
return EFL_GESTURE_RECOGNIZER_RESULT_FINISH;

View File

@ -6,5 +6,6 @@ class @beta Custom_Recognizer extends Efl.Canvas.Gesture_Recognizer_Custom
implements {
Efl.Object.finalize;
Efl.Canvas.Gesture_Recognizer.recognize;
Efl.Canvas.Gesture_Recognizer.type { get; }
}
}

View File

@ -45,12 +45,8 @@ static Eina_Value
_children_get(Eo *obj EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v)
{
Efl_Model *child;
Eina_Future **all;
unsigned int i, len;
all = calloc(1 + 1, sizeof(Eina_Future*));
if (!all) return eina_value_error_init(ENOMEM);
EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
{
Eina_Value *rel_val, *title_val;

View File

@ -8,6 +8,7 @@
#include <Evas_Legacy.h>
#include <evas_canvas_eo.h>
#include "custom_gesture.eo.h"
#include "custom_recognizer.eo.h"
#include "custom_recognizer2.eo.h"
@ -25,11 +26,12 @@ typedef enum
enum
{
TAP,
LONG_TAP,
LONG_PRESS,
DOUBLE_TAP,
TRIPLE_TAP,
MOMENTUM,
FLICK,
ROTATE,
ZOOM,
CUSTOM,
CUSTOM2,
@ -86,11 +88,12 @@ setup(void)
#define WATCH(type) \
efl_event_callback_add(rect, EFL_EVENT_GESTURE_##type, gesture_cb, &count[(type)])
WATCH(TAP);
WATCH(LONG_TAP);
WATCH(LONG_PRESS);
WATCH(DOUBLE_TAP);
WATCH(TRIPLE_TAP);
WATCH(MOMENTUM);
WATCH(FLICK);
WATCH(ROTATE);
WATCH(ZOOM);
get_me_to_those_events(win);
@ -104,11 +107,12 @@ EFL_START_TEST(test_efl_ui_gesture_taps)
/* basic tap */
click_object(rect);
CHECK_ALL(TAP, 1, 0, 1, 0);
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
CHECK_ALL(DOUBLE_TAP, 1, 1, 0, 0);
CHECK_ALL(TRIPLE_TAP, 1, 1, 0, 0);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -116,12 +120,13 @@ EFL_START_TEST(test_efl_ui_gesture_taps)
/* add a second tap */
click_object(rect);
CHECK_ALL(TAP, 1, 0, 1, 0);
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* UPDATE -> FINISH */
CHECK_ALL(DOUBLE_TAP, 0, 1, 1, 0);
CHECK_ALL(TRIPLE_TAP, 0, 2, 0, 0);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -129,12 +134,13 @@ EFL_START_TEST(test_efl_ui_gesture_taps)
/* add a third tap */
click_object(rect);
CHECK_ALL(TAP, 1, 0, 1, 0);
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* UPDATE -> FINISH */
CHECK_ALL(DOUBLE_TAP, 1, 1, 0, 0);
CHECK_ALL(TRIPLE_TAP, 0, 1, 1, 0);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
/* clear states */
@ -145,12 +151,13 @@ EFL_START_TEST(test_efl_ui_gesture_taps)
click_object_at(rect, 500, 500);
click_object_at(rect, 505, 505);
CHECK_ALL(TAP, 2, 0, 2, 0);
CHECK_ALL(LONG_TAP, 2, 0, 0, 2);
CHECK_ALL(LONG_PRESS, 2, 0, 0, 2);
/* UPDATE -> FINISH */
CHECK_ALL(DOUBLE_TAP, 1, 2, 1, 0);
CHECK_ALL(TRIPLE_TAP, 1, 3, 0, 0);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
/* clear states */
@ -160,11 +167,13 @@ EFL_START_TEST(test_efl_ui_gesture_taps)
/* verify multiple simultaneous presses treated as same press */
multi_click_object(rect, 2);
CHECK_ALL(TAP, 1, 0, 1, 0);
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
CHECK_ALL(DOUBLE_TAP, 1, 1, 0, 0);
CHECK_ALL(TRIPLE_TAP, 1, 1, 0, 0);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
/* this is two fingers, so we have a rotate start */
CHECK_ALL(ROTATE, 1, 0, 0, 1);
/* this is two fingers, so we have a zoom start */
CHECK_ALL(ZOOM, 1, 0, 0, 1);
@ -172,12 +181,14 @@ EFL_START_TEST(test_efl_ui_gesture_taps)
multi_click_object(rect, 2);
CHECK_ALL(TAP, 1, 0, 1, 0);
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* UPDATE -> FINISH */
CHECK_ALL(DOUBLE_TAP, 0, 1, 1, 0);
CHECK_ALL(TRIPLE_TAP, 0, 2, 0, 0);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
/* this is two fingers, so we have a rotate start */
CHECK_ALL(ROTATE, 1, 0, 0, 1);
/* this is two fingers, so we have a zoom start */
CHECK_ALL(ZOOM, 1, 0, 0, 1);
@ -185,12 +196,14 @@ EFL_START_TEST(test_efl_ui_gesture_taps)
multi_click_object(rect, 2);
CHECK_ALL(TAP, 1, 0, 1, 0);
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* UPDATE -> FINISH */
CHECK_ALL(DOUBLE_TAP, 1, 1, 0, 0);
CHECK_ALL(TRIPLE_TAP, 0, 1, 1, 0);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
/* this is two fingers, so we have a rotate start */
CHECK_ALL(ROTATE, 1, 0, 0, 1);
/* this is two fingers, so we have a zoom start */
CHECK_ALL(ZOOM, 1, 0, 0, 1);
/* clear states */
@ -199,11 +212,13 @@ EFL_START_TEST(test_efl_ui_gesture_taps)
multi_click_object(rect, 10);
CHECK_ALL(TAP, 1, 0, 1, 0);
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1);
CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 1);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
/* this is two fingers, so we have a rotate start */
CHECK_ALL(ROTATE, 1, 0, 0, 1);
/* this is two fingers, so we have a zoom start */
CHECK_ALL(ZOOM, 1, 0, 0, 1);
RESET;
@ -211,7 +226,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps)
}
EFL_END_TEST
EFL_START_TEST(test_efl_ui_gesture_long_tap)
EFL_START_TEST(test_efl_ui_gesture_long_press)
{
Eo *rect = setup();
double timeout = 1.2;
@ -224,11 +239,12 @@ EFL_START_TEST(test_efl_ui_gesture_long_tap)
/* press */
press_object(rect);
CHECK_ALL(TAP, 1, 0, 0, 0);
CHECK_ALL(LONG_TAP, 1, 0, 0, 0);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 0);
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 0);
CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 0);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -237,22 +253,24 @@ EFL_START_TEST(test_efl_ui_gesture_long_tap)
/* verify longpress */
CHECK_ALL(TAP, 0, 0, 0, 1);
CHECK_ALL(LONG_TAP, 0, 1, 0, 0);
CHECK_ALL(LONG_PRESS, 0, 1, 0, 0);
CHECK_ALL(DOUBLE_TAP, 0, 0, 0, 1);
CHECK_ALL(TRIPLE_TAP, 0, 0, 0, 1);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
evas_event_feed_mouse_up(e, 1, 0, 2, NULL);
CHECK_ZERO(TAP);
CHECK_ALL(LONG_TAP, 0, 0, 1, 0);
CHECK_ALL(LONG_PRESS, 0, 0, 1, 0);
CHECK_ZERO(DOUBLE_TAP);
CHECK_ZERO(TRIPLE_TAP);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -266,11 +284,12 @@ EFL_START_TEST(test_efl_ui_gesture_long_tap)
/* verify longpress */
CHECK_ALL(TAP, 0, 1, 0, 0);
CHECK_ALL(LONG_TAP, 0, 1, 0, 0);
CHECK_ALL(LONG_PRESS, 0, 1, 0, 0);
CHECK_ALL(DOUBLE_TAP, 0, 0, 0, 1);
CHECK_ALL(TRIPLE_TAP, 0, 0, 0, 1);
CHECK_ALL(MOMENTUM, 1, 0, 0, 0);
CHECK_ALL(FLICK, 1, 0, 0, 0);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -291,7 +310,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
/* canceled */
CHECK_ALL(TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1);
/* canceled */
@ -300,6 +319,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
CHECK_ALL(MOMENTUM, 1, DRAG_OBJECT_NUM_MOVES - 1, 0, 1);
/* triggered */
CHECK_ALL(FLICK, 1, DRAG_OBJECT_NUM_MOVES - 1, 1, 0);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -312,7 +332,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
/* canceled */
CHECK_ALL(TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1);
/* canceled */
@ -321,6 +341,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
CHECK_ALL(MOMENTUM, 1, DRAG_OBJECT_NUM_MOVES - 1, 0, 1);
/* triggered */
CHECK_ALL(FLICK, 1, DRAG_OBJECT_NUM_MOVES - 1, 1, 0);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -330,7 +351,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
/* canceled */
CHECK_ALL(TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1);
/* canceled */
@ -339,6 +360,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
CHECK_ALL(MOMENTUM, 1, DRAG_OBJECT_NUM_MOVES - 1, 0, 1);
/* triggered */
CHECK_ALL(FLICK, 1, DRAG_OBJECT_NUM_MOVES - 1, 1, 0);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -348,7 +370,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
/* canceled */
CHECK_ALL(TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1);
/* canceled */
@ -357,6 +379,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
CHECK_ALL(MOMENTUM, 1, DRAG_OBJECT_NUM_MOVES - 1, 0, 1);
/* triggered */
CHECK_ALL(FLICK, 1, DRAG_OBJECT_NUM_MOVES - 1, 1, 0);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -367,7 +390,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
/* canceled */
CHECK_ALL(TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1);
/* canceled */
@ -376,6 +399,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
CHECK_ALL(MOMENTUM, 1, DRAG_OBJECT_NUM_MOVES - 1, 0, 1);
/* triggered */
CHECK_ALL(FLICK, 1, DRAG_OBJECT_NUM_MOVES - 1, 1, 0);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -385,7 +409,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
/* canceled */
CHECK_ALL(TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1);
/* canceled */
@ -396,6 +420,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
CHECK_START(FLICK, 1);
CHECK_FINISH(FLICK, 1);
CHECK_CANCEL(FLICK, 0);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -412,6 +437,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
CHECK_ALL(MOMENTUM, 1, moves - 2, 1, 0);
/* NOT triggered; this is going to have some crazy number of update events since it ignores a bunch */
CHECK_FINISH(FLICK, 0);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -435,6 +461,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
CHECK_FINISH(FLICK, 0);
/* flick checks a tolerance value for straight lines, so "start" will be >= 1 */
ck_assert_int_ge(count[FLICK][EFL_GESTURE_STATE_CANCELED - 1], 1);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -458,6 +485,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick)
CHECK_FINISH(FLICK, 0);
/* flick checks a tolerance value for straight lines, so "start" will be >= 1 */
ck_assert_int_ge(count[FLICK][EFL_GESTURE_STATE_CANCELED - 1], 1);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
@ -473,19 +501,21 @@ EFL_START_TEST(test_efl_ui_gesture_zoom)
/* canceled */
CHECK_ALL(TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 1);
CHECK_START(MOMENTUM, 1);
CHECK_UPDATE(MOMENTUM, moves * 2 + 1);
CHECK_UPDATE(MOMENTUM, 0);
CHECK_FINISH(MOMENTUM, 0);
CHECK_CANCEL(MOMENTUM, 1);
/* only finish is verifiable */
CHECK_FINISH(FLICK, 0);
/* started then canceled */
CHECK_ALL(ROTATE, 1, 0, 0, 1);
/* started 1x */
CHECK_START(ZOOM, 1);
/* 2 touch points tracked, so this will be roughly (2 * moves) but probably less */
@ -501,19 +531,21 @@ EFL_START_TEST(test_efl_ui_gesture_zoom)
/* canceled */
CHECK_ALL(TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(LONG_TAP, 1, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 1);
CHECK_START(MOMENTUM, 1);
CHECK_UPDATE(MOMENTUM, moves * 2 + 1);
CHECK_UPDATE(MOMENTUM, 0);
CHECK_FINISH(MOMENTUM, 0);
CHECK_CANCEL(MOMENTUM, 1);
/* only finish is verifiable */
CHECK_FINISH(FLICK, 0);
/* started then canceled */
CHECK_ALL(ROTATE, 1, 0, 0, 1);
/* started 1x */
CHECK_START(ZOOM, 1);
/* 2 touch points tracked, so this will be roughly (2 * moves) but probably less */
@ -527,6 +559,71 @@ EFL_START_TEST(test_efl_ui_gesture_zoom)
}
EFL_END_TEST
EFL_START_TEST(test_efl_ui_gesture_rotate)
{
Eo *rect = setup();
int moves, momentum_moves;
multi_press_object(rect, 1);
CHECK_ALL(TAP, 1, 0, 0, 0);
CHECK_ALL(LONG_PRESS, 1, 0, 0, 0);
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 0);
CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 0);
CHECK_ZERO(MOMENTUM);
CHECK_ZERO(FLICK);
CHECK_ZERO(ROTATE);
CHECK_ZERO(ZOOM);
RESET;
moves = multi_drag_object_around(rect, 1, 500, 500, 250, 180);
CHECK_ALL(TAP, 0, 0, 0, 1);
CHECK_ALL(LONG_PRESS, 0, 0, 0, 1);
CHECK_ALL(DOUBLE_TAP, 0, 0, 0, 1);
CHECK_ALL(TRIPLE_TAP, 0, 0, 0, 1);
CHECK_START(MOMENTUM, 1);
momentum_moves = count[MOMENTUM][EFL_GESTURE_STATE_UPDATED - 1];
ck_assert_int_ge(count[MOMENTUM][EFL_GESTURE_STATE_UPDATED - 1], moves - 5);
CHECK_FINISH(MOMENTUM, 1);
CHECK_CANCEL(MOMENTUM, 0);
/* flick is just going to do flick stuff here, so don't even bother checking much */
CHECK_FINISH(FLICK, 0);
CHECK_ALL(ROTATE, 1, moves - 1, 1, 0);
CHECK_ALL(ZOOM, 1, 0, 0, 1);
RESET;
/* verify identical motion in reverse */
moves = multi_drag_object_around(rect, 1, 500, 500, 250, -180);
/* already occurred, first finger still down */
CHECK_ZERO(TAP);
/* already canceled, first finger still down */
CHECK_ZERO(LONG_PRESS);
CHECK_ZERO(DOUBLE_TAP);
CHECK_ZERO(TRIPLE_TAP);
/* continuing gesture, counts as already started */
CHECK_START(MOMENTUM, 0);
/* should be exactly 1 more than previous time */
CHECK_UPDATE(MOMENTUM, momentum_moves + 1);
CHECK_FINISH(MOMENTUM, 1);
CHECK_CANCEL(MOMENTUM, 0);
/* flick is just going to do flick stuff here, so don't even bother checking much */
CHECK_FINISH(FLICK, 0);
/* continuing gesture, counts as already started, increment update counter */
CHECK_ALL(ROTATE, 0, (moves - 1) + 1, 1, 0);
CHECK_ALL(ZOOM, 0, 1, 0, 1);
}
EFL_END_TEST
static void
custom_cb(void *data EINA_UNUSED , const Efl_Event *ev)
{
@ -549,12 +646,24 @@ custom_cb2(void *data EINA_UNUSED , const Efl_Event *ev)
count[efl_gesture_state_get(g) - 1]++;
}
static void
custom_gesture_cb(void *data EINA_UNUSED , const Efl_Event *ev)
{
Efl_Canvas_Gesture *g = ev->info;
Eina_Position2D *delta = data;
if (!eina_streq(efl_gesture_custom_gesture_name_get(g), "custom_gesture")) return;
delta->x = custom_gesture_x_delta_get(g);
delta->y = custom_gesture_y_delta_get(g);
}
EFL_START_TEST(test_efl_ui_gesture_custom)
{
Eo *rect = setup();
Eo *manager = efl_provider_find(rect, EFL_CANVAS_GESTURE_MANAGER_CLASS);
Eo *recognizer = efl_add(CUSTOM_RECOGNIZER_CLASS, manager);
Eo *recognizer2 = efl_add(CUSTOM_RECOGNIZER2_CLASS, manager);
Eina_Position2D delta = {0};
efl_gesture_manager_recognizer_register(manager, recognizer);
efl_gesture_manager_recognizer_register(manager, recognizer2);
@ -568,6 +677,15 @@ EFL_START_TEST(test_efl_ui_gesture_custom)
RESET;
/* verify gesture properties */
efl_event_callback_add(rect, EFL_EVENT_GESTURE_CUSTOM, custom_gesture_cb, &delta);
drag_object(rect, 0, 0, 75, 30, EINA_FALSE);
ck_assert_int_eq(delta.x, 75);
ck_assert_int_eq(delta.y, 30);
efl_event_callback_del(rect, EFL_EVENT_GESTURE_CUSTOM, custom_gesture_cb, &delta);
RESET;
/* verify that we aren't still processing */
efl_gesture_manager_recognizer_unregister(manager, recognizer);
efl_gesture_manager_recognizer_unregister(manager, recognizer2);
@ -599,11 +717,53 @@ EFL_START_TEST(test_efl_ui_gesture_custom)
}
EFL_END_TEST
EFL_START_TEST(test_efl_ui_gesture_sequence)
{
Eo *rect = setup();
int moves;
multi_click_object(rect, 1);
CHECK_ALL(TAP, 1, 0, 1, 0);
wait_timer(0.4);
RESET;
moves = pinch_object(rect, 500, 500, 501, 501, -250, 0, 250, 0);
/* canceled */
CHECK_ALL(TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(LONG_PRESS, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1);
/* canceled */
CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 1);
CHECK_START(ZOOM, 1);
/* 2 touch points tracked, so this will be roughly (2 * moves) but probably less */
ck_assert_int_ge(count[ZOOM][EFL_GESTURE_STATE_UPDATED - 1], moves);
/* finished 1x */
CHECK_FINISH(ZOOM, 1);
CHECK_CANCEL(ZOOM, 0);
wait_timer(0.4);
RESET;
multi_click_object(rect, 1);
CHECK_ALL(TAP, 1, 0, 1, 0);
RESET;
}
EFL_END_TEST
void efl_ui_test_gesture(TCase *tc)
{
tcase_add_test(tc, test_efl_ui_gesture_taps);
tcase_add_test(tc, test_efl_ui_gesture_long_tap);
tcase_add_test(tc, test_efl_ui_gesture_long_press);
tcase_add_test(tc, test_efl_ui_gesture_flick);
tcase_add_test(tc, test_efl_ui_gesture_zoom);
tcase_add_test(tc, test_efl_ui_gesture_rotate);
tcase_add_test(tc, test_efl_ui_gesture_custom);
tcase_add_test(tc, test_efl_ui_gesture_sequence);
}

View File

@ -1,4 +1,5 @@
priv_eo_files = [
'custom_gesture.eo',
'custom_recognizer.eo',
'custom_recognizer2.eo',
'focus_test.eo',
@ -164,6 +165,7 @@ efl_ui_suite_src = [
'efl_ui_test_group_item.c',
'efl_ui_test_text.c',
'efl_ui_test_vg_animation.c',
'custom_gesture.c',
'custom_recognizer.c',
'custom_recognizer2.c',
]

View File

@ -67,7 +67,12 @@ EFL_START_TEST(no_leaking_canvas_object)
Eina_Iterator *iter = eo_objects_iterator_new();
Eo *obj;
if (efl_isa(widget, EFL_UI_FLIP_CLASS)) return; //FIXME Flip needs more work for this. However, flip should be redone as a spotlight manager, When this is done, we can add these classes to the check here.
if (efl_isa(widget, EFL_UI_FLIP_CLASS))
{
//FIXME Flip needs more work for this. However, flip should be redone as a spotlight manager, When this is done, we can add these classes to the check here.
eina_iterator_free(iter);
return;
}
EINA_ITERATOR_FOREACH(iter, obj)
{

View File

@ -731,7 +731,7 @@ drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees)
{
Evas *e = evas_object_evas_get(obj);
/* clamp num mouse moves to a vaguely sane value */
int i, num = MIN(degrees, DRAG_OBJECT_AROUND_NUM_MOVES);
int i, num = MIN(abs(degrees), DRAG_OBJECT_AROUND_NUM_MOVES);
int last_x = round(cx + radius);
int last_y = round(cy);
/* start at 0 degrees */
@ -754,6 +754,32 @@ drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees)
return num;
}
int
multi_drag_object_around(Eo *obj, int touch_point, int cx, int cy, int radius, int degrees)
{
Evas *e = evas_object_evas_get(obj);
/* clamp num mouse moves to a vaguely sane value */
int i, num = MIN(abs(degrees), DRAG_OBJECT_AROUND_NUM_MOVES);
int last_x = round(cx + radius);
int last_y = round(cy);
/* start at 0 degrees */
evas_event_feed_multi_down(e, touch_point, last_x, last_y, 1, 1, 1, 1, 0, last_x, last_y, 0, ts++, NULL);
for (i = 1; i < num; i++)
{
/* x = cx + r * cos(a), y = cy + r * sin(a) */
int ax, ay;
/* each iteration is 1 degree */
double angle = (i * (degrees / DRAG_OBJECT_AROUND_NUM_MOVES)) * M_PI / 180.0;
ax = round(cx + radius * cos(angle));
ay = round(cy + radius * sin(angle));
if ((ax == last_x) && (ay == last_y)) continue;
evas_event_feed_multi_move(e, touch_point, ax, ay, 1, 1, 1, 1, 0, ax, ay, ts++, NULL);
last_x = ax, last_y = ay;
}
evas_event_feed_multi_up(e, touch_point, last_x, last_y, 1, 1, 1, 1, 0, last_x, last_y, 0, ts++, NULL);
/* only count arc motion: subtract initial move, mouse down, mouse up */
return num;
}
int
pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2)

View File

@ -34,6 +34,7 @@ void multi_click_object(Eo *obj, int ids);
void multi_press_object(Eo *obj, int ids);
void multi_click_object_at(Eo *obj, int x, int y, int ids);
void multi_press_object_at(Eo *obj, int x, int y, int ids);
int multi_drag_object_around(Eo *obj, int touch_point, int cx, int cy, int radius, int degrees);
void drag_object(Eo *obj, int x, int y, int dx, int dy, Eina_Bool iterate);
int drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees);
int pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2);