From 7ef58f9581d77091ad1da07a63f65e8b85b6f071 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Mon, 13 May 2019 15:45:50 +0900 Subject: [PATCH 01/53] evas png: apply interpolation when scale down image loading. Summary: This patch improves png quality when image uses scale-down at image loading. Since current scale-down logic just works like point sampling, image result could be wholely different, Simply, if source data is consist of continous white and black pixels, and scale down factor is 2, the sampled data would be only white, and lose all black pixels, or vice versa. The result can be unexpected by users. Even current jpeg scale-down works with interpolation. Before: {F3711651} After: {F3711652} Original: {F3711653} Reviewers: cedric, raster, #committers, kimcinoo, jsuya Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8788 --- .../image_loaders/png/evas_image_load_png.c | 101 ++++++++++++------ 1 file changed, 69 insertions(+), 32 deletions(-) diff --git a/src/modules/evas/image_loaders/png/evas_image_load_png.c b/src/modules/evas/image_loaders/png/evas_image_load_png.c index 9e47d0dc98..2cc0f52242 100644 --- a/src/modules/evas/image_loaders/png/evas_image_load_png.c +++ b/src/modules/evas/image_loaders/png/evas_image_load_png.c @@ -230,7 +230,6 @@ evas_image_load_file_data_png(void *loader_data, Eina_File *f; unsigned char *surface; - unsigned char *tmp_line; png_structp png_ptr = NULL; png_infop info_ptr = NULL; Evas_PNG_Info epi; @@ -382,7 +381,7 @@ evas_image_load_file_data_png(void *loader_data, } passes = png_set_interlace_handling(png_ptr); - + /* we read image line by line if scale down was set */ if (scale_ratio == 1 && region_set == 0) { @@ -396,6 +395,7 @@ evas_image_load_file_data_png(void *loader_data, else { unsigned char *src_ptr; + unsigned char *dst_ptr = surface; int skip_row = 0, region_x = 0, region_y = 0; if (region_set) @@ -406,51 +406,86 @@ evas_image_load_file_data_png(void *loader_data, if (passes == 1) { - tmp_line = (unsigned char *) alloca(image_w * pack_offset); + int line_size = (image_w * pack_offset) - (region_x * pack_offset); + unsigned char *tmp_line = (unsigned char *) alloca(image_w * pack_offset); + //accumulate pixel color here. + unsigned short *interp_buf = (unsigned short *) alloca(line_size * sizeof(unsigned short)); + unsigned short *pbuf; for (skip_row = 0; skip_row < region_y; skip_row++) png_read_row(png_ptr, tmp_line, NULL); - //general case: 4 bytes pixel. - if (pack_offset == sizeof(DATA32)) + png_read_row(png_ptr, tmp_line, NULL); + src_ptr = tmp_line + (region_x * pack_offset); + + //The first pixel, of the first line + for (k = 0; k < (int) pack_offset; k++) + dst_ptr[k] = src_ptr[k]; + + dst_ptr += pack_offset; + src_ptr += (scale_ratio * pack_offset); + + for (j = 1; j < w; j++) { - DATA32 *dst_ptr = (DATA32 *) surface; - DATA32 *src_ptr2; + //rgba + interp_buf[0] = 0; + interp_buf[1] = 0; + interp_buf[2] = 0; + interp_buf[3] = 0; - for (i = 0; i < h; i++) + //horizontal interpolation. + for (p = 0; p < scale_ratio; p++) { - png_read_row(png_ptr, tmp_line, NULL); - src_ptr2 = (DATA32 *) (tmp_line + region_x * pack_offset); - - for (j = 0; j < w; j++) - { - *dst_ptr = *src_ptr2; - ++dst_ptr; - src_ptr2 += scale_ratio; - } - for (j = 0; j < (scale_ratio - 1); j++) - png_read_row(png_ptr, tmp_line, NULL); + for (k = 0; k < (int) pack_offset; k++) + interp_buf[k] += src_ptr[k - (int)(p * pack_offset)]; } - } - else - { - unsigned char *dst_ptr = surface; + for (k = 0; k < (int) pack_offset; k++) + dst_ptr[k] = (interp_buf[k] / scale_ratio); - for (i = 0; i < h; i++) + dst_ptr += pack_offset; + src_ptr += (scale_ratio * pack_offset); + } + + //next lines + for (i = 1; i < h; i++) + { + memset(interp_buf, 0x00, line_size * sizeof(unsigned short)); + + //vertical interpolation. + for (j = 0; j < scale_ratio; j++) { png_read_row(png_ptr, tmp_line, NULL); - src_ptr = tmp_line + region_x * pack_offset; + src_ptr = tmp_line + (region_x * pack_offset); - for (j = 0; j < w; j++) + for (p = 0; p < line_size; ++p) + interp_buf[p] += src_ptr[p]; + } + + for (p = 0; p < line_size; ++p) + interp_buf[p] /= scale_ratio; + + pbuf = interp_buf; + + //The first pixel of the current line + for (k = 0; k < (int) pack_offset; k++) + dst_ptr[k] = pbuf[k]; + + dst_ptr += pack_offset; + pbuf += scale_ratio * pack_offset; + + for (j = 1; j < w; j++) + { + //horizontal interpolation. + for (p = 1; p < scale_ratio; ++p) { for (k = 0; k < (int) pack_offset; k++) - dst_ptr[k] = src_ptr[k]; - - dst_ptr += pack_offset; - src_ptr += scale_ratio * pack_offset; + pbuf[k] += pbuf[k - (int)(p * pack_offset)]; } - for (j = 0; j < (scale_ratio - 1); j++) - png_read_row(png_ptr, tmp_line, NULL); + for (k = 0; k < (int) pack_offset; k++) + dst_ptr[k] = (pbuf[k] / scale_ratio); + + dst_ptr += pack_offset; + pbuf += (scale_ratio * pack_offset); } } @@ -459,6 +494,8 @@ evas_image_load_file_data_png(void *loader_data, } else { + //TODO: Scale-down interpolation for multi-pass? + unsigned char *pixels2 = malloc(image_w * image_h * pack_offset); if (pixels2) From a9132a9a66955608e913bb1228e4adb371310b09 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Mon, 13 May 2019 11:27:40 +0200 Subject: [PATCH 02/53] elm: Put back Policy and Policy_Quit in EO files In e027ad2626 these enums were moved to header files, which is correct, since they are legacy and should not be present in EO files. However, the C# bindings are still using them. Until nobody is using these two enums, adding them back to EO fixes the build. --- src/lib/elementary/elm_general.eot | 27 +++++++++++++++++++++++ src/lib/elementary/elm_general.h | 35 ------------------------------ 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/src/lib/elementary/elm_general.eot b/src/lib/elementary/elm_general.eot index 12d800b11a..f76866459f 100644 --- a/src/lib/elementary/elm_general.eot +++ b/src/lib/elementary/elm_general.eot @@ -2,6 +2,33 @@ * NOTE: Some of those types still need to be moved to Efl.Ui */ +enum Elm.Policy +{ + [[Policy identifiers.]] + quit, [[under which circumstances the application should quit automatically. + See also @Elm.Policy.quit.]] + exit, [[defines elm_exit() behaviour. See also @Elm.Policy.exit. + + @since 1.8 + ]] + throttle, [[defines how throttling should work. See also @Elm.Policy.throttle + + @since 1.8 + ]] + last [[Sentinel value to indicate last enum field during iteration]] +} + +/* FIXME: elm_policy API is not bound to EO */ +enum Elm.Policy_Quit +{ + [[Possible values for the @Elm.Policy.quit policy]] + none = 0, [[never quit the application automatically]] + last_window_closed, [[quit when the application's last window is closed]] + last_window_hidden [[quit when the application's last window is hidden + + @since 1.14]] +} + /* Legacy-only function pointer types, for the legacy EO classes (genlist, etc...) */ type Evas_Smart_Cb: __undefined_type; [[Evas smart callback type]] diff --git a/src/lib/elementary/elm_general.h b/src/lib/elementary/elm_general.h index 4ee178b4df..cc4fba4c19 100644 --- a/src/lib/elementary/elm_general.h +++ b/src/lib/elementary/elm_general.h @@ -32,41 +32,6 @@ typedef struct _Elm_Event_Policy_Changed int old_value; /**< new value the policy got */ } Elm_Event_Policy_Changed; -/** Policy identifiers. - * - * @ingroup Elm - */ -typedef enum -{ - ELM_POLICY_QUIT = 0, /**< under which circumstances the application should - * quit automatically. See also @ref ELM_POLICY_QUIT. */ - ELM_POLICY_EXIT, /**< defines elm_exit() behaviour. See also - * @ref ELM_POLICY_EXIT. - * - * @since 1.8 */ - ELM_POLICY_THROTTLE, /**< defines how throttling should work. See also - * @ref ELM_POLICY_THROTTLE - * - * @since 1.8 */ - ELM_POLICY_LAST /**< Sentinel value to indicate last enum field during - * iteration */ -} Elm_Policy; - -/** Possible values for the @ref ELM_POLICY_QUIT policy - * - * @ingroup Elm - */ -typedef enum -{ - ELM_POLICY_QUIT_NONE = 0, /**< never quit the application automatically */ - ELM_POLICY_QUIT_LAST_WINDOW_CLOSED, /**< quit when the application's last - * window is closed */ - ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN /**< quit when the application's last - * window is hidden - * - * @since 1.14 */ -} Elm_Policy_Quit; - /** Possible values for the @ref ELM_POLICY_EXIT policy. * * @since 1.8 From a8d1c7d8ad5b54425147a6f678c917b966ada8f0 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Mon, 13 May 2019 14:12:28 +0100 Subject: [PATCH 03/53] eina - value - test - cats warnings on 32bit to get some silence longs will be truncated on 32bit in these tests so be explicit to not have warinings. note - eina value tests are broken on 32bit anyway already - the conversions to/from long types are broken and fail. this doesn't fix that. --- src/tests/eina/eina_test_value.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/eina/eina_test_value.c b/src/tests/eina/eina_test_value.c index a9e6e47de2..fc137df621 100644 --- a/src/tests/eina/eina_test_value.c +++ b/src/tests/eina/eina_test_value.c @@ -100,7 +100,7 @@ EFL_START_TEST(eina_value_test_simple) fail_unless(eina_value_int64_get(value, &i64)); fail_if(eina_value_long_get(value, &l)); fail_unless(eina_value_long_convert(value, &l)); - fail_unless(l == 0x0011223344556677); + fail_unless(l == (long)0x0011223344556677); fail_unless(i64 == 0x0011223344556677); eina_value_flush(value); @@ -157,7 +157,7 @@ EFL_START_TEST(eina_value_test_simple) fail_unless(eina_value_uint64_get(value, &u64)); fail_if(eina_value_ulong_get(value, &ul)); fail_unless(eina_value_ulong_convert(value, &ul)); - fail_unless(ul == 0x1122334455667788); + fail_unless(ul == (unsigned long)0x1122334455667788); fail_unless(u64 == 0x1122334455667788); eina_value_flush(value); From 96c3edd7012edbad8b9a72d291f203108e74b5fd Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Mon, 13 May 2019 14:21:04 +0100 Subject: [PATCH 04/53] ecore drm2 - fix warnigns in DBG eina logs for long types on 32bit longs are 32bit so cast appropriately to not have warnings. --- src/lib/ecore_drm2/ecore_drm2_device.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c index c27deb8199..b95a5a7d9e 100644 --- a/src/lib/ecore_drm2/ecore_drm2_device.c +++ b/src/lib/ecore_drm2/ecore_drm2_device.c @@ -266,7 +266,7 @@ _drm2_atomic_state_crtc_fill(Ecore_Drm2_Crtc_State *cstate, int fd) { cstate->active.id = prop->prop_id; cstate->active.value = oprops->prop_values[i]; - DBG("\t\t\tValue: %lu", cstate->active.value); + DBG("\t\t\tValue: %lu", (long)cstate->active.value); } else if (!strcmp(prop->name, "BACKGROUND_COLOR")) { @@ -307,13 +307,13 @@ _drm2_atomic_state_conn_fill(Ecore_Drm2_Connector_State *cstate, int fd) { cstate->crtc.id = prop->prop_id; cstate->crtc.value = oprops->prop_values[i]; - DBG("\t\t\tValue: %lu", cstate->crtc.value); + DBG("\t\t\tValue: %lu", (long)cstate->crtc.value); } else if (!strcmp(prop->name, "DPMS")) { cstate->dpms.id = prop->prop_id; cstate->dpms.value = oprops->prop_values[i]; - DBG("\t\t\tValue: %lu", cstate->dpms.value); + DBG("\t\t\tValue: %lu", (long)cstate->dpms.value); } else if (!strcmp(prop->name, "EDID")) { @@ -348,13 +348,13 @@ _drm2_atomic_state_conn_fill(Ecore_Drm2_Connector_State *cstate, int fd) { cstate->aspect.id = prop->prop_id; cstate->aspect.value = oprops->prop_values[i]; - DBG("\t\t\tValue: %lu", cstate->aspect.value); + DBG("\t\t\tValue: %lu", (long)cstate->aspect.value); } else if (!strcmp(prop->name, "scaling mode")) { cstate->scaling.id = prop->prop_id; cstate->scaling.value = oprops->prop_values[i]; - DBG("\t\t\tValue: %lu", cstate->scaling.value); + DBG("\t\t\tValue: %lu", (long)cstate->scaling.value); } cont: @@ -392,13 +392,13 @@ _drm2_atomic_state_plane_fill(Ecore_Drm2_Plane_State *pstate, int fd) { pstate->cid.id = prop->prop_id; pstate->cid.value = oprops->prop_values[i]; - DBG("\t\t\tValue: %lu", pstate->cid.value); + DBG("\t\t\tValue: %lu", (long)pstate->cid.value); } else if (!strcmp(prop->name, "FB_ID")) { pstate->fid.id = prop->prop_id; pstate->fid.value = oprops->prop_values[i]; - DBG("\t\t\tValue: %lu", pstate->fid.value); + DBG("\t\t\tValue: %lu", (long)pstate->fid.value); } else if (!strcmp(prop->name, "CRTC_X")) { @@ -456,7 +456,7 @@ _drm2_atomic_state_plane_fill(Ecore_Drm2_Plane_State *pstate, int fd) DBG("\t\t\tCursor Plane"); break; default: - DBG("\t\t\tValue: %lu", pstate->type.value); + DBG("\t\t\tValue: %lu", (long)pstate->type.value); break; } } From 346e5d1324d26b1948b5ecda5af6e20ed3b9a49b Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Mon, 13 May 2019 14:40:08 +0100 Subject: [PATCH 05/53] edje src - mark with efl version so we don't get warnings --- data/elementary/themes/default.edc | 2 ++ src/tests/edje/data/test_text.edc | 1 + 2 files changed, 3 insertions(+) diff --git a/data/elementary/themes/default.edc b/data/elementary/themes/default.edc index 95f879a8a8..0e30946e59 100644 --- a/data/elementary/themes/default.edc +++ b/data/elementary/themes/default.edc @@ -1,3 +1,5 @@ +efl_version: 1 22; + #include "macros.edc" externals.external: "elm"; diff --git a/src/tests/edje/data/test_text.edc b/src/tests/edje/data/test_text.edc index 9395a2d4de..b9f05bd883 100644 --- a/src/tests/edje/data/test_text.edc +++ b/src/tests/edje/data/test_text.edc @@ -1,3 +1,4 @@ +efl_version: 1 22; collections { styles { style { name: "tbstyle"; From 15693d3b3769e18b47ad8c2f2b4199fc42c4bbcc Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 13 May 2019 11:44:02 -0400 Subject: [PATCH 06/53] evas_render: deduplicate mapped mask render code Summary: this code block was repeated multiple times throughout the function no functional changes Reviewers: cedric, kimcinoo Reviewed By: kimcinoo Subscribers: kimcinoo, #reviewers, #committers Tags: #efl_rendering Differential Revision: https://phab.enlightenment.org/D8837 --- src/lib/evas/canvas/evas_render.c | 110 +++++++++--------------------- 1 file changed, 33 insertions(+), 77 deletions(-) diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c index e1891fc890..64fedeb948 100644 --- a/src/lib/evas/canvas/evas_render.c +++ b/src/lib/evas/canvas/evas_render.c @@ -1731,6 +1731,36 @@ _evas_render_mapped_context_clip_set(Evas_Public_Data *evas, Evas_Object *eo_obj } } +static void +_evas_render_mapped_mask(Evas_Public_Data *evas, Evas_Object_Protected_Data *obj, Evas_Object_Protected_Data *mask, + Evas_Proxy_Render_Data *proxy_render_data, void *output, void *ctx, int off_x, int off_y, int level, Eina_Bool do_async) +{ + if (!mask) return; + + // This path can be hit when we're multiplying masks on top of each other... + Evas_Object_Protected_Data *prev_mask = obj->clip.prev_mask; + Eina_Bool redraw = mask->mask->redraw || !mask->mask->surface; + + RD(level, " has mask: %s redraw:%d sfc:%p prev_mask:%p\n", + RDNAME(mask), mask->mask->redraw, mask->mask->surface, prev_mask); + if (prev_mask && !_mask_apply_inside_proxy(proxy_render_data, prev_mask)) + { + RD(level, " discard prev mask and redraw (guessed outside proxy)\n"); + prev_mask = NULL; + redraw = EINA_TRUE; + } + if (redraw) + evas_render_mask_subrender(evas, output, mask, prev_mask, level + 1, do_async); + + if (mask->mask->surface) + { + ENFN->context_clip_image_set(ENC, ctx, mask->mask->surface, + mask->cur->geometry.x + off_x, + mask->cur->geometry.y + off_y, + evas, do_async); + } +} + Eina_Bool evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *context, @@ -2052,31 +2082,7 @@ evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj, off_y); /* Clipper masks */ - if (mask) - { - // This path can be hit when we're multiplying masks on top of each other... - Evas_Object_Protected_Data *prev_mask = obj->clip.prev_mask; - Eina_Bool redraw = mask->mask->redraw || !mask->mask->surface; - - RD(level, " has mask: %s redraw:%d sfc:%p prev_mask:%p\n", - RDNAME(mask), mask->mask->redraw, mask->mask->surface, prev_mask); - if (prev_mask && !_mask_apply_inside_proxy(proxy_render_data, prev_mask)) - { - RD(level, " discard prev mask and redraw (guessed outside proxy)\n"); - prev_mask = NULL; - redraw = EINA_TRUE; - } - if (redraw) - evas_render_mask_subrender(evas, output, mask, prev_mask, level + 1, do_async); - - if (mask->mask->surface) - { - ENFN->context_clip_image_set(ENC, ctx, mask->mask->surface, - mask->cur->geometry.x + off_x, - mask->cur->geometry.y + off_y, - evas, do_async); - } - } + _evas_render_mapped_mask(evas, obj, mask, proxy_render_data, output, ctx, off_x, off_y, level, do_async); } if (obj->cur->cache.clip.visible || !proxy_src_clip) @@ -2121,32 +2127,7 @@ evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj, /* Clipper masks */ if (obj->cur->clipper && (mapped > 1) && _evas_render_object_is_mask(obj->cur->clipper)) - { - // This path can be hit when we're multiplying masks on top of each other... - Evas_Object_Protected_Data *mask = obj->cur->clipper; - Evas_Object_Protected_Data *prev_mask = obj->clip.prev_mask; - Eina_Bool redraw = mask->mask->redraw || !mask->mask->surface; - - RD(level, " has mask: %s redraw:%d sfc:%p prev_mask:%p\n", - RDNAME(mask), mask->mask->redraw, mask->mask->surface, prev_mask); - if (prev_mask && !_mask_apply_inside_proxy(proxy_render_data, prev_mask)) - { - RD(level, " discard prev mask and redraw (guessed outside proxy)\n"); - prev_mask = NULL; - redraw = EINA_TRUE; - } - if (redraw) - evas_render_mask_subrender(evas, output, mask, prev_mask, level + 1, do_async); - - if (mask->mask->surface) - { - ENFN->context_clip_image_set(ENC, ctx, - mask->mask->surface, - mask->cur->geometry.x + off_x, - mask->cur->geometry.y + off_y, - evas, do_async); - } - } + _evas_render_mapped_mask(evas, obj, obj->cur->clipper, proxy_render_data, output, ctx, off_x, off_y, level, do_async); else if (!proxy_src_clip) { if (!_proxy_context_clip(evas, ctx, proxy_render_data, obj, off_x, off_y)) @@ -2215,32 +2196,7 @@ evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj, } /* Clipper masks */ - if (mask) - { - // This path can be hit when we're multiplying masks on top of each other... - Evas_Object_Protected_Data *prev_mask = obj->clip.prev_mask; - Eina_Bool redraw = mask->mask->redraw || !mask->mask->surface; - - RD(level, " has mask: %s redraw:%d sfc:%p prev_mask:%p\n", - RDNAME(mask), mask->mask->redraw, mask->mask->surface, prev_mask); - if (prev_mask && !_mask_apply_inside_proxy(proxy_render_data, prev_mask)) - { - RD(level, " discard prev mask and redraw (guessed outside proxy)\n"); - prev_mask = NULL; - redraw = EINA_TRUE; - } - if (redraw) - evas_render_mask_subrender(evas, output, mask, prev_mask, level + 1, do_async); - - if (mask->mask->surface) - { - ENFN->context_clip_image_set(ENC, ctx, - mask->mask->surface, - mask->cur->geometry.x + off_x, - mask->cur->geometry.y + off_y, - evas, do_async); - } - } + _evas_render_mapped_mask(evas, obj, mask, proxy_render_data, output, ctx, off_x, off_y, level, do_async); } #ifdef REND_DBG From fa983e9ff146461341b733e91985b40845d1bf72 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 13 May 2019 11:44:11 -0400 Subject: [PATCH 07/53] evas/scale_sample: slightly refactor some mask geometry clamping Summary: this was a bit confusing to read since the comparators are not ordered as expected no functional changes Depends on D8837 Reviewers: cedric, segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, #reviewers, #committers Tags: #efl_rendering Differential Revision: https://phab.enlightenment.org/D8838 --- src/lib/evas/common/evas_scale_sample.c | 39 +++++++++++++------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/lib/evas/common/evas_scale_sample.c b/src/lib/evas/common/evas_scale_sample.c index fc1eb00a51..139f03281e 100644 --- a/src/lib/evas/common/evas_scale_sample.c +++ b/src/lib/evas/common/evas_scale_sample.c @@ -143,14 +143,14 @@ _evas_common_scale_rgba_sample_scale_mask(int y, /* a scanline buffer */ buf = alloca(dst_clip_w * sizeof(DATA32)); - // Adjust clipping info - if (EINA_UNLIKELY((dst_clip_x - mask_x) < 0)) + /* clamp/map to mask geometry */ + if (EINA_UNLIKELY(dst_clip_x < mask_x)) dst_clip_x = mask_x; - if (EINA_UNLIKELY((dst_clip_y - mask_y + y) < 0)) + if (EINA_UNLIKELY(dst_clip_y + y < mask_y)) dst_clip_y = mask_y + y; - if (EINA_UNLIKELY((dst_clip_x - mask_x + dst_clip_w) > (int)mask_ie->cache_entry.w)) + if (EINA_UNLIKELY(dst_clip_x + dst_clip_w > mask_x + (int)mask_ie->cache_entry.w)) dst_clip_w = mask_x - mask_ie->cache_entry.w - dst_clip_x; - if (EINA_UNLIKELY((dst_clip_y - mask_y + y + dst_clip_h) > (int)mask_ie->cache_entry.h)) + if (EINA_UNLIKELY(dst_clip_y + dst_clip_h + y > mask_y + (int)mask_ie->cache_entry.h)) dst_clip_h = mask_y + y - mask_ie->cache_entry.h - dst_clip_y; dptr = dptr + dst_w * y; @@ -337,15 +337,16 @@ evas_common_scale_rgba_sample_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli } else func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op); - // Adjust clipping info - if (EINA_UNLIKELY((dst_clip_x - mask_x) < 0)) + + /* clamp/map to mask geometry */ + if (EINA_UNLIKELY(dst_clip_x < mask_x)) dst_clip_x = mask_x; - if (EINA_UNLIKELY((dst_clip_y - mask_y) < 0)) + if (EINA_UNLIKELY(dst_clip_y < mask_y)) dst_clip_y = mask_y; - if (EINA_UNLIKELY((dst_clip_x - mask_x + dst_clip_w) > (int)mask_ie->cache_entry.w)) - dst_clip_w = mask_ie->cache_entry.w - dst_clip_x + mask_x; - if (EINA_UNLIKELY((dst_clip_y - mask_y + dst_clip_h) > (int)mask_ie->cache_entry.h)) - dst_clip_h = mask_ie->cache_entry.h - dst_clip_y + mask_y; + if (EINA_UNLIKELY(dst_clip_x + dst_clip_w > mask_x + (int)mask_ie->cache_entry.w)) + dst_clip_w = mask_x + mask_ie->cache_entry.w - dst_clip_x; + if (EINA_UNLIKELY(dst_clip_y + dst_clip_h > mask_y + (int)mask_ie->cache_entry.h)) + dst_clip_h = mask_y + mask_ie->cache_entry.h - dst_clip_y; } if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h)) @@ -613,15 +614,15 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, dc->render_op); if (dc->mul.use) func2 = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dc->mul.col, dst->cache_entry.flags.alpha, dst_clip_w, EVAS_RENDER_COPY); - // Adjust clipping info - if (EINA_UNLIKELY((dst_clip_x - mask_x) < 0)) + /* clamp/map to mask geometry */ + if (EINA_UNLIKELY(dst_clip_x < mask_x)) dst_clip_x = mask_x; - if (EINA_UNLIKELY((dst_clip_y - mask_y) < 0)) + if (EINA_UNLIKELY(dst_clip_y < mask_y)) dst_clip_y = mask_y; - if (EINA_UNLIKELY((dst_clip_x - mask_x + dst_clip_w) > (int)mask_ie->cache_entry.w)) - dst_clip_w = mask_ie->cache_entry.w - dst_clip_x + mask_x; - if (EINA_UNLIKELY((dst_clip_y - mask_y + dst_clip_h) > (int)mask_ie->cache_entry.h)) - dst_clip_h = mask_ie->cache_entry.h - dst_clip_y + mask_y; + if (EINA_UNLIKELY(dst_clip_x + dst_clip_w > mask_x + (int)mask_ie->cache_entry.w)) + dst_clip_w = mask_x + mask_ie->cache_entry.w - dst_clip_x; + if (EINA_UNLIKELY(dst_clip_y + dst_clip_h > mask_y + (int)mask_ie->cache_entry.h)) + dst_clip_h = mask_y + mask_ie->cache_entry.h - dst_clip_y; } if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h)) From 20cefc8db29a3096962e24a368edcd4b09c5c242 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 13 May 2019 11:44:18 -0400 Subject: [PATCH 08/53] evas/scale_sample: fix mask geometry clamping in scale thread Summary: the 'y' parameter is not relevant here. this clamping exists solely to avoid reading outside the bounds of the mask, and 'y' is the scanline at which to begin the masking subtracting the mask size here does not make sense: we are attempting to clamp to the size of the mask in order to avoid buffer over-read, so this means that we are mapping the maximum y coordinate of the mask (mask_y + mask_h) to be relative to the clipped y coordinate (dst_clip_y) Depends on D8838 Reviewers: cedric, segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, #reviewers, #committers Tags: #efl_rendering Differential Revision: https://phab.enlightenment.org/D8839 --- src/lib/evas/common/evas_scale_sample.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/evas/common/evas_scale_sample.c b/src/lib/evas/common/evas_scale_sample.c index 139f03281e..6fc54de00b 100644 --- a/src/lib/evas/common/evas_scale_sample.c +++ b/src/lib/evas/common/evas_scale_sample.c @@ -146,12 +146,12 @@ _evas_common_scale_rgba_sample_scale_mask(int y, /* clamp/map to mask geometry */ if (EINA_UNLIKELY(dst_clip_x < mask_x)) dst_clip_x = mask_x; - if (EINA_UNLIKELY(dst_clip_y + y < mask_y)) - dst_clip_y = mask_y + y; + if (EINA_UNLIKELY(dst_clip_y < mask_y)) + dst_clip_y = mask_y; if (EINA_UNLIKELY(dst_clip_x + dst_clip_w > mask_x + (int)mask_ie->cache_entry.w)) - dst_clip_w = mask_x - mask_ie->cache_entry.w - dst_clip_x; - if (EINA_UNLIKELY(dst_clip_y + dst_clip_h + y > mask_y + (int)mask_ie->cache_entry.h)) - dst_clip_h = mask_y + y - mask_ie->cache_entry.h - dst_clip_y; + dst_clip_w = mask_x + mask_ie->cache_entry.w - dst_clip_x; + if (EINA_UNLIKELY(dst_clip_y + dst_clip_h > mask_y + (int)mask_ie->cache_entry.h)) + dst_clip_h = mask_y + mask_ie->cache_entry.h - dst_clip_y; dptr = dptr + dst_w * y; for (; y < dst_clip_h; y++) From 01ce5a1249fee516d5cfdff0408221920ac26643 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 13 May 2019 11:44:27 -0400 Subject: [PATCH 09/53] evas/scale_sample: call alloca for the scanline buffer after clamping width Summary: this is already a risky call for larger scanlines, so use the clamped value to further reduce the chance of blowing out the stack Depends on D8839 Reviewers: cedric, segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, #reviewers, #committers Tags: #efl_rendering Differential Revision: https://phab.enlightenment.org/D8840 --- src/lib/evas/common/evas_scale_sample.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/evas/common/evas_scale_sample.c b/src/lib/evas/common/evas_scale_sample.c index 6fc54de00b..d043ba3414 100644 --- a/src/lib/evas/common/evas_scale_sample.c +++ b/src/lib/evas/common/evas_scale_sample.c @@ -140,9 +140,6 @@ _evas_common_scale_rgba_sample_scale_mask(int y, DATA32 *buf, *dst_ptr; int x; - /* a scanline buffer */ - buf = alloca(dst_clip_w * sizeof(DATA32)); - /* clamp/map to mask geometry */ if (EINA_UNLIKELY(dst_clip_x < mask_x)) dst_clip_x = mask_x; @@ -153,6 +150,9 @@ _evas_common_scale_rgba_sample_scale_mask(int y, if (EINA_UNLIKELY(dst_clip_y + dst_clip_h > mask_y + (int)mask_ie->cache_entry.h)) dst_clip_h = mask_y + mask_ie->cache_entry.h - dst_clip_y; + /* a scanline buffer */ + buf = alloca(dst_clip_w * sizeof(DATA32)); + dptr = dptr + dst_w * y; for (; y < dst_clip_h; y++) { From 787c2702238dfb9b7a58e00cbe9d72c2d113ba87 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 13 May 2019 11:45:13 -0400 Subject: [PATCH 10/53] evas/image: fix broken auto_fill mechanism when manually changing fill Summary: if auto_fill is set (which is the default for image objects), manually setting the fill for the image would previously only persist until the image was resized, at which point the auto_fill would activate and re-set the image's fill to be the same as the image's object geometry this fixes the auto_fill behavior to stop modifying the image's fill geometry if the fill is manually changed by the user, which fixes using fill on most image objects @fix Reviewers: cedric, Hermet Reviewed By: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8879 --- src/lib/evas/canvas/evas_object_image.c | 31 +++++++++++++++---------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 289ffaaa3d..dd8041b35a 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -561,30 +561,36 @@ _efl_canvas_image_internal_efl_gfx_image_border_center_fill_get(const Eo *eo_obj return (Efl_Gfx_Border_Fill_Mode)o->cur->border.fill; } +static void +_toggle_fill_listener(Eo *eo_obj, Evas_Image_Data *o) +{ + if (!o->filled) + evas_object_event_callback_del(eo_obj, EVAS_CALLBACK_RESIZE, + evas_object_image_filled_resize_listener); + else + evas_object_event_callback_add(eo_obj, EVAS_CALLBACK_RESIZE, + evas_object_image_filled_resize_listener, + NULL); +} + EOLIAN static void _efl_canvas_image_internal_efl_gfx_fill_fill_auto_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool setting) { Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); + Eina_Size2D sz; setting = !!setting; o->filled_set = 1; if (o->filled == setting) return; evas_object_async_block(obj); o->filled = setting; - if (!o->filled) - evas_object_event_callback_del(eo_obj, EVAS_CALLBACK_RESIZE, - evas_object_image_filled_resize_listener); - else - { - Eina_Size2D sz; - sz = efl_gfx_entity_size_get(eo_obj); - _evas_image_fill_set(eo_obj, o, 0, 0, sz.w, sz.h); + _toggle_fill_listener(eo_obj, o); - evas_object_event_callback_add(eo_obj, EVAS_CALLBACK_RESIZE, - evas_object_image_filled_resize_listener, - NULL); - } + if (!o->filled) return; + + sz = efl_gfx_entity_size_get(eo_obj); + _evas_image_fill_set(eo_obj, o, 0, 0, sz.w, sz.h); } EOLIAN static Eina_Bool @@ -650,6 +656,7 @@ _efl_canvas_image_internal_efl_gfx_fill_fill_set(Eo *eo_obj, Evas_Image_Data *o, // Should (0,0,0,0) reset the filled flag to true? o->filled = EINA_FALSE; o->filled_set = EINA_TRUE; + _toggle_fill_listener(eo_obj, o); _evas_image_fill_set(eo_obj, o, fill.x, fill.y, fill.w, fill.h); } From c39346cd51831567f4b8385d1142157592519902 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 13 May 2019 15:13:46 -0400 Subject: [PATCH 11/53] meson: we are not in release mode anymore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test Plan: Run the build, enable debug messages, and you will see that DBG messages start to appear again on your screen. As an example ´EINA_LOG_LEVELS="elementary_focus:10" ./src/bin/elementary_test´ Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8831 --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index e26d17e507..56701d0a21 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('efl', ['c','cpp'], version: '1.22.99', - default_options : ['buildtype=release', 'cpp_std=c++11'], + default_options : ['cpp_std=c++11'], meson_version : '>=0.47' ) From 4a7dc32f613f78d40254a17310116dc21e40485c Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 13 May 2019 15:13:54 -0400 Subject: [PATCH 12/53] elm_panel: do not use the unfocusable state here Summary: the widget itself is a focus_layer which means, the tree is orphaned and cannot be accessed until the panel is visible. There is not need for us to manually track this state. fix T7908 Depends on D8831 Reviewers: marcellus, zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7908 Differential Revision: https://phab.enlightenment.org/D8832 --- src/lib/elementary/elm_panel.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib/elementary/elm_panel.c b/src/lib/elementary/elm_panel.c index 7d9e800149..033c892adc 100644 --- a/src/lib/elementary/elm_panel.c +++ b/src/lib/elementary/elm_panel.c @@ -350,7 +350,6 @@ _drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim) int x = 0, y = 0, cx, cy; Eina_Bool horizontal = EINA_FALSE; - elm_widget_tree_unfocusable_set(obj, EINA_TRUE); switch (sd->orient) { case ELM_PANEL_ORIENT_TOP: @@ -462,7 +461,6 @@ _panel_toggle(void *data EINA_UNUSED, } //if the panel is hidden, make this thing unfocusable - elm_widget_tree_unfocusable_set(obj, sd->hidden); edje_object_message_signal_process(wd->resize_obj); } @@ -1479,7 +1477,6 @@ _elm_panel_scrollable_set(Eo *obj, Elm_Panel_Data *sd, Eina_Bool scrollable) evas_object_repeat_events_set(obj, EINA_FALSE); } - elm_widget_tree_unfocusable_set(obj, sd->hidden); edje_object_message_signal_process(sd->panel_edje); evas_object_hide(sd->scr_ly); From d29edceade9c4e37b8b45eeced4fc9280ea7c829 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 13 May 2019 15:14:03 -0400 Subject: [PATCH 13/53] efl_ui_clickable: move repeat event Summary: the repeat event is only emitted by the implementations of efl_ui_autorepeat. Additionally, the event should only be used by those who implement this interface. Depends on D8832 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike, segfaultxavi Subscribers: jpeg, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8813 --- src/examples/elementary/button_cxx_example_01.cc | 8 ++++---- src/lib/efl/interfaces/efl_ui_autorepeat.eo | 3 +++ src/lib/efl/interfaces/efl_ui_clickable.eo | 1 - src/lib/elementary/efl_ui_button.c | 7 +++++-- src/lib/elementary/efl_ui_calendar.c | 2 +- src/lib/elementary/elm_colorselector.c | 12 ++++++------ 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/examples/elementary/button_cxx_example_01.cc b/src/examples/elementary/button_cxx_example_01.cc index 4cad5d8ae7..433290d29b 100644 --- a/src/examples/elementary/button_cxx_example_01.cc +++ b/src/examples/elementary/button_cxx_example_01.cc @@ -156,7 +156,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) } cmid.hint_align_set(ax, ay); }, std::placeholders::_1); - efl::eolian::event_add(efl::ui::Clickable::repeated_event, up, btn_cursors_move); + efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, up, btn_cursors_move); auto btn_cursors_release = std::bind( [wmid] () @@ -185,7 +185,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) left.hint_fill_set(false, true); left.hint_align_set(0.0, 0.5); box_inferior.pack_end(left); - efl::eolian::event_add(efl::ui::Clickable::repeated_event, left, btn_cursors_move); + efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, left, btn_cursors_move); efl::eolian::event_add(efl::ui::Clickable::unpressed_event, left, btn_cursors_release); efl::ui::Image icon_left(instantiate, win); @@ -205,7 +205,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) right.hint_fill_set(false, true); right.hint_align_set(0.0, 0.5); box_inferior.pack_end(right); - efl::eolian::event_add(efl::ui::Clickable::repeated_event, right, btn_cursors_move); + efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, right, btn_cursors_move); efl::eolian::event_add(efl::ui::Clickable::unpressed_event, right, btn_cursors_release); efl::ui::Image icon_right(instantiate, win); @@ -219,7 +219,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) down.hint_fill_set(true, false); down.hint_align_set(0.5, 0.0); box.pack_end(down); - efl::eolian::event_add(efl::ui::Clickable::repeated_event, down, btn_cursors_move); + efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, down, btn_cursors_move); efl::eolian::event_add(efl::ui::Clickable::unpressed_event, down, btn_cursors_release); efl::ui::Image icon_down(instantiate, win); diff --git a/src/lib/efl/interfaces/efl_ui_autorepeat.eo b/src/lib/efl/interfaces/efl_ui_autorepeat.eo index 48093b205d..92dcc3a88a 100644 --- a/src/lib/efl/interfaces/efl_ui_autorepeat.eo +++ b/src/lib/efl/interfaces/efl_ui_autorepeat.eo @@ -45,4 +45,7 @@ interface @beta Efl.Ui.Autorepeat { } } } + events { + repeated: void; [[Called when a repeated event is emitted]] + } } diff --git a/src/lib/efl/interfaces/efl_ui_clickable.eo b/src/lib/efl/interfaces/efl_ui_clickable.eo index 34da147875..97806e7501 100644 --- a/src/lib/efl/interfaces/efl_ui_clickable.eo +++ b/src/lib/efl/interfaces/efl_ui_clickable.eo @@ -14,6 +14,5 @@ interface @beta Efl.Ui.Clickable unpressed: Efl.Object; [[Called when the object is no longer pressed]] /* FIXME: Might be NULL */ longpressed: Efl.Object; [[Called when the object receives a long press]] - repeated: void; [[Called when the object receives repeated presses/clicks]] } } diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index 28bfc8680c..3139856aff 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -131,8 +131,11 @@ _autorepeat_send(void *data) { ELM_BUTTON_DATA_GET_OR_RETURN_VAL(data, sd, ECORE_CALLBACK_CANCEL); - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_REPEATED, NULL); + if (elm_widget_is_legacy(data)) + evas_object_smart_callback_call(data, "repeated", NULL); + else + efl_event_callback_call(data, EFL_UI_AUTOREPEAT_EVENT_REPEATED, NULL); + if (!sd->repeating) { sd->timer = NULL; diff --git a/src/lib/elementary/efl_ui_calendar.c b/src/lib/elementary/efl_ui_calendar.c index eb3918d7ac..200566139b 100644 --- a/src/lib/elementary/efl_ui_calendar.c +++ b/src/lib/elementary/efl_ui_calendar.c @@ -462,7 +462,7 @@ _btn_create(Eo *obj, const char *style, char *part) efl_ui_autorepeat_gap_timeout_set(efl_added, INTERVAL), efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _inc_dec_btn_clicked_cb, obj), - efl_event_callback_add(efl_added, EFL_UI_EVENT_REPEATED, + efl_event_callback_add(efl_added, EFL_UI_AUTOREPEAT_EVENT_REPEATED, _inc_dec_btn_repeated_cb, obj), efl_content_set(efl_part(obj, part), efl_added)); } diff --git a/src/lib/elementary/elm_colorselector.c b/src/lib/elementary/elm_colorselector.c index a48ed8a49e..1a330b8d3a 100644 --- a/src/lib/elementary/elm_colorselector.c +++ b/src/lib/elementary/elm_colorselector.c @@ -1101,12 +1101,12 @@ _button_clicked_cb(void *data, const Efl_Event *event) } static void -_button_repeat_cb(void *data, const Efl_Event *event EINA_UNUSED) +_button_repeat_cb(void *data, Evas_Object *object, void *event_info EINA_UNUSED) { Color_Bar_Data *cb_data = data; double x, y, step; - if (event->object == cb_data->rbt) step = 1.0 / BASE_STEP; + if (object == cb_data->rbt) step = 1.0 / BASE_STEP; else step = -1.0 / BASE_STEP; edje_object_part_drag_value_get(cb_data->colorbar, "elm.arrow", &x, &y); @@ -1294,8 +1294,8 @@ _color_bars_add(Evas_Object *obj) (sd->cb_data[i]->lbt, _elm_config->longpress_timeout); elm_button_autorepeat_gap_timeout_set (sd->cb_data[i]->lbt, (1.0 / _elm_config->fps)); - efl_event_callback_add - (sd->cb_data[i]->lbt, EFL_UI_EVENT_REPEATED, _button_repeat_cb, sd->cb_data[i]); + evas_object_smart_callback_add + (sd->cb_data[i]->lbt, "repeated", _button_repeat_cb, sd->cb_data[i]); /* load right button */ if (!sd->cb_data[i]->rbt) sd->cb_data[i]->rbt = elm_button_add(sd->col_bars_area); @@ -1312,8 +1312,8 @@ _color_bars_add(Evas_Object *obj) (sd->cb_data[i]->rbt, _elm_config->longpress_timeout); elm_button_autorepeat_gap_timeout_set (sd->cb_data[i]->rbt, (1.0 / _elm_config->fps)); - efl_event_callback_add - (sd->cb_data[i]->rbt, EFL_UI_EVENT_REPEATED, _button_repeat_cb, sd->cb_data[i]); + evas_object_smart_callback_add + (sd->cb_data[i]->lbt, "repeated", _button_repeat_cb, sd->cb_data[i]); } } From 41e1dadbf10db016a539f483f42dc2281799491f Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 13 May 2019 15:14:13 -0400 Subject: [PATCH 14/53] elementary: do not emit new events in legacy Summary: This commits prepares the tree in order to mess with the events in the Efl.Ui.Clickable event. Events which have been emitted in a none legacy widget, are now emitted either with evas, when the widget is legacy due to inheritance. Or via the normal event and normal event functions. In case the widget is a legacy only widget (not used at all in the new api), then the events are for now emitted with evas_object_smart_callback_call. Cases where event handlers have been added to legacy widgets, smart events are now used, and not the eo one anymore. ref T7844 Depends on D8813 Reviewers: cedric, zmike, segfaultxavi Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7844 Differential Revision: https://phab.enlightenment.org/D8816 --- src/lib/elementary/efl_ui_button.c | 32 ++++++++++++----- src/lib/elementary/efl_ui_frame.c | 6 ++-- src/lib/elementary/efl_ui_image.c | 10 ++++-- src/lib/elementary/efl_ui_image_zoomable.c | 16 ++++++--- src/lib/elementary/efl_ui_panes.c | 6 ++-- src/lib/elementary/elc_combobox.c | 13 ++++--- src/lib/elementary/elc_fileselector.c | 36 ++++++++----------- src/lib/elementary/elc_fileselector_button.c | 5 +-- src/lib/elementary/elc_hoversel.c | 17 +++++---- src/lib/elementary/elc_multibuttonentry.c | 2 +- src/lib/elementary/elc_naviframe.c | 15 ++++---- src/lib/elementary/elc_player.c | 28 +++++++-------- src/lib/elementary/elm_bubble.c | 2 +- src/lib/elementary/elm_color_class.c | 7 ++-- src/lib/elementary/elm_colorselector.c | 7 ++-- src/lib/elementary/elm_diskselector.c | 4 +-- src/lib/elementary/elm_entry.c | 20 +++++------ src/lib/elementary/elm_gengrid.c | 12 +++---- src/lib/elementary/elm_genlist.c | 16 ++++----- src/lib/elementary/elm_hover.c | 12 +++---- src/lib/elementary/elm_index.c | 6 ++-- src/lib/elementary/elm_list.c | 12 +++---- src/lib/elementary/elm_map.c | 13 +++---- src/lib/elementary/elm_menu.c | 4 +-- src/lib/elementary/elm_photo.c | 2 +- src/lib/elementary/elm_plug.c | 2 +- src/lib/elementary/elm_thumb.c | 4 +-- src/lib/elementary/elm_toolbar.c | 6 ++-- .../clock_input_ctxpopup.c | 7 ++-- src/modules/elementary/prefs/elm_button.c | 7 ++-- 30 files changed, 174 insertions(+), 155 deletions(-) diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index 3139856aff..0b40c22187 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -71,8 +71,12 @@ _activate(Evas_Object *obj) _elm_access_say(E_("Clicked")); if (!elm_widget_disabled_get(obj) && !evas_object_freeze_events_get(obj)) - efl_event_callback_legacy_call - (obj, EFL_UI_EVENT_CLICKED, NULL); + { + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, "clicked", NULL); + else + efl_event_callback_call(obj, EFL_UI_EVENT_CLICKED, NULL); + } } } @@ -95,8 +99,10 @@ _efl_ui_button_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Button_Data *_pd if (act != EFL_UI_ACTIVATE_DEFAULT) return EINA_FALSE; if (evas_object_freeze_events_get(obj)) return EINA_FALSE; - efl_event_callback_legacy_call - (obj, EFL_UI_EVENT_CLICKED, NULL); + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, "clicked", NULL); + else + efl_event_callback_call(obj, EFL_UI_EVENT_CLICKED, NULL); if (elm_widget_is_legacy(obj)) elm_layout_signal_emit(obj, "elm,anim,activate", "elm"); @@ -175,8 +181,13 @@ _on_pressed_signal(void *data, (sd->ar_initial_timeout, _autorepeat_initial_send, data); } - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_PRESSED, NULL); + if (elm_widget_is_legacy(data)) + evas_object_smart_callback_call + (data, "pressed", NULL); + else + efl_event_callback_call + (data, EFL_UI_EVENT_PRESSED, NULL); + } static void @@ -189,8 +200,13 @@ _on_unpressed_signal(void *data, ELM_SAFE_FREE(sd->timer, ecore_timer_del); sd->repeating = EINA_FALSE; - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_UNPRESSED, NULL); + + if (elm_widget_is_legacy(data)) + evas_object_smart_callback_call + (data, "unpressed", NULL); + else + efl_event_callback_call + (data, EFL_UI_EVENT_UNPRESSED, NULL); } static char * diff --git a/src/lib/elementary/efl_ui_frame.c b/src/lib/elementary/efl_ui_frame.c index 664a542a46..b730a64db9 100644 --- a/src/lib/elementary/efl_ui_frame.c +++ b/src/lib/elementary/efl_ui_frame.c @@ -87,8 +87,10 @@ _on_frame_clicked(void *data, sd->anim = EINA_TRUE; elm_widget_tree_unfocusable_set(data, sd->collapsed); } - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_CLICKED, NULL); + if (elm_widget_is_legacy(data)) + evas_object_smart_callback_call(data, "clicked", NULL); + else + efl_event_callback_call(data, EFL_UI_EVENT_CLICKED, NULL); } /* using deferred sizing evaluation, just like the parent */ diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 166db8dc27..a0232aedeb 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -120,7 +120,10 @@ _on_mouse_up(void *data, if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; if (!wd->still_in) return; - efl_event_callback_legacy_call(data, EFL_UI_EVENT_CLICKED, NULL); + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(data, "clicked", NULL); + else + efl_event_callback_call(data, EFL_UI_EVENT_CLICKED, NULL); } static Eina_Bool @@ -735,7 +738,10 @@ _efl_ui_image_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Image_Data *sd EINA_UNUS static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED) { - efl_event_callback_legacy_call(obj, EFL_UI_EVENT_CLICKED, NULL); + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, "clicked", NULL); + else + efl_event_callback_call(obj, EFL_UI_EVENT_CLICKED, NULL); return EINA_TRUE; } diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 0fe2bd864a..6818cf09ad 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -857,8 +857,12 @@ _mouse_down_cb(void *data, if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = EINA_TRUE; else sd->on_hold = EINA_FALSE; if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_CLICKED_DOUBLE, NULL); + { + if (elm_widget_is_legacy(data)) + evas_object_smart_callback_call(data, "clicked,double", NULL); + else + efl_event_callback_call(data, EFL_UI_EVENT_CLICKED_DOUBLE, NULL); + } else efl_event_callback_legacy_call(data, EFL_UI_IMAGE_ZOOMABLE_EVENT_PRESS, NULL); sd->longpressed = EINA_FALSE; @@ -882,8 +886,12 @@ _mouse_up_cb(void *data, else sd->on_hold = EINA_FALSE; ELM_SAFE_FREE(sd->long_timer, ecore_timer_del); if (!sd->on_hold) - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_CLICKED, NULL); + { + if (elm_widget_is_legacy(data)) + evas_object_smart_callback_call(data, "clicked", NULL); + else + efl_event_callback_call(data, EFL_UI_EVENT_CLICKED, NULL); + } sd->on_hold = EINA_FALSE; } diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c index d42b3ebb3b..af96c84ee1 100644 --- a/src/lib/elementary/efl_ui_panes.c +++ b/src/lib/elementary/efl_ui_panes.c @@ -162,7 +162,7 @@ _on_clicked(void *data, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) { - efl_event_callback_legacy_call(data, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call(data, "clicked", NULL); } static void @@ -196,7 +196,7 @@ _on_unpressed(void *data, if (sd->double_clicked) { - efl_event_callback_legacy_call(data, EFL_UI_EVENT_CLICKED_DOUBLE, NULL); + evas_object_smart_callback_call(data, "clicked,double", NULL); sd->double_clicked = EINA_FALSE; } } @@ -620,7 +620,7 @@ _part_is_efl_ui_panes_part(const Eo *obj, const char *part) if ((eina_streq(part, "elm.swallow.left")) || (eina_streq(part, "elm.swallow.right"))) return EINA_TRUE; } - + return (eina_streq(part, "first")) || (eina_streq(part, "second")); } diff --git a/src/lib/elementary/elc_combobox.c b/src/lib/elementary/elc_combobox.c index 2318fe719f..15bf664198 100644 --- a/src/lib/elementary/elc_combobox.c +++ b/src/lib/elementary/elc_combobox.c @@ -121,11 +121,11 @@ _elm_combobox_efl_ui_widget_theme_apply(Eo *obj, Elm_Combobox_Data *sd) } static void -_on_hover_clicked(void *data, const Efl_Event *event) +_on_hover_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { const char *dismissstr; - dismissstr = elm_layout_data_get(event->object, "dismiss"); + dismissstr = elm_layout_data_get(obj, "dismiss"); if (!dismissstr || strcmp(dismissstr, "on")) elm_combobox_hover_end(data); // for backward compatibility @@ -303,7 +303,7 @@ _on_changed(void *data, const Efl_Event *event EINA_UNUSED) } static void -_on_clicked(void *data, const Efl_Event *event EINA_UNUSED) +_on_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { elm_combobox_hover_begin(data); } @@ -334,7 +334,7 @@ _elm_combobox_efl_canvas_group_group_add(Eo *obj, Elm_Combobox_Data *sd EINA_UNU efl_ui_mirrored_automatic_set(obj, EINA_FALSE); - efl_event_callback_add(obj, EFL_UI_EVENT_CLICKED, _on_clicked, obj); + evas_object_smart_callback_add(obj, "clicked", _on_clicked, obj); //What are you doing here? efl_ui_widget_theme_apply(obj); @@ -410,8 +410,7 @@ _elm_combobox_efl_object_constructor(Eo *obj, Elm_Combobox_Data *sd) elm_hover_target_set(sd->hover, obj); elm_widget_sub_object_add(obj, sd->hover); - efl_event_callback_add - (sd->hover, EFL_UI_EVENT_CLICKED, _on_hover_clicked, obj); + evas_object_smart_callback_add(sd->hover, "clicked", _on_hover_clicked, obj); elm_layout_signal_callback_add (sd->hover, "elm,action,hide,finished", "elm", _hover_end_finished, obj); @@ -530,7 +529,7 @@ _key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED) elm_combobox_hover_begin(obj); else { - efl_event_callback_legacy_call(sd->genlist, EFL_UI_EVENT_PRESSED, sd->item); + evas_object_smart_callback_call(sd->genlist, "pressed", sd->item); elm_entry_cursor_end_set(sd->entry); } return EINA_TRUE; diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 4ebf9cc7e8..7056389f42 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -81,9 +81,9 @@ static const Elm_Action key_actions[] = { {NULL, NULL} }; -static void _ok(void *data, const Efl_Event *event); -static void _canc(void *data, const Efl_Event *event); -static void _on_dir_up(void *data, const Efl_Event *event); +static void _ok(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); +static void _canc(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); +static void _on_dir_up(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); static void _populate(Evas_Object *obj, Efl_Model *model, Elm_Object_Item *parent_it, Efl_Model *selected); static Elm_Fileselector_Item_Data *_selected_item_data_get(Elm_Fileselector_Data *sd); @@ -376,16 +376,14 @@ _elm_fileselector_efl_ui_widget_theme_apply(Eo *obj, Elm_Fileselector_Data *sd) static Eina_Bool _key_action_select(Evas_Object *obj, const char *params EINA_UNUSED) { - Efl_Event event = {}; - _ok(obj, &event); + _ok(obj, NULL, NULL); return EINA_TRUE; } static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED) { - Efl_Event event = {}; - _canc(obj, &event); + _canc(obj, NULL, NULL); return EINA_TRUE; } @@ -403,7 +401,7 @@ _key_action_backspace(Evas_Object *obj, const char *params EINA_UNUSED) efl_unref(tmp); } else - _on_dir_up(obj, NULL); + _on_dir_up(obj, NULL, NULL); return EINA_TRUE; } @@ -1311,7 +1309,7 @@ _on_item_unselected(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) } static void -_on_dir_up(void *data, const Efl_Event *event EINA_UNUSED) +_on_dir_up(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *fs = data; Efl_Model *parent = NULL; @@ -1342,7 +1340,7 @@ _on_dir_up(void *data, const Efl_Event *event EINA_UNUSED) } static void -_home(void *data, const Efl_Event *event EINA_UNUSED) +_home(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *fs = data; @@ -1366,7 +1364,7 @@ _current_filter_changed(void *data, } static void -_ok(void *data, const Efl_Event *event EINA_UNUSED) +_ok(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { const char *name; const char *selection = NULL; @@ -1413,7 +1411,7 @@ _ok(void *data, const Efl_Event *event EINA_UNUSED) } static void -_canc(void *data, const Efl_Event *event EINA_UNUSED) +_canc(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *fs = data; @@ -1754,8 +1752,8 @@ _elm_fileselector_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Data *pri efl_ui_mirrored_automatic_set(bt, EINA_FALSE); elm_object_part_content_set(bt, "icon", ic); elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Up")); - efl_event_callback_add - (bt, EFL_UI_EVENT_CLICKED, _on_dir_up, obj); + + evas_object_smart_callback_add(bt, "clicked", _on_dir_up, obj); priv->up_button = bt; elm_object_style_set(priv->up_button, buf); @@ -1768,8 +1766,7 @@ _elm_fileselector_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Data *pri efl_ui_mirrored_automatic_set(bt, EINA_FALSE); elm_object_part_content_set(bt, "icon", ic); elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Home")); - efl_event_callback_add - (bt, EFL_UI_EVENT_CLICKED, _home, obj); + evas_object_smart_callback_add(bt, "clicked", _home, obj); priv->home_button = bt; elm_object_style_set(priv->home_button, buf); @@ -2061,8 +2058,7 @@ _elm_fileselector_buttons_ok_cancel_set(Eo *obj, Elm_Fileselector_Data *sd, Eina bt = elm_button_add(obj); efl_ui_mirrored_automatic_set(bt, EINA_FALSE); elm_object_domain_translatable_text_set(bt, PACKAGE, N_("OK")); - - efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, _ok, obj); + evas_object_smart_callback_add(bt, "clicked", _ok, obj); sd->ok_button = bt; elm_object_part_content_set(obj, "elm.swallow.ok", sd->ok_button); @@ -2071,9 +2067,7 @@ _elm_fileselector_buttons_ok_cancel_set(Eo *obj, Elm_Fileselector_Data *sd, Eina bt = elm_button_add(obj); efl_ui_mirrored_automatic_set(bt, EINA_FALSE); elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Cancel")); - - efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, _canc, obj); - + evas_object_smart_callback_add(bt, "clicked", _canc, obj); sd->cancel_button = bt; elm_object_part_content_set(obj, "elm.swallow.cancel", sd->cancel_button); } diff --git a/src/lib/elementary/elc_fileselector_button.c b/src/lib/elementary/elc_fileselector_button.c index dfc8df2cc9..df7259e09c 100644 --- a/src/lib/elementary/elc_fileselector_button.c +++ b/src/lib/elementary/elc_fileselector_button.c @@ -184,7 +184,7 @@ _activate(Elm_Fileselector_Button_Data *sd) } static void -_button_clicked(void *data, const Efl_Event *event EINA_UNUSED) +_button_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { _activate(data); } @@ -233,7 +233,8 @@ _elm_fileselector_button_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Bu efl_ui_mirrored_automatic_set(obj, EINA_FALSE); - efl_event_callback_add(obj, EFL_UI_EVENT_CLICKED, _button_clicked, priv); + evas_object_smart_callback_add(obj, "clicked", _button_clicked, priv); + efl_ui_widget_theme_apply(obj); elm_widget_can_focus_set(obj, EINA_TRUE); diff --git a/src/lib/elementary/elc_hoversel.c b/src/lib/elementary/elc_hoversel.c index e06c107338..baee718c15 100644 --- a/src/lib/elementary/elc_hoversel.c +++ b/src/lib/elementary/elc_hoversel.c @@ -114,11 +114,11 @@ _elm_hoversel_efl_ui_widget_theme_apply(Eo *obj, Elm_Hoversel_Data *sd) } static void -_on_hover_clicked(void *data, const Efl_Event *event) +_on_hover_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { const char *dismissstr; - dismissstr = elm_layout_data_get(event->object, "dismiss"); + dismissstr = elm_layout_data_get(obj, "dismiss"); if (!dismissstr || strcmp(dismissstr, "on")) elm_hoversel_hover_end(data); // for backward compatibility @@ -167,7 +167,7 @@ _auto_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void } static void -_on_item_clicked(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) +_on_item_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Elm_Hoversel_Item_Data *item = data; Evas_Object *obj2 = WIDGET(item); @@ -485,8 +485,7 @@ _activate(Evas_Object *obj) elm_object_style_set(sd->hover, buf); - efl_event_callback_add - (sd->hover, EFL_UI_EVENT_CLICKED, _on_hover_clicked, obj); + evas_object_smart_callback_add(sd->hover, "clicked", _on_hover_clicked, obj); elm_layout_signal_callback_add (sd->hover, "elm,action,hide,finished", "elm", _hover_end_finished, obj); elm_hover_target_set(sd->hover, obj); @@ -520,7 +519,7 @@ _activate(Evas_Object *obj) } static void -_on_clicked(void *data, const Efl_Event *event EINA_UNUSED) +_on_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { _activate(data); } @@ -639,8 +638,7 @@ _elm_hoversel_efl_canvas_group_group_add(Eo *obj, Elm_Hoversel_Data *pd) { efl_canvas_group_add(efl_super(obj, MY_CLASS)); - efl_event_callback_add(obj, EFL_UI_EVENT_CLICKED, _on_clicked, obj); - + evas_object_smart_callback_add(obj, "clicked", _on_clicked, obj); //What are you doing here? efl_ui_widget_theme_apply(obj); @@ -876,7 +874,8 @@ _elm_hoversel_item_add(Eo *obj, Elm_Hoversel_Data *sd, const char *label, const evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); - efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, _on_item_clicked, item); + evas_object_smart_callback_add(bt, "clicked", _on_item_clicked, item); + efl_event_callback_add(bt, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, _item_focus_changed, item); sd->items = eina_list_append(sd->items, eo_item); diff --git a/src/lib/elementary/elc_multibuttonentry.c b/src/lib/elementary/elc_multibuttonentry.c index 452d7e0849..3c7e26c216 100644 --- a/src/lib/elementary/elc_multibuttonentry.c +++ b/src/lib/elementary/elc_multibuttonentry.c @@ -972,7 +972,7 @@ _mouse_clicked_signal_cb(void *data EINA_UNUSED, if (sd->editable) elm_entry_input_panel_show(sd->entry); - efl_event_callback_legacy_call(obj, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call(obj, "clicked", NULL); } static void diff --git a/src/lib/elementary/elc_naviframe.c b/src/lib/elementary/elc_naviframe.c index 7675b6103b..e2be2f5464 100644 --- a/src/lib/elementary/elc_naviframe.c +++ b/src/lib/elementary/elc_naviframe.c @@ -49,7 +49,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { {NULL, NULL} }; -static void _on_item_back_btn_clicked(void *data, const Efl_Event *event); +static void _on_item_back_btn_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED); static Eina_Bool _key_action_top_item_get(Evas_Object *obj, const char *params); static Eina_Bool _key_action_item_pop(Evas_Object *obj, const char *params); @@ -680,8 +680,7 @@ _item_title_prev_btn_unset(Elm_Naviframe_Item_Data *it) evas_object_event_callback_del (content, EVAS_CALLBACK_DEL, _item_title_prev_btn_del_cb); - Eo* parent = efl_parent_get(content); - efl_event_callback_del(content, EFL_UI_EVENT_CLICKED, _on_item_back_btn_clicked, parent); + evas_object_smart_callback_del(content, "clicked", _on_item_back_btn_clicked); it->title_prev_btn = NULL; if (it->auto_pushed_btn) it->auto_pushed_btn = NULL; return content; @@ -938,13 +937,13 @@ _elm_naviframe_elm_layout_sizing_eval(Eo *obj, Elm_Naviframe_Data *sd) } static void -_on_item_back_btn_clicked(void *data, const Efl_Event *event) +_on_item_back_btn_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { /* Since edje has the event queue, clicked event could be happened multiple times on some heavy environment. This callback del will prevent those scenario and guarantee only one clicked for it's own page. */ - efl_event_callback_del(event->object, EFL_UI_EVENT_CLICKED, _on_item_back_btn_clicked, data); + evas_object_smart_callback_del(obj, "clicked", _on_item_back_btn_clicked); elm_naviframe_item_pop(data); } @@ -957,8 +956,7 @@ _back_btn_new(Evas_Object *obj, const char *title_label) btn = elm_button_add(obj); if (!btn) return NULL; - efl_event_callback_add - (btn, EFL_UI_EVENT_CLICKED, _on_item_back_btn_clicked, obj); + evas_object_smart_callback_add(btn, "clicked", _on_item_back_btn_clicked, obj); snprintf (buf, sizeof(buf), "naviframe/back_btn/%s", elm_widget_style_get(obj)); elm_object_style_set(btn, buf); @@ -1744,8 +1742,7 @@ _elm_naviframe_item_pop(Eo *obj, Elm_Naviframe_Data *sd) Since the item is not popped or deleted here, the deleted callback of the auto pushed button should be restored. */ if (it->auto_pushed_btn) - efl_event_callback_add - (it->auto_pushed_btn, EFL_UI_EVENT_CLICKED, _on_item_back_btn_clicked, obj); + evas_object_smart_callback_add(it->auto_pushed_btn, "clicked", _on_item_back_btn_clicked, obj); it->popping = EINA_FALSE; } evas_object_unref(obj); diff --git a/src/lib/elementary/elc_player.c b/src/lib/elementary/elc_player.c index 275599c30f..c711557173 100644 --- a/src/lib/elementary/elc_player.c +++ b/src/lib/elementary/elc_player.c @@ -289,7 +289,7 @@ _update_volume(void *data, const Efl_Event *event EINA_UNUSED) } static void -_forward(void *data, const Efl_Event *event EINA_UNUSED) +_forward(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { double pos, length; ELM_PLAYER_DATA_GET(data, sd); @@ -305,21 +305,21 @@ _forward(void *data, const Efl_Event *event EINA_UNUSED) } static void -_info(void *data, const Efl_Event *event EINA_UNUSED) +_info(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { elm_layout_signal_emit(data, "elm,button,info", "elm"); efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_INFO_CLICKED, NULL); } static void -_next(void *data, const Efl_Event *event EINA_UNUSED) +_next(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { elm_layout_signal_emit(data, "elm,button,next", "elm"); efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_NEXT_CLICKED, NULL); } static void -_pause(void *data, const Efl_Event *event EINA_UNUSED) +_pause(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { ELM_PLAYER_DATA_GET(data, sd); @@ -329,7 +329,7 @@ _pause(void *data, const Efl_Event *event EINA_UNUSED) } static void -_play(void *data, const Efl_Event *event EINA_UNUSED) +_play(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { ELM_PLAYER_DATA_GET(data, sd); @@ -339,14 +339,14 @@ _play(void *data, const Efl_Event *event EINA_UNUSED) } static void -_prev(void *data, const Efl_Event *event EINA_UNUSED) +_prev(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_PREV_CLICKED, NULL); elm_layout_signal_emit(data, "elm,button,prev", "elm"); } static void -_rewind(void *data, const Efl_Event *event EINA_UNUSED) +_rewind(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { double pos; ELM_PLAYER_DATA_GET(data, sd); @@ -361,14 +361,14 @@ _rewind(void *data, const Efl_Event *event EINA_UNUSED) } static void -_stop(void *data, const Efl_Event *event EINA_UNUSED) +_stop(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { elm_layout_signal_emit(data, "elm,button,stop", "elm"); efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_QUALITY_CLICKED, NULL); } static void -_eject(void *data, const Efl_Event *event EINA_UNUSED) +_eject(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { ELM_PLAYER_DATA_GET(data, sd); @@ -395,7 +395,7 @@ _mute_toggle(Evas_Object *obj) } static void -_volume(void *data, const Efl_Event *event EINA_UNUSED) +_volume(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { elm_layout_signal_emit(data, "elm,button,volume", "elm"); _mute_toggle(data); @@ -403,7 +403,7 @@ _volume(void *data, const Efl_Event *event EINA_UNUSED) } static void -_mute(void *data, const Efl_Event *event EINA_UNUSED) +_mute(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { elm_layout_signal_emit(data, "elm,button,mute", "elm"); _mute_toggle(data); @@ -455,7 +455,7 @@ _video_del(void *data, static Evas_Object * _player_button_add(Evas_Object *obj, const char *name, - Efl_Event_Cb func) + Evas_Smart_Cb func) { Evas_Object *ic; Evas_Object *bt; @@ -475,8 +475,8 @@ _player_button_add(Evas_Object *obj, snprintf(buf, sizeof(buf), "media_player/%s/%s", name, elm_widget_style_get(obj)); elm_object_style_set(bt, buf); - efl_event_callback_add - (bt, EFL_UI_EVENT_CLICKED, func, obj); + evas_object_smart_callback_add(bt, "clicked", func, obj); + snprintf(buf, sizeof(buf), "elm.swallow.media_player.%s", name); if (!elm_layout_content_set(obj, buf, bt)) { diff --git a/src/lib/elementary/elm_bubble.c b/src/lib/elementary/elm_bubble.c index 559ba53d55..b3eacc01fe 100644 --- a/src/lib/elementary/elm_bubble.c +++ b/src/lib/elementary/elm_bubble.c @@ -77,7 +77,7 @@ _on_mouse_up(void *data, if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; - efl_event_callback_legacy_call(data, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call(data, "clicked", NULL); } static Eina_Bool diff --git a/src/lib/elementary/elm_color_class.c b/src/lib/elementary/elm_color_class.c index f6ed3b9c62..9f90ae6baf 100644 --- a/src/lib/elementary/elm_color_class.c +++ b/src/lib/elementary/elm_color_class.c @@ -152,14 +152,14 @@ _colorclass_changed(void *data, const Efl_Event *event EINA_UNUSED) } static void -_colorclass_reset(void *data, const Efl_Event *event EINA_UNUSED) +_colorclass_reset(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { Colorclass_UI *cc = data; Colorclass color; if (!cc->current) { - efl_event_callback_stop(event->object); + efl_event_callback_stop(obj); return; } //if (cc->winid && remote_iface) @@ -750,8 +750,7 @@ elm_color_class_editor_add(Evas_Object *obj) /* FIXME: translate */ elm_object_text_set(bt, "Reset"); elm_object_part_content_set(ly, "elm.swallow.reset", bt); - efl_event_callback_add - (bt, EFL_UI_EVENT_CLICKED, _colorclass_reset, cc); + evas_object_smart_callback_add(bt, "clicked", _colorclass_reset, cc); cc->cs = cs = elm_colorselector_add(ly); elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_COMPONENTS); diff --git a/src/lib/elementary/elm_colorselector.c b/src/lib/elementary/elm_colorselector.c index 1a330b8d3a..6a2557e4f5 100644 --- a/src/lib/elementary/elm_colorselector.c +++ b/src/lib/elementary/elm_colorselector.c @@ -737,13 +737,13 @@ _x11_elm_widget_xwin_get(const Evas_Object *obj) } static void -_start_grab_pick_cb(void *data, const Efl_Event *event) +_start_grab_pick_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { Evas_Object *o = data; ELM_COLORSELECTOR_DATA_GET(o, sd); - elm_object_disabled_set(event->object, EINA_TRUE); + elm_object_disabled_set(obj, EINA_TRUE); sd->grab.mouse_motion = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _mouse_grab_pixels, o); sd->grab.key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_up_cb, o); @@ -937,8 +937,7 @@ _create_colorpicker(Evas_Object *obj) sd->button = elm_button_add(sd->picker); elm_object_style_set(sd->button, style); elm_object_text_set(sd->button, E_("Pick a color")); - efl_event_callback_add - (sd->button, EFL_UI_EVENT_CLICKED, _start_grab_pick_cb, obj); + evas_object_smart_callback_add(sd->button, "clicked", _start_grab_pick_cb, obj); elm_box_pack_end(bx, sd->button); evas_object_show(sd->button); } diff --git a/src/lib/elementary/elm_diskselector.c b/src/lib/elementary/elm_diskselector.c index fd2494f00c..cd7645491a 100644 --- a/src/lib/elementary/elm_diskselector.c +++ b/src/lib/elementary/elm_diskselector.c @@ -612,8 +612,8 @@ _item_click_cb(void *data, } if (it->func) it->func((void *)WIDGET_ITEM_DATA_GET(eo_it), WIDGET(it), eo_it); - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_CLICKED, eo_it); + evas_object_smart_callback_call + ( WIDGET(it), "clicked", eo_it); } static char * diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index 2a6ad77518..207c10368d 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -1987,8 +1987,8 @@ _long_press_cb(void *data) sd->long_pressed = EINA_TRUE; sd->longpress_timer = NULL; - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_LONGPRESSED, NULL); + evas_object_smart_callback_call + (data, "longpressed", NULL); return ECORE_CALLBACK_CANCEL; } @@ -2791,8 +2791,8 @@ _entry_mouse_clicked_signal_cb(void *data, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) { - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call + ( data, "clicked", NULL); } static void @@ -2801,8 +2801,8 @@ _entry_mouse_double_signal_cb(void *data, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) { - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_CLICKED_DOUBLE, NULL); + evas_object_smart_callback_call + ( data, "clicked,double", NULL); } static void @@ -2811,8 +2811,8 @@ _entry_mouse_triple_signal_cb(void *data, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) { - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_CLICKED_TRIPLE, NULL); + evas_object_smart_callback_call + ( data, "clicked,triple", NULL); } static Evas_Object * @@ -5586,8 +5586,8 @@ _activate(Evas_Object *obj) if (!elm_widget_disabled_get(obj) && !evas_object_freeze_events_get(obj)) { - efl_event_callback_legacy_call - (obj, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call + ( obj, "clicked", NULL); if (sd->editable && sd->input_panel_enable) edje_object_part_text_input_panel_show(sd->entry_edje, "elm.text"); } diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c index 76e540a9db..6f73fdfca7 100644 --- a/src/lib/elementary/elm_gengrid.c +++ b/src/lib/elementary/elm_gengrid.c @@ -888,8 +888,8 @@ _long_press_cb(void *data) if (elm_wdg_item_disabled_get(EO_OBJ(it)) || (it->dragging)) return ECORE_CALLBACK_CANCEL; sd->longpressed = EINA_TRUE; - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_LONGPRESSED, EO_OBJ(it)); + evas_object_smart_callback_call + (WIDGET(it), "longpressed", EO_OBJ(it)); if (sd->reorder_mode) { @@ -986,11 +986,11 @@ _item_mouse_down_cb(void *data, it->highlight_cb(it); if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) { - efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_CLICKED_DOUBLE, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), "clicked,double", EO_OBJ(it)); efl_event_callback_legacy_call(WIDGET(it), ELM_GENGRID_EVENT_ACTIVATED, EO_OBJ(it)); } - efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_PRESSED, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), "pressed", EO_OBJ(it)); ELM_SAFE_FREE(it->long_timer, ecore_timer_del); if (it->realized) it->long_timer = ecore_timer_add @@ -1296,8 +1296,8 @@ _item_mouse_up_cb(void *data, if (dx < 0) dx = -dx; if (dy < 0) dy = -dy; if ((dx < 5) && (dy < 5)) - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_CLICKED_RIGHT, EO_OBJ(it)); + evas_object_smart_callback_call + ( WIDGET(it), "clicked,right", EO_OBJ(it)); return; } diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index c82a023fd6..8a1bec391d 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -4122,8 +4122,8 @@ _long_press_cb(void *data) goto end; sd->longpressed = EINA_TRUE; - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_LONGPRESSED, EO_OBJ(it)); + evas_object_smart_callback_call + (WIDGET(it), "longpressed", EO_OBJ(it)); if ((sd->reorder_mode) && !(it->item->type & ELM_GENLIST_ITEM_GROUP)) { sd->reorder_it = it; @@ -4410,13 +4410,13 @@ _item_mouse_down_cb(void *data, _item_highlight(it); if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) { - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_CLICKED_DOUBLE, eo_it); + evas_object_smart_callback_call + ( WIDGET(it), "clicked,double", eo_it); efl_event_callback_legacy_call (WIDGET(it), ELM_GENLIST_EVENT_ACTIVATED, eo_it); } - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_PRESSED, eo_it); + evas_object_smart_callback_call + (WIDGET(it), "pressed", eo_it); } static Item_Block * @@ -5065,8 +5065,8 @@ _item_mouse_up_cb(void *data, if (dx < 0) dx = -dx; if (dy < 0) dy = -dy; if ((dx < 5) && (dy < 5)) - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_CLICKED_RIGHT, EO_OBJ(it)); + evas_object_smart_callback_call + ( WIDGET(it), "clicked,right", EO_OBJ(it)); return; } diff --git a/src/lib/elementary/elm_hover.c b/src/lib/elementary/elm_hover.c index 271436f707..80c234a568 100644 --- a/src/lib/elementary/elm_hover.c +++ b/src/lib/elementary/elm_hover.c @@ -566,14 +566,14 @@ _hov_dismiss_cb(void *data, if (dismissstr && !strcmp(dismissstr, "on")) { _hide_signals_emit(data); - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call + ( data, "clicked", NULL); } else { evas_object_hide(data); - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call + ( data, "clicked", NULL); efl_event_callback_legacy_call(data, ELM_HOVER_EVENT_DISMISSED, NULL); } // for backward compatibility } @@ -616,8 +616,8 @@ _elm_hover_efl_canvas_group_group_del(Eo *obj, Elm_Hover_Data *sd) if (evas_object_visible_get(obj)) { - efl_event_callback_legacy_call - (obj, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call + ( obj, "clicked", NULL); efl_event_callback_legacy_call(obj, ELM_HOVER_EVENT_DISMISSED, NULL); } diff --git a/src/lib/elementary/elm_index.c b/src/lib/elementary/elm_index.c index c046080a6e..18e38271ee 100644 --- a/src/lib/elementary/elm_index.c +++ b/src/lib/elementary/elm_index.c @@ -762,7 +762,7 @@ _sel_eval(Evas_Object *obj, _elm_access_say(ret); } - if (om_closest) + if (om_closest) efl_event_callback_legacy_call (obj, ELM_INDEX_EVENT_CHANGED, EO_OBJ(om_closest)); else @@ -861,8 +861,8 @@ _on_mouse_up(void *data, eo_item = elm_index_selected_item_get(data, sd->level); if (eo_item) { - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_CLICKED, eo_item); + evas_object_smart_callback_call + ( data, "clicked", eo_item); evas_object_smart_callback_call(data, "selected", eo_item); eo_id_item = eo_item; ELM_INDEX_ITEM_DATA_GET(eo_id_item, id_item); diff --git a/src/lib/elementary/elm_list.c b/src/lib/elementary/elm_list.c index da40668a02..4c936ab1b1 100644 --- a/src/lib/elementary/elm_list.c +++ b/src/lib/elementary/elm_list.c @@ -1597,8 +1597,8 @@ _long_press_cb(void *data) if (it->base->disabled) goto end; sd->longpressed = EINA_TRUE; - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_LONGPRESSED, EO_OBJ(it)); + evas_object_smart_callback_call + (WIDGET(it), "longpressed", EO_OBJ(it)); end: return ECORE_CALLBACK_CANCEL; @@ -1748,8 +1748,8 @@ _mouse_down_cb(void *data, /* Always call the callbacks last - the user may delete our context! */ if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) { - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_CLICKED_DOUBLE, EO_OBJ(it)); + evas_object_smart_callback_call + ( WIDGET(it), "clicked,double", EO_OBJ(it)); efl_event_callback_legacy_call (WIDGET(it), ELM_LIST_EVENT_ACTIVATED, EO_OBJ(it)); } @@ -1784,8 +1784,8 @@ _mouse_up_cb(void *data, if (dx < 0) dx = -dx; if (dy < 0) dy = -dy; if ((dx < 5) && (dy < 5)) - efl_event_callback_legacy_call - (obj, EFL_UI_EVENT_CLICKED_RIGHT, EO_OBJ(it)); + evas_object_smart_callback_call + ( obj, "clicked,right", EO_OBJ(it)); return; } diff --git a/src/lib/elementary/elm_map.c b/src/lib/elementary/elm_map.c index 71deea0b58..c026afa1b8 100644 --- a/src/lib/elementary/elm_map.c +++ b/src/lib/elementary/elm_map.c @@ -1356,8 +1356,8 @@ _long_press_cb(void *data) ELM_MAP_DATA_GET(data, sd); sd->long_timer = NULL; - efl_event_callback_legacy_call - (sd->obj, EFL_UI_EVENT_LONGPRESSED, &sd->ev); + + evas_object_smart_callback_call(sd->obj, "longpressed", &sd->ev); return ECORE_CALLBACK_CANCEL; } @@ -1376,8 +1376,8 @@ _mouse_down_cb(void *data, else sd->on_hold = EINA_FALSE; if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) - efl_event_callback_legacy_call - (sd->obj, EFL_UI_EVENT_CLICKED_DOUBLE, ev); + evas_object_smart_callback_call + (sd->obj, "clicked,double", ev); else efl_event_callback_legacy_call (sd->obj, ELM_MAP_EVENT_PRESS, ev); @@ -1407,8 +1407,9 @@ _mouse_up_cb(void *data, ELM_SAFE_FREE(sd->long_timer, ecore_timer_del); if (!sd->on_hold) - efl_event_callback_legacy_call - (sd->obj, EFL_UI_EVENT_CLICKED, ev); + + evas_object_smart_callback_call + (sd->obj, "clicked", ev); sd->on_hold = EINA_FALSE; } diff --git a/src/lib/elementary/elm_menu.c b/src/lib/elementary/elm_menu.c index 236d859399..681ac2273d 100644 --- a/src/lib/elementary/elm_menu.c +++ b/src/lib/elementary/elm_menu.c @@ -437,8 +437,8 @@ static void _hover_dismissed_cb(void *data, const Efl_Event *event) { _menu_hide(data, event->object, event->info); - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call + ( data, "clicked", NULL); efl_event_callback_legacy_call(data, ELM_MENU_EVENT_DISMISSED, NULL); } diff --git a/src/lib/elementary/elm_photo.c b/src/lib/elementary/elm_photo.c index 92d9aed828..765ede2ca1 100644 --- a/src/lib/elementary/elm_photo.c +++ b/src/lib/elementary/elm_photo.c @@ -232,7 +232,7 @@ _mouse_up(void *data, ELM_SAFE_FREE(sd->long_press_timer, ecore_timer_del); if (!sd->drag_started) - efl_event_callback_legacy_call(data, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call(data, "clicked", NULL); } static void diff --git a/src/lib/elementary/elm_plug.c b/src/lib/elementary/elm_plug.c index 4b1f005ff0..694b85c697 100644 --- a/src/lib/elementary/elm_plug.c +++ b/src/lib/elementary/elm_plug.c @@ -103,7 +103,7 @@ _on_mouse_up(void *data, if (ev->button != 1) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; - efl_event_callback_legacy_call(data, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call(data, "clicked", NULL); } EOLIAN static void diff --git a/src/lib/elementary/elm_thumb.c b/src/lib/elementary/elm_thumb.c index 67ac441d6f..98f6541048 100644 --- a/src/lib/elementary/elm_thumb.c +++ b/src/lib/elementary/elm_thumb.c @@ -63,7 +63,7 @@ _mouse_down_cb(void *data, else sd->on_hold = EINA_FALSE; if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) - efl_event_callback_legacy_call(obj, EFL_UI_EVENT_CLICKED_DOUBLE, NULL); + evas_object_smart_callback_call(obj, "clicked", NULL); else efl_event_callback_legacy_call(obj, ELM_THUMB_EVENT_PRESS, NULL); } @@ -82,7 +82,7 @@ _mouse_up_cb(void *data, else sd->on_hold = EINA_FALSE; if (!sd->on_hold) - efl_event_callback_legacy_call(obj, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call(obj, "clicked", NULL); sd->on_hold = EINA_FALSE; } diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c index 0efcacb8c0..c3c87b05b5 100644 --- a/src/lib/elementary/elm_toolbar.c +++ b/src/lib/elementary/elm_toolbar.c @@ -1731,7 +1731,7 @@ _mouse_clicked_cb(Elm_Toolbar_Item_Data *it, if (button == 1) { /* regular left click event */ - efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_CLICKED, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), "clicked", EO_OBJ(it)); return; } snprintf(buf, sizeof(buf), "elm,action,click,%d", button); @@ -2121,7 +2121,7 @@ _long_press_cb(void *data) if (sd->reorder_mode) _item_reorder_start(it); - efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_LONGPRESSED, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), "longpressed", EO_OBJ(it)); return ECORE_CALLBACK_CANCEL; } @@ -2154,7 +2154,7 @@ _mouse_down_cb(Elm_Toolbar_Item_Data *it, if (ev->button != 1) return; if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) - efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_CLICKED_DOUBLE, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), "clicked,double", EO_OBJ(it)); sd->mouse_down = EINA_TRUE; sd->long_press = EINA_FALSE; if (sd->long_timer) diff --git a/src/modules/elementary/clock_input_ctxpopup/clock_input_ctxpopup.c b/src/modules/elementary/clock_input_ctxpopup/clock_input_ctxpopup.c index 077bd7d14e..03b5a7f20a 100644 --- a/src/modules/elementary/clock_input_ctxpopup/clock_input_ctxpopup.c +++ b/src/modules/elementary/clock_input_ctxpopup/clock_input_ctxpopup.c @@ -96,13 +96,13 @@ _field_value_get(struct tm *tim, Efl_Ui_Clock_Type field_type) } static void -_diskselector_cb(void *data EINA_UNUSED, const Efl_Event *event) +_diskselector_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) { DiskItem_Data *disk_data; struct tm curr_time; const char *fmt; - disk_data = (DiskItem_Data *)elm_object_item_data_get(event->info); + disk_data = (DiskItem_Data *)elm_object_item_data_get(event_info); if (!disk_data || !(disk_data->ctx_mod)) return; curr_time = efl_ui_clock_time_get(disk_data->ctx_mod->mod_data.base); @@ -167,8 +167,7 @@ _field_clicked_cb(void *data, const Efl_Event *event) elm_ctxpopup_hover_parent_set(ctx_mod->ctxpopup, elm_widget_top_get(event->object)); diskselector = elm_diskselector_add(elm_widget_top_get(ctx_mod->mod_data.base)); - efl_event_callback_add - (diskselector, EFL_UI_EVENT_CLICKED, _diskselector_cb, NULL); + evas_object_smart_callback_add(diskselector, "clicked", _diskselector_cb, NULL); elm_object_style_set(diskselector, buf); elm_object_content_set(ctx_mod->ctxpopup, diskselector); diff --git a/src/modules/elementary/prefs/elm_button.c b/src/modules/elementary/prefs/elm_button.c index 2bce32b532..9192fc549c 100644 --- a/src/modules/elementary/prefs/elm_button.c +++ b/src/modules/elementary/prefs/elm_button.c @@ -9,11 +9,11 @@ static Elm_Prefs_Item_Type supported_types[] = }; static void -_item_changed_cb(void *data, const Efl_Event *event) +_item_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { Elm_Prefs_Item_Changed_Cb prefs_it_changed_cb = data; - prefs_it_changed_cb(event->object); + prefs_it_changed_cb(obj); } static Evas_Object * @@ -25,8 +25,7 @@ elm_prefs_button_add(const Elm_Prefs_Item_Iface *iface EINA_UNUSED, { Evas_Object *obj = elm_button_add(prefs); - efl_event_callback_add - (obj, EFL_UI_EVENT_CLICKED, _item_changed_cb, cb); + evas_object_smart_callback_add(obj, "clicked", _item_changed_cb, cb); return obj; } From b3d7e9128b8259e67a5540eabf7469af32ac04ba Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 13 May 2019 15:14:20 -0400 Subject: [PATCH 15/53] elc_fileselector: make a few events again legacy Summary: the events changed here should not be used. They should use legacy events. Depends on D8816 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8819 --- src/lib/elementary/elc_fileselector_entry.c | 35 +++++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index 7274b1dd85..bf9b7067ab 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -58,15 +58,24 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = } SIG_FWD(CHANGED, ELM_FILESELECTOR_ENTRY_EVENT_CHANGED) SIG_FWD(PRESS, ELM_FILESELECTOR_ENTRY_EVENT_PRESS) -SIG_FWD(LONGPRESSED, EFL_UI_EVENT_LONGPRESSED) -SIG_FWD(CLICKED, EFL_UI_EVENT_CLICKED) -SIG_FWD(CLICKED_DOUBLE, EFL_UI_EVENT_CLICKED_DOUBLE) SIG_FWD(SELECTION_PASTE, EFL_UI_EVENT_SELECTION_PASTE) SIG_FWD(SELECTION_COPY, EFL_UI_EVENT_SELECTION_COPY) SIG_FWD(SELECTION_CUT, EFL_UI_EVENT_SELECTION_CUT) -SIG_FWD(UNPRESSED, EFL_UI_EVENT_UNPRESSED) #undef SIG_FWD +#define SIG_FWD(name, event) \ + static void \ + _##name##_fwd(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) \ + { \ + evas_object_smart_callback_call(data, event, event_info); \ + } +SIG_FWD(CLICKED, "clicked") +SIG_FWD(CLICKED_DOUBLE, "clicked,double") +SIG_FWD(UNPRESSED, "unpressed") +SIG_FWD(LONGPRESSED, "longpressed") +#undef SIG_FWD + + static void _FILE_CHOSEN_fwd(void *data, const Efl_Event *event) { @@ -228,10 +237,14 @@ _elm_fileselector_entry_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Ent elm_fileselector_expandable_set (priv->button, _elm_config->fileselector_expand_enable); +#define SIG_FWD(name, event) \ + evas_object_smart_callback_add(priv->button, event, _##name##_fwd, obj) + SIG_FWD(CLICKED, "clicked"); + SIG_FWD(UNPRESSED, "unpressed"); +#undef SIG_FWD + #define SIG_FWD(name, event) \ efl_event_callback_add(priv->button, event, _##name##_fwd, obj) - SIG_FWD(CLICKED, EFL_UI_EVENT_CLICKED); - SIG_FWD(UNPRESSED, EFL_UI_EVENT_UNPRESSED); SIG_FWD(FILE_CHOSEN, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN); #undef SIG_FWD @@ -247,14 +260,16 @@ _elm_fileselector_entry_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Ent SIG_FWD(CHANGED, ELM_ENTRY_EVENT_CHANGED); SIG_FWD(ACTIVATED, ELM_ENTRY_EVENT_ACTIVATED); SIG_FWD(PRESS, ELM_ENTRY_EVENT_PRESS); - SIG_FWD(LONGPRESSED, EFL_UI_EVENT_LONGPRESSED); - SIG_FWD(CLICKED, EFL_UI_EVENT_CLICKED); - SIG_FWD(CLICKED_DOUBLE, EFL_UI_EVENT_CLICKED_DOUBLE); SIG_FWD(SELECTION_PASTE, EFL_UI_EVENT_SELECTION_PASTE); SIG_FWD(SELECTION_COPY, EFL_UI_EVENT_SELECTION_COPY); SIG_FWD(SELECTION_CUT, EFL_UI_EVENT_SELECTION_CUT); #undef SIG_FWD - +#define SIG_FWD(name, event) \ + evas_object_smart_callback_add(priv->entry, event, _##name##_fwd, obj) + SIG_FWD(LONGPRESSED, "longpressed"); + SIG_FWD(CLICKED, "clicked"); + SIG_FWD(CLICKED_DOUBLE, "clicked,double"); +#undef SIG_FWD efl_event_callback_forwarder_add(priv->entry, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, obj); if (!elm_layout_theme_set From f93eb3fc043fcc945fb2e65a27a05447ac8ce603 Mon Sep 17 00:00:00 2001 From: Lauro Moura Date: Tue, 14 May 2019 08:38:50 +0200 Subject: [PATCH 16/53] csharp: Fix event marshalling for value types Summary: It was wrongly assuming value types were passed by value. As stated in the documentation, all arguments are passed with a single level of indirection. Fixes T7957 Reviewers: woohyun, felipealmeida, vitor.sousa, segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7957 Differential Revision: https://phab.enlightenment.org/D8889 --- src/bin/eolian_mono/eolian/mono/events.hh | 39 ++++++++++++++++++-- src/tests/efl_mono/Events.cs | 27 ++++++++++++++ src/tests/efl_mono/dummy_test_object.eo | 37 +++++++++++++++++++ src/tests/efl_mono/libefl_mono_native_test.c | 16 ++++++-- 4 files changed, 113 insertions(+), 6 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/events.hh b/src/bin/eolian_mono/eolian/mono/events.hh index 56a22d7823..b5e6e4a7f1 100644 --- a/src/bin/eolian_mono/eolian/mono/events.hh +++ b/src/bin/eolian_mono/eolian/mono/events.hh @@ -45,11 +45,44 @@ struct unpack_event_args_visitor eina::optional name; std::function function; } + /// Sizes taken from https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/sizeof const match_table [] = { - {"bool", [&arg] { return arg + " != IntPtr.Zero"; }} - , {"int", [&arg] { return arg + ".ToInt32()"; }} - , {"uint", [&arg] { return "(uint)" + arg + ".ToInt32()";}} + {"bool", [&arg] { return "Marshal.ReadByte(" + arg + ") != 0"; }} + + , {"ubyte", [&arg] { return "Marshal.ReadByte(" + arg + ")"; }} + , {"byte", [&arg] { return "(sbyte) Marshal.ReadByte(" + arg + ")"; }} + + , {"char", [&arg] { return "(char) Marshal.ReadByte(" + arg + ")"; }} + + , {"short", [&arg] { return "Marshal.ReadInt16(" + arg + ")"; }} + , {"ushort", [&arg] { return "(ushort) Marshal.ReadInt16(" + arg + ")"; }} + + , {"int", [&arg] { return "Marshal.ReadInt32(" + arg + ")"; }} + , {"uint", [&arg] { return "(uint) Marshal.ReadInt32(" + arg + ")"; }} + + , {"long", [&arg] { return "Marshal.ReadInt64(" + arg + ")"; }} + , {"ulong", [&arg] { return "(ulong) Marshal.ReadInt64(" + arg + ")"; }} + + , {"llong", [&arg] { return "(long) Marshal.ReadInt64(" + arg + ")"; }} + , {"ullong", [&arg] { return "(ulong) Marshal.ReadInt64(" + arg + ")"; }} + + , {"int8", [&arg] { return "(sbyte)Marshal.ReadByte(" + arg + ")"; }} + , {"uint8", [&arg] { return "Marshal.ReadByte(" + arg + ")"; }} + + , {"int16", [&arg] { return "Marshal.ReadInt16(" + arg + ")"; }} + , {"uint16", [&arg] { return "(ushort)Marshal.ReadInt16(" + arg + ")"; }} + + , {"int32", [&arg] { return "Marshal.ReadInt32(" + arg + ")"; }} + , {"uint32", [&arg] { return "(uint) Marshal.ReadInt32(" + arg + ")"; }} + + // We don't support int128 as csharp has no similar datatype. + , {"int64", [&arg] { return "Marshal.ReadInt64(" + arg + ")"; }} + , {"uint64", [&arg] { return "(ulong) Marshal.ReadInt64(" + arg + ")"; }} + + , {"float", [&arg] { return "Eina.PrimitiveConversion.PointerToManaged(" + arg + ")"; }} + , {"double", [&arg] { return "Eina.PrimitiveConversion.PointerToManaged(" + arg + ")"; }} + , {"string", [&arg] { return "Eina.StringConversion.NativeUtf8ToManagedString(" + arg + ")"; }} , {"stringshare", [&arg] { return "Eina.StringConversion.NativeUtf8ToManagedString(" + arg + ")"; }} , {"Eina.Error", [&arg] { return "(Eina.Error)Marshal.PtrToStructure(" + arg + ", typeof(Eina.Error))"; }} diff --git a/src/tests/efl_mono/Events.cs b/src/tests/efl_mono/Events.cs index 32c87b2a75..70a49bff7e 100644 --- a/src/tests/efl_mono/Events.cs +++ b/src/tests/efl_mono/Events.cs @@ -100,6 +100,33 @@ class TestEoEvents Test.AssertEquals(0xbeef, received_uint); } + public static void event_with_float_payload() + { + var obj = new Dummy.TestObject(); + float received_float = 0; + obj.EvtWithFloatEvt += (object sender, Dummy.TestObjectEvtWithFloatEvt_Args e) => { + received_float = e.arg; + }; + + obj.EmitEventWithFloat(3.14f); + + Test.AssertAlmostEquals(3.14f, received_float); + } + + public static void event_with_double_payload() + { + var obj = new Dummy.TestObject(); + double received_double = 0; + double reference = float.MaxValue + 42; + obj.EvtWithDoubleEvt += (object sender, Dummy.TestObjectEvtWithDoubleEvt_Args e) => { + received_double = e.arg; + }; + + obj.EmitEventWithDouble(reference); + + Test.AssertAlmostEquals(reference, received_double); + } + public static void event_with_object_payload() { var obj = new Dummy.TestObject(); diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo index b5436a636e..ad859c6b11 100644 --- a/src/tests/efl_mono/dummy_test_object.eo +++ b/src/tests/efl_mono/dummy_test_object.eo @@ -1284,6 +1284,16 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface { @in data: uint; } } + emit_event_with_float { + params { + @in data: float; + } + } + emit_event_with_double { + params { + @in data: double; + } + } emit_event_with_obj { params { @in data: Dummy.Test_Object; @@ -1422,11 +1432,38 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface { evt,with,bool: bool; evt,with,int @hot: int; evt,with,uint @hot: uint; + evt,with,float @hot: float; + evt,with,double @hot: double; evt,with,obj @hot: Dummy.Test_Object; evt,with,error @hot: Eina.Error; evt,with,struct @hot: Dummy.StructSimple; evt,with,struct,complex @hot: Dummy.StructComplex; evt,with,array @hot: const(array); evt_with,under @hot: void; + + // Extra events to test generation, but not invocation + evt,with,byte: byte; + evt,with,ubyte: ubyte; + + evt,with,char: char; + + evt,with,short: short; + evt,with,ushort: ushort; + + evt,with,llong: llong; + evt,with,ullong: ullong; + + evt,with,int8 @hot: int8; + evt,with,uint8 @hot: uint8; + + evt,with,int16 @hot: int16; + evt,with,uint16 @hot: uint16; + + evt,with,int32 @hot: int32; + evt,with,uint32 @hot: uint32; + + evt,with,int64 @hot: int64; + evt,with,uint64 @hot: uint64; + } } diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c index 0201a6a026..c5850d6ab2 100644 --- a/src/tests/efl_mono/libefl_mono_native_test.c +++ b/src/tests/efl_mono/libefl_mono_native_test.c @@ -3782,17 +3782,27 @@ void _dummy_test_object_emit_event_with_string(Eo *obj, EINA_UNUSED Dummy_Test_O void _dummy_test_object_emit_event_with_bool(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Bool data) { - efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_BOOL, (void *) (uintptr_t) data); + efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_BOOL, &data); } void _dummy_test_object_emit_event_with_int(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, int data) { - efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_INT, (void *) (uintptr_t) data); + efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_INT, &data); } void _dummy_test_object_emit_event_with_uint(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, unsigned int data) { - efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_UINT, (void *) (uintptr_t) data); + efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_UINT, &data); +} + +void _dummy_test_object_emit_event_with_float(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, float data) +{ + efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_FLOAT, &data); +} + +void _dummy_test_object_emit_event_with_double(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, double data) +{ + efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_DOUBLE, &data); } void _dummy_test_object_emit_event_with_obj(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eo *data) From 54175998d538e0b2173fc023bb822f1e6536e58f Mon Sep 17 00:00:00 2001 From: Woochanlee Date: Tue, 14 May 2019 16:37:20 +0900 Subject: [PATCH 17/53] Gesture Manager: Add gestures and fix gesture managing, recognizer logic. Summary: https://phab.enlightenment.org/T7544 Provides a way for a user to get a gesture manager, recognizer instance. Supports different recognizer properties for each target(Eo). Gesture, Touch Class Life-cycle re-implementation. for supporting multiple touches. Add below gestures. efl_canvas_gesture_tap efl_canvas_gesture_double_tap efl_canvas_gesture_triple_tap efl_canvas_gesture_long_tap efl_canvas_gesture_momentum efl_canvas_gesture_zoom efl_canvas_gesture_flick Test Plan: Simple test -> test_gesture_framework.c More test cases will upload. Reviewers: woohyun, smohanty, segfaultxavi, Jaehyun_Cho Reviewed By: Jaehyun_Cho Subscribers: Jaehyun_Cho, segfaultxavi, cedric Tags: #efl, #do_not_merge Differential Revision: https://phab.enlightenment.org/D7579 --- src/Makefile_Evas.am | 40 +- src/bin/elementary/test_gesture_framework.c | 281 ++++++++++++-- src/lib/evas/Evas_Eo.h | 29 +- src/lib/evas/canvas/efl_canvas_object.eo | 6 +- src/lib/evas/canvas/evas_callbacks.c | 6 +- src/lib/evas/canvas/evas_object_main.c | 9 + src/lib/evas/gesture/efl_canvas_gesture.c | 19 +- src/lib/evas/gesture/efl_canvas_gesture.eo | 20 +- .../gesture/efl_canvas_gesture_double_tap.c | 18 + .../gesture/efl_canvas_gesture_double_tap.eo | 9 + .../evas/gesture/efl_canvas_gesture_flick.c | 30 ++ .../evas/gesture/efl_canvas_gesture_flick.eo | 20 + .../gesture/efl_canvas_gesture_long_tap.c | 8 +- .../gesture/efl_canvas_gesture_long_tap.eo | 5 +- .../evas/gesture/efl_canvas_gesture_manager.c | 241 +++++++++--- .../gesture/efl_canvas_gesture_manager.eo | 8 +- .../gesture/efl_canvas_gesture_momentum.c | 24 ++ .../gesture/efl_canvas_gesture_momentum.eo | 16 + .../evas/gesture/efl_canvas_gesture_private.h | 141 ++++++- .../gesture/efl_canvas_gesture_recognizer.c | 10 + .../gesture/efl_canvas_gesture_recognizer.eo | 15 +- ...efl_canvas_gesture_recognizer_double_tap.c | 191 ++++++++++ ...fl_canvas_gesture_recognizer_double_tap.eo | 22 ++ .../efl_canvas_gesture_recognizer_flick.c | 354 ++++++++++++++++++ .../efl_canvas_gesture_recognizer_flick.eo | 9 + .../efl_canvas_gesture_recognizer_long_tap.c | 151 +++++--- .../efl_canvas_gesture_recognizer_long_tap.eo | 16 +- .../efl_canvas_gesture_recognizer_momentum.c | 197 ++++++++++ .../efl_canvas_gesture_recognizer_momentum.eo | 9 + .../efl_canvas_gesture_recognizer_tap.c | 56 ++- .../efl_canvas_gesture_recognizer_tap.eo | 3 +- ...efl_canvas_gesture_recognizer_triple_tap.c | 191 ++++++++++ ...fl_canvas_gesture_recognizer_triple_tap.eo | 22 ++ .../efl_canvas_gesture_recognizer_zoom.c | 275 ++++++++++++++ .../efl_canvas_gesture_recognizer_zoom.eo | 9 + src/lib/evas/gesture/efl_canvas_gesture_tap.c | 3 +- .../evas/gesture/efl_canvas_gesture_tap.eo | 5 +- .../evas/gesture/efl_canvas_gesture_touch.c | 102 +++-- .../evas/gesture/efl_canvas_gesture_touch.eo | 18 +- .../gesture/efl_canvas_gesture_triple_tap.c | 18 + .../gesture/efl_canvas_gesture_triple_tap.eo | 9 + .../evas/gesture/efl_canvas_gesture_types.eot | 13 + .../evas/gesture/efl_canvas_gesture_zoom.c | 35 ++ .../evas/gesture/efl_canvas_gesture_zoom.eo | 19 + src/lib/evas/gesture/efl_gesture_events.eo | 13 + src/lib/evas/gesture/meson.build | 50 +-- 46 files changed, 2473 insertions(+), 272 deletions(-) create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_double_tap.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_double_tap.eo create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_flick.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_flick.eo create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_momentum.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_momentum.eo create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.eo create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.eo create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.eo create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.eo create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.eo create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_triple_tap.eo create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_zoom.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_zoom.eo create mode 100644 src/lib/evas/gesture/efl_gesture_events.eo diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 95ec86e756..9abbe585a3 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -59,16 +59,25 @@ evas_gesture_eolian_pub_files = \ lib/evas/gesture/efl_canvas_gesture.eo \ lib/evas/gesture/efl_canvas_gesture_tap.eo \ lib/evas/gesture/efl_canvas_gesture_long_tap.eo \ + lib/evas/gesture/efl_canvas_gesture_double_tap.eo \ + lib/evas/gesture/efl_canvas_gesture_triple_tap.eo \ + lib/evas/gesture/efl_canvas_gesture_momentum.eo \ + lib/evas/gesture/efl_canvas_gesture_flick.eo \ + lib/evas/gesture/efl_canvas_gesture_zoom.eo \ lib/evas/gesture/efl_canvas_gesture_recognizer.eo \ + lib/evas/gesture/efl_canvas_gesture_recognizer_tap.eo \ + lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.eo \ + lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.eo \ + lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.eo \ + lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.eo \ + lib/evas/gesture/efl_canvas_gesture_recognizer_flick.eo \ + lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.eo \ lib/evas/gesture/efl_canvas_gesture_manager.eo \ + lib/evas/gesture/efl_gesture_events.eo \ $(NULL) evas_canvas_eolian_priv_files = \ - lib/evas/include/evas_ector_buffer.eo - -evas_gesture_eolian_priv_files = \ - lib/evas/gesture/efl_canvas_gesture_recognizer_tap.eo \ - lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.eo + lib/evas/include/evas_ector_buffer.eo evas_canvas_eolian_type_files = \ lib/evas/canvas/evas_canvas3d_types.eot \ @@ -80,9 +89,6 @@ evas_gesture_eolian_type_files = \ evas_canvas_eolian_priv_c = $(evas_canvas_eolian_priv_files:%.eo=%.eo.c) evas_canvas_eolian_priv_h = $(evas_canvas_eolian_priv_files:%.eo=%.eo.h) -evas_gesture_eolian_priv_c = $(evas_gesture_eolian_priv_files:%.eo=%.eo.c) -evas_gesture_eolian_priv_h = $(evas_gesture_eolian_priv_files:%.eo=%.eo.h) - evas_canvas_eolian_pub_c = $(evas_canvas_eolian_pub_files:%.eo=%.eo.c) evas_canvas_eolian_pub_h = $(evas_canvas_eolian_pub_files:%.eo=%.eo.h) \ $(evas_canvas_eolian_type_files:%.eot=%.eot.h) @@ -97,13 +103,15 @@ evas_eolian_files = $(evas_canvas_eolian_pub_files) \ $(evas_gesture_eolian_type_files) evas_eolian_internal_files = $(evas_canvas_eolian_priv_files) \ - $(evas_gesture_eolian_priv_files) + $(evas_eolian_legacy_files) evas_eolian_c = $(evas_canvas_eolian_pub_c) $(evas_canvas_eolian_priv_c) \ - $(evas_gesture_eolian_pub_c) $(evas_gesture_eolian_priv_c) + $(evas_gesture_eolian_pub_c) \ + $(evas_eolian_legacy_c) evas_eolian_h = $(evas_canvas_eolian_pub_h) $(evas_canvas_eolian_priv_h) \ - $(evas_gesture_eolian_pub_h) $(evas_gesture_eolian_priv_h) + $(evas_gesture_eolian_pub_h) \ + $(evas_eolian_legacy_h) BUILT_SOURCES += \ $(evas_eolian_c) \ @@ -319,9 +327,19 @@ lib/evas/gesture/efl_canvas_gesture_touch.c \ lib/evas/gesture/efl_canvas_gesture.c \ lib/evas/gesture/efl_canvas_gesture_tap.c \ lib/evas/gesture/efl_canvas_gesture_long_tap.c \ +lib/evas/gesture/efl_canvas_gesture_double_tap.c \ +lib/evas/gesture/efl_canvas_gesture_triple_tap.c \ +lib/evas/gesture/efl_canvas_gesture_momentum.c \ +lib/evas/gesture/efl_canvas_gesture_flick.c \ +lib/evas/gesture/efl_canvas_gesture_zoom.c \ lib/evas/gesture/efl_canvas_gesture_recognizer.c \ lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c \ lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c \ +lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.c \ +lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c \ +lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c \ +lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c \ +lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c \ lib/evas/gesture/efl_canvas_gesture_manager.c \ lib/evas/common/region.c \ lib/evas/common/region.h \ diff --git a/src/bin/elementary/test_gesture_framework.c b/src/bin/elementary/test_gesture_framework.c index ada28bc50f..5e2e935e49 100644 --- a/src/bin/elementary/test_gesture_framework.c +++ b/src/bin/elementary/test_gesture_framework.c @@ -175,25 +175,19 @@ _color_and_icon_set(infra_data *infra, char *name, int n, int max, static void finger_tap_start(void *data , Efl_Canvas_Gesture *tap) { - Eina_Vector2 pos = efl_gesture_hotspot_get(tap); + Eina_Position2D pos = efl_gesture_hotspot_get(tap); _color_and_icon_set(data, TAP_NAME, 1, MAX_TAP, START_COLOR); - printf("Tap Gesture started x,y=<%f,%f> \n", pos.x, pos.y); -} - -static void -finger_tap_update(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) -{ - _color_and_icon_set(data, TAP_NAME, 1, MAX_TAP, UPDATE_COLOR); + printf("Tap Gesture started x,y=<%d,%d> \n", pos.x, pos.y); } static void finger_tap_end(void *data , Efl_Canvas_Gesture *tap) { - Eina_Vector2 pos = efl_gesture_hotspot_get(tap); + Eina_Position2D pos = efl_gesture_hotspot_get(tap); _color_and_icon_set(data, TAP_NAME, 1, MAX_TAP, END_COLOR); - printf("Tap Gesture ended x,y=<%f,%f> \n", pos.x, pos.y); + printf("Tap Gesture ended x,y=<%d,%d> \n", pos.x, pos.y); } static void @@ -203,13 +197,148 @@ finger_tap_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) printf("Tap Aborted\n"); } +static void +finger_flick_start(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + + _color_and_icon_set(data, FLICK_NAME, 1, MAX_TAP, START_COLOR); + printf("Flick Gesture started x,y=<%d,%d> \n", pos.x, pos.y); +} + +static void +finger_flick_end(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + double angle = efl_gesture_flick_angle_get(tap); + + _color_and_icon_set(data, FLICK_NAME, 1, MAX_TAP, END_COLOR); + printf("Flick Gesture ended x,y=<%d,%d> angle=<%f>\n", pos.x, pos.y, angle); +} + +static void +finger_flick_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +{ + _color_and_icon_set(data, FLICK_NAME, 1, MAX_TAP, ABORT_COLOR); + printf("Flick Aborted\n"); +} + +static void +finger_momentum_start(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + unsigned int t = efl_gesture_timestamp_get(tap); + + _color_and_icon_set(data, MOMENTUM_NAME, 1, MAX_TAP, START_COLOR); + printf("Momentum Gesture started x,y=<%d,%d> time=<%d>\n", pos.x, pos.y, t); +} + +static void +finger_momentum_update(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + Eina_Vector2 m = efl_gesture_momentum_get(tap); + unsigned int t = efl_gesture_timestamp_get(tap); + + _color_and_icon_set(data, MOMENTUM_NAME, 1, MAX_TAP, UPDATE_COLOR); + printf("Momentum Gesture updated x,y=<%d,%d> momentum=<%f %f> time=<%d>\n", + pos.x, pos.y, m.x, m.y, t); +} + +static void +finger_momentum_end(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + Eina_Vector2 m = efl_gesture_momentum_get(tap); + unsigned int t = efl_gesture_timestamp_get(tap); + + _color_and_icon_set(data, MOMENTUM_NAME, 1, MAX_TAP, END_COLOR); + printf("Momentum Gesture ended x,y=<%d,%d> momentum=<%f %f> time=<%d>\n", + pos.x, pos.y, m.x, m.y, t); +} + +static void +finger_momentum_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +{ + _color_and_icon_set(data, MOMENTUM_NAME, 1, MAX_TAP, ABORT_COLOR); + printf("Momentum Aborted\n"); +} + +static void +finger_triple_tap_start(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + + _color_and_icon_set(data, TRIPLE_TAP_NAME, 1, MAX_TAP, START_COLOR); + printf("Triple Tap Gesture started x,y=<%d,%d> \n", pos.x, pos.y); +} + +static void +finger_triple_tap_update(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + + _color_and_icon_set(data, TRIPLE_TAP_NAME, 1, MAX_TAP, UPDATE_COLOR); + printf("Triple Tap Gesture updated x,y=<%d,%d> \n", pos.x, pos.y); +} + +static void +finger_triple_tap_end(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + + _color_and_icon_set(data, TRIPLE_TAP_NAME, 1, MAX_TAP, END_COLOR); + printf("Triple Tap Gesture ended x,y=<%d,%d> \n", pos.x, pos.y); +} + +static void +finger_triple_tap_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +{ + _color_and_icon_set(data, TRIPLE_TAP_NAME, 1, MAX_TAP, ABORT_COLOR); + printf("Triple Tap Aborted\n"); +} + +static void +finger_double_tap_start(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + + _color_and_icon_set(data, DOUBLE_TAP_NAME, 1, MAX_TAP, START_COLOR); + printf("Double Tap Gesture started x,y=<%d,%d> \n", pos.x, pos.y); +} + +static void +finger_double_tap_update(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + + _color_and_icon_set(data, DOUBLE_TAP_NAME, 1, MAX_TAP, UPDATE_COLOR); + printf("Double Tap Gesture updated x,y=<%d,%d> \n", pos.x, pos.y); +} + +static void +finger_double_tap_end(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + + _color_and_icon_set(data, DOUBLE_TAP_NAME, 1, MAX_TAP, END_COLOR); + printf("Double Tap Gesture ended x,y=<%d,%d> \n", pos.x, pos.y); +} + +static void +finger_double_tap_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +{ + _color_and_icon_set(data, DOUBLE_TAP_NAME, 1, MAX_TAP, ABORT_COLOR); + printf("Double Tap Aborted\n"); +} + static void finger_long_tap_start(void *data , Efl_Canvas_Gesture *tap) { - Eina_Vector2 pos = efl_gesture_hotspot_get(tap); + Eina_Position2D pos = efl_gesture_hotspot_get(tap); _color_and_icon_set(data, LONG_TAP_NAME, 1, MAX_TAP, START_COLOR); - printf("Long Tap Gesture started x,y=<%f,%f> \n", pos.x, pos.y); + printf("Long Tap Gesture started x,y=<%d,%d> \n", pos.x, pos.y); } static void @@ -222,10 +351,10 @@ finger_long_tap_update(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) static void finger_long_tap_end(void *data , Efl_Canvas_Gesture *tap) { - Eina_Vector2 pos = efl_gesture_hotspot_get(tap); + Eina_Position2D pos = efl_gesture_hotspot_get(tap); _color_and_icon_set(data, LONG_TAP_NAME, 1, MAX_TAP, END_COLOR); - printf("Long Tap Gesture ended x,y=<%f,%f> \n",pos.x, pos.y); + printf("Long Tap Gesture ended x,y=<%d,%d> \n",pos.x, pos.y); } static void @@ -244,9 +373,6 @@ tap_gesture_cb(void *data , const Efl_Event *ev) case EFL_GESTURE_STARTED: finger_tap_start(data, g); break; - case EFL_GESTURE_UPDATED: - finger_tap_update(data, g); - break; case EFL_GESTURE_CANCELED: finger_tap_abort(data, g); break; @@ -258,6 +384,95 @@ tap_gesture_cb(void *data , const Efl_Event *ev) } } +static void +flick_gesture_cb(void *data , const Efl_Event *ev) +{ + Efl_Canvas_Gesture *g = ev->info; + switch(efl_gesture_state_get(g)) + { + case EFL_GESTURE_STARTED: + finger_flick_start(data, g); + break; + case EFL_GESTURE_CANCELED: + finger_flick_abort(data, g); + break; + case EFL_GESTURE_FINISHED: + finger_flick_end(data, g); + break; + default: + break; + } +} + +static void +momentum_gesture_cb(void *data , const Efl_Event *ev) +{ + Efl_Canvas_Gesture *g = ev->info; + switch(efl_gesture_state_get(g)) + { + case EFL_GESTURE_STARTED: + finger_momentum_start(data, g); + break; + case EFL_GESTURE_UPDATED: + finger_momentum_update(data, g); + break; + case EFL_GESTURE_CANCELED: + finger_momentum_abort(data, g); + break; + case EFL_GESTURE_FINISHED: + finger_momentum_end(data, g); + break; + default: + break; + } +} + +static void +triple_tap_gesture_cb(void *data , const Efl_Event *ev) +{ + Efl_Canvas_Gesture *g = ev->info; + switch(efl_gesture_state_get(g)) + { + case EFL_GESTURE_STARTED: + finger_triple_tap_start(data, g); + break; + case EFL_GESTURE_UPDATED: + finger_triple_tap_update(data, g); + break; + case EFL_GESTURE_CANCELED: + finger_triple_tap_abort(data, g); + break; + case EFL_GESTURE_FINISHED: + finger_triple_tap_end(data, g); + break; + default: + break; + } +} + +static void +double_tap_gesture_cb(void *data , const Efl_Event *ev) +{ + Efl_Canvas_Gesture *g = ev->info; + switch(efl_gesture_state_get(g)) + { + case EFL_GESTURE_STARTED: + finger_double_tap_start(data, g); + break; + case EFL_GESTURE_UPDATED: + finger_double_tap_update(data, g); + break; + case EFL_GESTURE_CANCELED: + finger_double_tap_abort(data, g); + break; + case EFL_GESTURE_FINISHED: + finger_double_tap_end(data, g); + break; + default: + break; + } +} + static void long_tap_gesture_cb(void *data , const Efl_Event *ev) { @@ -313,12 +528,23 @@ create_gesture_box(Evas_Object *win, icon_properties *icons, return bx; } +void +_tb_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + int w,h; + + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + evas_object_resize(data, w, h); + evas_object_color_set(data, 0, 0, 0, 0); + evas_object_show(data); +} + void test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *win, *tb, *lb, *bx; - Evas_Object *r; /* Gesture layer transparent object */ + Evas_Object *r, *target; /* Gesture layer transparent object */ infra_data *infra = _infra_data_alloc(); @@ -336,6 +562,9 @@ test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, evas_object_show(tb); evas_object_show(bx); + target = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _tb_resize, target); + /* Box of Tap icon and label */ bx = create_gesture_box(win, infra->icons, 0, TAP_NAME, "Tap"); elm_table_pack(tb, bx, 0, 0, 1, 1); @@ -458,15 +687,13 @@ test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, evas_object_show(lb); /* END - Building icons table */ - r = evas_object_rectangle_add(evas_object_evas_get(win)); - evas_object_move(r, 250, 300); - evas_object_color_set(r, 0, 0, 255, 255); - evas_object_resize(r, 70, 70); - evas_object_show(r); - - // LISTEN FOR TAP GESTURE - efl_event_callback_add(r, EFL_EVENT_GESTURE_TAP, tap_gesture_cb, infra); - efl_event_callback_add(r, EFL_EVENT_GESTURE_LONG_TAP, long_tap_gesture_cb, infra); + // 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_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); /* Update color state 20 times a second */ infra->colortimer = ecore_timer_add(0.05, _icon_color_set_cb, infra->icons); diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index a4f611e201..f3bcb6eb32 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -187,6 +187,27 @@ struct _Efl_Canvas_Object_Animation_Event #include "canvas/efl_canvas_animation_types.eot.h" +#include "gesture/efl_canvas_gesture_types.eot.h" +#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_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_zoom.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_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_zoom.eo.h" +#include "gesture/efl_canvas_gesture_manager.eo.h" +#include "gesture/efl_gesture_events.eo.h" + #include "canvas/efl_canvas_object.eo.h" #include "canvas/efl_canvas_animation.eo.h" @@ -442,11 +463,3 @@ typedef void (Evas_Canvas3D_Surface_Func)(Evas_Real *out_x, #include "canvas/efl_input_hold.eo.h" #include "canvas/efl_input_interface.eo.h" #include "canvas/efl_input_focus.eo.h" - -# include "gesture/efl_canvas_gesture_types.eot.h" -# 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_recognizer.eo.h" -# include "gesture/efl_canvas_gesture_manager.eo.h" diff --git a/src/lib/evas/canvas/efl_canvas_object.eo b/src/lib/evas/canvas/efl_canvas_object.eo index 9a5f89dbe8..6cd64ea713 100644 --- a/src/lib/evas/canvas/efl_canvas_object.eo +++ b/src/lib/evas/canvas/efl_canvas_object.eo @@ -8,7 +8,7 @@ struct Efl.Event_Animator_Tick { abstract Efl.Canvas.Object extends Efl.Loop_Consumer implements Efl.Gfx.Entity, Efl.Gfx.Color, Efl.Gfx.Stack, Efl.Input.Interface, Efl.Gfx.Hint, - Efl.Gfx.Mapping, Efl.Ui.I18n, Efl.Canvas.Pointer + Efl.Gfx.Mapping, Efl.Ui.I18n, Efl.Canvas.Pointer, Efl.Gesture.Events { [[Efl canvas object abstract class @@ -494,6 +494,10 @@ abstract Efl.Canvas.Object extends Efl.Loop_Consumer implements Efl.Gfx.Entity, return: bool; [[$true if the coords are inside the object, $false otherwise]] } } + gesture_manager_get @beta { + [[Returns current canvas's gesture manager]] + return: const(Efl.Canvas.Gesture_Manager); [[The gesture manager]] + } } implements { Efl.Object.constructor; diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c index dcd3338dd6..0e9be65f05 100644 --- a/src/lib/evas/canvas/evas_callbacks.c +++ b/src/lib/evas/canvas/evas_callbacks.c @@ -811,8 +811,7 @@ _check_event_catcher_add(void *data, const Efl_Event *event) for (i = 0; array[i].desc != NULL; i++) { - if (obj->layer->evas->gesture_manager && - _efl_canvas_gesture_manager_watches(array[i].desc)) + if (obj->layer->evas->gesture_manager) { if (!gd) gd = _efl_canvas_gesture_manager_private_data_get(obj->layer->evas->gesture_manager); @@ -853,8 +852,7 @@ _check_event_catcher_del(void *data, const Efl_Event *event) for (i = 0; array[i].desc != NULL; i++) { - if (obj->layer->evas->gesture_manager && - _efl_canvas_gesture_manager_watches(array[i].desc)) + if (obj->layer->evas->gesture_manager) { if (!gd) gd = _efl_canvas_gesture_manager_private_data_get(obj->layer->evas->gesture_manager); diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 07193790ba..35556cbf77 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -258,6 +258,15 @@ end: return efl_finalize(efl_super(eo_obj, MY_CLASS)); } +EOLIAN const Efl_Canvas_Gesture_Manager * +_efl_canvas_object_gesture_manager_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *pd) +{ + if (!pd->layer || !pd->layer->evas) + return NULL; + + return (pd->layer->evas)->gesture_manager; +} + void evas_object_change_reset(Evas_Object_Protected_Data *obj) { diff --git a/src/lib/evas/gesture/efl_canvas_gesture.c b/src/lib/evas/gesture/efl_canvas_gesture.c index 7386a90396..9017f822b5 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture.c +++ b/src/lib/evas/gesture/efl_canvas_gesture.c @@ -21,16 +21,29 @@ _efl_canvas_gesture_state_set(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd, } EOLIAN static void -_efl_canvas_gesture_hotspot_set(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd, Eina_Vector2 hotspot) +_efl_canvas_gesture_hotspot_set(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd, Eina_Position2D hotspot) { pd->hotspot = hotspot; } -EOLIAN static Eina_Vector2 +EOLIAN static Eina_Position2D _efl_canvas_gesture_hotspot_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd) { return pd->hotspot; } -#include "efl_canvas_gesture.eo.c" \ No newline at end of file +EOLIAN static void +_efl_canvas_gesture_timestamp_set(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd, unsigned int timestamp) +{ + pd->timestamp = timestamp; +} + + +EOLIAN static unsigned int +_efl_canvas_gesture_timestamp_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd) +{ + return pd->timestamp; +} + +#include "efl_canvas_gesture.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture.eo b/src/lib/evas/gesture/efl_canvas_gesture.eo index eafb1d983a..2a097d5fad 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture.eo @@ -2,7 +2,13 @@ import efl_canvas_gesture_types; abstract @beta Efl.Canvas.Gesture extends Efl.Object { - [[EFL Gesture abstract class]] + [[EFL Gesture abstract class + + A gesture class defines a method that spcific gesture event and privides information + about the gesture's type, state, and associated pointer information. + + For cetain gesture types, additional methods are defined to provide meaningful gesture + information to the user.]] c_prefix: efl_gesture; methods { @property type { @@ -30,7 +36,17 @@ abstract @beta Efl.Canvas.Gesture extends Efl.Object set { } values { - hotspot: Eina.Vector2;[[hotspot co-ordinate]] + hotspot: Eina.Position2D;[[hotspot co-ordinate]] + } + } + @property timestamp { + [[This property holds the timestamp of the current gesture.]] + get { + } + set { + } + values { + timestamp: uint;[[The timestamp]] } } } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c new file mode 100644 index 0000000000..971d49e3b6 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c @@ -0,0 +1,18 @@ +#include "efl_canvas_gesture_private.h" + +#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" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_double_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_double_tap.eo new file mode 100644 index 0000000000..39d84b86f2 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_double_tap.eo @@ -0,0 +1,9 @@ +class @beta Efl.Canvas.Gesture_Double_Tap extends Efl.Canvas.Gesture +{ + [[EFL Gesture Double Tap class]] + data: null; + c_prefix: efl_gesture_double_tap; + implements { + Efl.Object.constructor; + } +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_flick.c b/src/lib/evas/gesture/efl_canvas_gesture_flick.c new file mode 100644 index 0000000000..1095a84652 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_flick.c @@ -0,0 +1,30 @@ +#include "efl_canvas_gesture_private.h" + +#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(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Flick_Data *pd) +{ + return pd->momentum; +} + +EOLIAN static double +_efl_canvas_gesture_flick_angle_get(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Flick_Data *pd) +{ + return pd->angle; +} + +#include "efl_canvas_gesture_flick.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_flick.eo b/src/lib/evas/gesture/efl_canvas_gesture_flick.eo new file mode 100644 index 0000000000..7e87c55f71 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_flick.eo @@ -0,0 +1,20 @@ +import eina_types; + +class @beta Efl.Canvas.Gesture_Flick extends Efl.Canvas.Gesture +{ + [[EFL Gesture Flick class]] + c_prefix: efl_gesture_flick; + methods { + momentum_get { + [[Gets flick gesture momentum value]] + return: Eina.Vector2; [[The momentum vector]] + } + angle_get { + [[Gets flick direction angle]] + return: double; [[The angle value]] + } + } + implements { + Efl.Object.constructor; + } +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c index 099893a58e..21f0055414 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c @@ -2,9 +2,8 @@ #define MY_CLASS EFL_CANVAS_GESTURE_LONG_TAP_CLASS - EOLIAN static Efl_Object * -_efl_canvas_gesture_long_tap_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Long_Tap_Data *pd EINA_UNUSED) +_efl_canvas_gesture_long_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) { Efl_Canvas_Gesture_Data *gd; @@ -16,11 +15,8 @@ _efl_canvas_gesture_long_tap_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_ } EOLIAN static void -_efl_canvas_gesture_long_tap_efl_object_destructor(Eo *obj, Efl_Canvas_Gesture_Long_Tap_Data *pd) +_efl_canvas_gesture_long_tap_efl_object_destructor(Eo *obj, void *pd EINA_UNUSED) { - if (pd->timeout) - ecore_timer_del(pd->timeout); - efl_destructor(efl_super(obj, MY_CLASS)); } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo index 1a690b0d65..79c5c6d0e6 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo @@ -1,11 +1,8 @@ class @beta Efl.Canvas.Gesture_Long_Tap extends Efl.Canvas.Gesture { [[EFL Gesture Long Tap class]] + data: null; c_prefix: efl_gesture_long_tap; - event_prefix: efl; - events { - gesture,long_tap: Efl.Canvas.Gesture; [[Event for tap gesture]] - } implements { Efl.Object.constructor; Efl.Object.destructor; diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.c b/src/lib/evas/gesture/efl_canvas_gesture_manager.c index b174e49b7b..86960046ff 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_manager.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.c @@ -4,25 +4,25 @@ typedef struct _Object_Gesture { - Eo *object; - const Efl_Event_Description *type; + Eo *object; + const Efl_Event_Description *type; Efl_Canvas_Gesture *gesture; Efl_Canvas_Gesture_Recognizer *recognizer; -}Object_Gesture; +} Object_Gesture; typedef struct _Efl_Canvas_Gesture_Manager_Data { - // keeps track of all the gesture request for a particular target + //Keeps track of all the gesture request for a particular target Eina_Hash *m_gesture_contex; // (*target, *event_desc) - // keeps all the event directed to this particular object from touch_begin till touch_end + //Keeps all the event directed to this particular object from touch_begin till touch_end Eina_Hash *m_object_events; // (*target, *efl_gesture_touch) - // keeps all the recognizer registered to gesture manager + //Keeps all the recognizer registered to gesture manager Eina_Hash *m_recognizers; // (*gesture_type, *recognizer) - // keeps track of all current object gestures. + //Keeps track of all current object gestures. Eina_List *m_object_gestures; //(List of *object_gesture) - // lazy deletion of gestures + //Lazy deletion of gestures Eina_List *m_gestures_to_delete; - + //Kepps config values for gesture recognize Eina_Hash *m_config; } Efl_Canvas_Gesture_Manager_Data; @@ -65,13 +65,18 @@ _efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_M pd->m_config = eina_hash_string_superfast_new(EINA_FREE_CB(eina_value_free)); + //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_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_ZOOM_CLASS, obj)); return obj; } - EOLIAN static Eina_Value * _efl_canvas_gesture_manager_config_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Manager_Data *pd, const char *name) { @@ -84,6 +89,22 @@ _efl_canvas_gesture_manager_config_set(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_M Eina_Value *v = eina_value_new(eina_value_type_get(value)); eina_value_copy(value, v); eina_hash_add(pd->m_config, name, v); + + //Sets recognizer class property. + if (!strcmp(name, "glayer_tap_finger_size")) + { + int finger_size; + Efl_Canvas_Gesture_Recognizer *r; + Efl_Canvas_Gesture_Recognizer_Data *rd; + + eina_value_get(value, &finger_size); + + const Efl_Event_Description *type = EFL_EVENT_GESTURE_TAP; + + r = eina_hash_find(pd->m_recognizers, &type); + rd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); + rd->finger_size = finger_size; + } } EOLIAN static void @@ -109,11 +130,11 @@ void _efl_canvas_gesture_manager_callback_add_hook(void *data, Eo *target, const Efl_Event_Description *type) { Efl_Canvas_Gesture_Manager_Data *pd = data; - // if there is a recognizer registered for that event then add it to the gesture context + //If there is a recognizer registered for that event then add it to the gesture context Efl_Canvas_Gesture_Recognizer *recognizer = eina_hash_find (pd->m_recognizers, &type); if (recognizer) { - // add it to the gesture context. + //Add it to the gesture context. eina_hash_list_append(pd->m_gesture_contex, &target, type); } } @@ -122,7 +143,7 @@ void _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_Event_Description *type) { Efl_Canvas_Gesture_Manager_Data *pd = data; - // if there is a recognizer registered for that event then add it to the gesture context + //If there is a recognizer registered for that event then add it to the gesture context Efl_Canvas_Gesture_Recognizer *recognizer = eina_hash_find (pd->m_recognizers, &type); if (recognizer) { @@ -148,28 +169,39 @@ _efl_canvas_gesture_manager_filter_event(Eo *obj, Eo *target, void *event) gesture_context = eina_hash_find(pd->m_gesture_contex, &target); if (gesture_context) { - // get the touch event for this particular widget - touch_event = eina_hash_find(pd->m_object_events, &target); - if (!touch_event) - { - touch_event = efl_add_ref(EFL_CANVAS_GESTURE_TOUCH_CLASS, NULL); - eina_hash_add(pd->m_object_events, &target, touch_event); - } - - efl_gesture_touch_point_record(touch_event, pointer_data->tool, pointer_data->cur, - pointer_data->timestamp, pointer_data->action); - - if (efl_gesture_touch_state_get(touch_event) == EFL_GESTURE_TOUCH_UNKNOWN) - return; - EINA_LIST_FOREACH(gesture_context, l, gesture_type) { + //Check there is already created event exist or not. + touch_event = eina_hash_find(pd->m_object_events, &gesture_type); + + if (!touch_event) + { + touch_event = efl_add_ref(EFL_CANVAS_GESTURE_TOUCH_CLASS, NULL); + eina_hash_add(pd->m_object_events, &gesture_type, touch_event); + } + + efl_gesture_touch_point_record(touch_event, pointer_data->tool, pointer_data->cur, + pointer_data->timestamp, pointer_data->action); + + //This is for handling the case that mouse event pairs dont match. + //Such as the case of canceling gesture recognition after a mouse down. + if (efl_gesture_touch_state_get(touch_event) == EFL_GESTURE_TOUCH_UNKNOWN) + continue; + recognizer = eina_hash_find(pd->m_recognizers, &gesture_type); + + //If the gesture canceled or already finished by recognizer. gesture = _get_state(pd, target, recognizer, gesture_type); if (!gesture) continue; + + //Gesture detecting. recog_result = efl_gesture_recognizer_recognize(recognizer, gesture, target, touch_event); recog_state = recog_result & EFL_GESTURE_RESULT_MASK; + + Efl_Canvas_Gesture_Recognizer_Data *rd = + efl_data_scope_get(recognizer, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); + if (recog_state == EFL_GESTURE_TRIGGER) { if (efl_gesture_state_get(gesture) == EFL_GESTURE_NONE) @@ -188,53 +220,57 @@ _efl_canvas_gesture_manager_filter_event(Eo *obj, Eo *target, void *event) else if (recog_state == EFL_GESTURE_CANCEL) { if (efl_gesture_state_get(gesture) != EFL_GESTURE_NONE) - { - efl_gesture_state_set(gesture, EFL_GESTURE_CANCELED); - } + efl_gesture_state_set(gesture, EFL_GESTURE_CANCELED); else - continue; + { + //Need to recognize events that occur consecutively + //in a mouse-down state. + if (rd->continues) + continue; + } } else if (recog_state == EFL_GESTURE_IGNORE) { continue; } + + efl_gesture_timestamp_set(gesture, efl_gesture_touch_cur_timestamp_get(touch_event)); efl_event_callback_call(target, gesture_type, gesture); - } - if (efl_gesture_touch_state_get(touch_event) == EFL_GESTURE_TOUCH_END) - { - EINA_LIST_FOREACH(gesture_context, l, gesture_type) - _cleanup_cached_gestures(pd, target, gesture_type); + //If the current event recognizes the gesture continuously, dont delete gesture. + if (((recog_state == EFL_GESTURE_FINISH) || (recog_state == EFL_GESTURE_CANCEL)) && + !rd->continues) + { + _cleanup_cached_gestures(pd, target, gesture_type); + eina_hash_del(pd->m_object_events, &gesture_type, NULL); + //FIXME: delete it by object not list. + _cleanup_object(pd->m_gestures_to_delete); + pd->m_gestures_to_delete = NULL; - eina_hash_del(pd->m_object_events, &target, NULL); - // free gesture_to_delete list - _cleanup_object(pd->m_gestures_to_delete); - pd->m_gestures_to_delete = NULL; + } } } } -EOLIAN static const Efl_Event_Description * +EOLIAN static void _efl_canvas_gesture_manager_recognizer_register(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Manager_Data *pd, Efl_Canvas_Gesture_Recognizer *recognizer) { Efl_Canvas_Gesture_Recognizer_Data *rpd; - Efl_Canvas_Gesture *dummy = efl_gesture_recognizer_create(recognizer, 0); + Efl_Canvas_Gesture *dummy = efl_gesture_recognizer_add(recognizer, NULL); if (!dummy) - return NULL; + return; const Efl_Event_Description *type = efl_gesture_type_get(dummy); - // Add the recognizer to the m_recognizers + //Add the recognizer to the m_recognizers eina_hash_add(pd->m_recognizers, &type, efl_ref(recognizer)); - // update the manager + //Update the manager rpd = efl_data_scope_get(recognizer, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); rpd->manager = obj; efl_del(dummy); - - return type; } EOLIAN static void @@ -248,19 +284,19 @@ _efl_canvas_gesture_manager_recognizer_unregister(Eo *obj EINA_UNUSED, Efl_Canva if (!recognizer) return; - // find the type of the recognizer - dummy = efl_gesture_recognizer_create(recognizer, 0); + //Find the type of the recognizer + dummy = efl_gesture_recognizer_add(recognizer, 0); if (!dummy)return; type = efl_gesture_type_get(dummy); efl_del(dummy); - // check if its already registered + //Check if its already registered recognizer = eina_hash_find(pd->m_recognizers, &type); if (!recognizer) return; - // remove that gesture from the list of object gestures + //Remove that gesture from the list of object gestures EINA_LIST_FOREACH_SAFE(pd->m_object_gestures, l, l_next, object_gesture) { if (object_gesture->type == type) @@ -270,9 +306,71 @@ _efl_canvas_gesture_manager_recognizer_unregister(Eo *obj EINA_UNUSED, Efl_Canva pd->m_object_gestures = eina_list_remove_list(pd->m_object_gestures, l); } } + eina_hash_del(pd->m_recognizers, &type, NULL); } +static Efl_Canvas_Gesture_Recognizer * +_find_match_recognizer(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Canvas_Gesture_Recognizer_Type type) +{ + const Efl_Event_Description *event_type; + + switch (type) + { + case EFL_GESTURE_TAP: + { + event_type = EFL_EVENT_GESTURE_TAP; + break; + } + case EFL_GESTURE_DOUBLETAP: + { + event_type = EFL_EVENT_GESTURE_DOUBLE_TAP; + break; + } + case EFL_GESTURE_TRIPLETAP: + { + event_type = EFL_EVENT_GESTURE_TRIPLE_TAP; + break; + } + case EFL_GESTURE_LONGTAP: + { + event_type = EFL_EVENT_GESTURE_LONG_TAP; + break; + } + case EFL_GESTURE_MOMENTUM: + { + event_type = EFL_EVENT_GESTURE_MOMENTUM; + break; + } + case EFL_GESTURE_FLICK: + { + event_type = EFL_EVENT_GESTURE_FLICK; + break; + } + case EFL_GESTURE_ZOOM: + { + event_type = EFL_EVENT_GESTURE_ZOOM; + break; + } + default: + return NULL; + } + + return eina_hash_find(pd->m_recognizers, &event_type); +} + +EOLIAN static const Efl_Canvas_Gesture_Recognizer * +_efl_canvas_gesture_manager_recognizer_get(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Manager_Data *pd, + Efl_Canvas_Gesture_Recognizer_Type type) +{ + Efl_Canvas_Gesture_Recognizer *recognizer = _find_match_recognizer(pd, type); + + if (recognizer) + return recognizer; + else + return NULL; +} + // EOLIAN static void // _efl_canvas_gesture_manager_ungrab_all(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Manager_Data *pd, // Eo *target) @@ -291,7 +389,7 @@ _efl_canvas_gesture_manager_recognizer_unregister(Eo *obj EINA_UNUSED, Efl_Canva // eina_hash_del(pd->m_gesture_contex, &target, NULL); // } -// get or create a gesture object that will represent the state for a given object, used by the recognizer +//Get or create a gesture object that will represent the state for a given object, used by the recognizer Efl_Canvas_Gesture* _get_state(Efl_Canvas_Gesture_Manager_Data *pd, Eo *target, Efl_Canvas_Gesture_Recognizer *recognizer, const Efl_Event_Description *type) @@ -299,9 +397,11 @@ _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. + //If the widget is being deleted we should be careful not to + //Create a new state. if (efl_destructed_is(target)) return 0; @@ -310,19 +410,27 @@ _get_state(Efl_Canvas_Gesture_Manager_Data *pd, { if (object_gesture->object == target && object_gesture->recognizer == recognizer && - object_gesture->type == type) + object_gesture->type == type) { - // the gesture is already processed waiting for cleanup - if ((efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_FINISHED) || - (efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_CANCELED)) - return NULL; + //The gesture is already processed waiting for cleanup + if (((efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_FINISHED) || + (efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_CANCELED)) && + (!rd->continues)) + { + _cleanup_cached_gestures(pd, target, type); + eina_hash_del(pd->m_object_events, &type, NULL); + _cleanup_object(pd->m_gestures_to_delete); + pd->m_gestures_to_delete = NULL; + return NULL; + } return object_gesture->gesture; } } - gesture = efl_gesture_recognizer_create(recognizer, target); + gesture = efl_gesture_recognizer_add(recognizer, target); if (!gesture) return 0; + object_gesture = calloc(1, sizeof(Object_Gesture)); object_gesture->object = target; object_gesture->recognizer = recognizer; @@ -343,7 +451,7 @@ _cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd, EINA_LIST_FOREACH_SAFE(pd->m_object_gestures, l, l_next, object_gesture) { - if ( (object_gesture->type == type) && (target == object_gesture->object)) + if ((object_gesture->type == type) && (target == object_gesture->object)) { pd->m_gestures_to_delete = eina_list_append(pd->m_gestures_to_delete, object_gesture->gesture); free(object_gesture); @@ -371,4 +479,15 @@ _efl_canvas_gesture_manager_watches(const Efl_Event_Description *ev) return EINA_FALSE; } +void +efl_gesture_manager_gesture_clean_up(Eo *obj, Eo *target, const Efl_Event_Description *type) +{ + Efl_Canvas_Gesture_Manager_Data *pd = efl_data_scope_get(obj, MY_CLASS); + + _cleanup_cached_gestures(pd, target, type); + eina_hash_del(pd->m_object_events, &type, NULL); + _cleanup_object(pd->m_gestures_to_delete); + pd->m_gestures_to_delete = NULL; +} + #include "efl_canvas_gesture_manager.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.eo b/src/lib/evas/gesture/efl_canvas_gesture_manager.eo index a39318aea0..d626ca16de 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_manager.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.eo @@ -8,7 +8,6 @@ class @beta Efl.Canvas.Gesture_Manager extends Efl.Object params { @in recognizer: Efl.Canvas.Gesture_Recognizer; [[The gesture recognizer object]] } - return: ptr(const(Efl.Event_Description)); [[Returns the Efl.Event_Description type the recognizer supports]] } recognizer_unregister { [[This function is called to unregister a Efl.Canvas.Gesture_Recognizer]] @@ -16,6 +15,13 @@ class @beta Efl.Canvas.Gesture_Manager extends Efl.Object @in recognizer: Efl.Canvas.Gesture_Recognizer; [[The gesture recognizer object]] } } + recognizer_get { + [[Gets event type's recognizer]] + params { + @in gesture_type: Efl.Canvas.Gesture_Recognizer_Type; [[The gesture type]] + } + return: const(Efl.Canvas.Gesture_Recognizer); [[The gesture recognizer]] + } @property config { [[This property holds the config value for the recognizer]] set { diff --git a/src/lib/evas/gesture/efl_canvas_gesture_momentum.c b/src/lib/evas/gesture/efl_canvas_gesture_momentum.c new file mode 100644 index 0000000000..e7eb34ad2b --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_momentum.c @@ -0,0 +1,24 @@ +#include "efl_canvas_gesture_private.h" + +#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(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Momentum_Data *pd) +{ + return pd->momentum; +} + +#include "efl_canvas_gesture_momentum.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_momentum.eo b/src/lib/evas/gesture/efl_canvas_gesture_momentum.eo new file mode 100644 index 0000000000..c5aebcb5d2 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_momentum.eo @@ -0,0 +1,16 @@ +import eina_types; + +class @beta Efl.Canvas.Gesture_Momentum extends Efl.Canvas.Gesture +{ + [[EFL Gesture Momentum class]] + c_prefix: efl_gesture_momentum; + methods { + momentum_get { + [[Gets momentum value]] + return: Eina.Vector2; [[The momentum vector]] + } + } + implements { + Efl.Object.constructor; + } +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_private.h b/src/lib/evas/gesture/efl_canvas_gesture_private.h index c09fd26779..e1de45cb78 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_private.h +++ b/src/lib/evas/gesture/efl_canvas_gesture_private.h @@ -6,37 +6,154 @@ #define EFL_INTERNAL_UNSTABLE #include "interfaces/efl_common_internal.h" +#include "efl_gesture_events.eo.c" + #include -//private gesture classes -#include "efl_canvas_gesture_recognizer_tap.eo.h" -#include "efl_canvas_gesture_recognizer_long_tap.eo.h" +void efl_gesture_manager_gesture_clean_up(Eo *obj, Eo *target, const Efl_Event_Description *type); +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_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_Zoom_Data Efl_Canvas_Gesture_Recognizer_Zoom_Data; typedef struct _Efl_Canvas_Gesture_Data Efl_Canvas_Gesture_Data; -typedef struct _Efl_Canvas_Gesture_Tap_Data Efl_Canvas_Gesture_Tap_Data; -typedef struct _Efl_Canvas_Gesture_Long_Tap_Data Efl_Canvas_Gesture_Long_Tap_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 _Pointer_Data +{ + struct + { + Eina_Position2D pos; + unsigned int timestamp; + } start, prev, cur; + int id; + Efl_Pointer_Action action; +} Pointer_Data; + +typedef struct _Efl_Canvas_Gesture_Touch_Data +{ + Efl_Canvas_Gesture_Touch_State state; + Eina_Hash *touch_points; + int touch_down; + Eina_Bool multi_touch; + Eo *target; +} Efl_Canvas_Gesture_Touch_Data; struct _Efl_Canvas_Gesture_Recognizer_Data { - Eo *manager; // keeps a reference of the manager + Eo *manager; // keeps a reference of the manager + Eo *gesture; + int finger_size; + Eina_Bool continues; +}; + +struct _Efl_Canvas_Gesture_Recognizer_Tap_Data +{ + Eo *target; + Eo *gesture; + Ecore_Timer *timeout; +}; + +struct _Efl_Canvas_Gesture_Recognizer_Long_Tap_Data +{ + Eina_List *target_timeout; + Eo *target; + Efl_Canvas_Gesture *gesture; + Ecore_Timer *timeout; + double start_timeout; + Eina_Bool is_timeout; +}; + +struct _Efl_Canvas_Gesture_Recognizer_Double_Tap_Data +{ + Eina_List *target_timeout; + Eo *target; + Eo *gesture; + Ecore_Timer *timeout; + double start_timeout; + Eina_Bool is_timeout; + int tap_count; +}; + +struct _Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data +{ + Eina_List *target_timeout; + Eo *target; + Eo *gesture; + Ecore_Timer *timeout; + double start_timeout; + Eina_Bool is_timeout; + int tap_count; +}; + +struct _Efl_Canvas_Gesture_Recognizer_Momentum_Data +{ + Eina_Position2D st_line; + Eina_Position2D end_line; + unsigned int t_st; + unsigned int t_end; + int xdir; + int ydir; + Eina_Bool touched; +}; + +struct _Efl_Canvas_Gesture_Recognizer_Flick_Data +{ + Eina_Position2D st_line; + unsigned int t_st; + unsigned int t_end; + int line_length; + double line_angle; + Eina_Bool touched; +}; + +struct _Efl_Canvas_Gesture_Recognizer_Zoom_Data +{ + Pointer_Data zoom_st; + Pointer_Data zoom_st1; + + Pointer_Data zoom_mv; + Pointer_Data zoom_mv1; + + Evas_Coord zoom_base; /* Holds gap between fingers on + * zoom-start */ + double zoom_distance_tolerance; + double zoom_finger_factor; + double zoom_step; + double next_step; + Eina_Bool calc_temp; }; struct _Efl_Canvas_Gesture_Data { const Efl_Event_Description *type; - Efl_Canvas_Gesture_State state; - Eina_Vector2 hotspot; + Efl_Canvas_Gesture_State state; + Eina_Position2D hotspot; + unsigned int timestamp; }; -struct _Efl_Canvas_Gesture_Tap_Data +struct _Efl_Canvas_Gesture_Momentum_Data { + Eina_Vector2 momentum; }; -struct _Efl_Canvas_Gesture_Long_Tap_Data +struct _Efl_Canvas_Gesture_Flick_Data { - Ecore_Timer *timeout; - Eina_Bool is_timeout; + Eina_Vector2 momentum; + double angle; +}; + +struct _Efl_Canvas_Gesture_Zoom_Data +{ + double radius; + double zoom; }; #endif diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c index eac5f1cecf..8a83e2f945 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c @@ -2,6 +2,7 @@ #define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_CLASS +#define EFL_GESTURE_TAP_FINGER_SIZE 10 EOLIAN static Eina_Value * _efl_canvas_gesture_recognizer_config_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Data *pd, const char *name) { @@ -15,4 +16,13 @@ _efl_canvas_gesture_recognizer_reset(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Rec } +EOLIAN static Efl_Object * +_efl_canvas_gesture_recognizer_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Recognizer_Data *pd) +{ + obj = efl_constructor(efl_super(obj, MY_CLASS)); + + pd->finger_size = EFL_GESTURE_TAP_FINGER_SIZE; + + return obj; +} #include "efl_canvas_gesture_recognizer.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo index 857408913b..aaee7d29b1 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo @@ -2,10 +2,18 @@ import efl_canvas_gesture_types; abstract @beta Efl.Canvas.Gesture_Recognizer extends Efl.Object { - [[EFL Gesture Recognizer abstract class]] + [[EFL Gesture Recognizer abstract class + + The gesture recognizer class grabs events that occur on the target + object that user register to see if a particluar gesture has occurred. + + Uesr can adjust the config value involved in gesture recognition + through the method provided by the gesture recognizer. + + The default config values follow the system default config value.]] c_prefix: efl_gesture_recognizer; methods { - create @pure_virtual { + add @pure_virtual { [[This function is called to create a new Efl.Canvas.Gesture object for the given target]] params { @in target: Efl.Object; [[The target widget]] @@ -44,4 +52,7 @@ abstract @beta Efl.Canvas.Gesture_Recognizer extends Efl.Object } } } + implements { + Efl.Object.constructor; + } } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.c new file mode 100644 index 0000000000..1656bb633f --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.c @@ -0,0 +1,191 @@ +#include "efl_canvas_gesture_private.h" + +#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_DOUBLE_TAP_CLASS + +#define TAP_TIME_OUT 0.33 + +EOLIAN static Efl_Canvas_Gesture * +_efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_add(Eo *obj, Efl_Canvas_Gesture_Recognizer_Double_Tap_Data *pd EINA_UNUSED, Efl_Object *target EINA_UNUSED) +{ + return efl_add(EFL_CANVAS_GESTURE_DOUBLE_TAP_CLASS, obj); +} + +EOLIAN static void +_efl_canvas_gesture_recognizer_double_tap_efl_object_destructor(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Double_Tap_Data *pd) +{ + if (pd->timeout) + ecore_timer_del(pd->timeout); + + efl_destructor(efl_super(obj, MY_CLASS)); +} + +static Eina_Bool +_tap_timeout_cb(void *data) +{ + Efl_Canvas_Gesture_Recognizer_Data *rd; + Efl_Canvas_Gesture_Recognizer_Double_Tap_Data *pd; + + rd = efl_data_scope_get(data, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); + pd = efl_data_scope_get(data, EFL_CANVAS_GESTURE_RECOGNIZER_DOUBLE_TAP_CLASS); + + efl_gesture_state_set(pd->gesture, EFL_GESTURE_CANCELED); + efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_DOUBLE_TAP, pd->gesture); + + efl_gesture_manager_gesture_clean_up(rd->manager, pd->target, EFL_EVENT_GESTURE_DOUBLE_TAP); + + pd->timeout = NULL; + pd->tap_count = 0; + + return ECORE_CALLBACK_CANCEL; +} + +EOLIAN static Efl_Canvas_Gesture_Recognizer_Result +_efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_recognize(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Double_Tap_Data *pd, + Efl_Canvas_Gesture *gesture, Efl_Object *watched, + Efl_Canvas_Gesture_Touch *event) +{ + double length; + double timeout = TAP_TIME_OUT; + Eina_Position2D pos; + Eina_Vector2 dist; + Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_CANCEL; + Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); + + pd->target = watched; + pd->gesture = gesture; + + if (!pd->start_timeout) + { + double time; + Eina_Value *val = efl_gesture_recognizer_config_get(obj, "glayer_doublee_tap_timeout"); + + if (val) + { + eina_value_get(val, &time); + pd->start_timeout = timeout = time; + } + } + else + timeout = pd->start_timeout; + + switch (efl_gesture_touch_state_get(event)) + { + case EFL_GESTURE_TOUCH_BEGIN: + { + pos = efl_gesture_touch_start_point_get(event); + efl_gesture_hotspot_set(gesture, pos); + + if (pd->timeout) + ecore_timer_reset(pd->timeout); + else + pd->timeout = ecore_timer_add(timeout, _tap_timeout_cb, obj); + + result = EFL_GESTURE_TRIGGER; + + break; + } + + case EFL_GESTURE_TOUCH_UPDATE: + { + result = EFL_GESTURE_IGNORE; + + if (efl_gesture_state_get(gesture) != EFL_GESTURE_NONE && + !efl_gesture_touch_multi_touch_get(event)) + { + dist = efl_gesture_touch_distance(event, 0); + length = fabs(dist.x) + fabs(dist.y); + + if (length > rd->finger_size) + { + if (pd->timeout) + { + ecore_timer_del(pd->timeout); + pd->timeout = NULL; + } + + result = EFL_GESTURE_CANCEL; + + pd->tap_count = 0; + } + } + + break; + } + case EFL_GESTURE_TOUCH_END: + { + + if (efl_gesture_state_get(gesture) != EFL_GESTURE_NONE && + !efl_gesture_touch_multi_touch_get(event)) + { + dist = efl_gesture_touch_distance(event, 0); + length = fabs(dist.x) + fabs(dist.y); + + if (length <= rd->finger_size) + { + pd->tap_count++; + if (pd->tap_count == 1) + { + if (pd->timeout) + ecore_timer_reset(pd->timeout); + + result = EFL_GESTURE_TRIGGER; + } + else + { + if (pd->timeout) + { + ecore_timer_del(pd->timeout); + pd->timeout = NULL; + } + + if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_END) + result = EFL_GESTURE_FINISH; + else + result = EFL_GESTURE_TRIGGER; + + pd->tap_count = 0; + } + } + else + { + if (pd->timeout) + { + ecore_timer_del(pd->timeout); + pd->timeout = NULL; + } + + result = EFL_GESTURE_CANCEL; + + pd->tap_count = 0; + } + } + + break; + } + + default: + + break; + } + + return result; +} + +EOLIAN static double +_efl_canvas_gesture_recognizer_double_tap_timeout_get(const Eo *obj EINA_UNUSED, + Efl_Canvas_Gesture_Recognizer_Double_Tap_Data *pd) +{ + return pd->start_timeout; +} + +EOLIAN static void +_efl_canvas_gesture_recognizer_double_tap_timeout_set(Eo *obj EINA_UNUSED, + Efl_Canvas_Gesture_Recognizer_Double_Tap_Data *pd, + double time) +{ + pd->start_timeout = time; +} + +#include "efl_canvas_gesture_recognizer_double_tap.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.eo new file mode 100644 index 0000000000..9f3ab0a93c --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.eo @@ -0,0 +1,22 @@ +class @beta Efl.Canvas.Gesture_Recognizer_Double_Tap extends Efl.Canvas.Gesture_Recognizer +{ + [[EFL Gesture Recognizer Double Tap class]] + c_prefix: efl_gesture_recognizer_double_tap; + methods { + @property timeout { + [[Sets the time between taps to be recognized as a double tap]] + set { + } + get { + } + values { + time: double; [[Allowed time gap value]] + } + } + } + implements { + Efl.Object.destructor; + Efl.Canvas.Gesture_Recognizer.add; + Efl.Canvas.Gesture_Recognizer.recognize; + } +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c new file mode 100644 index 0000000000..4968c61b34 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c @@ -0,0 +1,354 @@ +#include "efl_canvas_gesture_private.h" + +#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_FLICK_CLASS + +#define MOMENTUM_TIMEOUT 50 +#define THUMBSCROLL_FRICTION 0.95 +#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) + +EOLIAN static Efl_Canvas_Gesture * +_efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_add(Eo *obj, Efl_Canvas_Gesture_Recognizer_Flick_Data *pd EINA_UNUSED, Efl_Object *target EINA_UNUSED) +{ + return efl_add(EFL_CANVAS_GESTURE_FLICK_CLASS, obj); +} + +static void +_momentum_set(Eo *obj, + Efl_Canvas_Gesture_Flick_Data *fd, + Eina_Position2D v1, + Eina_Position2D v2, + unsigned int t1, + unsigned int t2) +{ + Evas_Coord velx = 0, vely = 0, vel; + Evas_Coord dx = v2.x - v1.x; + Evas_Coord dy = v2.y - v1.y; + int dt = t2 - t1; + Eina_Value *tf, *tmt; + double thumbscroll_friction, thumbscroll_momentum_threshold; + + if (dt > 0) + { + velx = (dx * 1000) / dt; + vely = (dy * 1000) / dt; + } + + vel = sqrt((velx * velx) + (vely * vely)); + + tf = efl_gesture_recognizer_config_get(obj, "thumbscroll_friction"); + if (tf) eina_value_get(tf, &thumbscroll_friction); + else thumbscroll_friction = THUMBSCROLL_FRICTION; + + tmt = efl_gesture_recognizer_config_get(obj, "thumbscroll_momentum_threshold"); + if (tmt) eina_value_get(tmt, &thumbscroll_momentum_threshold); + else thumbscroll_momentum_threshold = THUMBSCROLL_MOMENTUM_THRESHOLD; + + if ((thumbscroll_friction > 0.0) && + (vel > thumbscroll_momentum_threshold)) /* report + * momentum */ + { + fd->momentum.x = velx; + fd->momentum.y = vely; + } + else + { + fd->momentum.x = 0; + fd->momentum.y = 0; + } +} + +static void +_single_line_process(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Flick_Data *pd, + Efl_Canvas_Gesture *gesture, + Efl_Canvas_Gesture_Flick_Data *fd, + Efl_Canvas_Gesture_Touch *event) +{ + switch (efl_gesture_touch_state_get(event)) + { + case EFL_GESTURE_TOUCH_BEGIN: + case EFL_GESTURE_TOUCH_UPDATE: + if (!pd->t_st) + { + pd->st_line = efl_gesture_touch_cur_point_get(event); + pd->t_st = efl_gesture_touch_cur_timestamp_get(event); + + efl_gesture_hotspot_set(gesture, pd->st_line); + + return; + } + + break; + + case EFL_GESTURE_TOUCH_END: + { + if (!pd->t_st) return; + + pd->t_end = efl_gesture_touch_cur_timestamp_get(event); + + break; + } + + default: + + return; + } + + _momentum_set(obj, fd, pd->st_line, efl_gesture_touch_cur_point_get(event), + pd->t_st, efl_gesture_touch_cur_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, + int *l, + double *a) +{ + int xx, yy; + + xx = (int)(v2.x - v1.x); + yy = (int)(v2.y - v1.y); + *l = (int)sqrt((xx * xx) + (yy * yy)); + *a = _angle_get((int)v1.x, (int)v1.y, (int)v2.x, (int)v2.y); +} + +EOLIAN static Efl_Canvas_Gesture_Recognizer_Result +_efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_recognize(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Flick_Data *pd, + Efl_Canvas_Gesture *gesture, Efl_Object *watched, + Efl_Canvas_Gesture_Touch *event) +{ + double angle; + Eina_Value *val; + unsigned char glayer_continues_enable; + Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_CANCEL; + Eina_Bool touch_up = EINA_FALSE; + Efl_Canvas_Gesture_Flick_Data *fd = efl_data_scope_get(gesture, EFL_CANVAS_GESTURE_FLICK_CLASS); + Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); + + val = efl_gesture_recognizer_config_get(obj, "glayer_continues_enable"); + if (val) eina_value_get(val, &glayer_continues_enable); + else glayer_continues_enable = 1; + + //We need to cover events that occur continuously in the mouse down state + //without mouse up. + //Recognizing the gesture again, even though it was canceled during gesture + //recognition. + if (efl_gesture_state_get(gesture) == EFL_GESTURE_CANCELED) + efl_gesture_state_set(gesture, EFL_GESTURE_NONE); + + if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_END) + touch_up = EINA_TRUE; + + //This is to handle a case with a mouse click on the target object. + if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_END && !pd->touched) + efl_gesture_manager_gesture_clean_up(rd->manager, watched, EFL_EVENT_GESTURE_FLICK); + + if (glayer_continues_enable && !pd->touched) + { + pd->touched = EINA_TRUE; + pd->line_angle = -1.0; + rd->continues = EINA_TRUE; + + return EFL_GESTURE_IGNORE; + } + + _single_line_process(obj, pd, gesture, fd, event); + _vector_get(pd->st_line, efl_gesture_touch_cur_point_get(event), + &pd->line_length, &angle); + + if (pd->t_st) + { + if (pd->line_angle >= 0.0) + { + double line_distance_tolerance, line_angular_tolerance; + double a = fabs(angle - pd->line_angle); + double d = (tan(DEG2RAD(a))) * pd->line_length; + + val = efl_gesture_recognizer_config_get(obj, "glayer_line_distance_tolerance"); + if (val) eina_value_get(val, &line_distance_tolerance); + else line_distance_tolerance = 3.0; + + line_distance_tolerance *= rd->finger_size; + + val = efl_gesture_recognizer_config_get(obj, "glayer_line_angular_tolerance"); + if (val) eina_value_get(val, &line_angular_tolerance); + else line_angular_tolerance = 20.0; + + if ((d > line_distance_tolerance) || + (a > line_angular_tolerance)) + { + memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Flick_Data)); + + if (touch_up) rd->continues = EINA_FALSE; + + return EFL_GESTURE_CANCEL; + } + + /* We may finish line if momentum is zero */ + if (glayer_continues_enable) + { + /* This is for continues-gesture */ + /* Finish line on zero momentum for continues gesture */ + if ((!fd->momentum.x) && (!fd->momentum.y)) + pd->t_end = efl_gesture_touch_cur_timestamp_get(event); + } + } + else + { + double line_min_length; + + val = efl_gesture_recognizer_config_get(obj, "glayer_line_min_length"); + if (val) eina_value_get(val, &line_min_length); + else line_min_length = 1.0; + + line_min_length *= rd->finger_size; + + if (pd->line_length >= line_min_length) + fd->angle = pd->line_angle = angle; + + } + + if (pd->t_end) + { + if (pd->line_angle < 0.0) + { + memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Flick_Data)); + + if (touch_up) rd->continues = EINA_FALSE; + + return EFL_GESTURE_CANCEL; + } + } + } + + unsigned int tm_end = efl_gesture_touch_cur_timestamp_get(event); + if (pd->t_end) + { + if (pd->t_end < tm_end) + tm_end = pd->t_end; + } + + unsigned int time_limit_ms; + val = efl_gesture_recognizer_config_get(obj, "glayer_flick_time_limit_ms"); + if (val) eina_value_get(val, &time_limit_ms); + else time_limit_ms = 120; + + if ((tm_end - pd->t_st) > time_limit_ms) + { + memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Flick_Data)); + + if (touch_up) rd->continues = EINA_FALSE; + + return EFL_GESTURE_CANCEL; + } + + switch (efl_gesture_touch_state_get(event)) + { + case EFL_GESTURE_TOUCH_BEGIN: + case EFL_GESTURE_TOUCH_UPDATE: + { + if (pd->t_st) + { + if (glayer_continues_enable && pd->t_end) + { + result = EFL_GESTURE_FINISH; + } + else + { + result = EFL_GESTURE_TRIGGER; + } + } + break; + } + + case EFL_GESTURE_TOUCH_END: + { + if (!pd->t_st) + { + pd->touched = EINA_FALSE; + rd->continues = EINA_FALSE; + + return EFL_GESTURE_CANCEL; + } + if (pd->t_st && pd->t_end) + { + rd->continues = EINA_FALSE; + + result = EFL_GESTURE_FINISH; + } + + efl_gesture_hotspot_set(gesture, efl_gesture_touch_cur_point_get(event)); + + memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Flick_Data)); + + rd->continues = EINA_FALSE; + + break; + } + + default: + + break; + } + + return result; +} + +#include "efl_canvas_gesture_recognizer_flick.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.eo new file mode 100644 index 0000000000..c7103ad33f --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.eo @@ -0,0 +1,9 @@ +class @beta Efl.Canvas.Gesture_Recognizer_Flick extends Efl.Canvas.Gesture_Recognizer +{ + [[EFL Gesture Recognizer Flick Class]] + c_prefix: efl_gesture_recognizer_flick; + implements { + Efl.Canvas.Gesture_Recognizer.add; + Efl.Canvas.Gesture_Recognizer.recognize; + } +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c index 9f5463cf49..8f6773588b 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c @@ -2,36 +2,71 @@ #define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_LONG_TAP_CLASS -#define LONG_TAP_TIME_OUT 0.2 +#define EFL_GESTURE_LONG_TAP_TIME_OUT 1.2 EOLIAN static Efl_Canvas_Gesture * -_efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_create(Eo *obj, void *pd EINA_UNUSED, - Efl_Object *target EINA_UNUSED) +_efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_add(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd EINA_UNUSED, + Efl_Object *target EINA_UNUSED) { return efl_add(EFL_CANVAS_GESTURE_LONG_TAP_CLASS, obj); } +EOLIAN static void +_efl_canvas_gesture_recognizer_long_tap_efl_object_destructor(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd) +{ + if (pd->timeout) + ecore_timer_del(pd->timeout); + + efl_destructor(efl_super(obj, MY_CLASS)); +} + static Eina_Bool _long_tap_timeout_cb(void *data) { - Efl_Canvas_Gesture_Long_Tap_Data *ltp = data; + Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd = data; /* FIXME: Needs to propagate this event back to evas! */ - ltp->is_timeout = EINA_TRUE; + pd->is_timeout = EINA_TRUE; + + efl_gesture_state_set(pd->gesture, EFL_GESTURE_UPDATED); + efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_LONG_TAP, 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 EINA_UNUSED, - void *pd EINA_UNUSED, - Efl_Canvas_Gesture *gesture, Efl_Object *watched EINA_UNUSED, - Efl_Canvas_Gesture_Touch *event) +_efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd, + Efl_Canvas_Gesture *gesture, + Efl_Object *watched, + Efl_Canvas_Gesture_Touch *event) { double length; // Manhattan distance - Eina_Vector2 pos, dist; + double timeout = EFL_GESTURE_LONG_TAP_TIME_OUT; + Eina_Position2D pos; + Eina_Vector2 dist; Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_CANCEL; - Efl_Canvas_Gesture_Long_Tap_Data *ltp = efl_data_scope_get(gesture, EFL_CANVAS_GESTURE_LONG_TAP_CLASS); + Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); + + pd->target = watched; + pd->gesture = gesture; + + if (!pd->start_timeout) + { + double time; + Eina_Value *val = efl_gesture_recognizer_config_get(obj, "glayer_long_tap_start_timeout"); + + if (val) + { + eina_value_get(val, &time); + pd->start_timeout = timeout = time; + } + } + else + timeout = pd->start_timeout; + switch (efl_gesture_touch_state_get(event)) { @@ -39,49 +74,56 @@ _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize( { pos = efl_gesture_touch_start_point_get(event); efl_gesture_hotspot_set(gesture, pos); - if (ltp->timeout) - ecore_timer_del(ltp->timeout); - ltp->timeout = ecore_timer_add(LONG_TAP_TIME_OUT, - _long_tap_timeout_cb, ltp); - result = EFL_GESTURE_MAYBE; + + if (pd->timeout) + { + ecore_timer_del(pd->timeout); + } + pd->timeout = ecore_timer_add(timeout, + _long_tap_timeout_cb, pd); + + result = EFL_GESTURE_TRIGGER; + break; } + case EFL_GESTURE_TOUCH_UPDATE: { - if (!efl_gesture_touch_multi_touch_get(event)) + dist = efl_gesture_touch_distance(event, 0); + length = fabs(dist.x) + fabs(dist.y); + + if ((efl_gesture_touch_multi_touch_get(event)) || (length > rd->finger_size)) { - dist = efl_gesture_touch_distance(event, 0); - length = fabs(dist.x) + fabs(dist.y); - if (length <= 50) // FIXME config! + if (pd->timeout) { - if (ltp->is_timeout) - { - ltp->is_timeout = EINA_FALSE; - result = EFL_GESTURE_TRIGGER; - } - else - { - result = EFL_GESTURE_MAYBE; - } - } - else - { - result = EFL_GESTURE_CANCEL; + ecore_timer_del(pd->timeout); + pd->timeout = NULL; } + + result = EFL_GESTURE_CANCEL; } + else + { + result = EFL_GESTURE_MAYBE; + } + break; } + case EFL_GESTURE_TOUCH_END: { - if (ltp->timeout) - ecore_timer_del(ltp->timeout); - ltp->timeout = NULL; + if (pd->timeout) + { + ecore_timer_del(pd->timeout); + pd->timeout = NULL; + } + if (efl_gesture_state_get(gesture) != EFL_GESTURE_NONE && !efl_gesture_touch_multi_touch_get(event)) { dist = efl_gesture_touch_distance(event, 0); length = fabs(dist.x) + fabs(dist.y); - if (length <= 50 && ltp->is_timeout) // FIXME config! + if (length <= rd->finger_size && pd->is_timeout) { result = EFL_GESTURE_FINISH; } @@ -90,26 +132,45 @@ _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize( result = EFL_GESTURE_CANCEL; } } + break; } + default: + break; } + return result; } EOLIAN static void _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_reset(Eo *obj, - void *pd EINA_UNUSED, - Efl_Canvas_Gesture *gesture) + Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd, + Efl_Canvas_Gesture *gesture) { - Efl_Canvas_Gesture_Long_Tap_Data *ltp; - ltp = efl_data_scope_get(gesture, EFL_CANVAS_GESTURE_LONG_TAP_CLASS); - if (ltp->timeout) - ecore_timer_del(ltp->timeout); - ltp->timeout = NULL; - ltp->is_timeout = EINA_FALSE; + if (pd->timeout) + { + ecore_timer_del(pd->timeout); + pd->timeout = NULL; + } + pd->is_timeout = EINA_FALSE; efl_gesture_recognizer_reset(efl_super(obj, MY_CLASS), gesture); } +EOLIAN static double +_efl_canvas_gesture_recognizer_long_tap_timeout_get(const Eo *obj EINA_UNUSED, + Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd) +{ + return pd->start_timeout; +} + +EOLIAN static void +_efl_canvas_gesture_recognizer_long_tap_timeout_set(Eo *obj EINA_UNUSED, + Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd, + double time) +{ + pd->start_timeout = time; +} + #include "efl_canvas_gesture_recognizer_long_tap.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.eo index 8094655f13..7c8df2cfeb 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.eo @@ -1,10 +1,22 @@ class @beta Efl.Canvas.Gesture_Recognizer_Long_Tap extends Efl.Canvas.Gesture_Recognizer { [[EFL Gesture Recognizer Long Tap class]] - data: null; c_prefix: efl_gesture_recognizer_long_tap; + methods { + @property timeout { + [[Sets the holding time to be recognized as a long tap.]] + set { + } + get { + } + values { + time: double; [[Allowed time gap value]] + } + } + } implements { - Efl.Canvas.Gesture_Recognizer.create; + Efl.Object.destructor; + Efl.Canvas.Gesture_Recognizer.add; Efl.Canvas.Gesture_Recognizer.recognize; Efl.Canvas.Gesture_Recognizer.reset; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c new file mode 100644 index 0000000000..34c9030ad3 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c @@ -0,0 +1,197 @@ +#include "efl_canvas_gesture_private.h" + +#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_MOMENTUM_CLASS + +#define MOMENTUM_TIMEOUT 50 +#define THUMBSCROLL_FRICTION 0.95 +#define THUMBSCROLL_MOMENTUM_THRESHOLD 100.0 +#define EFL_GESTURE_MINIMUM_MOMENTUM 0.001 + +EOLIAN static Efl_Canvas_Gesture * +_efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_add(Eo *obj, Efl_Canvas_Gesture_Recognizer_Momentum_Data *pd EINA_UNUSED, Efl_Object *target EINA_UNUSED) +{ + return efl_add(EFL_CANVAS_GESTURE_MOMENTUM_CLASS, obj); +} + +static void +_momentum_set(Eo *obj, + Efl_Canvas_Gesture_Momentum_Data *md, + Eina_Position2D v1, + Eina_Position2D v2, + unsigned int t1, + unsigned int t2) +{ + Evas_Coord velx = 0, vely = 0, vel; + Evas_Coord dx = v2.x - v1.x; + Evas_Coord dy = v2.y - v1.y; + int dt = t2 - t1; + Eina_Value *tf, *tmt; + double thumbscroll_friction, thumbscroll_momentum_threshold; + + if (dt > 0) + { + velx = (dx * 1000) / dt; + vely = (dy * 1000) / dt; + } + + vel = sqrt((velx * velx) + (vely * vely)); + + tf = efl_gesture_recognizer_config_get(obj, "thumbscroll_friction"); + if (tf) eina_value_get(tf, &thumbscroll_friction); + else thumbscroll_friction = THUMBSCROLL_FRICTION; + + tmt = efl_gesture_recognizer_config_get(obj, "thumbscroll_momentum_threshold"); + if (tmt) eina_value_get(tmt, &thumbscroll_momentum_threshold); + else thumbscroll_momentum_threshold = THUMBSCROLL_MOMENTUM_THRESHOLD; + + if ((thumbscroll_friction > 0.0) && + (vel > thumbscroll_momentum_threshold)) /* report + * momentum */ + { + md->momentum.x = velx; + md->momentum.y = vely; + } + else + { + md->momentum.x = 0; + md->momentum.y = 0; + } +} + +static int +_direction_get(Evas_Coord xx1, + Evas_Coord xx2) +{ + if (xx2 < xx1) return -1; + if (xx2 > xx1) return 1; + + return 0; +} + +EOLIAN static Efl_Canvas_Gesture_Recognizer_Result +_efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Momentum_Data *pd, + Efl_Canvas_Gesture *gesture, Efl_Object *watched EINA_UNUSED, + Efl_Canvas_Gesture_Touch *event) +{ + Eina_Value *val; + unsigned char glayer_continues_enable; + Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_CANCEL; + Efl_Canvas_Gesture_Momentum_Data *md = efl_data_scope_get(gesture, EFL_CANVAS_GESTURE_MOMENTUM_CLASS); + + val = efl_gesture_recognizer_config_get(obj, "glayer_continues_enable"); + if (val) eina_value_get(val, &glayer_continues_enable); + else glayer_continues_enable = 1; + + //Check the touched to ignore very first event. + //It does not have any meanging of this gesture. + if (glayer_continues_enable && !pd->touched) + { + pd->touched = EINA_TRUE; + + return EFL_GESTURE_IGNORE; + } + + switch (efl_gesture_touch_state_get(event)) + { + case EFL_GESTURE_TOUCH_BEGIN: + case EFL_GESTURE_TOUCH_UPDATE: + { + if (!pd->t_st) + { + if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_BEGIN || + glayer_continues_enable) + { + pd->t_st = pd->t_end = efl_gesture_touch_cur_timestamp_get(event); + + pd->st_line = pd->end_line = + efl_gesture_touch_start_point_get(event); + + efl_gesture_hotspot_set(gesture, pd->st_line); + + return EFL_GESTURE_TRIGGER; + } + } + + if ((efl_gesture_touch_cur_timestamp_get(event) - MOMENTUM_TIMEOUT) > + pd->t_end) + { + pd->st_line = efl_gesture_touch_cur_point_get(event); + pd->t_st = efl_gesture_touch_cur_timestamp_get(event); + pd->xdir = pd->ydir = 0; + } + else + { + int xdir, ydir; + Eina_Position2D cur_p = efl_gesture_touch_cur_point_get(event); + + xdir = _direction_get(pd->end_line.x, cur_p.x); + ydir = _direction_get(pd->end_line.y, cur_p.y); + + if (xdir && (xdir != pd->xdir)) + { + pd->st_line.x = pd->end_line.x; + pd->t_st = pd->t_end; + pd->xdir = xdir; + } + + if (ydir && (ydir != pd->ydir)) + { + pd->st_line.y = pd->end_line.y; + pd->t_st = pd->t_end; + pd->ydir = ydir; + } + } + + pd->end_line = efl_gesture_touch_cur_point_get(event); + pd->t_end = efl_gesture_touch_cur_timestamp_get(event); + efl_gesture_hotspot_set(gesture, pd->end_line); + + _momentum_set(obj, md, pd->st_line, efl_gesture_touch_cur_point_get(event), + pd->t_st, efl_gesture_touch_cur_timestamp_get(event)); + + result = EFL_GESTURE_TRIGGER; + + break; + } + + case EFL_GESTURE_TOUCH_END: + { + if (!pd->t_st) + { + pd->touched = EINA_FALSE; + + return EFL_GESTURE_CANCEL; + } + + if ((efl_gesture_touch_cur_timestamp_get(event) - MOMENTUM_TIMEOUT) > pd->t_end) + { + pd->st_line = efl_gesture_touch_cur_point_get(event); + pd->t_st = efl_gesture_touch_cur_timestamp_get(event); + pd->xdir = pd->ydir = 0; + } + + pd->end_line = efl_gesture_touch_cur_point_get(event); + pd->t_end = efl_gesture_touch_cur_timestamp_get(event); + efl_gesture_hotspot_set(gesture, pd->end_line); + + if ((abs(md->momentum.x) > EFL_GESTURE_MINIMUM_MOMENTUM) || + (abs(md->momentum.y) > EFL_GESTURE_MINIMUM_MOMENTUM)) + result = EFL_GESTURE_FINISH; + else + result = EFL_GESTURE_CANCEL; + + memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Momentum_Data)); + + break; + } + + default: + + break; + } + + return result; +} + +#include "efl_canvas_gesture_recognizer_momentum.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.eo new file mode 100644 index 0000000000..1ae250dbba --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.eo @@ -0,0 +1,9 @@ +class @beta Efl.Canvas.Gesture_Recognizer_Momentum extends Efl.Canvas.Gesture_Recognizer +{ + [[EFL Gesture Recognizer Momentum class]] + c_prefix: efl_gesture_recognizer_momentum; + implements { + Efl.Canvas.Gesture_Recognizer.add; + Efl.Canvas.Gesture_Recognizer.recognize; + } +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c index 2e4a5a6b76..8f53a0585a 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c @@ -2,22 +2,45 @@ #define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_TAP_CLASS +//FIXME: It doesnt have matched config value. +// may using dobule tap timeout value? +#define EFL_GESTURE_TAP_TIME_OUT 0.33 + EOLIAN static Efl_Canvas_Gesture * -_efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_create(Eo *obj, void *pd EINA_UNUSED, - Efl_Object *target EINA_UNUSED) +_efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_add(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Tap_Data *pd EINA_UNUSED, + Efl_Object *target EINA_UNUSED) { return efl_add(EFL_CANVAS_GESTURE_TAP_CLASS, obj); } +static Eina_Bool +_tap_timeout_cb(void *data) +{ + Efl_Canvas_Gesture_Recognizer_Tap_Data *pd = data; + + efl_gesture_state_set(pd->gesture, EFL_GESTURE_CANCELED); + efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_TAP, pd->gesture); + + return ECORE_CALLBACK_CANCEL; +} + + EOLIAN static Efl_Canvas_Gesture_Recognizer_Result -_efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_recognize(Eo *obj EINA_UNUSED, - void *pd EINA_UNUSED, - Efl_Canvas_Gesture *gesture, Efl_Object *watched EINA_UNUSED, - Efl_Canvas_Gesture_Touch *event EINA_UNUSED) +_efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_recognize(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Tap_Data *pd, + Efl_Canvas_Gesture *gesture, + Efl_Object *watched, + Efl_Canvas_Gesture_Touch *event) { double length; - Eina_Vector2 pos, dist; + Eina_Position2D pos; + Eina_Vector2 dist; Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_CANCEL; + Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); + + pd->target = watched; + pd->gesture = gesture; switch (efl_gesture_touch_state_get(event)) { @@ -25,18 +48,31 @@ _efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_recognize(Eo *o { pos = efl_gesture_touch_start_point_get(event); efl_gesture_hotspot_set(gesture, pos); + + if (pd->timeout) + ecore_timer_del(pd->timeout); + pd->timeout = ecore_timer_add(EFL_GESTURE_TAP_TIME_OUT, _tap_timeout_cb, pd); + result = EFL_GESTURE_TRIGGER; + break; } + case EFL_GESTURE_TOUCH_UPDATE: case EFL_GESTURE_TOUCH_END: { + if (pd->timeout) + { + ecore_timer_del(pd->timeout); + pd->timeout = NULL; + } + if (efl_gesture_state_get(gesture) != EFL_GESTURE_NONE && !efl_gesture_touch_multi_touch_get(event)) { dist = efl_gesture_touch_distance(event, 0); length = fabs(dist.x) + fabs(dist.y); - if (length <= 50) // FIXME config! + if (length <= rd->finger_size) { if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_END) result = EFL_GESTURE_FINISH; @@ -44,11 +80,15 @@ _efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_recognize(Eo *o result = EFL_GESTURE_TRIGGER; } } + break; } + default: + break; } + return result; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.eo index 65ae8c0c10..d7aabc7cdb 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.eo @@ -1,10 +1,9 @@ class @beta Efl.Canvas.Gesture_Recognizer_Tap extends Efl.Canvas.Gesture_Recognizer { [[EFL Gesture Recognizer Tap class]] - data: null; c_prefix: efl_gesture_recognizer_tap; implements { - Efl.Canvas.Gesture_Recognizer.create; + Efl.Canvas.Gesture_Recognizer.add; Efl.Canvas.Gesture_Recognizer.recognize; } } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c new file mode 100644 index 0000000000..cd54d45886 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c @@ -0,0 +1,191 @@ +#include "efl_canvas_gesture_private.h" + +#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_TRIPLE_TAP_CLASS + +#define TAP_TIME_OUT 0.33 + +EOLIAN static Efl_Canvas_Gesture * +_efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_add(Eo *obj, Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *pd EINA_UNUSED, Efl_Object *target EINA_UNUSED) +{ + return efl_add(EFL_CANVAS_GESTURE_TRIPLE_TAP_CLASS, obj); +} + +EOLIAN static void +_efl_canvas_gesture_recognizer_triple_tap_efl_object_destructor(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *pd) +{ + if (pd->timeout) + ecore_timer_del(pd->timeout); + + efl_destructor(efl_super(obj, MY_CLASS)); +} + +static Eina_Bool +_tap_timeout_cb(void *data) +{ + Efl_Canvas_Gesture_Recognizer_Data *rd; + Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *pd; + + rd = efl_data_scope_get(data, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); + pd = efl_data_scope_get(data, EFL_CANVAS_GESTURE_RECOGNIZER_TRIPLE_TAP_CLASS); + + efl_gesture_state_set(pd->gesture, EFL_GESTURE_CANCELED); + efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_TRIPLE_TAP, pd->gesture); + + efl_gesture_manager_gesture_clean_up(rd->manager, pd->target, EFL_EVENT_GESTURE_TRIPLE_TAP); + + pd->timeout = NULL; + pd->tap_count = 0; + + return ECORE_CALLBACK_CANCEL; +} + +EOLIAN static Efl_Canvas_Gesture_Recognizer_Result +_efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_recognize(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *pd, + Efl_Canvas_Gesture *gesture, Efl_Object *watched, + Efl_Canvas_Gesture_Touch *event) +{ + double length; + double timeout = TAP_TIME_OUT; + Eina_Position2D pos; + Eina_Vector2 dist; + Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_CANCEL; + Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); + + pd->target = watched; + pd->gesture = gesture; + + if (!pd->start_timeout) + { + double time; + Eina_Value *val = efl_gesture_recognizer_config_get(obj, "glayer_doublee_tap_timeout"); + + if (val) + { + eina_value_get(val, &time); + pd->start_timeout = timeout = time; + } + } + else + timeout = pd->start_timeout; + + switch (efl_gesture_touch_state_get(event)) + { + case EFL_GESTURE_TOUCH_BEGIN: + { + pos = efl_gesture_touch_start_point_get(event); + efl_gesture_hotspot_set(gesture, pos); + + if (pd->timeout) + ecore_timer_reset(pd->timeout); + else + pd->timeout = ecore_timer_add(timeout, _tap_timeout_cb, obj); + + result = EFL_GESTURE_TRIGGER; + + break; + } + + case EFL_GESTURE_TOUCH_UPDATE: + { + result = EFL_GESTURE_IGNORE; + + if (efl_gesture_state_get(gesture) != EFL_GESTURE_NONE && + !efl_gesture_touch_multi_touch_get(event)) + { + dist = efl_gesture_touch_distance(event, 0); + length = fabs(dist.x) + fabs(dist.y); + + if (length > rd->finger_size) + { + if (pd->timeout) + { + ecore_timer_del(pd->timeout); + pd->timeout = NULL; + } + + result = EFL_GESTURE_CANCEL; + + pd->tap_count = 0; + } + } + + break; + } + case EFL_GESTURE_TOUCH_END: + { + + if (efl_gesture_state_get(gesture) != EFL_GESTURE_NONE && + !efl_gesture_touch_multi_touch_get(event)) + { + dist = efl_gesture_touch_distance(event, 0); + length = fabs(dist.x) + fabs(dist.y); + + if (length <= rd->finger_size) + { + pd->tap_count++; + if (pd->tap_count < 3) + { + if (pd->timeout) + ecore_timer_reset(pd->timeout); + + result = EFL_GESTURE_TRIGGER; + } + else + { + if (pd->timeout) + { + ecore_timer_del(pd->timeout); + pd->timeout = NULL; + } + + if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_END) + result = EFL_GESTURE_FINISH; + else + result = EFL_GESTURE_TRIGGER; + + pd->tap_count = 0; + } + } + else + { + if (pd->timeout) + { + ecore_timer_del(pd->timeout); + pd->timeout = NULL; + } + + result = EFL_GESTURE_CANCEL; + + pd->tap_count = 0; + } + } + + break; + } + + default: + + break; + } + + return result; +} + +EOLIAN static double +_efl_canvas_gesture_recognizer_triple_tap_timeout_get(const Eo *obj EINA_UNUSED, + Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *pd) +{ + return pd->start_timeout; +} + +EOLIAN static void +_efl_canvas_gesture_recognizer_triple_tap_timeout_set(Eo *obj EINA_UNUSED, + Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *pd, + double time) +{ + pd->start_timeout = time; +} + +#include "efl_canvas_gesture_recognizer_triple_tap.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.eo new file mode 100644 index 0000000000..2ed02bb047 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.eo @@ -0,0 +1,22 @@ +class @beta Efl.Canvas.Gesture_Recognizer_Triple_Tap extends Efl.Canvas.Gesture_Recognizer +{ + [[EFL Gesture Recognizer Triple Tap class]] + c_prefix: efl_gesture_recognizer_triple_tap; + methods { + @property timeout { + [[Sets the time between taps to be recognized as a double tap.]] + set { + } + get { + } + values { + time: double; [[Time value.]] + } + } + } + implements { + Efl.Object.destructor; + Efl.Canvas.Gesture_Recognizer.add; + Efl.Canvas.Gesture_Recognizer.recognize; + } +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c new file mode 100644 index 0000000000..190e476312 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c @@ -0,0 +1,275 @@ +#include "efl_canvas_gesture_private.h" + +#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_ZOOM_CLASS + +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, + Evas_Coord xx1, + Evas_Coord yy1, + Evas_Coord xx2, + Evas_Coord yy2, + double zoom_finger_factor) +{ + double rt = 1.0; + //TODO: Enable below code if the zoom momentum is need + //unsigned int tm_end = (pd->zoom_mv.cur.timestamp > pd->zoom_mv1.cur.timestamp) ? + // pd->zoom_mv.cur.timestamp : pd->zoom_mv1.cur.timestamp; + + int x,y; //Hot spot + Evas_Coord diam = _finger_gap_length_get(xx1, yy1, xx2, yy2, + &x, &y); + + zd->radius = diam / 2; + + if (!pd->zoom_base) + { + pd->zoom_base = diam; + return zd->zoom; + } + + if (pd->zoom_distance_tolerance) /* zoom tolerance <> ZERO, means + * zoom action NOT started yet */ + { + /* avoid jump with zoom value when break tolerance */ + if (diam < (pd->zoom_base - pd->zoom_distance_tolerance)) + { + pd->zoom_base -= pd->zoom_distance_tolerance; + pd->zoom_distance_tolerance = 0; + } + + /* avoid jump with zoom value when break tolerance */ + if (diam > (pd->zoom_base + pd->zoom_distance_tolerance)) + { + pd->zoom_base += pd->zoom_distance_tolerance; + pd->zoom_distance_tolerance = 0; + } + + return rt; + } + + /* We use factor only on the difference between gap-base */ + /* if gap=120, base=100, we get ((120-100)/100)=0.2*factor */ + rt = ((1.0) + ((((float)diam - (float)pd->zoom_base) / + (float)pd->zoom_base) * zoom_finger_factor)); + + //TODO: Enable below code if the zoom momentum is need + /* Momentum: zoom per second: */ + //zd->momentum = _zoom_momentum_get(st, tm_end, rt); + + return rt; +} + +EOLIAN static Efl_Canvas_Gesture * +_efl_canvas_gesture_recognizer_zoom_efl_canvas_gesture_recognizer_add(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd EINA_UNUSED, + Efl_Object *target EINA_UNUSED) +{ + return efl_add(EFL_CANVAS_GESTURE_ZOOM_CLASS, obj); +} + +EOLIAN static Efl_Canvas_Gesture_Recognizer_Result +_efl_canvas_gesture_recognizer_zoom_efl_canvas_gesture_recognizer_recognize(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd, + Efl_Canvas_Gesture *gesture, + Efl_Object *watched, + Efl_Canvas_Gesture_Touch *event) +{ + int id1 = 0; + int id2 = 1; + Eina_Value *val; + unsigned char zoom_finger_enable; + unsigned char glayer_continues_enable; + Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_CANCEL; + Efl_Canvas_Gesture_Zoom_Data *zd = efl_data_scope_get(gesture, EFL_CANVAS_GESTURE_ZOOM_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); + + //FIXME: Wheel zoom test first here. + + val = efl_gesture_recognizer_config_get(obj, "glayer_continues_enable"); + if (val) eina_value_get(val, &glayer_continues_enable); + else glayer_continues_enable = 1; + + val = efl_gesture_recognizer_config_get(obj, "glayer_zoom_finger_enable"); + if (val) eina_value_get(val, &zoom_finger_enable); + else zoom_finger_enable = 1; + + val = efl_gesture_recognizer_config_get(obj, "glayer_zoom_finger_factor"); + if (val) eina_value_get(val, &pd->zoom_finger_factor); + else pd->zoom_finger_factor = 1.0; + + rd->continues = EINA_TRUE; + + if (!pd->zoom_distance_tolerance && !pd->calc_temp) + { + pd->calc_temp = EINA_TRUE; + val = efl_gesture_recognizer_config_get(obj, "glayer_zoom_distance_tolerance"); + if (val) eina_value_get(val, &pd->zoom_distance_tolerance); + else pd->zoom_distance_tolerance = 1.0; + + pd->zoom_distance_tolerance *= rd->finger_size; + } + + switch (efl_gesture_touch_state_get(event)) + { + case EFL_GESTURE_TOUCH_UPDATE: + { + if ((!glayer_continues_enable) && (!pd->zoom_st.cur.timestamp)) + { + return EFL_GESTURE_IGNORE; + } + EINA_FALLTHROUGH; + } + case EFL_GESTURE_TOUCH_BEGIN: + { + if (td->touch_down > 2) + { + return EFL_GESTURE_CANCEL; + } + + if (!pd->zoom_st.cur.timestamp) /* Now scan touched-devices list + * and find other finger */ + { + if (!efl_gesture_touch_multi_touch_get(event)) + return EFL_GESTURE_IGNORE; + + Pointer_Data *p1 = eina_hash_find(td->touch_points, &id1); + Pointer_Data *p2 = eina_hash_find(td->touch_points, &id2); + + memcpy(&pd->zoom_st, p2, sizeof(Pointer_Data)); + memcpy(&pd->zoom_st1, p1, sizeof(Pointer_Data)); + + memcpy(&pd->zoom_mv, p2, sizeof(Pointer_Data)); + memcpy(&pd->zoom_mv1, p1, sizeof(Pointer_Data)); + + int x,y; //Hot spot + zd->zoom = 1.0; + pd->zoom_base = _finger_gap_length_get(pd->zoom_st1.cur.pos.x, + pd->zoom_st1.cur.pos.y, + pd->zoom_st.cur.pos.x, + pd->zoom_st.cur.pos.y, + &x, &y); + + zd->radius = pd->zoom_base / 2; + + if ((efl_gesture_state_get(gesture) != EFL_GESTURE_STARTED) && + (efl_gesture_state_get(gesture) != EFL_GESTURE_UPDATED)) + return EFL_GESTURE_TRIGGER; + + return EFL_GESTURE_CANCEL; + } + + Pointer_Data *p2 = eina_hash_find(td->touch_points, &id2); + if (p2->id == pd->zoom_mv.id) + memcpy(&pd->zoom_mv, p2, sizeof(Pointer_Data)); + else if (p2->id == pd->zoom_mv1.id) + memcpy(&pd->zoom_mv1, p2, sizeof(Pointer_Data)); + + zd->zoom = _zoom_compute(pd, zd, pd->zoom_mv.cur.pos.x, + pd->zoom_mv.cur.pos.y, pd->zoom_mv1.cur.pos.x, + pd->zoom_mv1.cur.pos.y, pd->zoom_finger_factor); + + + if (!pd->zoom_distance_tolerance) + { + double d = zd->zoom - pd->next_step; + + if (d < 0.0) d = (-d); + + if (d >= pd->zoom_step) + { + pd->next_step = zd->zoom; + + return EFL_GESTURE_TRIGGER; + } + } + + return EFL_GESTURE_IGNORE; + } + case EFL_GESTURE_TOUCH_END: + { + if (td->touch_down == 0) + { + rd->continues = EINA_FALSE; + + memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Zoom_Data)); + efl_gesture_manager_gesture_clean_up(rd->manager, watched, EFL_EVENT_GESTURE_ZOOM); + + return EFL_GESTURE_IGNORE; + } + if ((pd->zoom_base) && (pd->zoom_distance_tolerance == 0)) + { + memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Zoom_Data)); + + return EFL_GESTURE_FINISH; + } + + if (efl_gesture_state_get(gesture) != EFL_GESTURE_NONE) + { + memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Zoom_Data)); + + return EFL_GESTURE_CANCEL; + } + } + + default: + + break; + } + + return result; +} + +#include "efl_canvas_gesture_recognizer_zoom.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.eo new file mode 100644 index 0000000000..350614c50c --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.eo @@ -0,0 +1,9 @@ +class @beta Efl.Canvas.Gesture_Recognizer_Zoom extends Efl.Canvas.Gesture_Recognizer +{ + [[EFL Gesture Recognizer Zoom class]] + c_prefix: efl_gesture_recognizer_zoom; + implements { + Efl.Canvas.Gesture_Recognizer.add; + Efl.Canvas.Gesture_Recognizer.recognize; + } +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_tap.c index aca24a9dbd..d777bebba1 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_tap.c @@ -2,9 +2,8 @@ #define MY_CLASS EFL_CANVAS_GESTURE_TAP_CLASS - EOLIAN static Efl_Object * -_efl_canvas_gesture_tap_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Tap_Data *pd EINA_UNUSED) +_efl_canvas_gesture_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) { Efl_Canvas_Gesture_Data *gd; diff --git a/src/lib/evas/gesture/efl_canvas_gesture_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_tap.eo index a994b90abe..bd6daba234 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_tap.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_tap.eo @@ -1,11 +1,8 @@ class @beta Efl.Canvas.Gesture_Tap extends Efl.Canvas.Gesture { [[EFL Gesture Tap class]] + data: null; c_prefix: efl_gesture_tap; - event_prefix: efl; - events { - gesture,tap: Efl.Canvas.Gesture; [[Event for tap gesture]] - } implements { Efl.Object.constructor; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_touch.c b/src/lib/evas/gesture/efl_canvas_gesture_touch.c index 9f997f59e6..4a5f5ca422 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_touch.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_touch.c @@ -2,29 +2,9 @@ #define MY_CLASS EFL_CANVAS_GESTURE_TOUCH_CLASS -typedef struct _Pointer_Data -{ - struct - { - Eina_Vector2 pos; - double timestamp; - } start, prev, cur; - Efl_Pointer_Action action; -} Pointer_Data; - -typedef struct _Efl_Canvas_Gesture_Touch_Data -{ - Efl_Canvas_Gesture_Touch_State state; - Eina_Hash *touch_points; - int touch_down; - Eina_Bool multi_touch; - Eo *target; -} Efl_Canvas_Gesture_Touch_Data; - - -// This event object accumulates all the touch points -// that are directed to a particular object from the -// first finger down to the last finger up +//This event object accumulates all the touch points +//that are directed to a particular object from the +//first finger down to the last finger up static void _hash_free_cb(Pointer_Data *point) { @@ -63,40 +43,52 @@ _efl_canvas_gesture_touch_state_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gestur EOLIAN static void _efl_canvas_gesture_touch_point_record(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd, - int id, Eina_Vector2 pos, double timestamp, Efl_Pointer_Action action) + int id, Eina_Vector2 pos, unsigned int timestamp, Efl_Pointer_Action action) { Pointer_Data *point = eina_hash_find(pd->touch_points, &id); + Eina_Position2D _pos = { pos.x, pos.y }; if (action == EFL_POINTER_ACTION_DOWN) - pd->touch_down++; + { + pd->touch_down++; + //TODO: Need to handle 2 or more case. + if (pd->touch_down == 2) + pd->multi_touch = EINA_TRUE; + } else if ((action == EFL_POINTER_ACTION_UP) || (action == EFL_POINTER_ACTION_CANCEL)) - pd->touch_down--; - EINA_SAFETY_ON_FALSE_GOTO(pd->touch_down >= 0, bad_fingers); + { + pd->touch_down--; + if (pd->multi_touch && pd->touch_down == 1) + pd->multi_touch = EINA_FALSE; + } + + if (pd->touch_down < 0) goto finished_touch; if (point) { - // the point already exists. update the cur and prev point + //The point already exists. update the cur and prev point point->prev = point->cur; - point->cur.pos = pos; + point->cur.pos = _pos; point->cur.timestamp = timestamp; } else { - // new finger + //New finger if (!id && (action != EFL_POINTER_ACTION_DOWN)) { - // discard any other event + //Discard any other event return; } point = calloc(1, sizeof(Pointer_Data)); if (!point) return; - point->start.pos = point->prev.pos = point->cur.pos = pos; + point->start.pos = point->prev.pos = point->cur.pos = _pos; point->start.timestamp = point->prev.timestamp = point->cur.timestamp = timestamp; + point->id = id; - // add to the hash + //Add to the hash eina_hash_add(pd->touch_points, &id, point); - // FIXME: finger_list was broken + //FIXME: finger_list was broken if (id) pd->multi_touch = EINA_TRUE; } @@ -106,7 +98,7 @@ _efl_canvas_gesture_touch_point_record(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_T { pd->state = EFL_GESTURE_TOUCH_BEGIN; } - else if ((action == EFL_POINTER_ACTION_UP) && (pd->touch_down == 0)) + else if (action == EFL_POINTER_ACTION_UP) { pd->state = EFL_GESTURE_TOUCH_END; } @@ -116,8 +108,7 @@ _efl_canvas_gesture_touch_point_record(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_T } return; -bad_fingers: - ERR("Inconsistent touch events received!"); +finished_touch: _touch_points_reset(pd); } @@ -127,12 +118,12 @@ _efl_canvas_gesture_touch_multi_touch_get(const Eo *obj EINA_UNUSED, Efl_Canvas_ return pd->multi_touch; } -EOLIAN static Eina_Vector2 +EOLIAN static Eina_Position2D _efl_canvas_gesture_touch_start_point_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd) { int tool = 0; Pointer_Data *point = eina_hash_find(pd->touch_points, &tool); - Eina_Vector2 vec = { 0, 0 }; + Eina_Position2D vec = { 0, 0 }; if (!point) return vec; @@ -140,16 +131,43 @@ _efl_canvas_gesture_touch_start_point_get(const Eo *obj EINA_UNUSED, Efl_Canvas_ return point->start.pos; } +EOLIAN static Eina_Position2D +_efl_canvas_gesture_touch_cur_point_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd) +{ + int tool = 0; + Pointer_Data *point = eina_hash_find(pd->touch_points, &tool); + Eina_Position2D vec = { 0, 0 }; + + if (!point) + return vec; + + return point->cur.pos; +} + +EOLIAN static unsigned int +_efl_canvas_gesture_touch_cur_timestamp_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd) +{ + int tool = 0; + Pointer_Data *point = eina_hash_find(pd->touch_points, &tool); + + if (!point) + return 0; + + return point->cur.timestamp; +} + EOLIAN static Eina_Vector2 _efl_canvas_gesture_touch_delta(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd, int tool) { Pointer_Data *point = eina_hash_find(pd->touch_points, &tool); Eina_Vector2 vec = { 0, 0 }; + Eina_Vector2 v1 = { point->cur.pos.x, point->cur.pos.y }; + Eina_Vector2 v2 = { point->prev.pos.x, point->prev.pos.y }; if (!point) return vec; - eina_vector2_subtract(&vec, &point->cur.pos, &point->prev.pos); + eina_vector2_subtract(&vec, &v1, &v2); return vec; } @@ -158,11 +176,13 @@ _efl_canvas_gesture_touch_distance(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture { Pointer_Data *point = eina_hash_find(pd->touch_points, &tool); Eina_Vector2 vec = { 0, 0 }; + Eina_Vector2 v1 = { point->cur.pos.x, point->cur.pos.y }; + Eina_Vector2 v2 = { point->start.pos.x, point->start.pos.y }; if (!point) return vec; - eina_vector2_subtract(&vec, &point->cur.pos, &point->start.pos); + eina_vector2_subtract(&vec, &v1, &v2); return vec; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_touch.eo b/src/lib/evas/gesture/efl_canvas_gesture_touch.eo index 4109b47de4..8b78e192de 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_touch.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_touch.eo @@ -13,7 +13,7 @@ class @beta Efl.Canvas.Gesture_Touch extends Efl.Object params { @in tool : int; [[The finger id ]] @in pos : Eina.Vector2; [[Position of the event]] - @in timestamp : double; [[The timestamp of the event]] + @in timestamp : uint; [[The timestamp of the event]] @in action : Efl.Pointer.Action; [[action of the event]] } } @@ -36,7 +36,21 @@ class @beta Efl.Canvas.Gesture_Touch extends Efl.Object [[Returns the first touch point.]] get {} values { - pos: Eina.Vector2; [[The start position.]] + pos: Eina.Position2D; [[The start position.]] + } + } + @property cur_point { + [[Returns the current touch point.]] + get {} + values { + pos: Eina.Position2D; [[The current position.]] + } + } + @property cur_timestamp { + [[Returns the timestamp.]] + get {} + values { + time: uint; [[The timestamp.]] } } @property multi_touch { diff --git a/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c new file mode 100644 index 0000000000..5a6bb2f126 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c @@ -0,0 +1,18 @@ +#include "efl_canvas_gesture_private.h" + +#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" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.eo new file mode 100644 index 0000000000..bab59c68fa --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.eo @@ -0,0 +1,9 @@ +class @beta Efl.Canvas.Gesture_Triple_Tap extends Efl.Canvas.Gesture +{ + [[EFL Gesture Triple Tap class]] + data: null; + c_prefix: efl_gesture_triple_tap; + implements { + Efl.Object.constructor; + } +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_types.eot b/src/lib/evas/gesture/efl_canvas_gesture_types.eot index 8be4528405..96a2ff6293 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_types.eot +++ b/src/lib/evas/gesture/efl_canvas_gesture_types.eot @@ -31,3 +31,16 @@ enum @beta Efl.Canvas.Gesture_Recognizer_Result cancel = 0x0010, [[The event made it clear that it is not a gesture. If the gesture recognizer was in Triggered state before, then the gesture is canceled.]] result_mask = 0x00ff, [[The gesture result mask]] } + +enum @beta Efl.Canvas.Gesture_Recognizer_Type +{ + [[ This enum type describes the state of a touch event. ]] + legacy: efl_gesture; + tap = 0, + doubleTap, + tripleTap, + longTap, + momentum, + flick, + zoom, +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_zoom.c b/src/lib/evas/gesture/efl_canvas_gesture_zoom.c new file mode 100644 index 0000000000..3ac4ffcbf4 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_zoom.c @@ -0,0 +1,35 @@ +#include "efl_canvas_gesture_private.h" + +#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(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Zoom_Data *pd) +{ + return pd->radius; +} + +EOLIAN static double +_efl_canvas_gesture_zoom_zoom_get(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Zoom_Data *pd) +{ + return pd->zoom; +} + +#include "efl_canvas_gesture_zoom.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_zoom.eo b/src/lib/evas/gesture/efl_canvas_gesture_zoom.eo new file mode 100644 index 0000000000..1cb7f7d48b --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_zoom.eo @@ -0,0 +1,19 @@ +class @beta Efl.Canvas.Gesture_Zoom extends Efl.Canvas.Gesture +{ + [[EFL Gesture Zoom class]] + c_prefix: efl_gesture_zoom; + methods { + radius_get { + [[Gets zoom center point reported to user]] + return: double; [[The radius value]] + } + zoom_get { + [[Gets zoom value. (1.0 means no zoom)]] + return: double; [[The zoom value]] + } + } + implements { + Efl.Object.constructor; + Efl.Object.destructor; + } +} diff --git a/src/lib/evas/gesture/efl_gesture_events.eo b/src/lib/evas/gesture/efl_gesture_events.eo new file mode 100644 index 0000000000..376b51ef4b --- /dev/null +++ b/src/lib/evas/gesture/efl_gesture_events.eo @@ -0,0 +1,13 @@ +interface @beta Efl.Gesture.Events +{ + event_prefix: efl; + events { + gesture,tap: Efl.Canvas.Gesture_Tap; [[Event for tap gesture]] + gesture,double_tap: Efl.Canvas.Gesture_Double_Tap; [[Event for double tap gesture]] + gesture,triple_tap: Efl.Canvas.Gesture_Triple_Tap; [[Event for triple tap gesture]] + gesture,long_tap: Efl.Canvas.Gesture_Long_Tap; [[Event for long tap gesture]] + gesture,momentum: Efl.Canvas.Gesture_Momentum; [[Event for momentum gesture]] + gesture,flick: Efl.Canvas.Gesture_Flick; [[Event for flick gesture]] + gesture,zoom: Efl.Canvas.Gesture_Zoom; [[Event for zoom gesture]] + } +} diff --git a/src/lib/evas/gesture/meson.build b/src/lib/evas/gesture/meson.build index 3765a0b67d..3c7847aeac 100644 --- a/src/lib/evas/gesture/meson.build +++ b/src/lib/evas/gesture/meson.build @@ -2,9 +2,22 @@ pub_eo_files = [ 'efl_canvas_gesture_touch.eo', 'efl_canvas_gesture.eo', '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_momentum.eo', + 'efl_canvas_gesture_flick.eo', + 'efl_canvas_gesture_zoom.eo', 'efl_canvas_gesture_recognizer.eo', - 'efl_canvas_gesture_manager.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_momentum.eo', + 'efl_canvas_gesture_recognizer_flick.eo', + 'efl_canvas_gesture_recognizer_zoom.eo', + 'efl_canvas_gesture_manager.eo', + 'efl_gesture_events.eo' ] evas_gesture_eo_files = pub_eo_files @@ -16,28 +29,7 @@ foreach eo_file : pub_eo_files depfile : eo_file + '.d', install : true, install_dir : join_paths(dir_package_include, 'gesture'), - command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, - '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), - '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), - '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), - '-gchd', '@INPUT@']) -endforeach - -pub_evas_eo_files += files(pub_eo_files) - -pub_eo_files = [ - 'efl_canvas_gesture_recognizer_tap.eo', - 'efl_canvas_gesture_recognizer_long_tap.eo' -] - -foreach eo_file : pub_eo_files - pub_eo_file_target += custom_target('eolian_gen_' + eo_file, - input : eo_file, - output : [eo_file + '.h'], - depfile : eo_file + '.d', - install : false, - install_dir : join_paths(dir_package_include, 'gesture'), - command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, + command : [eolian_gen, '-I', meson.current_source_dir(), eolian_include_directories, '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), @@ -59,7 +51,7 @@ foreach eo_file : pub_eo_types_files depfile : eo_file + '.d', install : true, install_dir : join_paths(dir_package_include, 'gesture'), - command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, + command : [eolian_gen, '-I', meson.current_source_dir(), eolian_include_directories, '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), '-ghd', '@INPUT@']) @@ -69,10 +61,20 @@ evas_src += files([ 'efl_canvas_gesture_touch.c', 'efl_canvas_gesture.c', '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_momentum.c', + 'efl_canvas_gesture_flick.c', + 'efl_canvas_gesture_zoom.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_momentum.c', + 'efl_canvas_gesture_recognizer_flick.c', + 'efl_canvas_gesture_recognizer_zoom.c', 'efl_canvas_gesture_manager.c', ]) From 7f907ecd9d6152753619967b3b7e2033f69abb28 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Tue, 14 May 2019 08:51:05 +0200 Subject: [PATCH 18/53] efl-mono: Use Efl.Ui.Win API instead of Elm.Policy Summary: This removes another bit of legacy API from the C# bindings. This also reverts "elm: Put back Policy and Policy_Quit in EO files" (a9132a9a66955608e913bb1228e4adb371310b09) so that these two Elm enums are definitely out of the EO files. Test Plan: Everything, including mono bindings, continue to build. At runtime, C# apps still exit when all windows are closed. Reviewers: lauromoura, vitor.sousa, q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8890 --- src/bindings/mono/efl_mono/efl_all.cs | 3 +- .../mono/efl_mono/efl_csharp_application.cs | 2 +- src/lib/elementary/elm_general.eot | 27 -------------- src/lib/elementary/elm_general.h | 35 +++++++++++++++++++ 4 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/bindings/mono/efl_mono/efl_all.cs b/src/bindings/mono/efl_mono/efl_all.cs index 873bd67e48..48a79b5a3a 100644 --- a/src/bindings/mono/efl_mono/efl_all.cs +++ b/src/bindings/mono/efl_mono/efl_all.cs @@ -23,7 +23,6 @@ static class UnsafeNativeMethods private static Efl.Eo.FunctionWrapper _evas_init; [DllImport(efl.Libs.Evas)] public static extern void evas_shutdown(); [DllImport(efl.Libs.Elementary)] public static extern int elm_init(int argc, IntPtr argv); - [DllImport(efl.Libs.Elementary)] public static extern void elm_policy_set(int policy, int policy_detail); [DllImport(efl.Libs.Elementary)] public static extern void elm_shutdown(); [DllImport(efl.Libs.Elementary)] public static extern void elm_run(); [DllImport(efl.Libs.Elementary)] public static extern void elm_exit(); @@ -117,7 +116,7 @@ public static class Config #endif elm_init(0, IntPtr.Zero); - elm_policy_set((int)Elm.Policy.Quit, (int)Elm.PolicyQuit.LastWindowHidden); + Efl.Ui.Win.ExitOnAllWindowsClosed = new Eina.Value(0); } public static void Shutdown() diff --git a/src/bindings/mono/efl_mono/efl_csharp_application.cs b/src/bindings/mono/efl_mono/efl_csharp_application.cs index 1e63d62c4a..ea29376c6c 100644 --- a/src/bindings/mono/efl_mono/efl_csharp_application.cs +++ b/src/bindings/mono/efl_mono/efl_csharp_application.cs @@ -61,7 +61,7 @@ public abstract class Application #endif elm_init(0, IntPtr.Zero); - elm_policy_set((int)Elm.Policy.Quit, (int)Elm.PolicyQuit.LastWindowHidden); + Efl.Ui.Win.ExitOnAllWindowsClosed = new Eina.Value(0); } initComponent = component; diff --git a/src/lib/elementary/elm_general.eot b/src/lib/elementary/elm_general.eot index f76866459f..12d800b11a 100644 --- a/src/lib/elementary/elm_general.eot +++ b/src/lib/elementary/elm_general.eot @@ -2,33 +2,6 @@ * NOTE: Some of those types still need to be moved to Efl.Ui */ -enum Elm.Policy -{ - [[Policy identifiers.]] - quit, [[under which circumstances the application should quit automatically. - See also @Elm.Policy.quit.]] - exit, [[defines elm_exit() behaviour. See also @Elm.Policy.exit. - - @since 1.8 - ]] - throttle, [[defines how throttling should work. See also @Elm.Policy.throttle - - @since 1.8 - ]] - last [[Sentinel value to indicate last enum field during iteration]] -} - -/* FIXME: elm_policy API is not bound to EO */ -enum Elm.Policy_Quit -{ - [[Possible values for the @Elm.Policy.quit policy]] - none = 0, [[never quit the application automatically]] - last_window_closed, [[quit when the application's last window is closed]] - last_window_hidden [[quit when the application's last window is hidden - - @since 1.14]] -} - /* Legacy-only function pointer types, for the legacy EO classes (genlist, etc...) */ type Evas_Smart_Cb: __undefined_type; [[Evas smart callback type]] diff --git a/src/lib/elementary/elm_general.h b/src/lib/elementary/elm_general.h index cc4fba4c19..4ee178b4df 100644 --- a/src/lib/elementary/elm_general.h +++ b/src/lib/elementary/elm_general.h @@ -32,6 +32,41 @@ typedef struct _Elm_Event_Policy_Changed int old_value; /**< new value the policy got */ } Elm_Event_Policy_Changed; +/** Policy identifiers. + * + * @ingroup Elm + */ +typedef enum +{ + ELM_POLICY_QUIT = 0, /**< under which circumstances the application should + * quit automatically. See also @ref ELM_POLICY_QUIT. */ + ELM_POLICY_EXIT, /**< defines elm_exit() behaviour. See also + * @ref ELM_POLICY_EXIT. + * + * @since 1.8 */ + ELM_POLICY_THROTTLE, /**< defines how throttling should work. See also + * @ref ELM_POLICY_THROTTLE + * + * @since 1.8 */ + ELM_POLICY_LAST /**< Sentinel value to indicate last enum field during + * iteration */ +} Elm_Policy; + +/** Possible values for the @ref ELM_POLICY_QUIT policy + * + * @ingroup Elm + */ +typedef enum +{ + ELM_POLICY_QUIT_NONE = 0, /**< never quit the application automatically */ + ELM_POLICY_QUIT_LAST_WINDOW_CLOSED, /**< quit when the application's last + * window is closed */ + ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN /**< quit when the application's last + * window is hidden + * + * @since 1.14 */ +} Elm_Policy_Quit; + /** Possible values for the @ref ELM_POLICY_EXIT policy. * * @since 1.8 From 64923b8db15fdaa25583824123e56f3c1083ac45 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 14 May 2019 15:50:15 -0400 Subject: [PATCH 19/53] efl_ui: move clickable from efl to efl_ui Summary: efl_ui_clickable is now a mixin. The mixin now brings two APIs the press and unpress API can be used to tell the implementation the state of the presses. Within the implementation the calls to press / unpress are then converted to longpress / clicked events. Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8820 --- src/Makefile_Efl.am | 1 - src/Makefile_Elementary.am | 4 + src/lib/efl/Efl.h | 1 - src/lib/efl/interfaces/efl_interfaces_main.c | 1 - src/lib/efl/interfaces/efl_ui_clickable.eo | 18 --- src/lib/efl/interfaces/meson.build | 1 - src/lib/elementary/Efl_Ui.h | 2 + src/lib/elementary/Elementary.h | 1 + src/lib/elementary/efl_ui_clickable.c | 120 ++++++++++++++++++ src/lib/elementary/efl_ui_clickable.eo | 47 +++++++ src/lib/elementary/efl_ui_clickable_util.c | 99 +++++++++++++++ src/lib/elementary/efl_ui_clickable_util.eo | 24 ++++ src/lib/elementary/efl_ui_image_zoomable.c | 7 +- src/lib/elementary/elm_bubble_eo.c | 2 +- src/lib/elementary/elm_colorselector_eo.c | 2 +- src/lib/elementary/elm_diskselector_eo.c | 2 +- src/lib/elementary/elm_entry_eo.c | 2 +- .../elementary/elm_fileselector_entry_eo.c | 2 +- src/lib/elementary/elm_fileselector_eo.c | 2 +- src/lib/elementary/elm_gengrid_eo.c | 2 +- src/lib/elementary/elm_genlist_eo.c | 2 +- src/lib/elementary/elm_hover_eo.c | 2 +- src/lib/elementary/elm_hoversel_eo.c | 2 +- src/lib/elementary/elm_index_eo.c | 2 +- src/lib/elementary/elm_list_eo.c | 2 +- src/lib/elementary/elm_map_eo.c | 2 +- src/lib/elementary/elm_menu_eo.c | 2 +- src/lib/elementary/elm_multibuttonentry_eo.c | 2 +- src/lib/elementary/elm_photo_eo.c | 2 +- src/lib/elementary/elm_plug_eo.c | 2 +- src/lib/elementary/elm_thumb_eo.c | 2 +- src/lib/elementary/elm_toolbar_eo.c | 2 +- src/lib/elementary/meson.build | 6 +- 33 files changed, 327 insertions(+), 43 deletions(-) delete mode 100644 src/lib/efl/interfaces/efl_ui_clickable.eo create mode 100644 src/lib/elementary/efl_ui_clickable.c create mode 100644 src/lib/elementary/efl_ui_clickable.eo create mode 100644 src/lib/elementary/efl_ui_clickable_util.c create mode 100644 src/lib/elementary/efl_ui_clickable_util.eo diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am index e9323a3195..f62bced764 100644 --- a/src/Makefile_Efl.am +++ b/src/Makefile_Efl.am @@ -7,7 +7,6 @@ efl_eolian_legacy_files = \ lib/efl/interfaces/efl_gfx_frame_controller.eo \ lib/efl/interfaces/efl_input_device.eo \ lib/efl/interfaces/efl_ui_draggable.eo \ - lib/efl/interfaces/efl_ui_clickable.eo \ lib/efl/interfaces/efl_ui_scrollable.eo \ lib/efl/interfaces/efl_ui_scrollable_interactive.eo \ lib/efl/interfaces/efl_ui_scrollbar.eo \ diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 9baaecc0ef..a67a8d9e7e 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -132,6 +132,8 @@ elm_public_eolian_files = \ lib/elementary/efl_ui_caching_factory.eo \ lib/elementary/efl_ui_widget_factory.eo \ lib/elementary/efl_ui_relative_layout.eo \ + lib/elementary/efl_ui_clickable.eo \ + lib/elementary/efl_ui_clickable_util.eo \ $(NULL) # More public files -- FIXME @@ -1211,6 +1213,8 @@ lib_elementary_libelementary_la_SOURCES = \ lib/elementary/efl_ui_exact_model.c \ lib/elementary/efl_ui_average_model.c \ lib/elementary/efl_ui_relative_layout.c \ + lib/elementary/efl_ui_clickable.c \ + lib/elementary/efl_ui_clickable_util.c \ $(NULL) diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index 9a21ee8bc3..c0651a861a 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -104,7 +104,6 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; #include "interfaces/efl_ui_range_interactive.eo.h" #include "interfaces/efl_ui_autorepeat.eo.h" #include "interfaces/efl_ui_draggable.eo.h" -#include "interfaces/efl_ui_clickable.eo.h" #include "interfaces/efl_ui_scrollable.eo.h" #include "interfaces/efl_ui_scrollbar.eo.h" #include "interfaces/efl_ui_scrollable_interactive.eo.h" diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index b3bbf4fa9b..4d7927f6f8 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -72,7 +72,6 @@ #include "interfaces/efl_ui_factory_bind.eo.c" #include "interfaces/efl_ui_draggable.eo.c" -#include "interfaces/efl_ui_clickable.eo.c" #include "interfaces/efl_ui_scrollable.eo.c" #include "interfaces/efl_ui_scrollable_interactive.eo.c" #include "interfaces/efl_ui_scrollbar.eo.c" diff --git a/src/lib/efl/interfaces/efl_ui_clickable.eo b/src/lib/efl/interfaces/efl_ui_clickable.eo deleted file mode 100644 index 97806e7501..0000000000 --- a/src/lib/efl/interfaces/efl_ui_clickable.eo +++ /dev/null @@ -1,18 +0,0 @@ -interface @beta Efl.Ui.Clickable -{ - [[Efl UI clickable interface]] - event_prefix: efl_ui; - events { - /* FIXME: Explain what are the objects passed through the event_infos */ - clicked: void; [[Called when object is clicked]] - clicked,double: void; [[Called when object receives a double click]] - clicked,triple: void; [[Called when object receives a triple click]] - clicked,right: Efl.Object; [[Called when object receives a right click]] - /* FIXME: Might be NULL */ - pressed: Efl.Object; [[Called when the object is pressed]] - /* FIXME: Might be NULL */ - unpressed: Efl.Object; [[Called when the object is no longer pressed]] - /* FIXME: Might be NULL */ - longpressed: Efl.Object; [[Called when the object receives a long press]] - } -} diff --git a/src/lib/efl/interfaces/meson.build b/src/lib/efl/interfaces/meson.build index 3efefbf4f9..d29af1cd6d 100644 --- a/src/lib/efl/interfaces/meson.build +++ b/src/lib/efl/interfaces/meson.build @@ -8,7 +8,6 @@ pub_legacy_eo_files = [ 'efl_gfx_frame_controller.eo', 'efl_input_device.eo', 'efl_ui_draggable.eo', - 'efl_ui_clickable.eo', 'efl_ui_scrollable.eo', 'efl_ui_scrollable_interactive.eo', 'efl_ui_scrollbar.eo', diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 246ebf8456..34f0549f4d 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -235,6 +235,8 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel); # include # include # include +# include +# include /** * Initialize Elementary diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h index b7e0bd678e..4fa8c3e468 100644 --- a/src/lib/elementary/Elementary.h +++ b/src/lib/elementary/Elementary.h @@ -171,6 +171,7 @@ typedef Eo Efl_Ui_Focus_Manager; #ifdef EFL_BETA_API_SUPPORT # include # include +#include #endif #include diff --git a/src/lib/elementary/efl_ui_clickable.c b/src/lib/elementary/efl_ui_clickable.c new file mode 100644 index 0000000000..ced9609e35 --- /dev/null +++ b/src/lib/elementary/efl_ui_clickable.c @@ -0,0 +1,120 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#define EFL_UI_CLICKABLE_PROTECTED 1 + +#include +#include "elm_priv.h" + +typedef struct { + Eina_Bool pressed; + int pressed_before; + Efl_Loop_Timer *timer; + double clicked_last_time; +} Button_State; + +typedef struct { + Button_State state[3]; +} Efl_Ui_Clickable_Data; + +#define MY_CLASS EFL_UI_CLICKABLE_MIXIN + +#define DOUBLE_CLICK_TIME ((double)0.1) //in seconds +#define LONGPRESS_TIMEOUT ((double)1.0) //in seconds + +static void +_timer_longpress(void *data, const Efl_Event *ev) +{ + Button_State *state; + Efl_Ui_Clickable_Data *pd = efl_data_scope_get(data, MY_CLASS); + + for (int i = 0; i < 3; ++i) + { + state = &pd->state[i]; + if (state->timer == ev->object) + { + efl_del(state->timer); + state->timer = NULL; + efl_event_callback_call(data, EFL_UI_EVENT_LONGPRESSED, &i); + } + } +} + +EOLIAN static void +_efl_ui_clickable_press(Eo *obj EINA_UNUSED, Efl_Ui_Clickable_Data *pd, unsigned int button) +{ + Button_State *state; + EINA_SAFETY_ON_FALSE_RETURN(button < 3); + + INF("Widget %s,%p is pressed(%d)", efl_class_name_get(obj), obj, button); + + state = &pd->state[button]; + EINA_SAFETY_ON_NULL_RETURN(state); + + state->pressed = EINA_TRUE; + if (state->timer) efl_del(state->timer); + state->timer = efl_add(EFL_LOOP_TIMER_CLASS, obj, + efl_loop_timer_interval_set(efl_added, LONGPRESS_TIMEOUT), + efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TIMER_TICK, _timer_longpress, obj)); + + efl_event_callback_call(obj, EFL_UI_EVENT_PRESSED, &button); +} + +EOLIAN static void +_efl_ui_clickable_unpress(Eo *obj EINA_UNUSED, Efl_Ui_Clickable_Data *pd, unsigned int button) +{ + Efl_Ui_Clickable_Clicked clicked; + Button_State *state; + Eina_Bool pressed; + EINA_SAFETY_ON_FALSE_RETURN(button < 3); + + state = &pd->state[button]; + EINA_SAFETY_ON_NULL_RETURN(state); + + INF("Widget %s,%p is unpressed(%d):%d", efl_class_name_get(obj), obj, button, state->pressed); + + //eval if this is a repeated click + if (state->clicked_last_time > 0.0 && ecore_time_unix_get() - state->clicked_last_time < DOUBLE_CLICK_TIME) + state->pressed_before++; + else + state->pressed_before = 0; + //reset state + state->clicked_last_time = ecore_time_unix_get(); + pressed = state->pressed; + state->pressed = EINA_FALSE; + if (state->timer) + efl_del(state->timer); + state->timer = NULL; + + //populate state + efl_event_callback_call(obj, EFL_UI_EVENT_UNPRESSED, &button); + if (pressed) + { + INF("Widget %s,%p is clicked(%d)", efl_class_name_get(obj), obj, button); + clicked.repeated = state->pressed_before; + clicked.button = button; + if (button == 1) + efl_event_callback_call(obj, EFL_UI_EVENT_CLICKED, &clicked); + efl_event_callback_call(obj, EFL_UI_EVENT_CLICKED_ANY, &clicked); + } +} + +EOLIAN static void +_efl_ui_clickable_button_state_reset(Eo *obj EINA_UNUSED, Efl_Ui_Clickable_Data *pd, unsigned int button) +{ + Button_State *state; + EINA_SAFETY_ON_FALSE_RETURN(button < 3); + + state = &pd->state[button]; + EINA_SAFETY_ON_NULL_RETURN(state); + + INF("Widget %s,%p is press is aborted(%d):%d", efl_class_name_get(obj), obj, button, state->pressed); + + if (state->timer) + efl_del(state->timer); + state->timer = NULL; + state->pressed = EINA_FALSE; +} + +#include "efl_ui_clickable.eo.c" diff --git a/src/lib/elementary/efl_ui_clickable.eo b/src/lib/elementary/efl_ui_clickable.eo new file mode 100644 index 0000000000..de3a3e4fb1 --- /dev/null +++ b/src/lib/elementary/efl_ui_clickable.eo @@ -0,0 +1,47 @@ +struct Efl.Ui.Clickable_Clicked { + [[A struct that expresses a click in elementary.]] + repeated : int; [[The amount of how often the clicked event was repeated in a certain amount of time]] + button : int; [[The Button that is pressed]] +} + +mixin @beta Efl.Ui.Clickable +{ + [[Efl UI clickable interface]] + event_prefix: efl_ui; + methods { + press @protected { + [[Change internal states that a button got pressed. + + When the button is already pressed, this is silently ignored. + ]] + params { + button : uint; [[The number of the button. FIXME ensure to have the right interval of possible input]] + } + } + unpress @protected { + [[Change internal states that a button got unpressed. + + When the button is not pressed, this is silently ignored. + ]] + params { + button : uint; [[The number of the button. FIXME ensure to have the right interval of possible input]] + } + } + button_state_reset @protected { + [[This aborts the internal state after a press call. + + This will stop the timer for longpress. And set the state of the clickable mixin back into the unpressed state. + ]] + params { + button : uint; + } + } + } + events { + clicked: Efl.Ui.Clickable_Clicked; [[Called when object is in sequence pressed and unpressed, by the primary button]] + clicked,any : Efl.Ui.Clickable_Clicked; [[Called when object is in sequence pressed and unpressed by any button. The button that triggered the event can be found in the event information.]] + pressed: int; [[Called when the object is pressed, event_info is the button that got pressed]] + unpressed: int; [[Called when the object is no longer pressed, event_info is the button that got pressed]] + longpressed: int; [[Called when the object receives a long press, event_info is the button that got pressed]] + } +} diff --git a/src/lib/elementary/efl_ui_clickable_util.c b/src/lib/elementary/efl_ui_clickable_util.c new file mode 100644 index 0000000000..b11e0c50e2 --- /dev/null +++ b/src/lib/elementary/efl_ui_clickable_util.c @@ -0,0 +1,99 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#define EFL_UI_CLICKABLE_PROTECTED 1 + +#include +#include "elm_priv.h" + +typedef struct { + +} Efl_Ui_Clickable_Util_Data; + +static void +_on_press_cb(void *data, + Evas_Object *obj EINA_UNUSED, + const char *emission EINA_UNUSED, + const char *source EINA_UNUSED) +{ + efl_ui_clickable_press(data, 1); +} + +static void +_on_unpress_cb(void *data, + Evas_Object *obj EINA_UNUSED, + const char *emission EINA_UNUSED, + const char *source EINA_UNUSED) +{ + efl_ui_clickable_unpress(data, 1); +} + +static void +_on_mouse_out(void *data, + Evas_Object *obj EINA_UNUSED, + const char *emission EINA_UNUSED, + const char *source EINA_UNUSED) +{ + efl_ui_clickable_button_state_reset(data, 1); +} + +EOLIAN static void +_efl_ui_clickable_util_bind_to_theme(Efl_Canvas_Layout *object, Efl_Ui_Clickable *clickable) +{ + efl_layout_signal_callback_add(object, "efl,action,press", "*", clickable, _on_press_cb, NULL); + efl_layout_signal_callback_add(object, "efl,action,unpress", "*", clickable, _on_unpress_cb, NULL); + efl_layout_signal_callback_add(object, "efl,action,mouse_out", "*", clickable, _on_mouse_out, NULL); +} + +static void +_press_cb(void *data, const Efl_Event *ev) +{ + Efl_Input_Pointer *pointer = ev->info; + if (!efl_input_processed_get(pointer)) + { + efl_ui_clickable_press(data, 1); + efl_input_processed_set(pointer, EINA_TRUE); + } +} + +static void +_unpress_cb(void *data, const Efl_Event *ev EINA_UNUSED) +{ + Efl_Input_Pointer *pointer = ev->info; + Eina_Position2D mouse_pos = efl_input_pointer_position_get(pointer); + Eina_Rect geom = efl_gfx_entity_geometry_get(data); + if (efl_input_processed_get(pointer)) + { + efl_ui_clickable_button_state_reset(data, 1); + } + else if (!eina_rectangle_coords_inside(&geom.rect, mouse_pos.x, mouse_pos.y)) + { + //we are emulating edje behavior here, do press unpress on the event, but not click + efl_ui_clickable_button_state_reset(data, 1); + if (efl_canvas_object_pointer_mode_get(data) == EFL_INPUT_OBJECT_POINTER_MODE_AUTO_GRAB) + { + efl_ui_clickable_unpress(data, 1); + efl_input_processed_set(pointer, EINA_TRUE); + } + } + else + { + efl_ui_clickable_unpress(data, 1); + efl_input_processed_set(pointer, EINA_TRUE); + } +} + +EFL_CALLBACKS_ARRAY_DEFINE(bind_to_theme_callbacks, + {EFL_EVENT_POINTER_DOWN, _press_cb}, + {EFL_EVENT_POINTER_UP, _unpress_cb}, +) + +EOLIAN static void +_efl_ui_clickable_util_bind_to_object(Efl_Input_Interface *object, Efl_Ui_Clickable *clickable) +{ + efl_event_callback_array_add(object, bind_to_theme_callbacks(), clickable); +} + + +#include "efl_ui_clickable_util.eo.c" diff --git a/src/lib/elementary/efl_ui_clickable_util.eo b/src/lib/elementary/efl_ui_clickable_util.eo new file mode 100644 index 0000000000..5f009e2925 --- /dev/null +++ b/src/lib/elementary/efl_ui_clickable_util.eo @@ -0,0 +1,24 @@ +class @beta Efl.Ui.Clickable_Util { + methods { + bind_to_theme @class { + [[This will listen to the standard events of a theme, and emit the events on clickable + + This means, widgets themselfs do not neccessarily need to listen to the theme signals. This function does this, and calls the correct clickable functions. + ]] + params { + object : Efl.Canvas.Layout; [[The object to listen on]] + clickable : Efl.Ui.Clickable; [[The object to call the clickable events on]] + } + } + bind_to_object @class { + [[This will listen to the standard events on a object, and call the correct methods on clickable + + This means, widgets themselfs do not neccessarily need to listen to the events on the object. This function does this, and calls the correct clickable functions. + ]] + params { + object : Efl.Input.Interface; [[The object to listen on]] + clickable : Efl.Ui.Clickable; [[The object to call the clickable events on]] + } + } + } +} diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 6818cf09ad..5f8147d777 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -861,7 +861,12 @@ _mouse_down_cb(void *data, if (elm_widget_is_legacy(data)) evas_object_smart_callback_call(data, "clicked,double", NULL); else - efl_event_callback_call(data, EFL_UI_EVENT_CLICKED_DOUBLE, NULL); + { + Efl_Ui_Clickable_Clicked clicked; + clicked.repeated = 1; + clicked.button = 1; + efl_event_callback_call(data, EFL_UI_EVENT_CLICKED, &clicked); + } } else efl_event_callback_legacy_call(data, EFL_UI_IMAGE_ZOOMABLE_EVENT_PRESS, NULL); diff --git a/src/lib/elementary/elm_bubble_eo.c b/src/lib/elementary/elm_bubble_eo.c index 8b6ef3e104..4f6ee165a3 100644 --- a/src/lib/elementary/elm_bubble_eo.c +++ b/src/lib/elementary/elm_bubble_eo.c @@ -50,6 +50,6 @@ static const Efl_Class_Description _elm_bubble_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_bubble_class_get, &_elm_bubble_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_bubble_class_get, &_elm_bubble_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_CLICKABLE_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_bubble_eo.legacy.c" diff --git a/src/lib/elementary/elm_colorselector_eo.c b/src/lib/elementary/elm_colorselector_eo.c index aba3685bd4..b6b288a8cf 100644 --- a/src/lib/elementary/elm_colorselector_eo.c +++ b/src/lib/elementary/elm_colorselector_eo.c @@ -146,6 +146,6 @@ static const Efl_Class_Description _elm_colorselector_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_colorselector_class_get, &_elm_colorselector_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_FOCUS_COMPOSITION_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_colorselector_class_get, &_elm_colorselector_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_FOCUS_COMPOSITION_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_colorselector_eo.legacy.c" diff --git a/src/lib/elementary/elm_diskselector_eo.c b/src/lib/elementary/elm_diskselector_eo.c index b44f2a0f9f..d533a106eb 100644 --- a/src/lib/elementary/elm_diskselector_eo.c +++ b/src/lib/elementary/elm_diskselector_eo.c @@ -222,6 +222,6 @@ static const Efl_Class_Description _elm_diskselector_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_diskselector_class_get, &_elm_diskselector_class_desc, EFL_UI_WIDGET_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_SCROLLABLE_INTERFACE, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_diskselector_class_get, &_elm_diskselector_class_desc, EFL_UI_WIDGET_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_UI_SCROLLABLE_INTERFACE, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_diskselector_eo.legacy.c" diff --git a/src/lib/elementary/elm_entry_eo.c b/src/lib/elementary/elm_entry_eo.c index 09ff5794c8..110de558bc 100644 --- a/src/lib/elementary/elm_entry_eo.c +++ b/src/lib/elementary/elm_entry_eo.c @@ -1188,6 +1188,6 @@ static const Efl_Class_Description _elm_entry_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_entry_class_get, &_elm_entry_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_ACCESS_TEXT_INTERFACE, EFL_ACCESS_EDITABLE_TEXT_INTERFACE, EFL_FILE_MIXIN, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_SCROLLABLE_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_entry_class_get, &_elm_entry_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_ACCESS_TEXT_INTERFACE, EFL_ACCESS_EDITABLE_TEXT_INTERFACE, EFL_FILE_MIXIN, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_SCROLLABLE_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_entry_eo.legacy.c" diff --git a/src/lib/elementary/elm_fileselector_entry_eo.c b/src/lib/elementary/elm_fileselector_entry_eo.c index 58c0092614..04af297c98 100644 --- a/src/lib/elementary/elm_fileselector_entry_eo.c +++ b/src/lib/elementary/elm_fileselector_entry_eo.c @@ -88,4 +88,4 @@ static const Efl_Class_Description _elm_fileselector_entry_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_fileselector_entry_class_get, &_elm_fileselector_entry_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_FILESELECTOR_INTERFACE, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_fileselector_entry_class_get, &_elm_fileselector_entry_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_FILESELECTOR_INTERFACE, EFL_UI_CLICKABLE_MIXIN, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); diff --git a/src/lib/elementary/elm_fileselector_eo.c b/src/lib/elementary/elm_fileselector_eo.c index fa3e9d6408..3ae6cd3539 100644 --- a/src/lib/elementary/elm_fileselector_eo.c +++ b/src/lib/elementary/elm_fileselector_eo.c @@ -202,6 +202,6 @@ static const Efl_Class_Description _elm_fileselector_class_desc = { _elm_fileselector_class_destructor }; -EFL_DEFINE_CLASS(elm_fileselector_class_get, &_elm_fileselector_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_FILESELECTOR_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_FOCUS_COMPOSITION_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_fileselector_class_get, &_elm_fileselector_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_FILESELECTOR_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_FOCUS_COMPOSITION_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_fileselector_eo.legacy.c" diff --git a/src/lib/elementary/elm_gengrid_eo.c b/src/lib/elementary/elm_gengrid_eo.c index 89263f9c1f..b3012a57b8 100644 --- a/src/lib/elementary/elm_gengrid_eo.c +++ b/src/lib/elementary/elm_gengrid_eo.c @@ -512,6 +512,6 @@ static const Efl_Class_Description _elm_gengrid_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_gengrid_class_get, &_elm_gengrid_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_ACCESS_SELECTION_INTERFACE, EFL_UI_LEGACY_INTERFACE, ELM_WIDGET_ITEM_CONTAINER_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_gengrid_class_get, &_elm_gengrid_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_ACCESS_SELECTION_INTERFACE, EFL_UI_LEGACY_INTERFACE, ELM_WIDGET_ITEM_CONTAINER_INTERFACE, NULL); #include "elm_gengrid_eo.legacy.c" diff --git a/src/lib/elementary/elm_genlist_eo.c b/src/lib/elementary/elm_genlist_eo.c index ca2fd5669e..fd0d5216ab 100644 --- a/src/lib/elementary/elm_genlist_eo.c +++ b/src/lib/elementary/elm_genlist_eo.c @@ -681,6 +681,6 @@ static const Efl_Class_Description _elm_genlist_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_genlist_class_get, &_elm_genlist_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_ACCESS_SELECTION_INTERFACE, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, ELM_WIDGET_ITEM_CONTAINER_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_genlist_class_get, &_elm_genlist_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_ACCESS_SELECTION_INTERFACE, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, ELM_WIDGET_ITEM_CONTAINER_INTERFACE, NULL); #include "elm_genlist_eo.legacy.c" diff --git a/src/lib/elementary/elm_hover_eo.c b/src/lib/elementary/elm_hover_eo.c index 5ca798a132..b5a1b20208 100644 --- a/src/lib/elementary/elm_hover_eo.c +++ b/src/lib/elementary/elm_hover_eo.c @@ -92,6 +92,6 @@ static const Efl_Class_Description _elm_hover_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_hover_class_get, &_elm_hover_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_FOCUS_LAYER_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_hover_class_get, &_elm_hover_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_FOCUS_LAYER_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_hover_eo.legacy.c" diff --git a/src/lib/elementary/elm_hoversel_eo.c b/src/lib/elementary/elm_hoversel_eo.c index fb108263a1..de2f5371c5 100644 --- a/src/lib/elementary/elm_hoversel_eo.c +++ b/src/lib/elementary/elm_hoversel_eo.c @@ -189,6 +189,6 @@ static const Efl_Class_Description _elm_hoversel_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_hoversel_class_get, &_elm_hoversel_class_desc, EFL_UI_BUTTON_LEGACY_CLASS, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_CLICKABLE_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_hoversel_class_get, &_elm_hoversel_class_desc, EFL_UI_BUTTON_LEGACY_CLASS, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_CLICKABLE_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_hoversel_eo.legacy.c" diff --git a/src/lib/elementary/elm_index_eo.c b/src/lib/elementary/elm_index_eo.c index 9c935c7f92..68bd184e59 100644 --- a/src/lib/elementary/elm_index_eo.c +++ b/src/lib/elementary/elm_index_eo.c @@ -322,6 +322,6 @@ static const Efl_Class_Description _elm_index_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_index_class_get, &_elm_index_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_DIRECTION_INTERFACE, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_index_class_get, &_elm_index_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_DIRECTION_INTERFACE, EFL_UI_CLICKABLE_MIXIN, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_index_eo.legacy.c" diff --git a/src/lib/elementary/elm_list_eo.c b/src/lib/elementary/elm_list_eo.c index 9668aa5e07..3da0cba750 100644 --- a/src/lib/elementary/elm_list_eo.c +++ b/src/lib/elementary/elm_list_eo.c @@ -363,6 +363,6 @@ static const Efl_Class_Description _elm_list_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_list_class_get, &_elm_list_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_ACCESS_SELECTION_INTERFACE, EFL_ACCESS_OBJECT_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, ELM_WIDGET_ITEM_CONTAINER_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_list_class_get, &_elm_list_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_ACCESS_SELECTION_INTERFACE, EFL_ACCESS_OBJECT_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, ELM_WIDGET_ITEM_CONTAINER_INTERFACE, NULL); #include "elm_list_eo.legacy.c" diff --git a/src/lib/elementary/elm_map_eo.c b/src/lib/elementary/elm_map_eo.c index 62ed9c2861..0e522f4635 100644 --- a/src/lib/elementary/elm_map_eo.c +++ b/src/lib/elementary/elm_map_eo.c @@ -360,6 +360,6 @@ static const Efl_Class_Description _elm_map_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_map_class_get, &_elm_map_class_desc, EFL_UI_WIDGET_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, EFL_UI_ZOOM_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_map_class_get, &_elm_map_class_desc, EFL_UI_WIDGET_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_UI_LEGACY_INTERFACE, EFL_UI_ZOOM_INTERFACE, NULL); #include "elm_map_eo.legacy.c" diff --git a/src/lib/elementary/elm_menu_eo.c b/src/lib/elementary/elm_menu_eo.c index 1bc7f988da..4aaa856be8 100644 --- a/src/lib/elementary/elm_menu_eo.c +++ b/src/lib/elementary/elm_menu_eo.c @@ -119,6 +119,6 @@ static const Efl_Class_Description _elm_menu_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_menu_class_get, &_elm_menu_class_desc, EFL_UI_WIDGET_CLASS, EFL_UI_CLICKABLE_INTERFACE, EFL_ACCESS_SELECTION_INTERFACE, EFL_UI_WIDGET_FOCUS_MANAGER_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_menu_class_get, &_elm_menu_class_desc, EFL_UI_WIDGET_CLASS, EFL_UI_CLICKABLE_MIXIN, EFL_ACCESS_SELECTION_INTERFACE, EFL_UI_WIDGET_FOCUS_MANAGER_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_menu_eo.legacy.c" diff --git a/src/lib/elementary/elm_multibuttonentry_eo.c b/src/lib/elementary/elm_multibuttonentry_eo.c index 24dfb7fc45..dcfb62778d 100644 --- a/src/lib/elementary/elm_multibuttonentry_eo.c +++ b/src/lib/elementary/elm_multibuttonentry_eo.c @@ -219,6 +219,6 @@ static const Efl_Class_Description _elm_multibuttonentry_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_multibuttonentry_class_get, &_elm_multibuttonentry_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_multibuttonentry_class_get, &_elm_multibuttonentry_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_CLICKABLE_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_multibuttonentry_eo.legacy.c" diff --git a/src/lib/elementary/elm_photo_eo.c b/src/lib/elementary/elm_photo_eo.c index 02b8a28fcf..6c49b03515 100644 --- a/src/lib/elementary/elm_photo_eo.c +++ b/src/lib/elementary/elm_photo_eo.c @@ -76,4 +76,4 @@ static const Efl_Class_Description _elm_photo_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_photo_class_get, &_elm_photo_class_desc, EFL_UI_WIDGET_CLASS, EFL_FILE_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_DRAGGABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_photo_class_get, &_elm_photo_class_desc, EFL_UI_WIDGET_CLASS, EFL_FILE_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_UI_DRAGGABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); diff --git a/src/lib/elementary/elm_plug_eo.c b/src/lib/elementary/elm_plug_eo.c index 7dc8c4daad..c40f883d22 100644 --- a/src/lib/elementary/elm_plug_eo.c +++ b/src/lib/elementary/elm_plug_eo.c @@ -54,6 +54,6 @@ static const Efl_Class_Description _elm_plug_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_plug_class_get, &_elm_plug_class_desc, EFL_UI_WIDGET_CLASS, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_plug_class_get, &_elm_plug_class_desc, EFL_UI_WIDGET_CLASS, EFL_UI_CLICKABLE_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); #include "elm_plug_eo.legacy.c" diff --git a/src/lib/elementary/elm_thumb_eo.c b/src/lib/elementary/elm_thumb_eo.c index d65f2ee700..0e57845112 100644 --- a/src/lib/elementary/elm_thumb_eo.c +++ b/src/lib/elementary/elm_thumb_eo.c @@ -82,4 +82,4 @@ static const Efl_Class_Description _elm_thumb_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_thumb_class_get, &_elm_thumb_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_FILE_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_DRAGGABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_thumb_class_get, &_elm_thumb_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_FILE_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_UI_DRAGGABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); diff --git a/src/lib/elementary/elm_toolbar_eo.c b/src/lib/elementary/elm_toolbar_eo.c index 0589b9aa71..4356aff25a 100644 --- a/src/lib/elementary/elm_toolbar_eo.c +++ b/src/lib/elementary/elm_toolbar_eo.c @@ -372,6 +372,6 @@ static const Efl_Class_Description _elm_toolbar_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_toolbar_class_get, &_elm_toolbar_class_desc, EFL_UI_WIDGET_CLASS, EFL_UI_FOCUS_COMPOSITION_MIXIN, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_UI_DIRECTION_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_ACCESS_SELECTION_INTERFACE, EFL_ACCESS_OBJECT_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, ELM_WIDGET_ITEM_CONTAINER_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_toolbar_class_get, &_elm_toolbar_class_desc, EFL_UI_WIDGET_CLASS, EFL_UI_FOCUS_COMPOSITION_MIXIN, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_UI_DIRECTION_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_ACCESS_SELECTION_INTERFACE, EFL_ACCESS_OBJECT_MIXIN, EFL_UI_CLICKABLE_MIXIN, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, ELM_WIDGET_ITEM_CONTAINER_INTERFACE, NULL); #include "elm_toolbar_eo.legacy.c" diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 6d40ca1cde..87e1b21c43 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -175,6 +175,8 @@ pub_eo_files = [ 'efl_ui_caching_factory.eo', 'efl_ui_widget_factory.eo', 'efl_ui_relative_layout.eo', + 'efl_ui_clickable.eo', + 'efl_ui_clickable_util.eo', ] foreach eo_file : pub_eo_files @@ -931,7 +933,9 @@ elementary_src = [ 'efl_ui_homogeneous_model.c', 'efl_ui_exact_model.c', 'efl_ui_average_model.c', - 'efl_ui_relative_layout.c' + 'efl_ui_relative_layout.c', + 'efl_ui_clickable.c', + 'efl_ui_clickable_util.c', ] elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl] From bb1388798b1afaced65484cedf385a93f6b1bb6a Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 14 May 2019 15:50:25 -0400 Subject: [PATCH 20/53] efl_ui_button: port to efl.ui.clickable Summary: Depends on D8820 Reviewers: zmike, segfaultxavi, cedric Reviewed By: segfaultxavi Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8821 --- data/elementary/themes/edc/efl/button.edc | 8 ++++---- src/lib/elementary/efl_ui_button.c | 21 ++++++++++----------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/data/elementary/themes/edc/efl/button.edc b/data/elementary/themes/edc/efl/button.edc index 55867d7ceb..77201b9f76 100644 --- a/data/elementary/themes/edc/efl/button.edc +++ b/data/elementary/themes/edc/efl/button.edc @@ -313,6 +313,10 @@ group { name: "efl/button"; action: SIGNAL_EMIT "efl,action,unpress" "efl"; after: "button_unclick_anim"; } + program { name: "button_pressed_out"; + signal: "mouse,pressed,out"; source: "event"; + action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; + } program { name: "button_unclick_anim"; script { new m = get_int(btmode); @@ -331,10 +335,6 @@ group { name: "efl/button"; in: 0.5 0.0; target: "base"; } - program { - signal: "mouse,clicked,1"; source: "event"; - action: SIGNAL_EMIT "efl,action,click" "efl"; - } program { name: "button_text_visible"; signal: "efl,state,text,set"; source: "efl"; script { diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index 0b40c22187..f653e949dd 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -6,6 +6,7 @@ #define EFL_ACCESS_OBJECT_PROTECTED #define ELM_LAYOUT_PROTECTED #define EFL_PART_PROTECTED +#define EFL_UI_CLICKABLE_PROTECTED #include #include "elm_priv.h" @@ -75,7 +76,10 @@ _activate(Evas_Object *obj) if (elm_widget_is_legacy(obj)) evas_object_smart_callback_call(obj, "clicked", NULL); else - efl_event_callback_call(obj, EFL_UI_EVENT_CLICKED, NULL); + { + efl_ui_clickable_press(obj, 1); + efl_ui_clickable_unpress(obj, 1); + } } } } @@ -102,7 +106,10 @@ _efl_ui_button_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Button_Data *_pd if (elm_widget_is_legacy(obj)) evas_object_smart_callback_call(obj, "clicked", NULL); else - efl_event_callback_call(obj, EFL_UI_EVENT_CLICKED, NULL); + { + efl_ui_clickable_press(obj, 1); + efl_ui_clickable_unpress(obj, 1); + } if (elm_widget_is_legacy(obj)) elm_layout_signal_emit(obj, "elm,anim,activate", "elm"); @@ -184,9 +191,6 @@ _on_pressed_signal(void *data, if (elm_widget_is_legacy(data)) evas_object_smart_callback_call (data, "pressed", NULL); - else - efl_event_callback_call - (data, EFL_UI_EVENT_PRESSED, NULL); } @@ -204,9 +208,6 @@ _on_unpressed_signal(void *data, if (elm_widget_is_legacy(data)) evas_object_smart_callback_call (data, "unpressed", NULL); - else - efl_event_callback_call - (data, EFL_UI_EVENT_UNPRESSED, NULL); } static char * @@ -252,15 +253,13 @@ _efl_ui_button_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Button_Data *_pd EINA_ } else { - edje_object_signal_callback_add - (wd->resize_obj, "efl,action,click", "*", - _on_clicked_signal, obj); edje_object_signal_callback_add (wd->resize_obj, "efl,action,press", "*", _on_pressed_signal, obj); edje_object_signal_callback_add (wd->resize_obj, "efl,action,unpress", "*", _on_unpressed_signal, obj); + efl_ui_clickable_util_bind_to_theme(wd->resize_obj, obj); } _elm_access_object_register(obj, wd->resize_obj); From 5ca38bfc34b42da3947264d6fc5e6c8bbbdfbec0 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 14 May 2019 15:50:32 -0400 Subject: [PATCH 21/53] efl_test_clickable: introduce new tests Summary: the new test checks if the events are correctly emitted Depends on D8821 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8822 --- .../elementary/spec/efl_test_clickable.c | 233 ++++++++++++++++++ src/tests/elementary/spec/efl_ui_spec_suite.h | 1 + src/tests/elementary/spec/meson.build | 3 +- 3 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 src/tests/elementary/spec/efl_test_clickable.c diff --git a/src/tests/elementary/spec/efl_test_clickable.c b/src/tests/elementary/spec/efl_test_clickable.c new file mode 100644 index 0000000000..f241deb68b --- /dev/null +++ b/src/tests/elementary/spec/efl_test_clickable.c @@ -0,0 +1,233 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include +#include "efl_ui_spec_suite.h" +#include "suite_helpers.h" + +/* spec-meta-start + {"test-interface":"Efl.Ui.Clickable", + "test-widgets": ["Efl.Ui.Button"] + } + spec-meta-end + */ + +/* + * Here follows a fixture that ensures that the window is correctly rendered, and the mouse is moved into the middle of the window. + */ + +static void +emit_mouse_events(void *data) +{ + Eina_Position2D *pos = data; + Evas *e = evas_object_evas_get(win); + evas_event_feed_mouse_in(e, 0, NULL); + evas_event_feed_mouse_move(e, pos->x, pos->y, 0, NULL); + efl_task_end(efl_app_main_get()); + free(pos); +} + +static void +prepare_window_norendered(void *data, Evas *e, void *event_info EINA_UNUSED) +{ + ecore_job_add(emit_mouse_events, data); + evas_event_callback_del(e, EVAS_CALLBACK_RENDER_POST, prepare_window_norendered); +} + +static void +prepare_window(void) +{ + Eina_Position2D *pos = calloc(1, sizeof(Eina_Position2D)); + ck_assert_ptr_ne(win, NULL); + ck_assert_ptr_ne(widget, NULL); + efl_gfx_entity_geometry_set(win, EINA_RECT(0, 0, 60, 60)); + pos->x = 30; + pos->y = 30; + + evas_smart_objects_calculate(evas_object_evas_get(win)); + evas_event_callback_add(evas_object_evas_get(win), EVAS_CALLBACK_RENDER_POST, prepare_window_norendered, pos); + efl_loop_begin(efl_app_main_get()); +} + +/* + * General helpers for emitting and checking mouse events. + */ + +typedef struct { + Efl_Ui_Clickable_Clicked clicked_params; + unsigned int clicked; + Efl_Ui_Clickable_Clicked clicked_all_params; + unsigned int clicked_all; + unsigned int pressed; + unsigned int unpressed; + unsigned int long_pressed; + unsigned int repeated; +} Clickable_Event_Register; + +Clickable_Event_Register event_caller = { 0 }; + +static void +_event_register(void *data EINA_UNUSED, const Efl_Event *ev) +{ +#define EVENT_CHECK(e,f) if (ev->desc == EFL_UI_EVENT_ ##e ) event_caller.f ++ + EVENT_CHECK(CLICKED, clicked); + EVENT_CHECK(CLICKED_ANY, clicked_all); + EVENT_CHECK(PRESSED, pressed); + EVENT_CHECK(UNPRESSED, unpressed); + EVENT_CHECK(LONGPRESSED, long_pressed); + + if (ev->desc == EFL_UI_EVENT_CLICKED) + { + Efl_Ui_Clickable_Clicked *clicked = ev->info; + + event_caller.clicked_params.repeated = clicked->repeated; + event_caller.clicked_params.button = clicked->button; + } + if (ev->desc == EFL_UI_EVENT_CLICKED_ANY) + { + Efl_Ui_Clickable_Clicked *clicked = ev->info; + + event_caller.clicked_all_params.repeated = clicked->repeated; + event_caller.clicked_all_params.button = clicked->button; + } +} + +EFL_CALLBACKS_ARRAY_DEFINE(clickable, + {EFL_UI_EVENT_CLICKED, _event_register}, + {EFL_UI_EVENT_CLICKED_ANY, _event_register}, + {EFL_UI_EVENT_PRESSED, _event_register}, + {EFL_UI_EVENT_UNPRESSED, _event_register}, + {EFL_UI_EVENT_LONGPRESSED, _event_register}, +) + +static void +assert_event_empty(void) +{ + ck_assert_int_eq(event_caller.clicked, 0); + ck_assert_int_eq(event_caller.clicked_all, 0); + ck_assert_int_eq(event_caller.pressed, 0); + ck_assert_int_eq(event_caller.unpressed, 0); + ck_assert_int_eq(event_caller.long_pressed, 0); + ck_assert_int_eq(event_caller.repeated, 0); +} + +static void +_timer_expired(void *data EINA_UNUSED, const Efl_Event *ev) +{ + efl_del(ev->object); + efl_task_end(efl_app_main_get()); +} + +static void +iterate_mainloop(double interval) +{ + efl_add(EFL_LOOP_TIMER_CLASS, efl_app_main_get(), + efl_loop_timer_interval_set(efl_added, interval), + efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TIMER_TICK, _timer_expired, NULL)); + efl_loop_begin(efl_app_main_get()); +} + +static void +down(int btn) +{ + Evas *e = evas_object_evas_get(win); + evas_event_feed_mouse_down(e, btn, 0, 0, NULL); +} + +static void +up(int btn) +{ + Evas *e = evas_object_evas_get(win); + evas_event_feed_mouse_up(e, btn, 0, 0, NULL); +} + +EFL_START_TEST(simple_left_down_up) +{ + efl_event_callback_array_add(widget, clickable(), NULL); + down(1); + iterate_mainloop(0.1); + ck_assert_int_eq(event_caller.pressed, 1); + event_caller.pressed = 0; + assert_event_empty(); + + up(1); + iterate_mainloop(0.1); + ck_assert_int_eq(event_caller.clicked, 1); + event_caller.clicked = 0; + ck_assert_int_eq(event_caller.clicked_params.repeated, 0); + ck_assert_int_eq(event_caller.clicked_params.button, 1); + ck_assert_int_eq(event_caller.clicked_all, 1); + event_caller.clicked_all = 0; + ck_assert_int_eq(event_caller.clicked_all_params.repeated, 0); + ck_assert_int_eq(event_caller.clicked_all_params.button, 1); + ck_assert_int_eq(event_caller.unpressed, 1); + event_caller.unpressed = 0; + assert_event_empty(); +} +EFL_END_TEST + +EFL_START_TEST(long_press_event) +{ + efl_event_callback_array_add(widget, clickable(), NULL); + down(1); + iterate_mainloop(0.1); + ck_assert_int_eq(event_caller.pressed, 1); + event_caller.pressed = 0; + assert_event_empty(); + iterate_mainloop(2.0); + ck_assert_int_eq(event_caller.long_pressed, 1); + event_caller.long_pressed = 0; + assert_event_empty(); + up(1); + iterate_mainloop(0.1); + ck_assert_int_eq(event_caller.clicked, 1); + event_caller.clicked = 0; + ck_assert_int_eq(event_caller.clicked_params.repeated, 0); + ck_assert_int_eq(event_caller.clicked_params.button, 1); + ck_assert_int_eq(event_caller.clicked_all, 1); + event_caller.clicked_all = 0; + ck_assert_int_eq(event_caller.clicked_all_params.repeated, 0); + ck_assert_int_eq(event_caller.clicked_all_params.button, 1); + ck_assert_int_eq(event_caller.unpressed, 1); + event_caller.unpressed = 0; + assert_event_empty(); +} +EFL_END_TEST + +EFL_START_TEST(repeated_event) +{ + efl_event_callback_array_add(widget, clickable(), NULL); + + for (int i = 0; i < 20; ++i) + { + down(1); + iterate_mainloop(0.01); + ck_assert_int_eq(event_caller.pressed, 1); + event_caller.pressed = 0; + assert_event_empty(); + + up(1); + iterate_mainloop(0.01); + ck_assert_int_eq(event_caller.clicked, 1); + event_caller.clicked = 0; + ck_assert_int_eq(event_caller.clicked_params.repeated, i); + ck_assert_int_eq(event_caller.clicked_params.button, 1); + ck_assert_int_eq(event_caller.clicked_all, 1); + event_caller.clicked_all = 0; + ck_assert_int_eq(event_caller.clicked_all_params.repeated, i); + ck_assert_int_eq(event_caller.clicked_all_params.button, 1); + ck_assert_int_eq(event_caller.unpressed, 1); + event_caller.unpressed = 0; + } +} +EFL_END_TEST + +void +efl_ui_clickable_behavior_test(TCase *tc) +{ + tcase_add_checked_fixture(tc, prepare_window, NULL); + tcase_add_test(tc, simple_left_down_up); + tcase_add_test(tc, long_press_event); + tcase_add_test(tc, repeated_event); +} diff --git a/src/tests/elementary/spec/efl_ui_spec_suite.h b/src/tests/elementary/spec/efl_ui_spec_suite.h index 582aeda48c..8389d819ef 100644 --- a/src/tests/elementary/spec/efl_ui_spec_suite.h +++ b/src/tests/elementary/spec/efl_ui_spec_suite.h @@ -14,6 +14,7 @@ void efl_pack_behavior_test(TCase *tc); void efl_pack_linear_behavior_test(TCase *tc); void efl_content_behavior_test(TCase *tc); void efl_gfx_arrangement_behavior_test(TCase *tc); +void efl_ui_clickable_behavior_test(TCase *tc); void efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len); void efl_test_container_expect_evt_content_added(Efl_Ui_Widget *widget, const Efl_Event_Description *ev, Eina_Bool *flag, void *event_data); diff --git a/src/tests/elementary/spec/meson.build b/src/tests/elementary/spec/meson.build index 55c6e068d5..0f72b54fad 100644 --- a/src/tests/elementary/spec/meson.build +++ b/src/tests/elementary/spec/meson.build @@ -3,7 +3,8 @@ efl_ui_suite_behavior_test_files = files([ 'efl_test_pack.c', 'efl_test_pack_linear.c', 'efl_test_content.c', - 'efl_test_gfx_arrangement.c' + 'efl_test_gfx_arrangement.c', + 'efl_test_clickable.c', ]) efl_ui_suite_behavior_src = files([ From 8429ffba9caa43114ec82074ce26d6408e2822b7 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 14 May 2019 15:50:39 -0400 Subject: [PATCH 22/53] efl_ui_image: migrate to efl.ui.clickable Summary: the mixin is now used to emit the events of the mixins. This is verified by the testsuite. The testsuite needs a special treatment for the object, because a missing image-file of the object would result in a 0x0 image size. Depends on D8822 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8823 --- src/lib/elementary/efl_ui_image.c | 17 ++++++---- src/lib/elementary/efl_ui_image_zoomable.c | 32 +++---------------- .../elementary/spec/efl_test_clickable.c | 10 +++++- 3 files changed, 24 insertions(+), 35 deletions(-) diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index a0232aedeb..8fde088c88 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -7,6 +7,7 @@ #define EFL_ACCESS_COMPONENT_PROTECTED #define EFL_ACCESS_WIDGET_ACTION_PROTECTED #define EFL_LAYOUT_CALC_PROTECTED +#define EFL_UI_CLICKABLE_PROTECTED #include @@ -120,10 +121,7 @@ _on_mouse_up(void *data, if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; if (!wd->still_in) return; - if (elm_widget_is_legacy(obj)) - evas_object_smart_callback_call(data, "clicked", NULL); - else - efl_event_callback_call(data, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call(data, "clicked", NULL); } static Eina_Bool @@ -578,8 +576,15 @@ _efl_ui_image_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Data *priv) evas_object_show(priv->hit_rect); evas_object_repeat_events_set(priv->hit_rect, EINA_TRUE); - evas_object_event_callback_add - (priv->hit_rect, EVAS_CALLBACK_MOUSE_UP, _on_mouse_up, obj); + if (elm_widget_is_legacy(obj)) + { + evas_object_event_callback_add + (priv->hit_rect, EVAS_CALLBACK_MOUSE_UP, _on_mouse_up, obj); + } + else + { + efl_ui_clickable_util_bind_to_object(priv->hit_rect, obj); + } priv->smooth = EINA_TRUE; priv->fill_inside = EINA_TRUE; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 5f8147d777..f8c3f4ac9e 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -6,6 +6,7 @@ #define EFL_ACCESS_WIDGET_ACTION_PROTECTED #define EFL_UI_SCROLL_MANAGER_PROTECTED #define EFL_UI_SCROLLBAR_PROTECTED +#define EFL_UI_CLICKABLE_PROTECTED #include @@ -830,19 +831,6 @@ _zoom_anim_cb(void *data, const Efl_Event *event EINA_UNUSED) } } -static Eina_Bool -_long_press_cb(void *data) -{ - EFL_UI_IMAGE_ZOOMABLE_DATA_GET(data, sd); - - sd->long_timer = NULL; - sd->longpressed = EINA_TRUE; - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_LONGPRESSED, NULL); - - return ECORE_CALLBACK_CANCEL; -} - static void _mouse_down_cb(void *data, Evas *evas EINA_UNUSED, @@ -856,24 +844,14 @@ _mouse_down_cb(void *data, if (ev->button != 1) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = EINA_TRUE; else sd->on_hold = EINA_FALSE; + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) { if (elm_widget_is_legacy(data)) evas_object_smart_callback_call(data, "clicked,double", NULL); - else - { - Efl_Ui_Clickable_Clicked clicked; - clicked.repeated = 1; - clicked.button = 1; - efl_event_callback_call(data, EFL_UI_EVENT_CLICKED, &clicked); - } } else efl_event_callback_legacy_call(data, EFL_UI_IMAGE_ZOOMABLE_EVENT_PRESS, NULL); - sd->longpressed = EINA_FALSE; - ecore_timer_del(sd->long_timer); - sd->long_timer = ecore_timer_add - (_elm_config->longpress_timeout, _long_press_cb, data); } static void @@ -889,13 +867,11 @@ _mouse_up_cb(void *data, if (ev->button != 1) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = EINA_TRUE; else sd->on_hold = EINA_FALSE; - ELM_SAFE_FREE(sd->long_timer, ecore_timer_del); + if (!sd->on_hold) { if (elm_widget_is_legacy(data)) evas_object_smart_callback_call(data, "clicked", NULL); - else - efl_event_callback_call(data, EFL_UI_EVENT_CLICKED, NULL); } sd->on_hold = EINA_FALSE; } @@ -1889,6 +1865,7 @@ _efl_ui_image_zoomable_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Zoomable (priv->img, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, obj); evas_object_event_callback_add (priv->img, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, obj); + efl_ui_clickable_util_bind_to_object(priv->img, obj); evas_object_image_scale_hint_set(priv->img, EVAS_IMAGE_SCALE_HINT_STATIC); /* XXX: mmm... */ @@ -1937,7 +1914,6 @@ _efl_ui_image_zoomable_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Image_Zoomable eina_stringshare_del(sd->file); ecore_job_del(sd->calc_job); ecore_timer_del(sd->scr_timer); - ecore_timer_del(sd->long_timer); efl_event_callback_del(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _zoom_anim_cb, obj); efl_event_callback_del(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _bounce_eval, obj); efl_event_callback_del(obj, EFL_UI_EVENT_SCROLL, _scroll_cb, obj); diff --git a/src/tests/elementary/spec/efl_test_clickable.c b/src/tests/elementary/spec/efl_test_clickable.c index f241deb68b..554c782d77 100644 --- a/src/tests/elementary/spec/efl_test_clickable.c +++ b/src/tests/elementary/spec/efl_test_clickable.c @@ -8,7 +8,7 @@ /* spec-meta-start {"test-interface":"Efl.Ui.Clickable", - "test-widgets": ["Efl.Ui.Button"] + "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image"] } spec-meta-end */ @@ -45,6 +45,14 @@ prepare_window(void) pos->x = 30; pos->y = 30; + if (efl_isa(widget, EFL_UI_IMAGE_CLASS)) + { + efl_gfx_hint_size_min_set(widget, EINA_SIZE2D(200, 200)); + efl_file_simple_load(widget, ELM_IMAGE_DATA_DIR"/images/bubble.png", NULL); + pos->x = 100; + pos->y = 100; + } + evas_smart_objects_calculate(evas_object_evas_get(win)); evas_event_callback_add(evas_object_evas_get(win), EVAS_CALLBACK_RENDER_POST, prepare_window_norendered, pos); efl_loop_begin(efl_app_main_get()); From 59dab13bfacae2d0bdd1d4976b481e3d39c64fea Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 14 May 2019 15:50:47 -0400 Subject: [PATCH 23/53] efl_ui_text: migrate to efl_ui_clickable Summary: This now uses the efl_ui_clickable mixin. It is impossible right now to test this in the test suite, as every single configuration of the efl.ui.text object is ending up in an error. Which is not allowed in the test suite. Additionally, simulating clicks on the objects gets it into some sort of inifinite recursion when asking for cursor positions. Depends on D8823 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8824 --- src/lib/elementary/efl_ui_text.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index b92df12edb..9cef215288 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -7,6 +7,7 @@ #define EFL_ACCESS_EDITABLE_TEXT_PROTECTED #define ELM_LAYOUT_PROTECTED #define EFL_PART_PROTECTED +#define EFL_UI_CLICKABLE_PROTECTED #include #include @@ -1412,8 +1413,8 @@ _menu_call(Evas_Object *obj) } } -static Eina_Bool -_long_press_cb(void *data) +static void +_long_press_cb(void *data, const Efl_Event *ev EINA_UNUSED) { EFL_UI_TEXT_DATA_GET(data, sd); @@ -1427,8 +1428,6 @@ _long_press_cb(void *data) sd->longpress_timer = NULL; efl_event_callback_call(data, EFL_UI_EVENT_LONGPRESSED, NULL); - - return ECORE_CALLBACK_CANCEL; } static void @@ -1495,15 +1494,9 @@ _mouse_down_cb(void *data, sd->downy = ev->canvas.y; sd->long_pressed = EINA_FALSE; - if (ev->button == 1) - { - ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del); - sd->longpress_timer = ecore_timer_add - (_elm_config->longpress_timeout, _long_press_cb, data); - } /* If right button is pressed and context menu disabled is true, * then only context menu will appear */ - else if (ev->button == 3 && (!_elm_config->context_menu_disabled)) + if (ev->button == 3 && (!_elm_config->context_menu_disabled)) { if (_elm_config->desktop_entry) { @@ -2126,6 +2119,7 @@ _efl_ui_text_efl_object_constructor(Eo *obj, Efl_Ui_Text_Data *sd) if (!elm_widget_theme_klass_get(obj)) elm_widget_theme_klass_set(obj, "text"); obj = efl_constructor(efl_super(obj, MY_CLASS)); + efl_event_callback_add(obj, EFL_UI_EVENT_LONGPRESSED, _long_press_cb, obj); text_obj = efl_add(EFL_UI_INTERNAL_TEXT_INTERACTIVE_CLASS, obj); efl_event_callback_forwarder_add(text_obj, EFL_UI_TEXT_EVENT_CHANGED_USER, obj); @@ -2215,6 +2209,7 @@ _efl_ui_text_efl_object_finalize(Eo *obj, (sd->entry_edje, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, obj); evas_object_event_callback_add (sd->entry_edje, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, obj); + efl_ui_clickable_util_bind_to_object(sd->entry_edje, obj); efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _text_size_changed_cb, obj); From 282b76e2bd39a66a891d09d555ac38d45e675b44 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 14 May 2019 15:50:53 -0400 Subject: [PATCH 24/53] efl_ui_panes: migrate to efl_ui_clickable Summary: the implementation of efl_ui_clickable is now used to tricker the events. efl,action,click and efl,action,click,double is not needed anymore from the theme. Depends on D8824 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8825 --- data/elementary/themes/edc/efl/panes.edc | 30 +++++-------------- src/lib/elementary/efl_ui_panes.c | 17 +++-------- .../elementary/spec/efl_test_clickable.c | 2 +- 3 files changed, 13 insertions(+), 36 deletions(-) diff --git a/data/elementary/themes/edc/efl/panes.edc b/data/elementary/themes/edc/efl/panes.edc index 6dc5e26537..6809817d73 100644 --- a/data/elementary/themes/edc/efl/panes.edc +++ b/data/elementary/themes/edc/efl/panes.edc @@ -5,8 +5,6 @@ efl,panes,unfixed: Used for elm_panes_fixed_set() [SIGNAL EMIT] - efl,action,click: Used for "clicked" smart callback. - efl,action,click,double: Used for "clicked,double" smart callback. efl,action,press: Used for "press" smart callback. efl,action,unpress: Used for "unpress" smart callback. */ @@ -137,11 +135,8 @@ group { name: "efl/panes/vertical"; program { signal: "mouse,up,1"; source: "bar"; // for "unpress" smart callback action: SIGNAL_EMIT "efl,action,unpress" "efl"; } - program { signal: "mouse,clicked,1"; source: "bar"; // for "clicked" smart callback - action: SIGNAL_EMIT "efl,action,click" "efl"; - } - program { signal: "mouse,down,1,double"; source: "bar"; // for "clicked,double" smart callback - action: SIGNAL_EMIT "efl,action,click,double" "efl"; + program { signal: "mouse,pressed,out"; source: "bar"; + action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; } program { // for elm_panes_fixed_set() signal: "efl,panes,fixed"; source: "efl"; @@ -278,11 +273,8 @@ group { name: "efl/panes/horizontal"; program { signal: "mouse,up,1"; source: "bar"; // for "unpress" smart callback action: SIGNAL_EMIT "efl,action,unpress" "efl"; } - program { signal: "mouse,clicked,1"; source: "bar"; // for "clicked" smart callback - action: SIGNAL_EMIT "efl,action,click" "efl"; - } - program { signal: "mouse,down,1,double"; source: "bar"; // for "clicked,double" smart callback - action: SIGNAL_EMIT "efl,action,click,double" "efl"; + program { signal: "mouse,pressed,out"; source: "bar"; + action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; } program { // for elm_panes_fixed_set() signal: "efl,panes,fixed"; source: "efl"; @@ -478,11 +470,8 @@ group { name: "efl/panes/vertical:flush"; program { signal: "mouse,up,1"; source: "bar"; // for "unpress" smart callback action: SIGNAL_EMIT "efl,action,unpress" "efl"; } - program { signal: "mouse,clicked,1"; source: "bar"; // for "clicked" smart callback - action: SIGNAL_EMIT "efl,action,click" "efl"; - } - program { signal: "mouse,down,1,double"; source: "bar"; // for "clicked,double" smart callback - action: SIGNAL_EMIT "efl,action,click,double" "efl"; + program { signal: "mouse,pressed,out"; source: "bar"; + action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; } program { // for elm_panes_fixed_set() signal: "efl,panes,fixed"; source: "efl"; @@ -734,11 +723,8 @@ group { name: "efl/panes/horizontal:flush"; program { signal: "mouse,up,1"; source: "bar"; // for "unpress" smart callback action: SIGNAL_EMIT "efl,action,unpress" "efl"; } - program { signal: "mouse,clicked,1"; source: "bar"; // for "clicked" smart callback - action: SIGNAL_EMIT "efl,action,click" "efl"; - } - program { signal: "mouse,down,1,double"; source: "bar"; // for "clicked,double" smart callback - action: SIGNAL_EMIT "efl,action,click,double" "efl"; + program { signal: "mouse,pressed,out"; source: "bar"; + action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; } program { // for elm_panes_fixed_set() signal: "efl,panes,fixed"; source: "efl"; diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c index af96c84ee1..fe3ed5c09b 100644 --- a/src/lib/elementary/efl_ui_panes.c +++ b/src/lib/elementary/efl_ui_panes.c @@ -6,6 +6,7 @@ #define ELM_LAYOUT_PROTECTED #define EFL_GFX_HINT_PROTECTED #define EFL_PART_PROTECTED +#define EFL_UI_CLICKABLE_PROTECTED #include @@ -183,6 +184,7 @@ _on_pressed(void *data, const char *source EINA_UNUSED) { efl_event_callback_legacy_call(data, ELM_PANES_EVENT_PRESS, NULL); + efl_ui_clickable_press(data, 1); } static void @@ -193,7 +195,7 @@ _on_unpressed(void *data, { EFL_UI_PANES_DATA_GET(data, sd); efl_event_callback_legacy_call(data, ELM_PANES_EVENT_UNPRESS, NULL); - + efl_ui_clickable_unpress(data, 1); if (sd->double_clicked) { evas_object_smart_callback_call(data, "clicked,double", NULL); @@ -437,18 +439,7 @@ _efl_ui_panes_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UN } else { - edje_object_signal_callback_add - (wd->resize_obj, "efl,action,click", "*", - _on_clicked, obj); - edje_object_signal_callback_add - (wd->resize_obj, "efl,action,click,double", "*", - _double_clicked, obj); - edje_object_signal_callback_add - (wd->resize_obj, "efl,action,press", "*", - _on_pressed, obj); - edje_object_signal_callback_add - (wd->resize_obj, "efl,action,unpress", "*", - _on_unpressed, obj); + efl_ui_clickable_util_bind_to_theme(wd->resize_obj, obj); } evas_object_event_callback_add (wd->resize_obj, EVAS_CALLBACK_RESIZE, diff --git a/src/tests/elementary/spec/efl_test_clickable.c b/src/tests/elementary/spec/efl_test_clickable.c index 554c782d77..a184053847 100644 --- a/src/tests/elementary/spec/efl_test_clickable.c +++ b/src/tests/elementary/spec/efl_test_clickable.c @@ -8,7 +8,7 @@ /* spec-meta-start {"test-interface":"Efl.Ui.Clickable", - "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image"] + "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes"] } spec-meta-end */ From 930f481eee298af3804299ceae80942a669b252f Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 14 May 2019 15:51:06 -0400 Subject: [PATCH 25/53] efl_ui_tab_bar: remove Efl.Ui.Clickable Summary: nothing here uses this directly, and nothing emits events. For now the implementation is removed. If this is required later on, it can be readded. Depends on D8826 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8827 --- src/lib/elementary/efl_ui_navigation_bar_part_back_button.eo | 2 +- src/lib/elementary/efl_ui_tab_bar.eo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_navigation_bar_part_back_button.eo b/src/lib/elementary/efl_ui_navigation_bar_part_back_button.eo index 2ed99a181f..1690a54617 100644 --- a/src/lib/elementary/efl_ui_navigation_bar_part_back_button.eo +++ b/src/lib/elementary/efl_ui_navigation_bar_part_back_button.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Navigation_Bar_Part_Back_Button extends Efl.Ui.Layout_Part implements Efl.Ui.Clickable, Efl.Gfx.Entity, Efl.Text, Efl.Content +class @beta Efl.Ui.Navigation_Bar_Part_Back_Button extends Efl.Ui.Layout_Part implements Efl.Gfx.Entity, Efl.Text, Efl.Content { [[Efl Ui Navigation_Bar internal part back button class]] data: null; diff --git a/src/lib/elementary/efl_ui_tab_bar.eo b/src/lib/elementary/efl_ui_tab_bar.eo index e83401b12a..c0be2aa90c 100644 --- a/src/lib/elementary/efl_ui_tab_bar.eo +++ b/src/lib/elementary/efl_ui_tab_bar.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Tab_Bar extends Efl.Ui.Layout_Base implements Efl.Ui.Clickable +class @beta Efl.Ui.Tab_Bar extends Efl.Ui.Layout_Base { [[Tab Bar class]] methods { From 6a5a5a43032370acf9085c47a3627d4539ac324a Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 14 May 2019 15:51:12 -0400 Subject: [PATCH 26/53] efl_ui: remove Efl.Ui.Clickable from containers Summary: these widgets here are containers, means: they contain items that can be clicked, but the container itself cannot be clicked. Later on, we should introduce a new interface which contains events that reflect the clicked event of theire items. Depends on D8827 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8828 --- src/lib/elementary/efl_ui_grid.eo | 1 - src/lib/elementary/efl_ui_list.eo | 1 - src/lib/elementary/efl_ui_list_view.eo | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/elementary/efl_ui_grid.eo b/src/lib/elementary/efl_ui_grid.eo index 54de96d210..a07aa82031 100644 --- a/src/lib/elementary/efl_ui_grid.eo +++ b/src/lib/elementary/efl_ui_grid.eo @@ -5,7 +5,6 @@ class @beta Efl.Ui.Grid extends Efl.Ui.Layout_Base implements Efl.Ui.Scrollbar, Efl.Pack_Linear, Efl.Pack_Layout, Efl.Ui.Direction, - Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.Multi_Selectable, Efl.Gfx.Arrangement diff --git a/src/lib/elementary/efl_ui_list.eo b/src/lib/elementary/efl_ui_list.eo index d09288ef78..08e6478f53 100644 --- a/src/lib/elementary/efl_ui_list.eo +++ b/src/lib/elementary/efl_ui_list.eo @@ -4,7 +4,6 @@ class @beta Efl.Ui.List extends Efl.Ui.Layout_Base implements Efl.Ui.Scrollable_Interactive, Efl.Ui.Scrollbar, Efl.Pack_Linear, Efl.Pack_Layout, - Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.Multi_Selectable, Efl.Gfx.Arrangement diff --git a/src/lib/elementary/efl_ui_list_view.eo b/src/lib/elementary/efl_ui_list_view.eo index f963fd3331..613c38dc11 100644 --- a/src/lib/elementary/efl_ui_list_view.eo +++ b/src/lib/elementary/efl_ui_list_view.eo @@ -8,7 +8,7 @@ struct @beta Efl.Ui.List_View_Item_Event } class @beta Efl.Ui.List_View extends Efl.Ui.Layout_Base implements Efl.Ui.Scrollable_Interactive, Efl.Ui.Scrollbar, Efl.Access.Widget.Action, Efl.Access.Selection, Efl.Ui.Focus.Composition, Efl.Ui.Focus.Manager_Sub, - Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.List_View_Model, Efl.Ui.Widget_Focus_Manager + Efl.Ui.Selectable, Efl.Ui.List_View_Model, Efl.Ui.Widget_Focus_Manager { methods { @property homogeneous { From 10062fd957e924b03e75b6081d6613f8674c1bed Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 15 May 2019 11:22:45 +0900 Subject: [PATCH 27/53] ector_software_rasterizer: Improved masking calculation. Summary: The memory allocation for the buffer size is improved to allocate only the width size. Test Plan: N/A Reviewers: Hermet, kimcinoo Reviewed By: Hermet Subscribers: cedric, #reviewers, smohanty, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8873 --- .../software/ector_software_rasterizer.c | 79 ++++++++----------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c index 428c067efe..a368774310 100644 --- a/src/lib/ector/software/ector_software_rasterizer.c +++ b/src/lib/ector/software/ector_software_rasterizer.c @@ -150,16 +150,11 @@ _blend_mask_add(int count, const SW_FT_Span *spans, void *user_data) while (count--) { - memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); + memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); comp_func(ttarget, spans->len, color, spans->coverage); for (int i = 0; i < spans->len; i++) - { - double adst = A_VAL(&mtarget[i]) == 0 ? 0 : (double)(A_VAL(&mtarget[i])) / (double)255; - double asrc = A_VAL(&ttarget[i]) == 0 ? 0 : (double)(A_VAL(&ttarget[i])) / (double)255; - uint32_t aout = (int)(((adst * (1 - asrc)) + asrc) * 255); - mtarget[i] = (aout<<24) + (0x00FFFFFF & mtarget[i]); - } + mtarget[i] = draw_mul_256(0xFF - (ttarget[i]>>24), mtarget[i]) + ttarget[i]; ++spans; } } @@ -172,26 +167,20 @@ _blend_mask_sub(int count, const SW_FT_Span *spans, void *user_data) uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); - uint32_t *mtarget = mask->pixels.u32; + uint32_t *mbuffer = mask->pixels.u32; - int tsize = sd->raster_buffer->generic->w * sd->raster_buffer->generic->h; - uint32_t *tbuffer = alloca(sizeof(uint32_t) * tsize); - memset(tbuffer, 0x00, sizeof(uint32_t) * tsize); + int tsize = sd->raster_buffer->generic->w; + uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize); while (count--) { - uint32_t *ttarget = tbuffer + ((mask->generic->w * spans->y) + spans->x); + uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); + memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); comp_func(ttarget, spans->len, color, spans->coverage); + for (int i = 0; i < spans->len; i++) + mtarget[i] = draw_mul_256(0xFF - (ttarget[i]>>24), mtarget[i]); ++spans; } - - for(int i = 0; i < tsize; i++) - { - double adst = A_VAL(&mtarget[i]) == 0 ? 0 : (double)(A_VAL(&mtarget[i])) / (double)255; - double asrc = A_VAL(&tbuffer[i]) == 0 ? 0 : (double)(A_VAL(&tbuffer[i])) / (double)255; - uint32_t aout = (int)((adst * (1 - asrc)) * 255); - mtarget[i] = (aout<<24) + (0x00FFFFFF & mtarget[i]); - } } @@ -203,25 +192,32 @@ _blend_mask_ins(int count, const SW_FT_Span *spans, void *user_data) uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); - uint32_t *mtarget = mask->pixels.u32; + uint32_t *mbuffer = mask->pixels.u32; - int tsize = sd->raster_buffer->generic->w * sd->raster_buffer->generic->h; - uint32_t *tbuffer = alloca(sizeof(uint32_t) * tsize); - memset(tbuffer, 0x00, sizeof(uint32_t) * tsize); + int tsize = sd->raster_buffer->generic->w; + uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize); - while (count--) + for(unsigned int y = 0; y < mask->generic->h; y++) { - uint32_t *ttarget = tbuffer + ((mask->generic->w * spans->y) + spans->x); - comp_func(ttarget, spans->len, color, spans->coverage); - ++spans; - } - - for(int i = 0; i < tsize; i++) - { - double adst = A_VAL(&mtarget[i]) == 0 ? 0 : (double)(A_VAL(&mtarget[i])) / (double)255; - double asrc = A_VAL(&tbuffer[i]) == 0 ? 0 : (double)(A_VAL(&tbuffer[i])) / (double)255; - uint32_t aout = (int)((adst * asrc) * 255); - mtarget[i] = (aout<<24) + (0x00FFFFFF & mtarget[i]); + for(unsigned int x = 0; x < mask->generic->w; x++) + { + if (x == (unsigned int)spans->x && x + spans->len <= mask->generic->w && + y == (unsigned int)spans->y && count > 0) + { + memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); + uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); + comp_func(ttarget, spans->len, color, spans->coverage); + for (int c = 0; c < spans->len; c++) + mtarget[c] = draw_mul_256(ttarget[c]>>24, mtarget[c]); + x += spans->len - 1; + ++spans; + --count; + } + else + { + mbuffer[x + (mask->generic->w * y)] = (0x00FFFFFF & mbuffer[x + (mask->generic->w * y)]); + } + } } } @@ -245,12 +241,7 @@ _blend_mask_diff(int count, const SW_FT_Span *spans, void *user_data) uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); comp_func(ttarget, spans->len, color, spans->coverage); for (int i = 0; i < spans->len; i++) - { - double adst = A_VAL(&mtarget[i]) == 0 ? 0 : (double)(A_VAL(&mtarget[i])) / (double)255; - double asrc = A_VAL(&ttarget[i]) == 0 ? 0 : (double)(A_VAL(&ttarget[i])) / (double)255; - uint32_t aout = (int)((((1 - adst) * asrc) + ((1 - asrc) * adst)) * 255); - mtarget[i] = (aout<<24) + (0x00FFFFFF & mtarget[i]); - } + mtarget[i] = draw_mul_256(0xFF - (mtarget[i]>>24), ttarget[i]) + draw_mul_256(0xFF - (ttarget[i]>>24), mtarget[i]); ++spans; } } @@ -648,10 +639,6 @@ _adjust_span_fill_methods(Span_Data *spdata) spdata->unclipped_blend = NULL; } - //FIXME: Mask and mask case is not use clipping. - if (spdata->mask_op >= EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD) - spdata->clip.enabled = EINA_FALSE; - // Clipping Function if (spdata->clip.enabled) { From 59ef5ab8f1ca625ef1011b5931c088599966eafa Mon Sep 17 00:00:00 2001 From: WooHyun Jung Date: Wed, 15 May 2019 15:14:15 +0900 Subject: [PATCH 28/53] Makefile_Cxx: add include dependency with evas/gesture Summary: There was a build break when "make check". This patch will fix the issue. Test Plan: - ./autogen.sh --with-tests=regular --enable-csharp-bindings - make - sudo make install - sudo make check Reviewers: Jaehyun_Cho, CHAN, zmike, segfaultxavi Reviewed By: Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8896 --- src/Makefile_Cxx.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Makefile_Cxx.am b/src/Makefile_Cxx.am index e7930eaf69..da656af993 100644 --- a/src/Makefile_Cxx.am +++ b/src/Makefile_Cxx.am @@ -379,6 +379,7 @@ check_LIBRARIES = tests/elementary_cxx/libcxx_compile_test.a tests_elementary_cxx_libcxx_compile_test_a_SOURCES = tests/elementary_cxx/cxx_compile_test.cc tests_elementary_cxx_libcxx_compile_test_a_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_builddir)/src/lib/evas/canvas/ \ + -I$(top_builddir)/src/lib/evas/gesture/ \ -I$(top_builddir)/src/lib/efl/interfaces/ \ -DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/elementary_cxx\" \ -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/elementary_cxx\" \ @@ -396,6 +397,7 @@ tests/elementary_cxx/$(TESTS_ELM_CXX_OBJNAME)cxx_dummy_compile_test-cxx_dummy_co tests_elementary_cxx_cxx_dummy_compile_test_SOURCES = tests/elementary_cxx/cxx_dummy_compile_test.cc tests_elementary_cxx_cxx_dummy_compile_test_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_builddir)/src/lib/evas/canvas/ \ + -I$(top_builddir)/src/lib/evas/gesture/ \ -I$(top_builddir)/src/lib/efl/interfaces/ \ -DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/elementary_cxx\" \ -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/elementary_cxx\" \ From 6fd7c3f727102f2206a5ac08ad56902b96d64713 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Wed, 15 May 2019 17:23:32 +0900 Subject: [PATCH 29/53] efl_ui: fix to use Efl.Ui.Widget's "background" and "shadow" part class To use Efl.Ui.Widget's "background" and "shadow" part class, each widget inheriting from Efl.Ui.Widget should not use their Part class for "background" and "shadow" parts. --- src/lib/elementary/efl_ui_scroll_alert_popup.c | 12 +++++++++++- src/lib/elementary/efl_ui_text.c | 12 +++++++++++- src/lib/elementary/efl_ui_text_alert_popup.c | 12 +++++++++++- src/lib/elementary/efl_ui_textpath.c | 13 ++++++++++++- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/efl_ui_scroll_alert_popup.c b/src/lib/elementary/efl_ui_scroll_alert_popup.c index 54e28c5643..3ea05b1b2b 100644 --- a/src/lib/elementary/efl_ui_scroll_alert_popup.c +++ b/src/lib/elementary/efl_ui_scroll_alert_popup.c @@ -282,7 +282,17 @@ _efl_ui_scroll_alert_popup_efl_object_constructor(Eo *obj, /* Efl.Part begin */ -ELM_PART_OVERRIDE(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data) +static Eina_Bool +_part_is_efl_ui_scroll_alert_popup_part(const Eo *obj EINA_UNUSED, const char *part) +{ + //Use Efl.Ui.Widget's "background" and "shadow" parts + if (eina_streq(part, "background") || eina_streq(part, "shadow")) + return EINA_FALSE; + + return EINA_TRUE; +} + +ELM_PART_OVERRIDE_PARTIAL(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data, _part_is_efl_ui_scroll_alert_popup_part) ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data) ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data) ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data) diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 9cef215288..87f2ca5cc2 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -4054,7 +4054,17 @@ _efl_ui_text_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *pd, #undef STRCMP -ELM_PART_OVERRIDE(efl_ui_text, EFL_UI_TEXT, Efl_Ui_Text_Data) +static Eina_Bool +_part_is_efl_ui_text_part(const Eo *obj EINA_UNUSED, const char *part) +{ + //Use Efl.Ui.Widget's "background" and "shadow" parts + if (eina_streq(part, "background") || eina_streq(part, "shadow")) + return EINA_FALSE; + + return EINA_TRUE; +} + +ELM_PART_OVERRIDE_PARTIAL(efl_ui_text, EFL_UI_TEXT, Efl_Ui_Text_Data, _part_is_efl_ui_text_part) ELM_PART_OVERRIDE_TEXT_SET(efl_ui_text, EFL_UI_TEXT, Efl_Ui_Text_Data) ELM_PART_OVERRIDE_TEXT_GET(efl_ui_text, EFL_UI_TEXT, Efl_Ui_Text_Data) #include "efl_ui_text_part.eo.c" diff --git a/src/lib/elementary/efl_ui_text_alert_popup.c b/src/lib/elementary/efl_ui_text_alert_popup.c index 355b8c21f3..230328d21e 100644 --- a/src/lib/elementary/efl_ui_text_alert_popup.c +++ b/src/lib/elementary/efl_ui_text_alert_popup.c @@ -290,7 +290,17 @@ _efl_ui_text_alert_popup_efl_object_constructor(Eo *obj, /* Efl.Part begin */ -ELM_PART_OVERRIDE(efl_ui_text_alert_popup, EFL_UI_TEXT_ALERT_POPUP, Efl_Ui_Text_Alert_Popup_Data) +static Eina_Bool +_part_is_efl_ui_text_alert_popup_part(const Eo *obj EINA_UNUSED, const char *part) +{ + //Use Efl.Ui.Widget's "background" and "shadow" parts + if (eina_streq(part, "background") || eina_streq(part, "shadow")) + return EINA_FALSE; + + return EINA_TRUE; +} + +ELM_PART_OVERRIDE_PARTIAL(efl_ui_text_alert_popup, EFL_UI_TEXT_ALERT_POPUP, Efl_Ui_Text_Alert_Popup_Data, _part_is_efl_ui_text_alert_popup_part) ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_text_alert_popup, EFL_UI_TEXT_ALERT_POPUP, Efl_Ui_Text_Alert_Popup_Data) ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_text_alert_popup, EFL_UI_TEXT_ALERT_POPUP, Efl_Ui_Text_Alert_Popup_Data) ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_text_alert_popup, EFL_UI_TEXT_ALERT_POPUP, Efl_Ui_Text_Alert_Popup_Data) diff --git a/src/lib/elementary/efl_ui_textpath.c b/src/lib/elementary/efl_ui_textpath.c index 593339c059..10165607c7 100644 --- a/src/lib/elementary/efl_ui_textpath.c +++ b/src/lib/elementary/efl_ui_textpath.c @@ -748,7 +748,18 @@ _efl_ui_textpath_ellipsis_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *p } /* Efl.Part begin */ -ELM_PART_OVERRIDE(efl_ui_textpath, EFL_UI_TEXTPATH, Efl_Ui_Textpath_Data) + +static Eina_Bool +_part_is_efl_ui_textpath_part(const Eo *obj EINA_UNUSED, const char *part) +{ + //Use Efl.Ui.Widget's "background" and "shadow" parts + if (eina_streq(part, "background") || eina_streq(part, "shadow")) + return EINA_FALSE; + + return EINA_TRUE; +} + +ELM_PART_OVERRIDE_PARTIAL(efl_ui_textpath, EFL_UI_TEXTPATH, Efl_Ui_Textpath_Data, _part_is_efl_ui_textpath_part) ELM_PART_OVERRIDE_TEXT_SET(efl_ui_textpath, EFL_UI_TEXTPATH, Efl_Ui_Textpath_Data) ELM_PART_OVERRIDE_TEXT_GET(efl_ui_textpath, EFL_UI_TEXTPATH, Efl_Ui_Textpath_Data) #include "efl_ui_textpath_part.eo.c" From b60ca228395670bc644e33fc5fe1ea546c3deaeb Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Wed, 15 May 2019 19:14:38 +0900 Subject: [PATCH 30/53] efl_ui_popup: add efl.background swallow part To make background part cover popup's bg image, efl.background swallow part is added. --- data/elementary/themes/edc/efl/popup.edc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/data/elementary/themes/edc/efl/popup.edc b/data/elementary/themes/edc/efl/popup.edc index ac03f2642c..68714ade58 100644 --- a/data/elementary/themes/edc/efl/popup.edc +++ b/data/elementary/themes/edc/efl/popup.edc @@ -15,6 +15,11 @@ group { "efl/popup"; image.normal: "rounded_square.png"; } } + swallow { "efl.background"; + desc { "default"; + rel.to: "bg"; + } + } swallow { "efl.content"; desc { "default"; rel.to: "base"; @@ -34,7 +39,12 @@ group { "efl/alert_popup"; min: 100 100; image.border: 15 15 15 15; image.normal: "rounded_square.png"; - } + } + } + swallow { "efl.background"; + desc { "default"; + rel.to: "bg"; + } } spacer { "base"; desc { "default"; From d8cb3e7f71b485abeee9aec6695c2a9a765b8c76 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Wed, 15 May 2019 12:27:37 +0100 Subject: [PATCH 31/53] Evil: move the inclusion of all headers in evil_private.h Summary: first step for making Evil private. evil_private.h will be included in the EFL source code instead of Evil.h Test Plan: compilation Reviewers: raster, cedric, zmike Reviewed By: raster Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8893 --- src/Makefile_Evil.am | 2 -- src/lib/evil/Evil.h | 28 +------------------- src/lib/evil/evil_dlfcn.c | 11 +------- src/lib/evil/evil_fcntl.c | 3 +-- src/lib/evil/evil_langinfo.c | 3 +-- src/lib/evil/evil_locale.c | 9 +------ src/lib/evil/evil_macro.h | 27 ------------------- src/lib/evil/evil_macro_pop.h | 8 ------ src/lib/evil/evil_main.c | 9 ------- src/lib/evil/evil_mman.c | 8 ------ src/lib/evil/evil_private.h | 49 +++++++++++++++++++++++++++++++++++ src/lib/evil/evil_pwd.c | 2 +- src/lib/evil/evil_stdio.c | 8 ------ src/lib/evil/evil_stdlib.c | 12 +++------ src/lib/evil/evil_string.c | 3 +-- src/lib/evil/evil_time.c | 3 --- src/lib/evil/evil_unistd.c | 3 +-- src/lib/evil/evil_util.c | 9 +------ src/lib/evil/meson.build | 2 -- src/lib/evil/sys/mman.h | 17 ++++++++++-- 20 files changed, 76 insertions(+), 140 deletions(-) delete mode 100644 src/lib/evil/evil_macro.h delete mode 100644 src/lib/evil/evil_macro_pop.h diff --git a/src/Makefile_Evil.am b/src/Makefile_Evil.am index f3ed4787e2..5cf4c0d0f1 100644 --- a/src/Makefile_Evil.am +++ b/src/Makefile_Evil.am @@ -11,8 +11,6 @@ lib/evil/evil_dlfcn.h \ lib/evil/evil_fcntl.h \ lib/evil/evil_langinfo.h \ lib/evil/evil_locale.h \ -lib/evil/evil_macro.h \ -lib/evil/evil_macro_pop.h \ lib/evil/evil_macro_wrapper.h \ lib/evil/evil_main.h \ lib/evil/evil_stdio.h \ diff --git a/src/lib/evil/Evil.h b/src/lib/evil/Evil.h index e09e261ead..7383fe7398 100644 --- a/src/lib/evil/Evil.h +++ b/src/lib/evil/Evil.h @@ -94,15 +94,6 @@ extern "C" { #endif -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -#include -#undef WIN32_LEAN_AND_MEAN - -#include /* for mkdir in evil_macro_wrapper */ - - typedef unsigned long uid_t; typedef unsigned long gid_t; @@ -117,20 +108,6 @@ typedef unsigned short mode_t; # define strdup(str) _strdup(str) #endif - -#include "evil_macro.h" -#include "evil_dlfcn.h" -#include "evil_fcntl.h" -#include "evil_langinfo.h" -#include "evil_locale.h" -#include "evil_main.h" -#include "evil_stdlib.h" -#include "evil_stdio.h" -#include "evil_string.h" -#include "evil_time.h" -#include "evil_unistd.h" -#include "evil_util.h" - #ifndef S_ISDIR # define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) #endif @@ -177,10 +154,7 @@ typedef unsigned short mode_t; #define _S_IWUSR _S_IWRITE #define _S_IRUSR _S_IREAD -#define sigsetjmp(Env, Save) setjmp(Env) - -#include "evil_macro_wrapper.h" -#include "evil_macro_pop.h" +#include "evil_private.h" #ifdef __cplusplus } diff --git a/src/lib/evil/evil_dlfcn.c b/src/lib/evil/evil_dlfcn.c index 1a7db5e21b..ef161cc782 100644 --- a/src/lib/evil/evil_dlfcn.c +++ b/src/lib/evil/evil_dlfcn.c @@ -4,19 +4,10 @@ #include -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -#include -#undef WIN32_LEAN_AND_MEAN +#include "evil_private.h" #include /* EnumProcessModules(Ex) */ -#include "evil_macro.h" -#include "evil_util.h" -#include "evil_dlfcn.h" -#include "evil_private.h" - static char *_dl_err = NULL; static int _dl_err_viewed = 0; diff --git a/src/lib/evil/evil_fcntl.c b/src/lib/evil/evil_fcntl.c index e222f2bf73..dd23b7b838 100644 --- a/src/lib/evil/evil_fcntl.c +++ b/src/lib/evil/evil_fcntl.c @@ -8,8 +8,7 @@ #include /* for ioctlsocket */ #include -#include "evil_macro.h" -#include "evil_fcntl.h" +#include "evil_private.h" /* SOCKET is defined as a uintptr_t, so passing a fd (int) is not a problem */ static int diff --git a/src/lib/evil/evil_langinfo.c b/src/lib/evil/evil_langinfo.c index 25a863a70e..5e0a344404 100644 --- a/src/lib/evil/evil_langinfo.c +++ b/src/lib/evil/evil_langinfo.c @@ -5,8 +5,7 @@ #include #include -#include "evil_macro.h" -#include "evil_langinfo.h" +#include "evil_private.h" static char * diff --git a/src/lib/evil/evil_locale.c b/src/lib/evil/evil_locale.c index 0a28a5e493..a4d056ad93 100644 --- a/src/lib/evil/evil_locale.c +++ b/src/lib/evil/evil_locale.c @@ -6,14 +6,7 @@ #include #include -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -#include -#undef WIN32_LEAN_AND_MEAN - -#include "evil_macro.h" -#include "evil_locale.h" +#include "evil_private.h" /* * LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME need at least a buffer diff --git a/src/lib/evil/evil_macro.h b/src/lib/evil/evil_macro.h deleted file mode 100644 index 88cec3dcf8..0000000000 --- a/src/lib/evil/evil_macro.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __EVIL_MACRO_H__ -#define __EVIL_MACRO_H__ - -#if _WIN32_WINNT < 0x0600 -# error Windows XP not supported anymore -#endif - -#ifdef EAPI -# undef EAPI -#endif - -#ifdef EFL_BUILD -# ifdef DLL_EXPORT -# define EAPI __declspec(dllexport) -# else -# define EAPI -# endif -#else -# define EAPI __declspec(dllimport) -#endif - - -#ifndef PATH_MAX -# define PATH_MAX MAX_PATH -#endif - -#endif /* __EVIL_MACRO_H__ */ diff --git a/src/lib/evil/evil_macro_pop.h b/src/lib/evil/evil_macro_pop.h deleted file mode 100644 index 0fb9122459..0000000000 --- a/src/lib/evil/evil_macro_pop.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __EVIL_MACRO_POP_H__ -#define __EVIL_MACRO_POP_H__ - -#undef EAPI -#define EAPI - - -#endif /* __EVIL_MACRO_POP_H__ */ diff --git a/src/lib/evil/evil_main.c b/src/lib/evil/evil_main.c index 875d6c5764..07dcd4a06d 100644 --- a/src/lib/evil/evil_main.c +++ b/src/lib/evil/evil_main.c @@ -4,15 +4,6 @@ #include -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -#include -#undef WIN32_LEAN_AND_MEAN - -#include "evil_macro.h" -#include "evil_unistd.h" -#include "evil_main.h" #include "evil_private.h" diff --git a/src/lib/evil/evil_mman.c b/src/lib/evil/evil_mman.c index 3f632e5c74..83b9ee771b 100644 --- a/src/lib/evil/evil_mman.c +++ b/src/lib/evil/evil_mman.c @@ -7,17 +7,9 @@ #include #include -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -#include -#undef WIN32_LEAN_AND_MEAN - #include -#include "evil_macro.h" #include "sys/mman.h" -#include "evil_util.h" #include "evil_private.h" diff --git a/src/lib/evil/evil_private.h b/src/lib/evil/evil_private.h index 560b4e276d..a88572bf24 100644 --- a/src/lib/evil/evil_private.h +++ b/src/lib/evil/evil_private.h @@ -1,6 +1,9 @@ #ifndef __EVIL_PRIVATE_H__ #define __EVIL_PRIVATE_H__ +#if _WIN32_WINNT < 0x0600 +# error Windows XP not supported anymore +#endif #ifdef __cplusplus extern "C" { @@ -14,6 +17,52 @@ extern "C" { # endif #endif +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include +#undef WIN32_LEAN_AND_MEAN + +#include /* for mkdir in evil_macro_wrapper */ + + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef EFL_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif +#else +# define EAPI __declspec(dllimport) +#endif + +#ifndef PATH_MAX +# define PATH_MAX MAX_PATH +#endif + +#include "evil_dlfcn.h" +#include "evil_fcntl.h" +#include "evil_langinfo.h" +#include "evil_locale.h" +#include "evil_main.h" +#include "evil_stdlib.h" +#include "evil_stdio.h" +#include "evil_string.h" +#include "evil_time.h" +#include "evil_unistd.h" +#include "evil_util.h" + +#define sigsetjmp(Env, Save) setjmp(Env) + +#include "evil_macro_wrapper.h" + +#undef EAPI +#define EAPI + #ifdef __cplusplus } #endif diff --git a/src/lib/evil/evil_pwd.c b/src/lib/evil/evil_pwd.c index 841c106048..03e74149ac 100644 --- a/src/lib/evil/evil_pwd.c +++ b/src/lib/evil/evil_pwd.c @@ -9,7 +9,7 @@ #include #include -#include "evil_macro.h" +#include "evil_private.h" #include "pwd.h" diff --git a/src/lib/evil/evil_stdio.c b/src/lib/evil/evil_stdio.c index 6b71e922bb..61afe7ce3b 100644 --- a/src/lib/evil/evil_stdio.c +++ b/src/lib/evil/evil_stdio.c @@ -5,14 +5,6 @@ #include #include -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -#include -#undef WIN32_LEAN_AND_MEAN - -#include "evil_macro.h" -#include "evil_stdio.h" #include "evil_private.h" #undef rename diff --git a/src/lib/evil/evil_stdlib.c b/src/lib/evil/evil_stdlib.c index b03625a24d..d6de5a4fcd 100644 --- a/src/lib/evil/evil_stdlib.c +++ b/src/lib/evil/evil_stdlib.c @@ -5,20 +5,14 @@ #include #include #include +#include #include #include #include #include -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -#include -#undef WIN32_LEAN_AND_MEAN - -#include "evil_macro.h" -#include "evil_stdlib.h" +#include "evil_private.h" /* * Environment variable related functions @@ -146,7 +140,7 @@ mkdtemp(char *__template) { val = _mkstemp(suffix, val); - if (mkdir(__template) == 0) + if (_mkdir(__template) == 0) return __template; if (errno == EFAULT || diff --git a/src/lib/evil/evil_string.c b/src/lib/evil/evil_string.c index 3620ce5e89..d135454338 100644 --- a/src/lib/evil/evil_string.c +++ b/src/lib/evil/evil_string.c @@ -6,8 +6,7 @@ #include #include -#include "evil_macro.h" -#include "evil_string.h" +#include "evil_private.h" /* diff --git a/src/lib/evil/evil_time.c b/src/lib/evil/evil_time.c index 90b63692fc..32cfc2cf07 100644 --- a/src/lib/evil/evil_time.c +++ b/src/lib/evil/evil_time.c @@ -7,9 +7,6 @@ #include #include -#include "evil_macro.h" -#include "evil_time.h" -#include "evil_macro_wrapper.h" #include "evil_private.h" /* diff --git a/src/lib/evil/evil_unistd.c b/src/lib/evil/evil_unistd.c index 765c7aa34f..3eebf97e1e 100644 --- a/src/lib/evil/evil_unistd.c +++ b/src/lib/evil/evil_unistd.c @@ -12,8 +12,7 @@ #include #undef WIN32_LEAN_AND_MEAN -#include "evil_macro.h" -#include "evil_unistd.h" +#include "evil_private.h" LONGLONG _evil_time_freq; diff --git a/src/lib/evil/evil_util.c b/src/lib/evil/evil_util.c index 7add78f888..c045bf3cc0 100644 --- a/src/lib/evil/evil_util.c +++ b/src/lib/evil/evil_util.c @@ -8,14 +8,7 @@ #include #include -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -#include -#undef WIN32_LEAN_AND_MEAN - -#include "evil_macro.h" -#include "evil_util.h" +#include "evil_private.h" DWORD _evil_tls_index; diff --git a/src/lib/evil/meson.build b/src/lib/evil/meson.build index db2871c9fa..8ed266c77e 100644 --- a/src/lib/evil/meson.build +++ b/src/lib/evil/meson.build @@ -7,8 +7,6 @@ if target_machine.system() == 'windows' 'evil_fcntl.h', 'evil_langinfo.h', 'evil_locale.h', - 'evil_macro.h', - 'evil_macro_pop.h', 'evil_macro_wrapper.h', 'evil_main.h', 'evil_stdio.h', diff --git a/src/lib/evil/sys/mman.h b/src/lib/evil/sys/mman.h index 93b6bd4914..15f176acb9 100644 --- a/src/lib/evil/sys/mman.h +++ b/src/lib/evil/sys/mman.h @@ -3,7 +3,19 @@ #include -#include +#ifdef EAPI +# undef EAPI +#endif + +#ifdef EFL_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif +#else +# define EAPI __declspec(dllimport) +#endif #ifdef __cplusplus @@ -148,7 +160,8 @@ EAPI int munmap(void *addr, #endif -#include +#undef EAPI +#define EAPI #endif /* __EVIL_SYS_MMAN_H__ */ From 81d8d8ee55808dabbc124642b09bc01372d60938 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Wed, 15 May 2019 09:09:04 -0400 Subject: [PATCH 32/53] efl_ui_frame: migrate to efl.ui.clickable Summary: frame now uses efl.ui.clickable, which ensures correct click emittion. The click event is not needed in the event anymore. However, now efl,action,press / efl,action,unpress is needed. Depends on D8825 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8826 --- data/elementary/themes/edc/efl/frame.edc | 11 +++++-- src/lib/elementary/efl_ui_frame.c | 30 ++++++++++++++----- .../elementary/spec/efl_test_clickable.c | 8 ++++- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/data/elementary/themes/edc/efl/frame.edc b/data/elementary/themes/edc/efl/frame.edc index 6d3067170a..afaaba74c7 100644 --- a/data/elementary/themes/edc/efl/frame.edc +++ b/data/elementary/themes/edc/efl/frame.edc @@ -131,9 +131,14 @@ group { name: "efl/frame"; transition: DECELERATE 0.3; after: "signal"; } - program { - signal: "mouse,up,1"; source: "event"; - action: SIGNAL_EMIT "efl,action,click" "efl"; + program {signal: "mouse,down,1"; source: "event"; // for "press" smart callback + action: SIGNAL_EMIT "efl,action,press" "efl"; + } + program { signal: "mouse,up,1"; source: "event"; // for "unpress" smart callback + action: SIGNAL_EMIT "efl,action,unpress" "efl"; + } + program { signal: "mouse,pressed,out"; source: "event"; + action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; } program { signal: "efl,action,toggle"; source: "efl"; diff --git a/src/lib/elementary/efl_ui_frame.c b/src/lib/elementary/efl_ui_frame.c index b730a64db9..fd9420d6b7 100644 --- a/src/lib/elementary/efl_ui_frame.c +++ b/src/lib/elementary/efl_ui_frame.c @@ -5,6 +5,7 @@ #define EFL_ACCESS_OBJECT_PROTECTED #define ELM_LAYOUT_PROTECTED #define EFL_PART_PROTECTED +#define EFL_UI_CLICKABLE_PROTECTED #include #include "elm_priv.h" @@ -87,10 +88,7 @@ _on_frame_clicked(void *data, sd->anim = EINA_TRUE; elm_widget_tree_unfocusable_set(data, sd->collapsed); } - if (elm_widget_is_legacy(data)) - evas_object_smart_callback_call(data, "clicked", NULL); - else - efl_event_callback_call(data, EFL_UI_EVENT_CLICKED, NULL); + evas_object_smart_callback_call(data, "clicked", NULL); } /* using deferred sizing evaluation, just like the parent */ @@ -107,6 +105,25 @@ _efl_ui_frame_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Frame_Data *sd) } } +static void +_clicked_cb(void *data, const Efl_Event *ev EINA_UNUSED) +{ + EFL_UI_FRAME_DATA_GET(data, sd); + ELM_WIDGET_DATA_GET_OR_RETURN(data, wd); + + if (sd->anim) return; + + if (sd->collapsible) + { + efl_event_callback_add(wd->resize_obj, EFL_LAYOUT_EVENT_RECALC, _recalc, data); + elm_layout_signal_emit(data, "efl,action,toggle", "efl"); + + sd->collapsed++; + sd->anim = EINA_TRUE; + elm_widget_tree_unfocusable_set(data, sd->collapsed); + } +} + EOLIAN static void _efl_ui_frame_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Frame_Data *_pd EINA_UNUSED) { @@ -130,9 +147,8 @@ _efl_ui_frame_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Frame_Data *_pd EINA_UN edje_object_signal_callback_add (wd->resize_obj, "efl,anim,done", "efl", _on_recalc_done, obj); - edje_object_signal_callback_add - (wd->resize_obj, "efl,action,click", "efl", - _on_frame_clicked, obj); + efl_ui_clickable_util_bind_to_theme(wd->resize_obj, obj); + efl_event_callback_add(obj, EFL_UI_EVENT_CLICKED, _clicked_cb, obj); } elm_widget_can_focus_set(obj, EINA_FALSE); diff --git a/src/tests/elementary/spec/efl_test_clickable.c b/src/tests/elementary/spec/efl_test_clickable.c index a184053847..c1b63d38b7 100644 --- a/src/tests/elementary/spec/efl_test_clickable.c +++ b/src/tests/elementary/spec/efl_test_clickable.c @@ -8,7 +8,7 @@ /* spec-meta-start {"test-interface":"Efl.Ui.Clickable", - "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes"] + "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes", "Efl.Ui.Frame"] } spec-meta-end */ @@ -52,6 +52,12 @@ prepare_window(void) pos->x = 100; pos->y = 100; } + else if (efl_isa(widget, EFL_UI_FRAME_CLASS)) + { + efl_text_set(widget, "Test, here has to be text in order to make the frame y > 0"); + pos->x = 30; + pos->y = 10; + } evas_smart_objects_calculate(evas_object_evas_get(win)); evas_event_callback_add(evas_object_evas_get(win), EVAS_CALLBACK_RENDER_POST, prepare_window_norendered, pos); From b050294635d5104decb6d0cbad271ba507ce2d4a Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 15 May 2019 14:26:11 +0100 Subject: [PATCH 33/53] meson buildtype - use plain not debug as debug will be insanely slow eina cow backtraces on write make this impractically slow to use debug. also the switch back to dev mode was not the reverse of switching to release mode. this fixes that. --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 56701d0a21..bfe54aa274 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('efl', ['c','cpp'], version: '1.22.99', - default_options : ['cpp_std=c++11'], + default_options : ['buildtype=plain', 'cpp_std=c++11'], meson_version : '>=0.47' ) From f417fb26e88c10afec74a09a3f0b93b97c143b48 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Wed, 15 May 2019 09:49:48 -0400 Subject: [PATCH 34/53] Revert "remove vpath test for user dir the test was broken and fixing is insane" Summary: This reverts commit 954a534bc0e7f30e66cc7dfd15ac79544e92671f. It appears that the concerns from this commit are invalid. The case of ~asdf/ does not have any fallback case, if there is no getpwent on this system, then there will be simply an error, same for the case of a missing user. In such a case nothing will be written in the buffer / returned by eina_vpath. The windows build problem can be fixed by a simple #ifdef'ing the test code. Reviewers: raster, zmike, cedric, vtorri Reviewed By: vtorri Subscribers: vtorri, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8671 --- src/tests/eina/eina_test_vpath.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/tests/eina/eina_test_vpath.c b/src/tests/eina/eina_test_vpath.c index cad61bd831..7a38712acc 100644 --- a/src/tests/eina/eina_test_vpath.c +++ b/src/tests/eina/eina_test_vpath.c @@ -61,9 +61,26 @@ EFL_START_TEST(eina_test_vpath_snprintf) } EFL_END_TEST +EFL_START_TEST(eina_test_vpath_user) +{ +#ifdef HAVE_GETPWENT + char buf[PATH_MAX]; + char cmp[PATH_MAX]; + struct passwd *pwent; + + pwent = getpwuid(getuid()); + + eina_vpath_resolve_snprintf(buf, sizeof(buf), "~%s/foo/bar/king/kong/", pwent->pw_name); + snprintf(cmp, sizeof(cmp), "%s/foo/bar/king/kong/", pwent->pw_dir); + ck_assert_str_eq(buf, cmp); +#endif +} +EFL_END_TEST + void eina_test_vpath(TCase *tc) { tcase_add_test(tc, eina_test_vpath_invalid); tcase_add_test(tc, eina_test_vpath_valid); tcase_add_test(tc, eina_test_vpath_snprintf); + tcase_add_test(tc, eina_test_vpath_user); } From 7c7998b3dccc27fcee10668bb05c4e8d4e28c537 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 15 May 2019 12:44:27 -0400 Subject: [PATCH 35/53] meson: enforce 61s timeout for tests, remove explicit timeouts from build files unit tests automatically abort with info after 60s, and tests should be run with an appropriate timeout to avoid conflict with the test runner's default 30s timeout set explicit timeout in eio test for now because there's still frequent bugs here Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8894 --- .ci/ci-make-check.sh | 2 +- src/benchmarks/eina/meson.build | 1 - src/benchmarks/elementary/meson.build | 1 - src/tests/ecore/meson.build | 2 -- src/tests/ecore_cxx/meson.build | 1 - src/tests/eet_cxx/meson.build | 1 - src/tests/eina/meson.build | 1 - src/tests/eina_cxx/meson.build | 1 - src/tests/eio/meson.build | 2 +- src/tests/eldbus/meson.build | 1 - src/tests/eldbus_cxx/meson.build | 1 - src/tests/elua/meson.build | 1 - src/tests/eo_cxx/meson.build | 1 - src/tests/eolian/meson.build | 1 - src/tests/eolian_cxx/meson.build | 1 - 15 files changed, 2 insertions(+), 16 deletions(-) diff --git a/.ci/ci-make-check.sh b/.ci/ci-make-check.sh index 762cf70774..ff8f5e0894 100755 --- a/.ci/ci-make-check.sh +++ b/.ci/ci-make-check.sh @@ -23,7 +23,7 @@ if [ "$BUILDSYSTEM" = "ninja" ] ; then # https://github.com/mesonbuild/meson/commit/253c581412d7f2b09af353dd83d943454bd555be if [ "$DISTRO" != "Ubuntu1810" ] && [ "$DISTRO" != "Debian96" ]; then for tries in $(seq 1 ${NUM_TRIES}); do - (docker exec --env EINA_LOG_BACKTRACE="0" --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) meson test -C build --wrapper dbus-launch ) && break + (docker exec --env EINA_LOG_BACKTRACE="0" --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) meson test -t 120 -C build --wrapper dbus-launch ) && break docker exec --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) cat build/meson-logs/testlog-dbus-launch.txt if [ $tries != ${NUM_TRIES} ] ; then echo "tests failed, trying again!" ; fi false diff --git a/src/benchmarks/eina/meson.build b/src/benchmarks/eina/meson.build index 34c75b7ca0..9b924dd1b9 100644 --- a/src/benchmarks/eina/meson.build +++ b/src/benchmarks/eina/meson.build @@ -38,5 +38,4 @@ eina_bench = executable('eina_bench', benchmark('eina_bench', eina_bench, args : 'libcity.la', - timeout : 20*60 ) diff --git a/src/benchmarks/elementary/meson.build b/src/benchmarks/elementary/meson.build index 158a535ae2..206ea06e4b 100644 --- a/src/benchmarks/elementary/meson.build +++ b/src/benchmarks/elementary/meson.build @@ -5,5 +5,4 @@ focus_widget_tree_bench = executable('focus_widget_tree_bench', benchmark('focus_widget_tree', focus_widget_tree_bench, args: ['5'], - timeout : 5*60 ) diff --git a/src/tests/ecore/meson.build b/src/tests/ecore/meson.build index c49d941355..9ce6848ce2 100644 --- a/src/tests/ecore/meson.build +++ b/src/tests/ecore/meson.build @@ -109,11 +109,9 @@ efl_app_suite = executable('efl_app_suite', ) test('ecore-suite', ecore_suite, - timeout : 10*60, env : test_env ) test('efl-app', efl_app_suite, - timeout : 10*60, env : test_env ) diff --git a/src/tests/ecore_cxx/meson.build b/src/tests/ecore_cxx/meson.build index 75547f1258..9c88552418 100644 --- a/src/tests/ecore_cxx/meson.build +++ b/src/tests/ecore_cxx/meson.build @@ -24,6 +24,5 @@ executable('ecore_cxx_suite_compile_test', ) test('ecore_cxx-suite', ecore_cxx_suite, - timeout : 10*60, env : test_env ) diff --git a/src/tests/eet_cxx/meson.build b/src/tests/eet_cxx/meson.build index f3f3fb8046..9b5b1b0145 100644 --- a/src/tests/eet_cxx/meson.build +++ b/src/tests/eet_cxx/meson.build @@ -16,6 +16,5 @@ eet_cxx_suite = executable('eet_cxx_suite', test('ecore_cxx-suite', eet_cxx_suite, - timeout : 10*60, env : test_env ) diff --git a/src/tests/eina/meson.build b/src/tests/eina/meson.build index f111e3a12d..b6ba688e8b 100644 --- a/src/tests/eina/meson.build +++ b/src/tests/eina/meson.build @@ -69,5 +69,4 @@ eina_test_exe = executable('eina_suite', test('eina', eina_test_exe, env : test_env, - timeout : 5*60 ) diff --git a/src/tests/eina_cxx/meson.build b/src/tests/eina_cxx/meson.build index 726e01d034..facad4a9af 100644 --- a/src/tests/eina_cxx/meson.build +++ b/src/tests/eina_cxx/meson.build @@ -50,6 +50,5 @@ eina_cxx_suite = executable('eina_cxx_suite', ) test('eina_cxx-suite', eina_cxx_suite, - timeout : 10*60, env : test_env ) diff --git a/src/tests/eio/meson.build b/src/tests/eio/meson.build index 516ac2417d..4ae10236ee 100644 --- a/src/tests/eio/meson.build +++ b/src/tests/eio/meson.build @@ -26,5 +26,5 @@ eio_suite = executable('eio_suite', test('eio-suite', eio_suite, env : test_env, - timeout : 10*60 #10 min. can be realistic, this testsuite is slow! + timeout : 120 ) diff --git a/src/tests/eldbus/meson.build b/src/tests/eldbus/meson.build index f5b8319824..565c9ce7fb 100644 --- a/src/tests/eldbus/meson.build +++ b/src/tests/eldbus/meson.build @@ -29,5 +29,4 @@ eldbus_suite = executable('eldbus_suite', test('eldbus-suite', eldbus_suite, env : test_env, - timeout : 60 ) diff --git a/src/tests/eldbus_cxx/meson.build b/src/tests/eldbus_cxx/meson.build index e3e04e5290..23b955958f 100644 --- a/src/tests/eldbus_cxx/meson.build +++ b/src/tests/eldbus_cxx/meson.build @@ -16,6 +16,5 @@ eldbus_cxx_suite = executable('eldbus_cxx_suite', ) test('eldbus_cxx-suite', eldbus_cxx_suite, - timeout : 10*60, env : test_env ) diff --git a/src/tests/elua/meson.build b/src/tests/elua/meson.build index ec75f672b1..22174f0bb0 100644 --- a/src/tests/elua/meson.build +++ b/src/tests/elua/meson.build @@ -26,6 +26,5 @@ elua_suite = executable('elua_suite', ) test('elua-suite', elua_suite, - timeout : 10*60, env : test_env ) diff --git a/src/tests/eo_cxx/meson.build b/src/tests/eo_cxx/meson.build index 43e487da57..eaacac6a17 100644 --- a/src/tests/eo_cxx/meson.build +++ b/src/tests/eo_cxx/meson.build @@ -15,6 +15,5 @@ eo_cxx_suite = executable('eo_cxx_suite', ) test('eo_cxx-suite', eo_cxx_suite, - timeout : 10*60, env : test_env ) diff --git a/src/tests/eolian/meson.build b/src/tests/eolian/meson.build index a9f569dfd1..f4b6cdc6f1 100644 --- a/src/tests/eolian/meson.build +++ b/src/tests/eolian/meson.build @@ -36,6 +36,5 @@ eolian_suite = executable('eolian_suite', ) test('eolian', eolian_suite, - timeout: 30, env : test_env ) diff --git a/src/tests/eolian_cxx/meson.build b/src/tests/eolian_cxx/meson.build index aa1c5677cb..23b2727eaf 100644 --- a/src/tests/eolian_cxx/meson.build +++ b/src/tests/eolian_cxx/meson.build @@ -69,6 +69,5 @@ eolian_cxx_suite = executable('eolian_cxx_suite', ) test('eolian_cxx-suite', eolian_cxx_suite, - timeout : 10*60, env : test_env ) From 122ca2fa2f9290729e10715253e45f0ad343e09a Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Wed, 15 May 2019 17:45:56 +0200 Subject: [PATCH 36/53] theme: add a macro file for making themes easier CLICKABLE_SIGNAL_EMITS now can be used to setup all the events required to have automatically emission of all the clickable events Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D8899 --- data/elementary/themes/default.edc | 1 + data/elementary/themes/edc/efl/button.edc | 7 +--- data/elementary/themes/edc/efl/frame.edc | 10 +----- data/elementary/themes/edc/efl/macros.edc | 24 ++++++++++++++ data/elementary/themes/edc/efl/panes.edc | 40 +++-------------------- 5 files changed, 31 insertions(+), 51 deletions(-) create mode 100644 data/elementary/themes/edc/efl/macros.edc diff --git a/data/elementary/themes/default.edc b/data/elementary/themes/default.edc index 0e30946e59..7e068d6dd9 100644 --- a/data/elementary/themes/default.edc +++ b/data/elementary/themes/default.edc @@ -167,6 +167,7 @@ collections { #include "edc/O/icons.edc" // New efl ui themes +#include "edc/efl/macros.edc" #include "edc/efl/bg.edc" #include "edc/efl/button.edc" #include "edc/efl/calendar.edc" diff --git a/data/elementary/themes/edc/efl/button.edc b/data/elementary/themes/edc/efl/button.edc index 77201b9f76..4a9e2dae82 100644 --- a/data/elementary/themes/edc/efl/button.edc +++ b/data/elementary/themes/edc/efl/button.edc @@ -296,9 +296,9 @@ group { name: "efl/button"; } } programs { + EFL_UI_CLICKABLE_PART_BIND("event") program { signal: "mouse,down,1"; source: "event"; - action: SIGNAL_EMIT "efl,action,press" "efl"; after: "button_click_anim"; } program { name: "button_click_anim"; @@ -310,13 +310,8 @@ group { name: "efl/button"; } program { name: "button_unclick"; signal: "mouse,up,1"; source: "event"; - action: SIGNAL_EMIT "efl,action,unpress" "efl"; after: "button_unclick_anim"; } - program { name: "button_pressed_out"; - signal: "mouse,pressed,out"; source: "event"; - action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; - } program { name: "button_unclick_anim"; script { new m = get_int(btmode); diff --git a/data/elementary/themes/edc/efl/frame.edc b/data/elementary/themes/edc/efl/frame.edc index afaaba74c7..d964e47502 100644 --- a/data/elementary/themes/edc/efl/frame.edc +++ b/data/elementary/themes/edc/efl/frame.edc @@ -131,15 +131,7 @@ group { name: "efl/frame"; transition: DECELERATE 0.3; after: "signal"; } - program {signal: "mouse,down,1"; source: "event"; // for "press" smart callback - action: SIGNAL_EMIT "efl,action,press" "efl"; - } - program { signal: "mouse,up,1"; source: "event"; // for "unpress" smart callback - action: SIGNAL_EMIT "efl,action,unpress" "efl"; - } - program { signal: "mouse,pressed,out"; source: "event"; - action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; - } + EFL_UI_CLICKABLE_PART_BIND("event") program { signal: "efl,action,toggle"; source: "efl"; script { diff --git a/data/elementary/themes/edc/efl/macros.edc b/data/elementary/themes/edc/efl/macros.edc new file mode 100644 index 0000000000..4705310ea3 --- /dev/null +++ b/data/elementary/themes/edc/efl/macros.edc @@ -0,0 +1,24 @@ +/** + * A macro for defining the programms that are needed to redirect the mouse events of a part to the implementation of Efl.Ui.Clickable. + * + * The Widget using this has to call the method bind_to_theme of Efl.Ui.Clickable_Util in order to redirect the here called signals to real events that can be used in code. + * The resulting events on the widget will be from the Efl.Ui.Clickable class. + */ + +#define EFL_UI_CLICKABLE_PART_BIND(PART) \ +program { \ + signal: "mouse,down,1"; source: PART; \ + action: SIGNAL_EMIT "efl,action,press" "efl"; \ +} \ +program { \ + signal: "mouse,down,1,*"; source: PART; \ + action: SIGNAL_EMIT "efl,action,press" "efl"; \ +} \ +program { \ + signal: "mouse,up,1"; source: PART; \ + action: SIGNAL_EMIT "efl,action,unpress" "efl"; \ +} \ +program { \ + signal: "mouse,pressed,out"; source: PART; \ + action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; \ +} diff --git a/data/elementary/themes/edc/efl/panes.edc b/data/elementary/themes/edc/efl/panes.edc index 6809817d73..5bd90aed7d 100644 --- a/data/elementary/themes/edc/efl/panes.edc +++ b/data/elementary/themes/edc/efl/panes.edc @@ -129,15 +129,7 @@ group { name: "efl/panes/vertical"; } } programs { - program {signal: "mouse,down,1"; source: "bar"; // for "press" smart callback - action: SIGNAL_EMIT "efl,action,press" "efl"; - } - program { signal: "mouse,up,1"; source: "bar"; // for "unpress" smart callback - action: SIGNAL_EMIT "efl,action,unpress" "efl"; - } - program { signal: "mouse,pressed,out"; source: "bar"; - action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; - } + EFL_UI_CLICKABLE_PART_BIND("bar") program { // for elm_panes_fixed_set() signal: "efl,panes,fixed"; source: "efl"; action: STATE_SET "disabled" 0.0; @@ -267,15 +259,7 @@ group { name: "efl/panes/horizontal"; } } programs { - program {signal: "mouse,down,1"; source: "bar"; // for "press" smart callback - action: SIGNAL_EMIT "efl,action,press" "efl"; - } - program { signal: "mouse,up,1"; source: "bar"; // for "unpress" smart callback - action: SIGNAL_EMIT "efl,action,unpress" "efl"; - } - program { signal: "mouse,pressed,out"; source: "bar"; - action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; - } + EFL_UI_CLICKABLE_PART_BIND("bar") program { // for elm_panes_fixed_set() signal: "efl,panes,fixed"; source: "efl"; action: STATE_SET "disabled" 0.0; @@ -464,15 +448,7 @@ group { name: "efl/panes/vertical:flush"; } } programs { - program {signal: "mouse,down,1"; source: "bar"; // for "press" smart callback - action: SIGNAL_EMIT "efl,action,press" "efl"; - } - program { signal: "mouse,up,1"; source: "bar"; // for "unpress" smart callback - action: SIGNAL_EMIT "efl,action,unpress" "efl"; - } - program { signal: "mouse,pressed,out"; source: "bar"; - action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; - } + EFL_UI_CLICKABLE_PART_BIND("bar") program { // for elm_panes_fixed_set() signal: "efl,panes,fixed"; source: "efl"; action: STATE_SET "disabled" 0.0; @@ -717,15 +693,7 @@ group { name: "efl/panes/horizontal:flush"; target: "glow2a"; target: "glow2b"; } - program {signal: "mouse,down,1"; source: "bar"; // for "press" smart callback - action: SIGNAL_EMIT "efl,action,press" "efl"; - } - program { signal: "mouse,up,1"; source: "bar"; // for "unpress" smart callback - action: SIGNAL_EMIT "efl,action,unpress" "efl"; - } - program { signal: "mouse,pressed,out"; source: "bar"; - action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; - } + EFL_UI_CLICKABLE_PART_BIND("bar") program { // for elm_panes_fixed_set() signal: "efl,panes,fixed"; source: "efl"; action: STATE_SET "disabled" 0.0; From 6da6bd536e1386488d3e2e746659f113226a3e02 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Wed, 15 May 2019 21:53:02 +0900 Subject: [PATCH 37/53] efl_canvas_text: fix to set halign correctly Previously, halign_auto was AUTO_NORMAL when halign was set so the given halign value could not be applied correctly. Now, halign_auto is modified to AUTO_NONE before halign is set so the given halign value is applied correctly. --- src/lib/evas/canvas/evas_object_textblock.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index bb8deab1ce..c0948b1756 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -15995,11 +15995,6 @@ _efl_canvas_text_efl_text_font_font_bitmap_scalable_get(const Eo *obj EINA_UNUSE _FMT(x) = v; \ _canvas_text_format_changed(obj, o); -#define _FMT_DBL_SET(x, v) \ - if (EINA_DBL_EQ(_FMT(x), v)) return; \ - _FMT(x) = v; \ - _canvas_text_format_changed(obj, o); - /* Helper: updates format field of extended format information, and informs if changed. */ #define _FMT_INFO_SET_START(x, v) \ Eina_Bool changed = EINA_FALSE; \ @@ -16453,8 +16448,9 @@ _efl_canvas_text_efl_text_format_halign_set(Eo *obj, Efl_Canvas_Text_Data *o, double value) { ASYNC_BLOCK; - _FMT_DBL_SET(halign, value); + if (EINA_DBL_EQ(_FMT(halign), value)) return; _FMT(halign_auto) = EVAS_TEXTBLOCK_ALIGN_AUTO_NONE; + _FMT_SET(halign, value); } static double From 60bc43462855f050f0522276b6647854d195b8e4 Mon Sep 17 00:00:00 2001 From: WooHyun Jung Date: Thu, 16 May 2019 10:02:28 +0200 Subject: [PATCH 38/53] csharp: fix formatting in generated .eo.cs codes Summary: There was duplicated scope_tab, so I removed it. Test Plan: - ./autogen --enable-csharp-bindings - make Reviewers: lauromoura, felipealmeida, Jaehyun_Cho, YOhoho, segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8901 --- src/bin/eolian_mono/eolian/mono/events.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/eolian_mono/eolian/mono/events.hh b/src/bin/eolian_mono/eolian/mono/events.hh index b5e6e4a7f1..350dd57ad4 100644 --- a/src/bin/eolian_mono/eolian/mono/events.hh +++ b/src/bin/eolian_mono/eolian/mono/events.hh @@ -337,7 +337,7 @@ struct event_definition_generator auto sub_context = change_indentation(indent.inc().inc(), context); - if (!as_generator(scope_tab(6) << wrapper_args_type << " args = new " << wrapper_args_type << "();\n" + if (!as_generator(wrapper_args_type << " args = new " << wrapper_args_type << "();\n" << scope_tab(6) << "args.arg = ").generate(arg_initializer_sink, attributes::unused, context)) return false; if (!(*etype).original_type.visit(unpack_event_args_visitor{arg_initializer_sink, &sub_context, *etype})) From 7f45f94af0201d48f7fcae14c6320ce3b9bcab71 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 16 May 2019 14:36:12 +0200 Subject: [PATCH 39/53] Eo: replace Evil.h with evil_private.h Test Plan: compilation Reviewers: q66, raster, zmike Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8905 --- src/lib/eo/eo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index c16c021ef2..0113434a8c 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -9,7 +9,7 @@ #include #ifdef _WIN32 -# include +# include /* evil_time_get dladdr */ #endif #if defined(__APPLE__) && defined(__MACH__) From 4ab1f2388eb303f8e5d9eae31cdcf39df683c736 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Thu, 16 May 2019 15:31:37 +0200 Subject: [PATCH 40/53] eolian: add API to retrieve the C name of an object This is to prepare for type/class renaming support. This adds the necessary API to retrieve C-specific names. Other refactoring is necessary elsewhere for now. This also renames the old API eolian_class_c_name_get to eolian_class_c_macro_get to avoid conflict as well as clarify the intention. --- src/bin/eolian/headers.c | 2 +- src/bin/eolian/sources.c | 6 +- src/bindings/luajit/eolian.lua | 15 ++++- src/lib/eolian/Eolian.h | 88 +++++++++++++++++++++++++++-- src/lib/eolian/database_class.c | 1 + src/lib/eolian/database_class_api.c | 2 +- src/lib/eolian/database_type.c | 2 + src/lib/eolian/database_var.c | 1 + src/lib/eolian/eo_parser.c | 20 +++++++ src/lib/eolian/eolian_database.c | 7 +++ src/lib/eolian/eolian_database.h | 1 + src/scripts/pyolian/eolian.py | 4 +- src/scripts/pyolian/eolian_lib.py | 6 +- src/scripts/pyolian/test_eolian.py | 2 +- src/tests/eolian/eolian_parsing.c | 3 +- 15 files changed, 141 insertions(+), 19 deletions(-) diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c index d35c604577..645d6945d1 100644 --- a/src/bin/eolian/headers.c +++ b/src/bin/eolian/headers.c @@ -205,7 +205,7 @@ eo_gen_header_gen(const Eolian_State *state, const Eolian_Class *cl, } } - Eina_Stringshare *mname = eolian_class_c_name_get(cl); + Eina_Stringshare *mname = eolian_class_c_macro_get(cl); Eina_Stringshare *gname = eolian_class_c_get_function_name_get(cl); eina_strbuf_append_printf(buf, "#define %s %s()\n\n", mname, gname); eina_stringshare_del(mname); diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c index 265dc75d92..37acd7e641 100644 --- a/src/bin/eolian/sources.c +++ b/src/bin/eolian/sources.c @@ -1163,14 +1163,14 @@ eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf) eina_strbuf_append(buf, ", NULL"); else { - Eina_Stringshare *mname = eolian_class_c_name_get(icl); + Eina_Stringshare *mname = eolian_class_c_macro_get(icl); eina_strbuf_append_printf(buf, ", %s", mname); eina_stringshare_del(mname); } Eina_Iterator *itr = eolian_class_extensions_get(cl); EINA_ITERATOR_FOREACH(itr, icl) { - Eina_Stringshare *mname = eolian_class_c_name_get(icl); + Eina_Stringshare *mname = eolian_class_c_macro_get(icl); eina_strbuf_append_printf(buf, ", %s", mname); eina_stringshare_del(mname); } @@ -1342,7 +1342,7 @@ _gen_proto(const Eolian_Class *cl, const Eolian_Function *fid, if (!strcmp(efname + strlen(efname) - sizeof("destructor") + 1, "destructor")) { Eina_Stringshare *fcn = eolian_function_full_c_name_get(fid, ftype); - Eina_Stringshare *mname = eolian_class_c_name_get(cl); + Eina_Stringshare *mname = eolian_class_c_macro_get(cl); eina_strbuf_append(buf, " "); eina_strbuf_append(buf, fcn); eina_stringshare_del(fcn); diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index a89946c1eb..d3edf8492b 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -301,6 +301,7 @@ ffi.cdef [[ int eolian_object_line_get(const Eolian_Object *obj); int eolian_object_column_get(const Eolian_Object *obj); const char *eolian_object_name_get(const Eolian_Object *obj); + const char *eolian_object_c_name_get(const Eolian_Object *obj); const char *eolian_object_short_name_get(const Eolian_Object *obj); Eina_Iterator *eolian_object_namespaces_get(const Eolian_Object *obj); Eina_Bool eolian_object_is_beta(const Eolian_Object *obj); @@ -409,7 +410,7 @@ ffi.cdef [[ const char *eolian_class_c_get_function_name_get(const Eolian_Class *klass); Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp); Eolian_Type_Builtin_Type eolian_type_builtin_type_get(const Eolian_Type *tp); - const char *eolian_class_c_name_get(const Eolian_Class *klass); + const char *eolian_class_c_macro_get(const Eolian_Class *klass); const char *eolian_class_c_data_type_get(const Eolian_Class *klass); Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp); Eina_Iterator *eolian_typedecl_struct_fields_get(const Eolian_Typedecl *tp); @@ -587,6 +588,14 @@ local object_idx, wrap_object = gen_wrap { return ffi.string(v) end, + c_name_get = function(self) + local v = eolian.eolian_object_c_name_get(cast_obj(self)) + if v == nil then + return nil + end + return ffi.string(v) + end, + short_name_get = function(self) local v = eolian.eolian_object_short_name_get(cast_obj(self)) if v == nil then @@ -1510,8 +1519,8 @@ M.Class = ffi.metatype("Eolian_Class", { return ffi_stringshare(v) end, - c_name_get = function(self) - local v = eolian.eolian_class_c_name_get(self) + c_macro_get = function(self) + local v = eolian.eolian_class_c_macro_get(self) if v == nil then return nil end return ffi_stringshare(v) end, diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 748edb9be6..662cf39f7a 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -586,6 +586,7 @@ EAPI void *eolian_state_error_data_set(Eolian_State *state, void *data); * @see eolian_object_line_get * @see eolian_object_column_get * @see eolian_object_name_get + * @see eolian_object_c_name_get * * @ingroup Eolian */ @@ -601,6 +602,7 @@ EAPI Eolian_Object_Type eolian_object_type_get(const Eolian_Object *obj); * @see eolian_object_line_get * @see eolian_object_column_get * @see eolian_object_name_get + * @see eolian_object_c_name_get * * @ingroup Eolian */ @@ -617,6 +619,7 @@ EAPI const Eolian_Unit *eolian_object_unit_get(const Eolian_Object *obj); * @see eolian_object_line_get * @see eolian_object_column_get * @see eolian_object_name_get + * @see eolian_object_c_name_get * * @ingroup Eolian */ @@ -632,6 +635,7 @@ EAPI const char *eolian_object_file_get(const Eolian_Object *obj); * @see eolian_object_file_get * @see eolian_object_column_get * @see eolian_object_name_get + * @see eolian_object_c_name_get * * @ingroup Eolian */ @@ -650,6 +654,7 @@ EAPI int eolian_object_line_get(const Eolian_Object *obj); * @see eolian_object_file_get * @see eolian_object_line_get * @see eolian_object_name_get + * @see eolian_object_c_name_get * * @ingroup Eolian */ @@ -669,11 +674,34 @@ EAPI int eolian_object_column_get(const Eolian_Object *obj); * @see eolian_object_column_get * @see eolian_object_short_name_get * @see eolian_object_namespaces_get + * @see eolian_object_c_name_get * * @ingroup Eolian */ EAPI const char *eolian_object_name_get(const Eolian_Object *obj); +/* + * @brief Get the C name of an object. + * + * This is the full name, but for C. It is typically derived from the + * regular full name, with namespaces flattened to underscores, but + * some things may be explicitly renamed. Only classes, types (both + * declarations and instances) and variables have C names, as others + * are never referred to by name directly in C. + * + * @see eolian_object_unit_get + * @see eolian_object_type_get + * @see eolian_object_file_get + * @see eolian_object_line_get + * @see eolian_object_column_get + * @see eolian_object_short_name_get + * @see eolian_object_namespaces_get + * @see eolian_object_name_get + * + * @ingroup Eolian + */ +EAPI const char *eolian_object_c_name_get(const Eolian_Object *obj); + /* * @brief Get the short name of an object. * @@ -1391,6 +1419,19 @@ eolian_class_name_get(const Eolian_Class *klass) return eolian_object_name_get(EOLIAN_OBJECT(klass)); } +/* + * @brief A helper function to get the C name of a class. + * + * @see eolian_object_c_name_get + * + * @ingroup Eolian + */ +static inline const char * +eolian_class_c_name_get(const Eolian_Class *klass) +{ + return eolian_object_c_name_get(EOLIAN_OBJECT(klass)); +} + /* * @brief A helper function to get the short name of a class. * @@ -2278,12 +2319,12 @@ EAPI Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass); EAPI Eina_Stringshare *eolian_class_c_get_function_name_get(const Eolian_Class *klass); /* - * @brief Get the C name of the class. + * @brief Get the C macro of the class. * * @param[in] klass the class - * @return the C name + * @return the C symbol * - * The C name is the name of the macro the class is accessed through, in format + * This is the name by which the class is accessed in C environment, in format * CLASS_NAME_SUFFIX where SUFFIX is CLASS, MIXIN or INTERFACE. You're responsible * for the stringshare afterwards. * @@ -2291,7 +2332,7 @@ EAPI Eina_Stringshare *eolian_class_c_get_function_name_get(const Eolian_Class * * * @ingroup Eolian */ -EAPI Eina_Stringshare *eolian_class_c_name_get(const Eolian_Class *klass); +EAPI Eina_Stringshare *eolian_class_c_macro_get(const Eolian_Class *klass); /* * @brief Get the C data type of the class. @@ -2559,6 +2600,19 @@ eolian_typedecl_name_get(const Eolian_Typedecl *tp) return eolian_object_name_get(EOLIAN_OBJECT(tp)); } +/* + * @brief A helper function to get the C name of a typedecl. + * + * @see eolian_object_c_name_get + * + * @ingroup Eolian + */ +static inline const char * +eolian_typedecl_c_name_get(const Eolian_Typedecl *tp) +{ + return eolian_object_c_name_get(EOLIAN_OBJECT(tp)); +} + /* * @brief A helper function to get the short name of a typedecl. * @@ -2754,6 +2808,19 @@ eolian_type_name_get(const Eolian_Type *tp) return eolian_object_name_get(EOLIAN_OBJECT(tp)); } +/* + * @brief A helper function to get the C name of a type. + * + * @see eolian_object_c_name_get + * + * @ingroup Eolian + */ +static inline const char * +eolian_type_c_name_get(const Eolian_Type *tp) +{ + return eolian_object_c_name_get(EOLIAN_OBJECT(tp)); +} + /* * @brief A helper function to get the short name of a type. * @@ -2997,6 +3064,19 @@ eolian_variable_name_get(const Eolian_Variable *tp) return eolian_object_name_get(EOLIAN_OBJECT(tp)); } +/* + * @brief A helper function to get the C name of a variable. + * + * @see eolian_object_c_name_get + * + * @ingroup Eolian + */ +static inline const char * +eolian_variable_c_name_get(const Eolian_Variable *tp) +{ + return eolian_object_c_name_get(EOLIAN_OBJECT(tp)); +} + /* * @brief A helper function to get the short name of a variable. * diff --git a/src/lib/eolian/database_class.c b/src/lib/eolian/database_class.c index 4c8c45d400..110817cdb5 100644 --- a/src/lib/eolian/database_class.c +++ b/src/lib/eolian/database_class.c @@ -18,6 +18,7 @@ database_class_del(Eolian_Class *cl) eina_stringshare_del(cl->base.file); eina_stringshare_del(cl->base.name); + eina_stringshare_del(cl->base.c_name); EINA_LIST_FREE(cl->implements, impl) database_implement_del(impl); diff --git a/src/lib/eolian/database_class_api.c b/src/lib/eolian/database_class_api.c index 3e3b0d78d5..5733d6c6ff 100644 --- a/src/lib/eolian/database_class_api.c +++ b/src/lib/eolian/database_class_api.c @@ -178,7 +178,7 @@ eolian_class_c_get_function_name_get(const Eolian_Class *cl) } EAPI Eina_Stringshare * -eolian_class_c_name_get(const Eolian_Class *cl) +eolian_class_c_macro_get(const Eolian_Class *cl) { EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); Eina_Stringshare *ret; diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c index 529617e348..2523527a2d 100644 --- a/src/lib/eolian/database_type.c +++ b/src/lib/eolian/database_type.c @@ -11,6 +11,7 @@ database_type_del(Eolian_Type *tp) if (!tp || eolian_object_unref(&tp->base)) return; eina_stringshare_del(tp->base.file); eina_stringshare_del(tp->base.name); + eina_stringshare_del(tp->base.c_name); database_type_del(tp->base_type); database_type_del(tp->next_type); if (tp->freefunc) eina_stringshare_del(tp->freefunc); @@ -23,6 +24,7 @@ database_typedecl_del(Eolian_Typedecl *tp) if (!tp || eolian_object_unref(&tp->base)) return; eina_stringshare_del(tp->base.file); eina_stringshare_del(tp->base.name); + eina_stringshare_del(tp->base.c_name); database_type_del(tp->base_type); if (tp->fields) eina_hash_free(tp->fields); if (tp->field_list) eina_list_free(tp->field_list); diff --git a/src/lib/eolian/database_var.c b/src/lib/eolian/database_var.c index a6eea20cdf..4007091848 100644 --- a/src/lib/eolian/database_var.c +++ b/src/lib/eolian/database_var.c @@ -11,6 +11,7 @@ database_var_del(Eolian_Variable *var) if (!var || eolian_object_unref(&var->base)) return; eina_stringshare_del(var->base.file); eina_stringshare_del(var->base.name); + eina_stringshare_del(var->base.c_name); if (var->base_type) database_type_del(var->base_type); if (var->value) database_expr_del(var->value); diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 65a28dfd58..80d89e558b 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -98,6 +98,17 @@ check_match(Eo_Lexer *ls, int what, int who, int where, int col) } } +static Eina_Stringshare * +make_c_name(const char *fulln) +{ + char *mbuf = strdup(fulln); + for (char *p = mbuf; (p = strchr(p, '.')); ++p) + *p = '_'; + Eina_Stringshare *ret = eina_stringshare_add(mbuf); + free(mbuf); + return ret; +} + static Eina_Bool compare_class_file(const char *fn1, const char *fn2) { @@ -440,6 +451,7 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, def->is_extern = is_extern; def->base.is_beta = is_beta; def->base.name = name; + def->base.c_name = make_c_name(name); def->type = EOLIAN_TYPEDECL_STRUCT; def->fields = eina_hash_string_small_new(EINA_FREE_CB(_struct_field_free)); if (freefunc) @@ -499,6 +511,7 @@ parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, def->is_extern = is_extern; def->base.is_beta = is_beta; def->base.name = name; + def->base.c_name = make_c_name(name); def->type = EOLIAN_TYPEDECL_ENUM; def->fields = eina_hash_string_small_new(EINA_FREE_CB(_enum_field_free)); check_next(ls, '{'); @@ -672,6 +685,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ptr) { def->btype = ls->t.kw - KW_byte + 1; def->base.name = eina_stringshare_ref(ls->t.value.s); + def->base.c_name = eina_stringshare_ref(def->base.name); eo_lexer_get(ls); if ((tpid >= KW_accessor && tpid <= KW_list) || (tpid >= KW_slice && tpid <= KW_rw_slice)) @@ -723,6 +737,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ptr) def->type = EOLIAN_TYPE_CLASS; } def->base.name = eina_stringshare_add(nm); + def->base.c_name = make_c_name(nm); eo_lexer_context_pop(ls); eo_lexer_dtor_pop(ls); } @@ -760,6 +775,7 @@ tags_done: FILL_BASE(def->base, ls, ls->line_number, ls->column, TYPEDECL); parse_name(ls, buf); def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); + def->base.c_name = make_c_name(def->base.name); Eolian_Object *decl = _eolian_decl_get(ls, def->base.name); if (decl) { @@ -805,6 +821,7 @@ tags_done: FILL_BASE(def->base, ls, ls->line_number, ls->column, VARIABLE); parse_name(ls, buf); def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); + def->base.c_name = make_c_name(def->base.name); Eolian_Object *decl = _eolian_decl_get(ls, def->base.name); if (decl) { @@ -1257,6 +1274,7 @@ parse_function_pointer(Eo_Lexer *ls) tags_done: parse_name(ls, buf); def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); + def->base.c_name = make_c_name(def->base.name); eo_lexer_dtor_pop(ls); meth = calloc(1, sizeof(Eolian_Function)); @@ -2047,6 +2065,7 @@ parse_class(Eo_Lexer *ls, Eolian_Class_Type type) eo_lexer_syntax_error(ls, "class and file names differ"); } ls->klass->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); + ls->klass->base.c_name = make_c_name(ls->klass->base.name); Eolian_Object *decl = _eolian_decl_get(ls, ls->klass->base.name); if (decl) { @@ -2246,6 +2265,7 @@ postparams: eo_lexer_dtor_pop(ls); } def->base.name = name; + def->base.c_name = make_c_name(name); eo_lexer_get(ls); FILL_DOC(ls, def, doc); FILL_BASE(def->base, ls, line, col, TYPEDECL); diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index 194ac064a2..93e833e9a5 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -60,6 +60,13 @@ eolian_object_name_get(const Eolian_Object *obj) return obj->name; } +EAPI const char * +eolian_object_c_name_get(const Eolian_Object *obj) +{ + if (!obj) return NULL; + return obj->c_name; +} + typedef struct _Eolian_Namespace_List { Eina_Iterator itr; diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index baf2fde640..f2dceba007 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h @@ -85,6 +85,7 @@ struct _Eolian_Object Eolian_Unit *unit; Eina_Stringshare *file; Eina_Stringshare *name; + Eina_Stringshare *c_name; int line; int column; int refcount; diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index 84e3f480ed..502c658971 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -636,8 +636,8 @@ class Class(Object): return "".format(self) @cached_property - def c_name(self): - s = lib.eolian_class_c_name_get(self) + def c_macro(self): + s = lib.eolian_class_c_macro_get(self) ret = _str_to_py(s) lib.eina_stringshare_del(c_void_p(s)) return ret diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py index 6e9f9cb1a6..655684b66b 100644 --- a/src/scripts/pyolian/eolian_lib.py +++ b/src/scripts/pyolian/eolian_lib.py @@ -306,9 +306,9 @@ lib.eolian_class_dtor_enable_get.restype = c_bool lib.eolian_class_c_get_function_name_get.argtypes = (c_void_p,) lib.eolian_class_c_get_function_name_get.restype = c_void_p # Stringshare TO BE FREED -# EAPI Eina_Stringshare *eolian_class_c_name_get(const Eolian_Class *klass); -lib.eolian_class_c_name_get.argtypes = (c_void_p,) -lib.eolian_class_c_name_get.restype = c_void_p # Stringshare TO BE FREED +# EAPI Eina_Stringshare *eolian_class_c_macro_get(const Eolian_Class *klass); +lib.eolian_class_c_macro_get.argtypes = (c_void_p,) +lib.eolian_class_c_macro_get.restype = c_void_p # Stringshare TO BE FREED # EAPI Eina_Stringshare *eolian_class_c_data_type_get(const Eolian_Class *klass); lib.eolian_class_c_data_type_get.argtypes = (c_void_p,) diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py index 990fcfc6c9..b394c502cf 100755 --- a/src/scripts/pyolian/test_eolian.py +++ b/src/scripts/pyolian/test_eolian.py @@ -333,7 +333,7 @@ class TestEolianClass(unittest.TestCase): self.assertFalse(cls.ctor_enable) self.assertFalse(cls.dtor_enable) self.assertEqual(cls.c_get_function_name, 'efl_loop_timer_class_get') - self.assertEqual(cls.c_name, 'EFL_LOOP_TIMER_CLASS') + self.assertEqual(cls.c_macro, 'EFL_LOOP_TIMER_CLASS') self.assertEqual(cls.c_data_type, 'Efl_Loop_Timer_Data') self.assertEqual([f.name for f in cls.methods], ['reset','loop_reset','delay']) self.assertEqual([f.name for f in cls.properties], ['interval','pending']) diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 60dc8f965d..5ac08b8cd2 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -575,9 +575,10 @@ EFL_START_TEST(eolian_simple_parsing) eina_stringshare_del(string); /* c name */ - fail_if(!(string = eolian_class_c_name_get(class))); + fail_if(!(string = eolian_class_c_macro_get(class))); fail_if(strcmp(string, "CLASS_SIMPLE_CLASS")); eina_stringshare_del(string); + fail_if(strcmp(eolian_class_c_name_get(class), "Class_Simple")); /* Property */ fail_if(!(fid = eolian_class_function_by_name_get(class, "a", EOLIAN_PROPERTY))); From b3a870c7bb29461c6478fae9f51c211229b62d9d Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Thu, 16 May 2019 15:52:46 +0200 Subject: [PATCH 41/53] eolian: rename eolian_typedecl_enum_field_c_name_get This is to allow for better object oriented APIs, as the `c_name` field would be inherited from Object. This also makes it more clear in C. --- src/bin/eolian/docs.c | 2 +- src/bin/eolian/types.c | 2 +- src/bin/eolian_js/main.cc | 2 +- src/bindings/luajit/eolian.lua | 4 ++-- src/lib/eolian/Eolian.h | 4 ++-- src/lib/eolian/database_type_api.c | 2 +- src/lib/eolian_cxx/grammar/klass_def.hpp | 2 +- src/scripts/pyolian/eolian.py | 4 ++-- src/scripts/pyolian/eolian_lib.py | 6 +++--- src/scripts/pyolian/test_eolian.py | 2 +- src/tests/eolian/eolian_parsing.c | 4 ++-- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c index 7120612c9d..e497581e83 100644 --- a/src/bin/eolian/docs.c +++ b/src/bin/eolian/docs.c @@ -68,7 +68,7 @@ _generate_ref(const Eolian_State *state, const char *refn, Eina_Strbuf *wbuf) eina_stringshare_del(bname); goto noref; } - Eina_Stringshare *str = eolian_typedecl_enum_field_c_name_get(efl); + Eina_Stringshare *str = eolian_typedecl_enum_field_c_constant_get(efl); eina_strbuf_append(wbuf, str); eina_stringshare_del(bname); return; diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c index 85e443e6d8..a932a7c046 100644 --- a/src/bin/eolian/types.c +++ b/src/bin/eolian/types.c @@ -81,7 +81,7 @@ _type_generate(const Eolian_State *state, const Eolian_Typedecl *tp, const Eolian_Expression *vale = eolian_typedecl_enum_field_value_get(memb, EINA_FALSE); Eina_Stringshare *membn = - eolian_typedecl_enum_field_c_name_get(memb); + eolian_typedecl_enum_field_c_constant_get(memb); if (!vale) eina_strbuf_append_printf(buf, " %s", membn); else diff --git a/src/bin/eolian_js/main.cc b/src/bin/eolian_js/main.cc index 86940d1dba..71466a8f83 100644 --- a/src/bin/eolian_js/main.cc +++ b/src/bin/eolian_js/main.cc @@ -1174,7 +1174,7 @@ int main(int argc, char** argv) , ef_end; ef != ef_end; ++ef) { auto field_name = ::eolian_typedecl_enum_field_name_get(&*ef); - auto field_c_name = ::eolian_typedecl_enum_field_c_name_get(&*ef); + auto field_c_name = ::eolian_typedecl_enum_field_c_constant_get(&*ef); if (!field_name || !field_c_name) { EINA_CXX_DOM_LOG_ERR(eolian::js::domain) << "Could not get enum field name"; diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index d3edf8492b..71886511bf 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -419,7 +419,7 @@ ffi.cdef [[ const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl); Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp); const Eolian_Enum_Type_Field *eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field); - const char *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl); + const char *eolian_typedecl_enum_field_c_constant_get(const Eolian_Enum_Type_Field *fl); const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl); const Eolian_Expression *eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force); @@ -979,7 +979,7 @@ ffi.metatype("Eolian_Struct_Type_Field", { ffi.metatype("Eolian_Enum_Type_Field", { __index = wrap_object { c_name_get = function(self) - local v = eolian.eolian_typedecl_enum_field_c_name_get(self) + local v = eolian.eolian_typedecl_enum_field_c_constant_get(self) if v == nil then return nil end return ffi_stringshare(v) end, diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 662cf39f7a..3207e16634 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -2469,7 +2469,7 @@ eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *field) } /* - * @brief Get the C name of a field of an enum type. + * @brief Get the C constant name used to refer to a particular enum field. * * The user of the API is responsible for the resulting stringshare. * @@ -2478,7 +2478,7 @@ eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *field) * * @ingroup Eolian */ -EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl); +EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_constant_get(const Eolian_Enum_Type_Field *fl); /* * @brief Get the documentation of a field of an enum type. diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c index 7d471c7ee4..b10a9a700f 100644 --- a/src/lib/eolian/database_type_api.c +++ b/src/lib/eolian/database_type_api.c @@ -86,7 +86,7 @@ eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field) } EAPI Eina_Stringshare * -eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl) +eolian_typedecl_enum_field_c_constant_get(const Eolian_Enum_Type_Field *fl) { Eina_Stringshare *ret; Eina_Strbuf *buf; diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index fa32dfbe93..60abbb54a6 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp @@ -1474,7 +1474,7 @@ struct enum_value_def enum_value_def(Eolian_Enum_Type_Field const* enum_field, Eolian_Unit const*) { name = eolian_typedecl_enum_field_name_get(enum_field); - c_name = eolian_typedecl_enum_field_c_name_get(enum_field); + c_name = eolian_typedecl_enum_field_c_constant_get(enum_field); auto exp = eolian_typedecl_enum_field_value_get(enum_field, EINA_TRUE); value = eolian_expression_eval(exp, EOLIAN_MASK_INT); // FIXME hardcoded int documentation = eolian_typedecl_enum_field_documentation_get(enum_field); diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index 502c658971..787c9ff694 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -1190,8 +1190,8 @@ class Enum_Type_Field(Object): return "".format(self) @cached_property - def c_name(self): - s = lib.eolian_typedecl_enum_field_c_name_get(self) + def c_constant(self): + s = lib.eolian_typedecl_enum_field_c_constant_get(self) ret = _str_to_py(s) lib.eina_stringshare_del(c_void_p(s)) return ret diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py index 655684b66b..15863cf3b4 100644 --- a/src/scripts/pyolian/eolian_lib.py +++ b/src/scripts/pyolian/eolian_lib.py @@ -525,9 +525,9 @@ lib.eolian_typedecl_enum_fields_get.restype = c_void_p lib.eolian_typedecl_enum_field_get.argtypes = (c_void_p, c_char_p) lib.eolian_typedecl_enum_field_get.restype = c_void_p -# EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl); -lib.eolian_typedecl_enum_field_c_name_get.argtypes = (c_void_p,) -lib.eolian_typedecl_enum_field_c_name_get.restype = c_void_p # Stringshare TO BE FREED +# EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_constant_get(const Eolian_Enum_Type_Field *fl); +lib.eolian_typedecl_enum_field_c_constant_get.argtypes = (c_void_p,) +lib.eolian_typedecl_enum_field_c_constant_get.restype = c_void_p # Stringshare TO BE FREED # EAPI const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl); lib.eolian_typedecl_enum_field_documentation_get.argtypes = (c_void_p,) diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py index b394c502cf..0a28cb1010 100755 --- a/src/scripts/pyolian/test_eolian.py +++ b/src/scripts/pyolian/test_eolian.py @@ -512,7 +512,7 @@ class TestEolianTypedecl(unittest.TestCase): field = td.enum_field_get('v1_0') self.assertIsInstance(field, eolian.Enum_Type_Field) self.assertEqual(field.name, 'v1_0') - self.assertEqual(field.c_name, 'EFL_NET_HTTP_VERSION_V1_0') + self.assertEqual(field.c_constant, 'EFL_NET_HTTP_VERSION_V1_0') self.assertIsInstance(field.documentation, eolian.Documentation) self.assertIsInstance(field.value, eolian.Expression) diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 5ac08b8cd2..8711fdf319 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -888,7 +888,7 @@ EFL_START_TEST(eolian_enum) fail_if(v.type != EOLIAN_EXPR_INT); fail_if(v.value.i != 15); - cname = eolian_typedecl_enum_field_c_name_get(field); + cname = eolian_typedecl_enum_field_c_constant_get(field); fail_if(strcmp(cname, "TEST_FOO")); eina_stringshare_del(cname); @@ -915,7 +915,7 @@ EFL_START_TEST(eolian_enum) fail_if(!(tdl = eolian_unit_enum_by_name_get(unit, "Name.Spaced"))); fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "pants"))); - cname = eolian_typedecl_enum_field_c_name_get(field); + cname = eolian_typedecl_enum_field_c_constant_get(field); fail_if(strcmp(cname, "NAME_SPACED_PANTS")); eina_stringshare_del(cname); From e5c9f5e76fb82a022b13bf9627cc9c00e006e685 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Thu, 16 May 2019 15:57:39 +0200 Subject: [PATCH 42/53] eolian: rename eolian_event_c_name_get This is for consistency with the new eolian_class_c_macro_get as well as for better clarity, as c_name_get is already provided by Object and refers to something else. --- src/bin/eolian/headers.c | 2 +- src/bin/eolian/sources.c | 2 +- src/bin/eolian_js/main.cc | 2 +- src/bindings/luajit/eolian.lua | 6 +++--- src/lib/eolian/Eolian.h | 6 +++--- src/lib/eolian/database_event_api.c | 2 +- src/lib/eolian_cxx/grammar/klass_def.hpp | 2 +- src/scripts/pyolian/eolian.py | 4 ++-- src/scripts/pyolian/eolian_lib.py | 6 +++--- src/scripts/pyolian/test_eolian.py | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c index 645d6945d1..63f38feaa5 100644 --- a/src/bin/eolian/headers.c +++ b/src/bin/eolian/headers.c @@ -248,7 +248,7 @@ events: itr = eolian_class_events_get(cl); EINA_ITERATOR_FOREACH(itr, ev) { - Eina_Stringshare *evn = eolian_event_c_name_get(ev); + Eina_Stringshare *evn = eolian_event_c_macro_get(ev); Eolian_Object_Scope evs = eolian_event_scope_get(ev); if (evs == EOLIAN_SCOPE_PRIVATE) diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c index 37acd7e641..d729b63283 100644 --- a/src/bin/eolian/sources.c +++ b/src/bin/eolian/sources.c @@ -1054,7 +1054,7 @@ eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf) Eolian_Event *ev; EINA_ITERATOR_FOREACH(itr, ev) { - Eina_Stringshare *evn = eolian_event_c_name_get(ev); + Eina_Stringshare *evn = eolian_event_c_macro_get(ev); eina_strbuf_append(buf, "EWAPI const Efl_Event_Description _"); eina_strbuf_append(buf, evn); eina_strbuf_append(buf, " =\n EFL_EVENT_DESCRIPTION"); diff --git a/src/bin/eolian_js/main.cc b/src/bin/eolian_js/main.cc index 71466a8f83..378f2bbe4d 100644 --- a/src/bin/eolian_js/main.cc +++ b/src/bin/eolian_js/main.cc @@ -1041,7 +1041,7 @@ int main(int argc, char** argv) { auto tp = eolian_event_type_get(&*first); ss << " {\n"; - ss << " static efl::eo::js::event_information ev_info{&constructor_from_eo, " << eolian_event_c_name_get(&*first); + ss << " static efl::eo::js::event_information ev_info{&constructor_from_eo, " << eolian_event_c_macro_get(&*first); ss << ", &efl::eo::js::event_callback<"; ss << (tp ? _eolian_type_cpp_type_named_get(tp, class_name, need_name_getter) : "void"); ss << ">, \"" << type_class_name(tp) << "\"};\n"; diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index 71886511bf..20118af15f 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -401,7 +401,7 @@ ffi.cdef [[ Eina_Bool eolian_event_is_hot(const Eolian_Event *event); Eina_Bool eolian_event_is_restart(const Eolian_Event *event); Eina_Iterator *eolian_class_parts_get(const Eolian_Class *klass); - const char *eolian_event_c_name_get(const Eolian_Event *event); + const char *eolian_event_c_macro_get(const Eolian_Event *event); const Eolian_Class *eolian_part_class_get(const Eolian_Part *part); const Eolian_Documentation *eolian_part_documentation_get(const Eolian_Part *part); const Eolian_Event *eolian_class_event_by_name_get(const Eolian_Class *klass, const char *event_name); @@ -1375,8 +1375,8 @@ ffi.metatype("Eolian_Event", { return tonumber(eolian.eolian_event_scope_get(self)) end, - c_name_get = function(self) - local v = eolian.eolian_event_c_name_get(self) + c_macro_get = function(self) + local v = eolian.eolian_event_c_macro_get(self) if v == nil then return nil end return ffi_stringshare(v) end, diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 3207e16634..3715ed1eaf 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -2214,16 +2214,16 @@ EAPI Eina_Bool eolian_event_is_restart(const Eolian_Event *event); EAPI Eina_Iterator *eolian_class_parts_get(const Eolian_Class *klass); /* - * @brief Returns the C name of an event + * @brief Returns the C macro name used to refer to an event * * @param[in] event the event handle - * @return the event C name + * @return the event C macro * * You're responsible for deleting the stringshare. * * @ingroup Eolian */ -EAPI Eina_Stringshare *eolian_event_c_name_get(const Eolian_Event *event); +EAPI Eina_Stringshare *eolian_event_c_macro_get(const Eolian_Event *event); /* * @brief A helper function to get the name of a part. diff --git a/src/lib/eolian/database_event_api.c b/src/lib/eolian/database_event_api.c index 4142c5048d..2c0647d5c9 100644 --- a/src/lib/eolian/database_event_api.c +++ b/src/lib/eolian/database_event_api.c @@ -50,7 +50,7 @@ eolian_event_is_restart(const Eolian_Event *event) } EAPI Eina_Stringshare * -eolian_event_c_name_get(const Eolian_Event *event) +eolian_event_c_macro_get(const Eolian_Event *event) { char buf[512]; char *tmp = buf; diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index 60abbb54a6..c11aba44ed 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp @@ -1059,7 +1059,7 @@ struct event_def : klass(cls, {attributes::qualifier_info::is_none, std::string()}) , type( ::eolian_event_type_get(event) ? eina::optional{{::eolian_event_type_get(event), unit, EOLIAN_C_TYPE_DEFAULT}} : eina::optional{}) , name( ::eolian_event_name_get(event)) - , c_name( ::eolian_event_c_name_get(event)) + , c_name( ::eolian_event_c_macro_get(event)) , beta( ::eolian_event_is_beta(event)) , protect( ::eolian_event_scope_get(event) == EOLIAN_SCOPE_PROTECTED) , documentation( ::eolian_event_documentation_get(event)) {} diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index 787c9ff694..4dce2e6d4b 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -794,8 +794,8 @@ class Event(Object): return "".format(self) @cached_property - def c_name(self): - s = lib.eolian_event_c_name_get(self) + def c_macro(self): + s = lib.eolian_event_c_macro_get(self) ret = _str_to_py(s) lib.eina_stringshare_del(c_void_p(s)) return ret diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py index 15863cf3b4..622486ebdf 100644 --- a/src/scripts/pyolian/eolian_lib.py +++ b/src/scripts/pyolian/eolian_lib.py @@ -461,9 +461,9 @@ lib.eolian_constructor_is_optional.restype = c_bool ### Eolian_Event ############################################################ -# EAPI Eina_Stringshare *eolian_event_c_name_get(const Eolian_Event *event); -lib.eolian_event_c_name_get.argtypes = (c_void_p,) -lib.eolian_event_c_name_get.restype = c_void_p # Stringshare TO BE FREED +# EAPI Eina_Stringshare *eolian_event_c_macro_get(const Eolian_Event *event); +lib.eolian_event_c_macro_get.argtypes = (c_void_p,) +lib.eolian_event_c_macro_get.restype = c_void_p # Stringshare TO BE FREED # EAPI const Eolian_Type *eolian_event_type_get(const Eolian_Event *event); lib.eolian_event_type_get.argtypes = (c_void_p,) diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py index 0a28cb1010..3695330cc6 100755 --- a/src/scripts/pyolian/test_eolian.py +++ b/src/scripts/pyolian/test_eolian.py @@ -413,7 +413,7 @@ class TestEolianEvent(unittest.TestCase): ev = cls.event_by_name_get('tick') self.assertIsInstance(ev, eolian.Event) self.assertEqual(ev.name, 'tick') - self.assertEqual(ev.c_name, 'EFL_LOOP_TIMER_EVENT_TIMER_TICK') + self.assertEqual(ev.c_macro, 'EFL_LOOP_TIMER_EVENT_TIMER_TICK') self.assertIsNone(ev.type) # TODO is this correct self.assertIsInstance(ev.documentation, eolian.Documentation) self.assertEqual(ev.scope, eolian.Eolian_Object_Scope.PUBLIC) From 05902c708a0c0f01eddb3d48f12dc2e5d793c165 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Thu, 16 May 2019 18:06:46 +0200 Subject: [PATCH 43/53] docfx: Use the public repo url for www-content Otherwise, you need to have credentials, etc. --- doc/docfx/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/docfx/setup.sh b/doc/docfx/setup.sh index eb15787c2e..3cf9d60e3b 100755 --- a/doc/docfx/setup.sh +++ b/doc/docfx/setup.sh @@ -36,7 +36,7 @@ fi # Clone whole Content site # rm -rf www-content -git clone --depth 1 git+ssh://git@git.enlightenment.org/website/www-content.git www-content +git clone --depth 1 https://git@git.enlightenment.org/website/www-content.git www-content # # Copy all pages related to C# (those inside a folder called 'csharp') to the articles folder From ce9cad3a3b21e1048f66c275840bb9b2a02aa55d Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 16 May 2019 13:48:59 -0400 Subject: [PATCH 44/53] Eina: replace Evil.h with evil_private.h and remove Evil.h when not necessary Test Plan: compilation Reviewers: raster, zmike, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8903 --- src/lib/eina/Eina.h | 4 ---- src/lib/eina/eina_benchmark.c | 4 ---- src/lib/eina/eina_binbuf.c | 4 ---- src/lib/eina/eina_convert.c | 4 ---- src/lib/eina/eina_debug.c | 2 +- src/lib/eina/eina_debug_bt.c | 2 +- src/lib/eina/eina_debug_bt_file.c | 2 +- src/lib/eina/eina_evlog.c | 4 ---- src/lib/eina/eina_file_common.c | 2 +- src/lib/eina/eina_file_win32.c | 6 +----- src/lib/eina/eina_inline_slice.x | 3 --- src/lib/eina/eina_list.c | 4 ---- src/lib/eina/eina_log.c | 2 +- src/lib/eina/eina_magic.c | 4 ---- src/lib/eina/eina_main.c | 4 ---- src/lib/eina/eina_matrixsparse.c | 4 ---- src/lib/eina/eina_module.c | 2 +- src/lib/eina/eina_prefix.c | 2 +- src/lib/eina/eina_private.h | 4 ---- src/lib/eina/eina_quadtree.c | 4 ---- src/lib/eina/eina_rectangle.c | 4 ---- src/lib/eina/eina_share_common.c | 4 ---- src/lib/eina/eina_simple_xml_parser.c | 4 ---- src/lib/eina/eina_strbuf.c | 4 ---- src/lib/eina/eina_strbuf_common.c | 4 ---- src/lib/eina/eina_stringshare.c | 4 ---- src/lib/eina/eina_tmpstr.c | 4 ---- src/lib/eina/eina_ustrbuf.c | 4 ---- src/lib/eina/eina_value.c | 4 ---- src/lib/eina/eina_value_util.c | 2 +- src/lib/eina/eina_xattr.c | 4 ---- 31 files changed, 9 insertions(+), 100 deletions(-) diff --git a/src/lib/eina/Eina.h b/src/lib/eina/Eina.h index b403d308f8..bbf3161929 100644 --- a/src/lib/eina/Eina.h +++ b/src/lib/eina/Eina.h @@ -202,10 +202,6 @@ * make it safer, log errors, manage memory more efficiently and more. */ -#ifdef _WIN32 -# include -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/src/lib/eina/eina_benchmark.c b/src/lib/eina/eina_benchmark.c index db17a0f4b8..7afa8e8e56 100644 --- a/src/lib/eina/eina_benchmark.c +++ b/src/lib/eina/eina_benchmark.c @@ -24,10 +24,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_alloca.h" diff --git a/src/lib/eina/eina_binbuf.c b/src/lib/eina/eina_binbuf.c index c8623a3e99..d392686c33 100644 --- a/src/lib/eina/eina_binbuf.c +++ b/src/lib/eina/eina_binbuf.c @@ -5,10 +5,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_private.h" #include "eina_strbuf_common.h" #include "eina_binbuf.h" diff --git a/src/lib/eina/eina_convert.c b/src/lib/eina/eina_convert.c index bd2d3c2479..915ed7d563 100644 --- a/src/lib/eina/eina_convert.c +++ b/src/lib/eina/eina_convert.c @@ -31,10 +31,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_log.h" diff --git a/src/lib/eina/eina_debug.c b/src/lib/eina/eina_debug.c index c29e2f3db9..c811c5fe2a 100644 --- a/src/lib/eina/eina_debug.c +++ b/src/lib/eina/eina_debug.c @@ -56,7 +56,7 @@ #ifdef _WIN32 # include -# include +# include /* fcntl */ #endif #include "eina_alloca.h" diff --git a/src/lib/eina/eina_debug_bt.c b/src/lib/eina/eina_debug_bt.c index f38dcd481a..a2510e9123 100644 --- a/src/lib/eina/eina_debug_bt.c +++ b/src/lib/eina/eina_debug_bt.c @@ -22,7 +22,7 @@ #ifdef HAVE_DLADDR # ifdef _WIN32 -# include +# include /* dladdr */ # else # include # endif diff --git a/src/lib/eina/eina_debug_bt_file.c b/src/lib/eina/eina_debug_bt_file.c index 5035187d1f..672b3fe20d 100644 --- a/src/lib/eina/eina_debug_bt_file.c +++ b/src/lib/eina/eina_debug_bt_file.c @@ -22,7 +22,7 @@ #include #ifdef _WIN32 -#include +#include /* realpath */ #endif #include "eina_debug_private.h" diff --git a/src/lib/eina/eina_evlog.c b/src/lib/eina/eina_evlog.c index 3e5f3c55f2..994a370779 100644 --- a/src/lib/eina/eina_evlog.c +++ b/src/lib/eina/eina_evlog.c @@ -29,10 +29,6 @@ #include "eina_evlog.h" #include "eina_debug.h" -#ifdef _WIN32 -# include -#endif - #if defined(__APPLE__) && defined(__MACH__) # include #endif diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c index c87b7d94aa..b62fc22b80 100644 --- a/src/lib/eina/eina_file_common.c +++ b/src/lib/eina/eina_file_common.c @@ -28,7 +28,7 @@ #include #ifdef _WIN32 -# include +# include /* windows.h fcntl mkstemps mkdtemp */ #endif #define COPY_BLOCKSIZE (4 * 1024 * 1024) diff --git a/src/lib/eina/eina_file_win32.c b/src/lib/eina/eina_file_win32.c index e10a8f5b04..ca8e78b83e 100644 --- a/src/lib/eina/eina_file_win32.c +++ b/src/lib/eina/eina_file_win32.c @@ -23,11 +23,7 @@ #include #include -#define WIN32_LEAN_AND_MEAN -#include -#undef WIN32_LEAN_AND_MEAN - -#include +#include #include "eina_config.h" #include "eina_private.h" diff --git a/src/lib/eina/eina_inline_slice.x b/src/lib/eina/eina_inline_slice.x index 5949cd71f4..e11a468cce 100644 --- a/src/lib/eina/eina_inline_slice.x +++ b/src/lib/eina/eina_inline_slice.x @@ -20,9 +20,6 @@ #define _EINA_INLINE_SLICE_H #include -#ifdef _WIN32 -# include -#endif static inline Eina_Slice eina_rw_slice_slice_get(const Eina_Rw_Slice rw_slice) diff --git a/src/lib/eina/eina_list.c b/src/lib/eina/eina_list.c index 9192b4c332..a5a6ba79e1 100644 --- a/src/lib/eina/eina_list.c +++ b/src/lib/eina/eina_list.c @@ -62,10 +62,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_log.h" diff --git a/src/lib/eina/eina_log.c b/src/lib/eina/eina_log.c index b6c5632267..357b341909 100644 --- a/src/lib/eina/eina_log.c +++ b/src/lib/eina/eina_log.c @@ -34,7 +34,7 @@ #endif #ifdef _WIN32 -# include +# include #endif #ifdef HAVE_EXECINFO_H diff --git a/src/lib/eina/eina_magic.c b/src/lib/eina/eina_magic.c index c1918419fc..cb0d997eac 100644 --- a/src/lib/eina/eina_magic.c +++ b/src/lib/eina/eina_magic.c @@ -23,10 +23,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_log.h" diff --git a/src/lib/eina/eina_main.c b/src/lib/eina/eina_main.c index 024d1e3eaa..b8856474d3 100644 --- a/src/lib/eina/eina_main.c +++ b/src/lib/eina/eina_main.c @@ -40,10 +40,6 @@ #include #endif -#ifdef _WIN32 -#include "Evil.h" -#endif - #include "eina_lock.h" #include "eina_config.h" #include "eina_private.h" diff --git a/src/lib/eina/eina_matrixsparse.c b/src/lib/eina/eina_matrixsparse.c index eb85ddec42..9716a2cbd5 100644 --- a/src/lib/eina/eina_matrixsparse.c +++ b/src/lib/eina/eina_matrixsparse.c @@ -33,10 +33,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_log.h" diff --git a/src/lib/eina/eina_module.c b/src/lib/eina/eina_module.c index 58f79b5fb6..bff6e3f317 100644 --- a/src/lib/eina/eina_module.c +++ b/src/lib/eina/eina_module.c @@ -32,7 +32,7 @@ #endif #ifdef _WIN32 -# include +# include #endif #ifdef HAVE_ESCAPE diff --git a/src/lib/eina/eina_prefix.c b/src/lib/eina/eina_prefix.c index aeac22f4b7..35b8cec0f6 100644 --- a/src/lib/eina/eina_prefix.c +++ b/src/lib/eina/eina_prefix.c @@ -43,7 +43,7 @@ #ifdef _WIN32 # include /* getcwd */ -# include +# include /* path_is_absolute realpath dladdr */ #endif #ifdef HAVE_ESCAPE diff --git a/src/lib/eina/eina_private.h b/src/lib/eina/eina_private.h index d377357b67..9e2954e001 100644 --- a/src/lib/eina/eina_private.h +++ b/src/lib/eina/eina_private.h @@ -25,10 +25,6 @@ #include #endif -#ifdef _WIN32 -# include -#endif - #include "eina_magic.h" #include "eina_iterator.h" #include "eina_accessor.h" diff --git a/src/lib/eina/eina_quadtree.c b/src/lib/eina/eina_quadtree.c index 1f50fd5d02..83778ef8a2 100644 --- a/src/lib/eina/eina_quadtree.c +++ b/src/lib/eina/eina_quadtree.c @@ -30,10 +30,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_quadtree.h" #include "eina_magic.h" #include "eina_mempool.h" diff --git a/src/lib/eina/eina_rectangle.c b/src/lib/eina/eina_rectangle.c index c7b89b524a..e8e04cdc16 100644 --- a/src/lib/eina/eina_rectangle.c +++ b/src/lib/eina/eina_rectangle.c @@ -23,10 +23,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_magic.h" diff --git a/src/lib/eina/eina_share_common.c b/src/lib/eina/eina_share_common.c index 7dfb4460a0..6fce317a6e 100644 --- a/src/lib/eina/eina_share_common.c +++ b/src/lib/eina/eina_share_common.c @@ -63,10 +63,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_hash.h" diff --git a/src/lib/eina/eina_simple_xml_parser.c b/src/lib/eina/eina_simple_xml_parser.c index 3b218da215..a2548a97e1 100644 --- a/src/lib/eina/eina_simple_xml_parser.c +++ b/src/lib/eina/eina_simple_xml_parser.c @@ -26,10 +26,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_alloca.h" diff --git a/src/lib/eina/eina_strbuf.c b/src/lib/eina/eina_strbuf.c index a76e4418ea..69d6a30cfe 100644 --- a/src/lib/eina/eina_strbuf.c +++ b/src/lib/eina/eina_strbuf.c @@ -6,10 +6,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_private.h" #include "eina_str.h" #include "eina_strbuf_common.h" diff --git a/src/lib/eina/eina_strbuf_common.c b/src/lib/eina/eina_strbuf_common.c index 3a18d4d4d0..e08d4b79fe 100644 --- a/src/lib/eina/eina_strbuf_common.c +++ b/src/lib/eina/eina_strbuf_common.c @@ -6,10 +6,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_private.h" #include "eina_str.h" #include "eina_magic.h" diff --git a/src/lib/eina/eina_stringshare.c b/src/lib/eina/eina_stringshare.c index c5ee200880..efabdb2280 100644 --- a/src/lib/eina/eina_stringshare.c +++ b/src/lib/eina/eina_stringshare.c @@ -30,10 +30,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_alloca.h" diff --git a/src/lib/eina/eina_tmpstr.c b/src/lib/eina/eina_tmpstr.c index 9dbbe7d17c..84dd8439b6 100644 --- a/src/lib/eina/eina_tmpstr.c +++ b/src/lib/eina/eina_tmpstr.c @@ -26,10 +26,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_log.h" diff --git a/src/lib/eina/eina_ustrbuf.c b/src/lib/eina/eina_ustrbuf.c index 7a2a5a0d20..7c1c2db246 100644 --- a/src/lib/eina/eina_ustrbuf.c +++ b/src/lib/eina/eina_ustrbuf.c @@ -2,10 +2,6 @@ # include "config.h" #endif -#ifdef _WIN32 -#include "Evil.h" -#endif - #include "eina_strbuf_common.h" #include "eina_unicode.h" #include "eina_ustrbuf.h" diff --git a/src/lib/eina/eina_value.c b/src/lib/eina/eina_value.c index c75a5f1235..a2f6f53099 100644 --- a/src/lib/eina/eina_value.c +++ b/src/lib/eina/eina_value.c @@ -24,10 +24,6 @@ #include /* PRId64 and PRIu64 */ #include /* struct timeval */ -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" #include "eina_alloca.h" diff --git a/src/lib/eina/eina_value_util.c b/src/lib/eina/eina_value_util.c index 3d35a47838..05c79910f0 100644 --- a/src/lib/eina/eina_value_util.c +++ b/src/lib/eina/eina_value_util.c @@ -23,7 +23,7 @@ #include #ifdef _WIN32 -# include +# include /* strptime */ #endif #include "eina_safety_checks.h" diff --git a/src/lib/eina/eina_xattr.c b/src/lib/eina/eina_xattr.c index a0170ca630..a32ff5306a 100644 --- a/src/lib/eina/eina_xattr.c +++ b/src/lib/eina/eina_xattr.c @@ -32,10 +32,6 @@ #include -#ifdef _WIN32 -#include "Evil.h" -#endif - #include "eina_config.h" #include "eina_private.h" From 8b21255bba87989100cbaac1a47c2f163017cfd9 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 16 May 2019 13:49:39 -0400 Subject: [PATCH 45/53] Evil: remove fall through warning Summary: gcc and clang support the usage of "fall through" comment to suppress this warning Test Plan: compilation Reviewers: raster, zmike, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8904 --- src/lib/evil/evil_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/evil/evil_main.c b/src/lib/evil/evil_main.c index 07dcd4a06d..cd7fde8555 100644 --- a/src/lib/evil/evil_main.c +++ b/src/lib/evil/evil_main.c @@ -100,6 +100,8 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) _evil_tls_index = TlsAlloc(); if (_evil_tls_index == TLS_OUT_OF_INDEXES) return FALSE; + /* No break: Initialize the index for first thread. */ + /* fall through */ case DLL_THREAD_ATTACH: data = (LPVOID)LocalAlloc(LPTR, 4096); if (!data) From 4e574867e81478301414a4c36698c07e61780eef Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Fri, 17 May 2019 10:44:41 +0900 Subject: [PATCH 46/53] evas_vg_node: Move change flag value setting Summary: _node_change function is only executed when the flag is none to prevent duplicate calls. If CHANGE_MATRIX_FLAG is added to the flag in advance, _node_change function does not operate normally. Test Plan: cd ./src/examples/evas gcc -o evas_vg_simple evas-vg-simple.c `pkg-config --libs --cflags evas ecore ecore-evas eina ector eo efl` -lm ./evas_vg_simple Reviewers: Hermet, kimcinoo, smohanty Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8895 --- src/lib/evas/canvas/efl_canvas_vg_node.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg_node.c b/src/lib/evas/canvas/efl_canvas_vg_node.c index 77e4eaffa8..895706c71a 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_node.c +++ b/src/lib/evas/canvas/efl_canvas_vg_node.c @@ -60,8 +60,10 @@ _efl_canvas_vg_node_transformation_set(Eo *obj, pd->m = NULL; } - pd->flags |= EFL_GFX_CHANGE_FLAG_MATRIX; + /* NOTE: _node_change function is only executed + when pd->flags is EFL_GFX_CHANGE_FLAG_NONE to prevent duplicate calls.*/ _node_change(obj, pd); + pd->flags |= EFL_GFX_CHANGE_FLAG_MATRIX; } const Eina_Matrix3 * From 099eb2c315a277bda10f41709d7f936b0ae7fb20 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Fri, 17 May 2019 19:32:24 +0900 Subject: [PATCH 47/53] evas_gesture: fix meson.build to build and install correctly --- src/lib/evas/gesture/meson.build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/evas/gesture/meson.build b/src/lib/evas/gesture/meson.build index 3c7847aeac..04cb753fcd 100644 --- a/src/lib/evas/gesture/meson.build +++ b/src/lib/evas/gesture/meson.build @@ -29,13 +29,15 @@ foreach eo_file : pub_eo_files depfile : eo_file + '.d', install : true, install_dir : join_paths(dir_package_include, 'gesture'), - command : [eolian_gen, '-I', meson.current_source_dir(), eolian_include_directories, + command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), '-gchd', '@INPUT@']) endforeach +pub_evas_eo_files += files(pub_eo_files) + pub_eo_types_files = [ 'efl_canvas_gesture_types.eot', ] @@ -51,7 +53,7 @@ foreach eo_file : pub_eo_types_files depfile : eo_file + '.d', install : true, install_dir : join_paths(dir_package_include, 'gesture'), - command : [eolian_gen, '-I', meson.current_source_dir(), eolian_include_directories, + command : eolian_gen + ['-I', meson.current_source_dir(), eolian_include_directories, '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), '-ghd', '@INPUT@']) From 839f22870bccc85384d46b8c735fc2ff3edc7ed8 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Fri, 17 May 2019 11:52:41 +0100 Subject: [PATCH 48/53] bin/efl and ecore: include evil_private.h when appropriate Test Plan: compilation Reviewers: raster, zmike, cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8908 --- src/bin/efl/efl_debugd.c | 3 +++ src/lib/ecore/ecore.c | 2 +- src/lib/ecore/ecore_anim.c | 1 + src/lib/ecore/ecore_app.c | 4 ---- src/lib/ecore/ecore_exe_win32.c | 2 ++ src/lib/ecore/ecore_main.c | 3 +-- src/lib/ecore/ecore_pipe.c | 5 +---- src/lib/ecore/ecore_thread.c | 4 ---- src/lib/ecore/ecore_time.c | 4 ---- src/lib/ecore/efl_core_proc_env.c | 3 +++ src/lib/ecore/efl_thread.c | 3 +++ 11 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/bin/efl/efl_debugd.c b/src/bin/efl/efl_debugd.c index 3962aa6a80..b23db7544c 100644 --- a/src/bin/efl/efl_debugd.c +++ b/src/bin/efl/efl_debugd.c @@ -25,6 +25,9 @@ #include #include "eina_debug_private.h" +#ifdef _WIN32 +# include /* mkdir */ +#endif #include #include #include diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c index ceb3021019..7aa987b271 100644 --- a/src/lib/ecore/ecore.c +++ b/src/lib/ecore/ecore.c @@ -24,7 +24,7 @@ #endif #ifdef _WIN32 -# include +# include /* evil_init/shutdown */ #endif #include #include diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c index b4810ae441..f2ec2d61c8 100644 --- a/src/lib/ecore/ecore_anim.c +++ b/src/lib/ecore/ecore_anim.c @@ -18,6 +18,7 @@ #ifdef _WIN32 # include +# include /* pipe */ # define pipe_write(fd, buffer, size) send((fd), (char *)(buffer), size, 0) # define pipe_read(fd, buffer, size) recv((fd), (char *)(buffer), size, 0) diff --git a/src/lib/ecore/ecore_app.c b/src/lib/ecore/ecore_app.c index 006948d46c..a3d5debc71 100644 --- a/src/lib/ecore/ecore_app.c +++ b/src/lib/ecore/ecore_app.c @@ -5,10 +5,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "Ecore.h" #include "ecore_private.h" diff --git a/src/lib/ecore/ecore_exe_win32.c b/src/lib/ecore/ecore_exe_win32.c index 69e80dafbf..24159c6eac 100644 --- a/src/lib/ecore/ecore_exe_win32.c +++ b/src/lib/ecore/ecore_exe_win32.c @@ -7,6 +7,8 @@ #undef WIN32_LEAN_AND_MEAN #include +#include /* evil_last_error_get */ + #include "Ecore.h" #include "ecore_private.h" diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c index 42d554cf0f..523add2af3 100644 --- a/src/lib/ecore/ecore_main.c +++ b/src/lib/ecore/ecore_main.c @@ -44,9 +44,8 @@ #endif #ifdef _WIN32 -# include +# include /* evil_last_error_get */ #endif - #include "Ecore.h" #include "ecore_private.h" diff --git a/src/lib/ecore/ecore_pipe.c b/src/lib/ecore/ecore_pipe.c index 92127b95d0..d352853c4b 100644 --- a/src/lib/ecore/ecore_pipe.c +++ b/src/lib/ecore/ecore_pipe.c @@ -26,10 +26,6 @@ # endif #endif -#ifdef _WIN32 -# include -#endif - #ifdef HAVE_ESCAPE # include #endif @@ -51,6 +47,7 @@ #ifdef _WIN32 # include +# include /* pipe fcntl */ # define pipe_write(fd, buffer, size) send((fd), (char *)(buffer), size, 0) # define pipe_read(fd, buffer, size) recv((fd), (char *)(buffer), size, 0) # define pipe_close(fd) closesocket(fd) diff --git a/src/lib/ecore/ecore_thread.c b/src/lib/ecore/ecore_thread.c index eef9d3d930..a2c6489d3f 100644 --- a/src/lib/ecore/ecore_thread.c +++ b/src/lib/ecore/ecore_thread.c @@ -8,10 +8,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "Ecore.h" #include "ecore_private.h" diff --git a/src/lib/ecore/ecore_time.c b/src/lib/ecore/ecore_time.c index 303295b796..31ffa717c8 100644 --- a/src/lib/ecore/ecore_time.c +++ b/src/lib/ecore/ecore_time.c @@ -7,10 +7,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #if defined(__APPLE__) && defined(__MACH__) # include #endif diff --git a/src/lib/ecore/efl_core_proc_env.c b/src/lib/ecore/efl_core_proc_env.c index 10ad1f9845..4c02821474 100644 --- a/src/lib/ecore/efl_core_proc_env.c +++ b/src/lib/ecore/efl_core_proc_env.c @@ -2,6 +2,9 @@ # include #endif +#ifdef _WIN32 +# include /* setenv unsetenv */ +#endif #include #ifdef HAVE_CRT_EXTERNS_H # include diff --git a/src/lib/ecore/efl_thread.c b/src/lib/ecore/efl_thread.c index c9badf716a..cff9314d1a 100644 --- a/src/lib/ecore/efl_thread.c +++ b/src/lib/ecore/efl_thread.c @@ -6,6 +6,9 @@ #define EFL_IO_WRITER_PROTECTED 1 #define EFL_IO_CLOSER_PROTECTED 1 +#ifdef _WIN32 +# include /* pipe fcntl */ +#endif #include #include "ecore_private.h" From 40e2f9ba8eaa59ab3fada45e09c6431060d18321 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Fri, 17 May 2019 11:52:58 +0100 Subject: [PATCH 49/53] Eet: remove useless inclusion of Evil.h Test Plan: compilation Reviewers: raster, zmike, cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8909 --- src/lib/eet/eet_node.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/lib/eet/eet_node.c b/src/lib/eet/eet_node.c index fa203f2ea8..9fbbf49186 100644 --- a/src/lib/eet/eet_node.c +++ b/src/lib/eet/eet_node.c @@ -5,10 +5,6 @@ #include #include -#ifdef _WIN32 -# include -#endif /* ifdef _WIN32 */ - #include #include "Eet.h" From a55777c9258f6cf0df1bb68377a9edb19a399caf Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Fri, 17 May 2019 17:35:00 +0900 Subject: [PATCH 50/53] efl_mono: generate efl_canvas_text.eo.cs To use canvas text in efl csharp bindings, it is permitted to generate efl_canvas_text.eo.cs. --- src/Makefile_Efl_Mono.am | 1 - src/bindings/mono/meson.build | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Makefile_Efl_Mono.am b/src/Makefile_Efl_Mono.am index cc6e38570c..a5912b5c98 100644 --- a/src/Makefile_Efl_Mono.am +++ b/src/Makefile_Efl_Mono.am @@ -130,7 +130,6 @@ include Makefile_Eolian_Mono_Helper.am ### Efl C Sharp Binding evas_eolian_blacklisted_files = \ -lib/evas/canvas/efl_canvas_text.eo.cs \ lib/evas/canvas/efl_canvas_scene3d.eo.cs \ lib/evas/canvas/evas_canvas3d_camera.eo.cs \ lib/evas/canvas/evas_canvas3d_light.eo.cs \ diff --git a/src/bindings/mono/meson.build b/src/bindings/mono/meson.build index c55a8f4e37..69a5f8491f 100644 --- a/src/bindings/mono/meson.build +++ b/src/bindings/mono/meson.build @@ -42,7 +42,6 @@ mono_sublibs = [ blacklisted_files = [ 'efl_class.eo', - 'efl_canvas_text.eo', 'efl_canvas_scene3d.eo', 'evas_canvas3d_camera.eo', 'evas_canvas3d_light.eo', From 5922bb268f0222764cf14f68365e6e66e1a9789c Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Fri, 17 May 2019 16:08:23 +0200 Subject: [PATCH 51/53] eolian tests: rename owning.eo.c to clear confusion --- src/Makefile_Eolian.am | 2 +- src/tests/eolian/data/{owning.eo.c => owning_ref.c} | 0 src/tests/eolian/eolian_generation.c | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename src/tests/eolian/data/{owning.eo.c => owning_ref.c} (100%) diff --git a/src/Makefile_Eolian.am b/src/Makefile_Eolian.am index e5a8e49c38..876a2f01ac 100644 --- a/src/Makefile_Eolian.am +++ b/src/Makefile_Eolian.am @@ -158,7 +158,7 @@ tests/eolian/data/typedef_ref.h \ tests/eolian/data/typedef_ref_stub.h \ tests/eolian/data/struct_ref.h \ tests/eolian/data/struct_ref_stub.h \ -tests/eolian/data/owning.eo.c \ +tests/eolian/data/owning_ref.c \ tests/eolian/data/class_simple_ref.c \ tests/eolian/data/override_ref.c \ tests/eolian/data/class_simple_ref_eo.h \ diff --git a/src/tests/eolian/data/owning.eo.c b/src/tests/eolian/data/owning_ref.c similarity index 100% rename from src/tests/eolian/data/owning.eo.c rename to src/tests/eolian/data/owning_ref.c diff --git a/src/tests/eolian/eolian_generation.c b/src/tests/eolian/eolian_generation.c index f5b4c820fb..99e0f69a4b 100644 --- a/src/tests/eolian/eolian_generation.c +++ b/src/tests/eolian/eolian_generation.c @@ -226,7 +226,7 @@ EFL_START_TEST(owning) eina_environment_tmp_get()); _remove_ref(output_filepath, "eo.c"); fail_if(0 != _eolian_gen_execute(TESTS_SRC_DIR"/data/owning.eo", "-gc", output_filepath)); - fail_if(!_files_compare(TESTS_SRC_DIR"/data/owning.eo.c", output_filepath, "eo.c")); + fail_if(!_files_compare(TESTS_SRC_DIR"/data/owning_ref.c", output_filepath, "eo.c")); } EFL_END_TEST From 092114ecc8ea39e3fdf0f0e7a7f2db9574269531 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Fri, 17 May 2019 13:51:50 -0400 Subject: [PATCH 52/53] bin/eet and ecore_con: remove Evil.h when not necessary and include evil_private.h when necessary Test Plan: compilation Reviewers: raster, zmike, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8911 --- src/bin/ecore_con/efl_net_proxy_helper.c | 4 ---- src/bin/eet/eet_main.c | 4 ---- src/lib/ecore_con/ecore_con.c | 2 +- src/lib/ecore_con/ecore_con_legacy.c | 4 ---- src/lib/ecore_con/ecore_con_local_win32.c | 1 - src/lib/ecore_con/ecore_con_proxy_helper.c | 4 ---- src/lib/ecore_con/ecore_con_socks.c | 1 - src/lib/ecore_con/efl_net_dialer_ssl.c | 3 --- src/lib/ecore_con/efl_net_dialer_tcp.c | 3 --- src/lib/ecore_con/efl_net_dialer_udp.c | 3 --- src/lib/ecore_con/efl_net_ip_address.c | 4 ---- src/lib/ecore_con/efl_net_server_fd.c | 3 --- src/lib/ecore_con/efl_net_server_ip.c | 3 --- src/lib/ecore_con/efl_net_server_tcp.c | 3 --- src/lib/ecore_con/efl_net_server_udp.c | 3 --- src/lib/ecore_con/efl_net_server_udp_client.c | 3 --- src/lib/ecore_con/efl_net_socket_fd.c | 3 --- src/lib/ecore_con/efl_net_socket_tcp.c | 3 --- src/lib/ecore_con/efl_net_socket_udp.c | 3 --- src/lib/ecore_con/efl_net_ssl_conn-openssl.c | 2 +- 20 files changed, 2 insertions(+), 57 deletions(-) diff --git a/src/bin/ecore_con/efl_net_proxy_helper.c b/src/bin/ecore_con/efl_net_proxy_helper.c index 1a0255bb86..6b2e3678ce 100644 --- a/src/bin/ecore_con/efl_net_proxy_helper.c +++ b/src/bin/ecore_con/efl_net_proxy_helper.c @@ -10,10 +10,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "Eina.h" #ifdef ERR diff --git a/src/bin/eet/eet_main.c b/src/bin/eet/eet_main.c index 7967cc791c..7da5cfd4d3 100644 --- a/src/bin/eet/eet_main.c +++ b/src/bin/eet/eet_main.c @@ -7,10 +7,6 @@ #include #include -#ifdef _WIN32 -# include -#endif /* ifdef _WIN32 */ - #include static int _eet_main_log_dom = -1; diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index a781025d7b..75f083ac9f 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -40,7 +40,7 @@ #ifdef _WIN32 # include -# include +# include /* evil_init|shutdown */ #endif #include "Ecore.h" diff --git a/src/lib/ecore_con/ecore_con_legacy.c b/src/lib/ecore_con/ecore_con_legacy.c index 1956176604..d1c402e045 100644 --- a/src/lib/ecore_con/ecore_con_legacy.c +++ b/src/lib/ecore_con/ecore_con_legacy.c @@ -10,10 +10,6 @@ # include #endif -#ifdef _WIN32 -# include -#endif - #define EFL_NET_SOCKET_SSL_PROTECTED #include "Ecore.h" diff --git a/src/lib/ecore_con/ecore_con_local_win32.c b/src/lib/ecore_con/ecore_con_local_win32.c index 86593a2ffa..6b68bf07fe 100644 --- a/src/lib/ecore_con/ecore_con_local_win32.c +++ b/src/lib/ecore_con/ecore_con_local_win32.c @@ -4,7 +4,6 @@ #include -#include #include #include "Ecore_Con.h" diff --git a/src/lib/ecore_con/ecore_con_proxy_helper.c b/src/lib/ecore_con/ecore_con_proxy_helper.c index 1b58ab1952..01b90652d8 100644 --- a/src/lib/ecore_con/ecore_con_proxy_helper.c +++ b/src/lib/ecore_con/ecore_con_proxy_helper.c @@ -10,10 +10,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "Ecore.h" #include "ecore_private.h" #include "Ecore_Con.h" diff --git a/src/lib/ecore_con/ecore_con_socks.c b/src/lib/ecore_con/ecore_con_socks.c index 08f5585381..0068b33076 100644 --- a/src/lib/ecore_con/ecore_con_socks.c +++ b/src/lib/ecore_con/ecore_con_socks.c @@ -36,7 +36,6 @@ #ifdef _WIN32 # include -# include #endif #include "Ecore.h" diff --git a/src/lib/ecore_con/efl_net_dialer_ssl.c b/src/lib/ecore_con/efl_net_dialer_ssl.c index ffc36a6f58..efc9d8e34c 100644 --- a/src/lib/ecore_con/efl_net_dialer_ssl.c +++ b/src/lib/ecore_con/efl_net_dialer_ssl.c @@ -24,9 +24,6 @@ #ifdef HAVE_ARPA_INET_H # include #endif -#ifdef _WIN32 -# include -#endif #define MY_CLASS EFL_NET_DIALER_SSL_CLASS diff --git a/src/lib/ecore_con/efl_net_dialer_tcp.c b/src/lib/ecore_con/efl_net_dialer_tcp.c index ba93fc4c74..50a354126c 100644 --- a/src/lib/ecore_con/efl_net_dialer_tcp.c +++ b/src/lib/ecore_con/efl_net_dialer_tcp.c @@ -24,9 +24,6 @@ #ifdef HAVE_ARPA_INET_H # include #endif -#ifdef _WIN32 -# include -#endif #define MY_CLASS EFL_NET_DIALER_TCP_CLASS diff --git a/src/lib/ecore_con/efl_net_dialer_udp.c b/src/lib/ecore_con/efl_net_dialer_udp.c index e75ed24fed..e353121f26 100644 --- a/src/lib/ecore_con/efl_net_dialer_udp.c +++ b/src/lib/ecore_con/efl_net_dialer_udp.c @@ -25,9 +25,6 @@ #ifdef HAVE_ARPA_INET_H # include #endif -#ifdef _WIN32 -# include -#endif #define MY_CLASS EFL_NET_DIALER_UDP_CLASS diff --git a/src/lib/ecore_con/efl_net_ip_address.c b/src/lib/ecore_con/efl_net_ip_address.c index cc29aba680..4ee875e306 100644 --- a/src/lib/ecore_con/efl_net_ip_address.c +++ b/src/lib/ecore_con/efl_net_ip_address.c @@ -8,10 +8,6 @@ # include #endif -#ifdef _WIN32 -# include -#endif - #include "Ecore.h" #include "Ecore_Con.h" #include "ecore_con_private.h" diff --git a/src/lib/ecore_con/efl_net_server_fd.c b/src/lib/ecore_con/efl_net_server_fd.c index e4e6461576..d3d61ca46f 100644 --- a/src/lib/ecore_con/efl_net_server_fd.c +++ b/src/lib/ecore_con/efl_net_server_fd.c @@ -13,9 +13,6 @@ #ifdef HAVE_SYS_SOCKET_H # include #endif -#ifdef _WIN32 -# include -#endif #ifdef HAVE_SYSTEMD # include diff --git a/src/lib/ecore_con/efl_net_server_ip.c b/src/lib/ecore_con/efl_net_server_ip.c index ea7770a695..e7e5e0d53b 100644 --- a/src/lib/ecore_con/efl_net_server_ip.c +++ b/src/lib/ecore_con/efl_net_server_ip.c @@ -22,9 +22,6 @@ #ifdef HAVE_ARPA_INET_H # include #endif -#ifdef _WIN32 -# include -#endif #define MY_CLASS EFL_NET_SERVER_IP_CLASS diff --git a/src/lib/ecore_con/efl_net_server_tcp.c b/src/lib/ecore_con/efl_net_server_tcp.c index b4bda04192..576b5a9867 100644 --- a/src/lib/ecore_con/efl_net_server_tcp.c +++ b/src/lib/ecore_con/efl_net_server_tcp.c @@ -23,9 +23,6 @@ #ifdef HAVE_ARPA_INET_H # include #endif -#ifdef _WIN32 -# include -#endif #define MY_CLASS EFL_NET_SERVER_TCP_CLASS diff --git a/src/lib/ecore_con/efl_net_server_udp.c b/src/lib/ecore_con/efl_net_server_udp.c index 0f0b2287e9..3ae452eb33 100644 --- a/src/lib/ecore_con/efl_net_server_udp.c +++ b/src/lib/ecore_con/efl_net_server_udp.c @@ -25,9 +25,6 @@ #ifdef HAVE_ARPA_INET_H # include #endif -#ifdef _WIN32 -# include -#endif #define MY_CLASS EFL_NET_SERVER_UDP_CLASS diff --git a/src/lib/ecore_con/efl_net_server_udp_client.c b/src/lib/ecore_con/efl_net_server_udp_client.c index 9a4a7990a4..5c4e8c0515 100644 --- a/src/lib/ecore_con/efl_net_server_udp_client.c +++ b/src/lib/ecore_con/efl_net_server_udp_client.c @@ -15,9 +15,6 @@ #ifdef HAVE_SYS_SOCKET_H # include #endif -#ifdef _WIN32 -# include -#endif #define MY_CLASS EFL_NET_SERVER_UDP_CLIENT_CLASS diff --git a/src/lib/ecore_con/efl_net_socket_fd.c b/src/lib/ecore_con/efl_net_socket_fd.c index 3ade365fc2..8d07ed9da2 100644 --- a/src/lib/ecore_con/efl_net_socket_fd.c +++ b/src/lib/ecore_con/efl_net_socket_fd.c @@ -20,9 +20,6 @@ #ifdef HAVE_SYS_SOCKET_H # include #endif -#ifdef _WIN32 -# include -#endif #define MY_CLASS EFL_NET_SOCKET_FD_CLASS diff --git a/src/lib/ecore_con/efl_net_socket_tcp.c b/src/lib/ecore_con/efl_net_socket_tcp.c index cec971237a..8a7f0a7935 100644 --- a/src/lib/ecore_con/efl_net_socket_tcp.c +++ b/src/lib/ecore_con/efl_net_socket_tcp.c @@ -29,9 +29,6 @@ #ifdef HAVE_ARPA_INET_H # include #endif -#ifdef _WIN32 -# include -#endif #define MY_CLASS EFL_NET_SOCKET_TCP_CLASS diff --git a/src/lib/ecore_con/efl_net_socket_udp.c b/src/lib/ecore_con/efl_net_socket_udp.c index 67e3f6a795..85a44b86b3 100644 --- a/src/lib/ecore_con/efl_net_socket_udp.c +++ b/src/lib/ecore_con/efl_net_socket_udp.c @@ -29,9 +29,6 @@ #ifdef HAVE_ARPA_INET_H # include #endif -#ifdef _WIN32 -# include -#endif #define MY_CLASS EFL_NET_SOCKET_UDP_CLASS diff --git a/src/lib/ecore_con/efl_net_ssl_conn-openssl.c b/src/lib/ecore_con/efl_net_ssl_conn-openssl.c index c2a7dc8331..3f88c20237 100644 --- a/src/lib/ecore_con/efl_net_ssl_conn-openssl.c +++ b/src/lib/ecore_con/efl_net_ssl_conn-openssl.c @@ -18,7 +18,7 @@ #endif #ifdef _WIN32 -# include +# include /* dlsym */ #endif #ifdef HAVE_ESCAPE From 1692ff3890875be579dbf953bd0ec2146497eba9 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Fri, 17 May 2019 14:02:21 -0400 Subject: [PATCH 53/53] bin/ecore_evas: remove useless inclusion of Evil.h Test Plan: compilation Reviewers: zmike, raster, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8917 --- src/bin/ecore_evas/ecore_evas_convert.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/bin/ecore_evas/ecore_evas_convert.c b/src/bin/ecore_evas/ecore_evas_convert.c index e76888db47..019e42c7ff 100644 --- a/src/bin/ecore_evas/ecore_evas_convert.c +++ b/src/bin/ecore_evas/ecore_evas_convert.c @@ -2,10 +2,6 @@ #include #endif -#ifdef _WIN32 -# include -#endif - #include #include #include