Merge branch 'master' into devs/hermet/lottie

This commit is contained in:
Hermet Park 2019-07-22 13:23:59 +09:00
commit 05a50dc2eb
28 changed files with 257 additions and 171 deletions

10
README
View File

@ -422,15 +422,7 @@ libc calls not in Mingw32 that EFL needs.
COMPILING AND INSTALLING
------------------------
./configure
make
sudo make install
If you have doxygen, then you can build documentation with:
make doc
You will find documentation in the doc/ directory.
See the INSTALL file: https://git.enlightenment.org/core/efl.git/tree/INSTALL
REQUIREMENTS

View File

@ -183,7 +183,8 @@ void test_scroller6(void *data, Evas_Object *obj, void *event_info);
void test_scroller7(void *data, Evas_Object *obj, void *event_info);
void test_scroller_simple(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_scroller(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_scroller2(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_scroller_simple(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_scroller_simple2(void *data, Evas_Object *obj, void *event_info);
void test_spinner(void *data, Evas_Object *obj, void *event_info);
void test_ui_spin(void *data, Evas_Object *obj, void *event_info);
void test_ui_spin_button(void *data, Evas_Object *obj, void *event_info);
@ -1096,7 +1097,8 @@ add_tests:
ADD_TEST(NULL, "Scroller", "Scroller 7", test_scroller7);
ADD_TEST(NULL, "Scroller", "Scroller Simple", test_scroller_simple);
ADD_TEST_EO(NULL, "Scroller", "Efl.Ui.Scroller", test_efl_ui_scroller);
ADD_TEST_EO(NULL, "Scroller", "Efl.Ui.Scroller Simple", test_efl_ui_scroller2);
ADD_TEST_EO(NULL, "Scroller", "Efl.Ui.Scroller Simple", test_efl_ui_scroller_simple);
ADD_TEST_EO(NULL, "Scroller", "Efl.Ui.Scroller Simple2", test_efl_ui_scroller_simple2);
//------------------------------//
// FIXME: add frame test

View File

@ -131,7 +131,7 @@ test_efl_ui_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
}
void
test_efl_ui_scroller2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
test_efl_ui_scroller_simple(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Eo *win, *sc, *bx;
int i;
@ -165,3 +165,45 @@ test_efl_ui_scroller2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
efl_pack(bx, efl_added));
}
}
void
test_efl_ui_scroller_simple2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Eo *win, *sc, *tb;
int i;
win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Efl Ui Scroller Simple2"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 400));
sc = efl_add(EFL_UI_SCROLLER_CLASS, win,
efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
efl_event_callback_add(efl_added, EFL_UI_EVENT_SCROLL_START, _scroll_start_cb, NULL),
efl_event_callback_add(efl_added, EFL_UI_EVENT_SCROLL_STOP, _scroll_stop_cb, NULL),
efl_content_set(win, efl_added));
tb = efl_add(EFL_UI_TABLE_CLASS, sc,
efl_pack_table_columns_set(efl_added, 2),
efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0),
efl_gfx_hint_align_set(efl_added, 0.5, 0),
efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_FALSE),
efl_content_set(sc, efl_added));
for (i = 0; i < 1000; i++)
{
efl_add(EFL_UI_BUTTON_CLASS, tb,
efl_text_set(efl_added, "Vertical"),
efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0.0),
efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_FALSE),
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _bt_clicked, NULL),
efl_pack_table(tb, efl_added, 0, i, 1, 1));
efl_add(EFL_UI_BUTTON_CLASS, tb,
efl_text_set(efl_added, "Horizontal"),
efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0.0),
efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_FALSE),
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _bt_clicked, NULL),
efl_pack_table(tb, efl_added, 1, i, 1, 1));
}
}

View File

@ -1177,6 +1177,7 @@ _ecore_main_loop_iterate_may_block(Eo *obj, Efl_Loop_Data *pd, int may_block)
void
_ecore_main_loop_begin(Eo *obj, Efl_Loop_Data *pd)
{
pd->loop_active++;
if (obj == ML_OBJ)
{
#ifdef HAVE_SYSTEMD
@ -1240,11 +1241,13 @@ _ecore_main_loop_begin(Eo *obj, Efl_Loop_Data *pd)
pd->do_quit = 0;
#endif
}
pd->loop_active--;
}
void
_ecore_main_loop_quit(Eo *obj, Efl_Loop_Data *pd)
{
if (!pd->loop_active) return;
pd->do_quit = 1;
if (obj != ML_OBJ) return;
#ifdef USE_G_MAIN_LOOP

View File

@ -163,6 +163,7 @@ struct _Efl_Loop_Data
int idlers;
int in_loop;
unsigned int loop_active;
struct {
int high;

View File

@ -605,6 +605,22 @@ _efl_thread_efl_object_parent_set(Eo *obj, Efl_Thread_Data *pd, Efl_Object *pare
pd->loop = efl_provider_find(parent, EFL_LOOP_CLASS);
}
static void
_task_run_pipe_fail_clear(Thread_Data *thdat, Efl_Thread_Data *pd)
{
efl_del(pd->fd.in_handler);
efl_del(pd->fd.out_handler);
close(thdat->fd.in);
close(thdat->fd.out);
close(pd->fd.in);
close(pd->fd.out);
pd->fd.in_handler = NULL;
pd->fd.out_handler = NULL;
pd->fd.in = -1;
pd->fd.out = -1;
free(thdat);
}
EOLIAN static Eina_Future *
_efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
{
@ -689,35 +705,15 @@ _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
if (pipe(pipe_to_thread) != 0)
{
ERR("Can't create to_thread control pipe");
efl_del(pd->fd.in_handler);
efl_del(pd->fd.out_handler);
close(thdat->fd.in);
close(thdat->fd.out);
close(pd->fd.in);
close(pd->fd.out);
pd->fd.in_handler = NULL;
pd->fd.out_handler = NULL;
pd->fd.in = -1;
pd->fd.out = -1;
free(thdat);
_task_run_pipe_fail_clear(thdat, pd);
return NULL;
}
if (pipe(pipe_from_thread) != 0)
{
ERR("Can't create from_thread control pipe");
efl_del(pd->fd.in_handler);
efl_del(pd->fd.out_handler);
_task_run_pipe_fail_clear(thdat, pd);
close(pipe_to_thread[0]);
close(pipe_to_thread[1]);
close(thdat->fd.in);
close(thdat->fd.out);
close(pd->fd.in);
close(pd->fd.out);
pd->fd.in_handler = NULL;
pd->fd.out_handler = NULL;
pd->fd.in = -1;
pd->fd.out = -1;
free(thdat);
return NULL;
}
thdat->ctrl.in = pipe_from_thread[1]; // write - input to parent
@ -872,6 +868,15 @@ _efl_thread_efl_io_closer_closed_get(const Eo *obj EINA_UNUSED, Efl_Thread_Data
return EINA_FALSE;
}
static void
_io_reader_read_fd_out_clear(Efl_Thread_Data *pd)
{
close(pd->fd.out);
pd->fd.out = -1;
efl_del(pd->fd.out_handler);
pd->fd.out_handler = NULL;
}
EOLIAN static Eina_Error
_efl_thread_efl_io_reader_read(Eo *obj, Efl_Thread_Data *pd, Eina_Rw_Slice *rw_slice)
{
@ -897,22 +902,14 @@ _efl_thread_efl_io_reader_read(Eo *obj, Efl_Thread_Data *pd, Eina_Rw_Slice *rw_s
{
efl_io_reader_can_read_set(obj, EINA_FALSE);
efl_io_reader_eos_set(obj, EINA_TRUE);
close(pd->fd.out);
pd->fd.out = -1;
efl_del(pd->fd.out_handler);
pd->fd.out_handler = NULL;
_io_reader_read_fd_out_clear(pd);
_thread_exit_eval(obj, pd);
return EPIPE;
}
return 0;
err:
if ((pd->fd.out != -1) && (errno != EAGAIN))
{
close(pd->fd.out);
pd->fd.out = -1;
efl_del(pd->fd.out_handler);
pd->fd.out_handler = NULL;
}
_io_reader_read_fd_out_clear(pd);
rw_slice->len = 0;
rw_slice->mem = NULL;
efl_io_reader_can_read_set(obj, EINA_FALSE);
@ -960,6 +957,15 @@ _efl_thread_efl_io_reader_eos_get(const Eo *obj EINA_UNUSED, Efl_Thread_Data *pd
return pd->fd.eos_read;
}
static void
_io_writer_write_fd_in_clear(Efl_Thread_Data *pd)
{
close(pd->fd.in);
pd->fd.in = -1;
efl_del(pd->fd.in_handler);
pd->fd.in_handler = NULL;
}
EOLIAN static Eina_Error
_efl_thread_efl_io_writer_write(Eo *obj, Efl_Thread_Data *pd, Eina_Slice *slice, Eina_Slice *remaining)
{
@ -991,22 +997,14 @@ _efl_thread_efl_io_writer_write(Eo *obj, Efl_Thread_Data *pd, Eina_Slice *slice,
efl_io_writer_can_write_set(obj, EINA_FALSE);
if (r == 0)
{
close(pd->fd.in);
pd->fd.in = -1;
efl_del(pd->fd.in_handler);
pd->fd.in_handler = NULL;
_io_writer_write_fd_in_clear(pd);
_thread_exit_eval(obj, pd);
return EPIPE;
}
return 0;
err:
if ((pd->fd.in != -1) && (errno != EAGAIN))
{
close(pd->fd.in);
pd->fd.in = -1;
efl_del(pd->fd.in_handler);
pd->fd.in_handler = NULL;
}
_io_writer_write_fd_in_clear(pd);
if (remaining) *remaining = *slice;
slice->len = 0;
slice->mem = NULL;
@ -1035,11 +1033,9 @@ _efl_thread_efl_io_writer_can_write_get(const Eo *obj EINA_UNUSED, Efl_Thread_Da
return pd->fd.can_write;
}
void
_appthread_threadio_call(Eo *obj EINA_UNUSED, Efl_Appthread_Data *pd,
void *func_data, EFlThreadIOCall func, Eina_Free_Cb func_free_cb)
static void
_threadio_call(int fd, void *func_data, EFlThreadIOCall func, Eina_Free_Cb func_free_cb)
{
Thread_Data *thdat = pd->thdat;
Control_Data cmd;
memset(&cmd, 0, sizeof(cmd));
@ -1047,21 +1043,41 @@ _appthread_threadio_call(Eo *obj EINA_UNUSED, Efl_Appthread_Data *pd,
cmd.d.ptr[0] = func;
cmd.d.ptr[1] = func_data;
cmd.d.ptr[2] = func_free_cb;
_efl_thread_pipe_write(thdat->ctrl.in, &cmd, sizeof(Control_Data));
_efl_thread_pipe_write(fd, &cmd, sizeof(Control_Data));
}
void
_appthread_threadio_call(Eo *obj EINA_UNUSED, Efl_Appthread_Data *pd,
void *func_data, EFlThreadIOCall func, Eina_Free_Cb func_free_cb)
{
Thread_Data *thdat = pd->thdat;
_threadio_call(thdat->ctrl.in, func_data, func, func_free_cb);
}
EOLIAN static void
_efl_thread_efl_threadio_call(Eo *obj EINA_UNUSED, Efl_Thread_Data *pd,
void *func_data, EFlThreadIOCall func, Eina_Free_Cb func_free_cb)
{
_threadio_call(pd->ctrl.in, func_data, func, func_free_cb);
}
static void *
_threadio_call_sync(int fd, void *func_data, EFlThreadIOCallSync func, Eina_Free_Cb func_free_cb)
{
Control_Data cmd;
Control_Reply rep;
memset(&cmd, 0, sizeof(cmd));
cmd.d.command = CMD_CALL;
cmd.d.command = CMD_CALL_SYNC;
cmd.d.ptr[0] = func;
cmd.d.ptr[1] = func_data;
cmd.d.ptr[2] = func_free_cb;
_efl_thread_pipe_write(pd->ctrl.in, &cmd, sizeof(Control_Data));
cmd.d.ptr[3] = &rep;
rep.data = NULL;
eina_semaphore_new(&(rep.sem), 0);
_efl_thread_pipe_write(fd, &cmd, sizeof(Control_Data));
eina_semaphore_lock(&(rep.sem));
return rep.data;
}
void *
@ -1069,50 +1085,14 @@ _appthread_threadio_call_sync(Eo *obj EINA_UNUSED, Efl_Appthread_Data *pd,
void *func_data, EFlThreadIOCallSync func, Eina_Free_Cb func_free_cb)
{
Thread_Data *thdat = pd->thdat;
Control_Data cmd;
Control_Reply *rep;
void *data;
memset(&cmd, 0, sizeof(cmd));
cmd.d.command = CMD_CALL_SYNC;
cmd.d.ptr[0] = func;
cmd.d.ptr[1] = func_data;
cmd.d.ptr[2] = func_free_cb;
rep = malloc(sizeof(Control_Reply));
if (!rep) return NULL;
cmd.d.ptr[3] = rep;
rep->data = NULL;
eina_semaphore_new(&(rep->sem), 0);
_efl_thread_pipe_write(thdat->ctrl.in, &cmd, sizeof(Control_Data));
eina_semaphore_lock(&(rep->sem));
data = rep->data;
free(rep);
return data;
return _threadio_call_sync(thdat->ctrl.in, func_data, func, func_free_cb);
}
EOLIAN static void *
_efl_thread_efl_threadio_call_sync(Eo *obj EINA_UNUSED, Efl_Thread_Data *pd,
void *func_data, EFlThreadIOCallSync func, Eina_Free_Cb func_free_cb)
{
Control_Data cmd;
Control_Reply *rep;
void *data;
memset(&cmd, 0, sizeof(cmd));
cmd.d.command = CMD_CALL_SYNC;
cmd.d.ptr[0] = func;
cmd.d.ptr[1] = func_data;
cmd.d.ptr[2] = func_free_cb;
rep = malloc(sizeof(Control_Reply));
if (!rep) return NULL;
cmd.d.ptr[3] = rep;
rep->data = NULL;
eina_semaphore_new(&(rep->sem), 0);
_efl_thread_pipe_write(pd->ctrl.in, &cmd, sizeof(Control_Data));
eina_semaphore_lock(&(rep->sem));
data = rep->data;
free(rep);
return data;
return _threadio_call_sync(pd->ctrl.in, func_data, func, func_free_cb);
}
//////////////////////////////////////////////////////////////////////////

View File

@ -595,12 +595,17 @@ ecore_wl2_buffer_init(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer_Type types)
if (!getenv("EVAS_WAYLAND_SHM_DISABLE_DMABUF") && dmabuf)
{
fd = open("/dev/dri/renderD128", O_RDWR | O_CLOEXEC);
if (fd < 0) goto err_drm;
if (fd < 0)
{
ERR("Tried to use dmabufs, but can't find /dev/dri/renderD128 . Falling back to regular SHM");
goto fallback_shm;
}
success = _intel_buffer_manager_setup(fd);
if (!success) success = _exynos_buffer_manager_setup(fd);
if (!success) success = _vc4_buffer_manager_setup(fd);
}
fallback_shm:
if (!success) success = shm && _wl_shm_buffer_manager_setup(0);
if (!success) goto err_bm;
@ -610,7 +615,6 @@ ecore_wl2_buffer_init(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer_Type types)
err_bm:
if (fd >= 0) close(fd);
err_drm:
free(buffer_manager);
buffer_manager = NULL;
err_alloc:

View File

@ -3014,9 +3014,9 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp)
if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
{
evas_object_show(en->cursor_bg);
evas_object_show(en->cursor_fg);
evas_object_show(en->cursor_fg2);
if (en->cursor_bg) evas_object_show(en->cursor_bg);
if (en->cursor_fg) evas_object_show(en->cursor_fg);
if (en->cursor_fg2) evas_object_show(en->cursor_fg2);
en->input_panel_enable = EINA_TRUE;
#ifdef HAVE_ECORE_IMF

View File

@ -1363,7 +1363,8 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
for (i = 0; i < ed->table_parts_size; i++)
{
rp = ed->table_parts[i];
evas_object_show(rp->object);
/* SPACER parts do not have objects */
if (rp->object) evas_object_show(rp->object);
if (_edje_block_break(ed)) break;
if (rp->drag)
{

View File

@ -195,11 +195,11 @@ eina_vpath_shutdown(void)
return EINA_TRUE;
}
#ifdef HAVE_GETPWENT
static Eina_Bool
_fetch_user_homedir(char **str, const char *name, const char *error)
{
*str = NULL;
#ifdef HAVE_GETPWENT
struct passwd *pwent;
pwent = getpwnam(name);
@ -211,12 +211,8 @@ _fetch_user_homedir(char **str, const char *name, const char *error)
*str = pwent->pw_dir;
return EINA_TRUE;
#else
ERR("User fetching is disabled on this system\nThe string was: %s", error);
return EINA_FALSE;
(void) name;
#endif
}
#endif
static int
_eina_vpath_resolve(const char *path, char *str, size_t size)
@ -232,6 +228,10 @@ _eina_vpath_resolve(const char *path, char *str, size_t size)
}
// ~username/ <- homedir of user "username"
else
#ifndef HAVE_GETPWENT
ERR("User fetching is disabled on this system\nThe string was: %s", path);
return 0;
#else
{
const char *p;
char *name;
@ -248,6 +248,7 @@ _eina_vpath_resolve(const char *path, char *str, size_t size)
return 0;
path = p;
}
#endif
if (home)
{
return snprintf(str, size, "%s%s", home, path);

View File

@ -81,12 +81,14 @@
*
* @since 1.21
*
* @note on Windows, vpath like ~bob/foo is not supported.
*
*/
typedef const char * Eina_Vpath;
/**
* Translate a virtual path into a normal path.
*
*
* The return string is a string allocated by malloc and should be freed with
* free() when no longer needed.
*

View File

@ -297,13 +297,10 @@ endif
if cc.has_header_symbol(pthread_np_header_file, 'pthread_attr_setaffinity_np', args : pthread_args)
eina_config.set('EINA_HAVE_PTHREAD_AFFINITY', '1')
endif
# FIXME the author of eina_debug probebly never ran with EINA_HAVE_DEBUG_THREADS
# however eina debug decides to init that lock and never frees it. which means
# the code in eina_main.c will not work in the way it currently is there.
#if debug_threads or get_option('debug-threads')
# eina_config.set('EINA_HAVE_DEBUG_THREADS', '1')
#endif
if debug_threads or get_option('debug-threads')
eina_config.set('EINA_HAVE_DEBUG_THREADS', '1')
endif
eina_config.set('EINA_SIZEOF_WCHAR_T', cc.sizeof('wchar_t', prefix : '#include<wchar.h>'))

View File

@ -249,6 +249,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
# include <efl_ui_format.eo.h>
# include <efl_ui_spin.eo.h>
# include <efl_ui_spin_button.eo.h>
# include <efl_ui_slider.eo.h>
/**
* Initialize Elementary

View File

@ -1232,7 +1232,8 @@ static inline double
_scroll_manager_animation_duration_get(Evas_Coord dx, Evas_Coord dy)
{
double dist = 0.0, vel = 0.0, dur = 0.0;
dist = sqrt(dx * dx + dy *dy);
uint64_t x = abs(dx), y = abs(dy);
dist = sqrt(x * x + y * y);
vel = _elm_config->thumbscroll_friction_standard / _elm_config->thumbscroll_friction;
dur = dist / vel;
dur = (dur > _elm_config->thumbscroll_friction) ? _elm_config->thumbscroll_friction : dur;

View File

@ -174,7 +174,7 @@ EOLIAN static void
_efl_ui_table_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Table_Data *_pd EINA_UNUSED, Eina_Size2D sz)
{
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
efl_canvas_group_change(obj);
efl_pack_layout_request(obj);
}
EOLIAN static void
@ -508,8 +508,9 @@ _efl_ui_table_efl_pack_unpack_all(Eo *obj, Efl_Ui_Table_Data *pd)
}
EOLIAN static void
_efl_ui_table_efl_pack_layout_layout_request(Eo *obj, Efl_Ui_Table_Data *pd EINA_UNUSED)
_efl_ui_table_efl_pack_layout_layout_request(Eo *obj, Efl_Ui_Table_Data *pd)
{
pd->full_recalc = EINA_TRUE;
efl_canvas_group_need_recalculate_set(obj, EINA_TRUE);
}

View File

@ -218,6 +218,27 @@ _efl_ui_table_regular_item_size_get(Table_Calc *table_calc, Item_Calc *item, Ein
- item->hints[axis].margin[0] - item->hints[axis].margin[1];
}
/* this function performs a simplified layout when the table has changed position
* but no other changes have occurred, e.g., when a table is being scrolled
*/
static void
_efl_ui_table_layout_simple(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
{
Table_Item *ti;
Eina_Position2D pos = efl_gfx_entity_position_get(ui_table);
EINA_INLIST_FOREACH(EINA_INLIST_GET(pd->items), ti)
{
Eina_Position2D child_pos = efl_gfx_entity_position_get(ti->object);
efl_gfx_entity_position_set(ti->object,
EINA_POSITION2D(pos.x - pd->last_pos.x + child_pos.x,
pos.y - pd->last_pos.y + child_pos.y));
}
pd->last_pos = pos;
efl_event_callback_call(ui_table, EFL_PACK_EVENT_LAYOUT_UPDATED, NULL);
}
void
_efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
{
@ -228,16 +249,22 @@ _efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
int (*_efl_ui_table_item_pos_get[2])(Table_Calc *, Item_Calc *, Eina_Bool);
int (*_efl_ui_table_item_size_get[2])(Table_Calc *, Item_Calc *, Eina_Bool);
Table_Calc table_calc;
Eina_Bool do_free;
count = pd->count;
if (!count)
{
efl_gfx_hint_size_restricted_min_set(ui_table, EINA_SIZE2D(0, 0));
return;
}
if (!pd->full_recalc)
{
_efl_ui_table_layout_simple(ui_table, pd);
return;
}
_efl_ui_container_layout_init(ui_table, table_calc.layout_calc);
pd->last_pos.x = table_calc.layout_calc[0].pos - table_calc.layout_calc[0].margin[0];
pd->last_pos.y = table_calc.layout_calc[1].pos - table_calc.layout_calc[1].margin[0];
table_calc.want[0] = table_calc.want[1] = 0;
table_calc.weight_sum[0] = table_calc.weight_sum[1] = 0;
@ -250,7 +277,17 @@ _efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
memset(table_calc.cell_calc[0], 0, cols * sizeof(Cell_Calc));
memset(table_calc.cell_calc[1], 0, rows * sizeof(Cell_Calc));
items = alloca(count * sizeof(*items));
/* Item_Calc struct is currently 152 bytes.
* this is pretty big to be allocating a huge number of, and we don't want to explode the stack
*/
do_free = count >= 500;
if (do_free)
{
items = malloc(count * sizeof(*items));
EINA_SAFETY_ON_NULL_RETURN(items);
}
else
items = alloca(count * sizeof(*items));
#ifdef DEBUG
memset(items, 0, count * sizeof(*items));
#endif
@ -380,8 +417,10 @@ _efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
+ (table_calc.layout_calc[1].pad *
table_calc.cell_calc[1][rows - 1].index);
pd->full_recalc = EINA_FALSE;
efl_gfx_hint_size_restricted_min_set(ui_table,
EINA_SIZE2D(table_calc.want[0],
table_calc.want[1]));
efl_event_callback_call(ui_table, EFL_PACK_EVENT_LAYOUT_UPDATED, NULL);
if (do_free) free(items);
}

View File

@ -44,11 +44,13 @@ struct _Efl_Ui_Table_Data
struct {
double h, v;
} align;
Eina_Position2D last_pos;
Eina_Bool cols_recalc : 1;
Eina_Bool rows_recalc : 1;
Eina_Bool linear_recalc : 1;
Eina_Bool homogeneoush : 1;
Eina_Bool homogeneousv : 1;
Eina_Bool full_recalc : 1; //whether to force full recalc
};
struct _Table_Item_Iterator

View File

@ -2318,6 +2318,7 @@ efl_alive_get(const Eo *obj)
{
return efl_finalized_get(obj) && !efl_invalidating_get(obj) && !efl_invalidated_get(obj);
}
#endif /* EFL_BETA_API_SUPPORT */
/**
@ -2359,6 +2360,15 @@ EAPI Eina_Iterator *eo_classes_iterator_new(void);
*/
EAPI Eina_Iterator *eo_objects_iterator_new(void);
/**
* @brief Check if a object can be owned
*
* This API checks if the passed object has at least one free reference that is not taken by the parent relation.
* If this is not the case, a ERR will be printed.
*
* @return EINA_TRUE if the object is ownable. EINA_FALSE if not.
*/
EAPI Eina_Bool efl_ownable_get(const Eo *obj);
/**
* @}
*/

View File

@ -3718,3 +3718,17 @@ efl_class_type_get(const Efl_Class *klass_id)
return klass->desc->type;
}
EAPI Eina_Bool
efl_ownable_get(const Eo *obj)
{
int ref = efl_ref_count(obj);
if (efl_parent_get(obj))
ref --;
if (ref <= 0)
ERR("There is no free reference to pass this object. Please check that this object is really owned by you.");
return (ref > 0);
}

View File

@ -357,9 +357,8 @@ _evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e)
EAPI void
evas_free(Evas *eo_e)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
if (!eo_e) return;
EVAS_TYPE_CHECK(eo_e);
if (efl_parent_get(eo_e))
efl_del(eo_e);
else
@ -1230,9 +1229,7 @@ _evas_canvas_efl_canvas_scene_image_max_size_get(const Eo *eo_e EINA_UNUSED, Eva
EAPI void
evas_output_framespace_set(Evas *eo_e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
EVAS_TYPE_CHECK(eo_e);
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
@ -1251,9 +1248,7 @@ evas_output_framespace_set(Evas *eo_e, Evas_Coord x, Evas_Coord y, Evas_Coord w,
EAPI void
evas_output_framespace_get(const Evas *eo_e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
EVAS_TYPE_CHECK(eo_e);
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
@ -1266,9 +1261,7 @@ evas_output_framespace_get(const Evas *eo_e, Evas_Coord *x, Evas_Coord *y, Evas_
EAPI void
evas_output_method_set(Evas *eo_e, int render_method)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
EVAS_TYPE_CHECK(eo_e);
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
@ -1340,9 +1333,7 @@ evas_output_method_set(Evas *eo_e, int render_method)
EAPI int
evas_output_method_get(const Evas *eo_e)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return RENDER_METHOD_INVALID;
MAGIC_CHECK_END();
EVAS_TYPE_CHECK(eo_e, RENDER_METHOD_INVALID);
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
@ -1352,9 +1343,7 @@ evas_output_method_get(const Evas *eo_e)
EAPI void
evas_output_size_set(Evas *eo_e, int w, int h)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
EVAS_TYPE_CHECK(eo_e);
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
@ -1382,9 +1371,7 @@ evas_output_size_set(Evas *eo_e, int w, int h)
EAPI void
evas_output_size_get(const Evas *eo_e, int *w, int *h)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
EVAS_TYPE_CHECK(eo_e);
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
@ -1395,9 +1382,7 @@ evas_output_size_get(const Evas *eo_e, int *w, int *h)
EAPI void
evas_output_viewport_set(Evas *eo_e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
EVAS_TYPE_CHECK(eo_e);
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
@ -1425,9 +1410,7 @@ evas_output_viewport_set(Evas *eo_e, Evas_Coord x, Evas_Coord y, Evas_Coord w, E
EAPI void
evas_output_viewport_get(const Evas *eo_e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
EVAS_TYPE_CHECK(eo_e);
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
@ -1961,9 +1944,7 @@ evas_font_hinting_can_hint(const Evas *eo_e, Evas_Font_Hinting_Flags hinting)
EAPI void
evas_font_available_list_free(Evas *eo_e, Eina_List *available)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
EVAS_TYPE_CHECK(eo_e);
evas_font_dir_available_list_free(available);
}
@ -1978,7 +1959,7 @@ _evas_canvas_efl_canvas_scene_group_objects_calculate(Eo *eo_e, Evas_Public_Data
EAPI void
evas_smart_objects_calculate(Eo *eo_e)
{
EINA_SAFETY_ON_NULL_RETURN(eo_e);
EVAS_TYPE_CHECK(eo_e);
evas_call_smarts_calculate(eo_e);
}
@ -1991,6 +1972,7 @@ _evas_canvas_efl_canvas_scene_group_objects_calculating_get(const Eo *eo_e EINA_
EAPI Eina_Bool
evas_smart_objects_calculating_get(const Eo *obj)
{
EVAS_TYPE_CHECK(obj, EINA_FALSE);
return efl_canvas_scene_group_objects_calculating_get(obj);
}
@ -2004,18 +1986,21 @@ _evas_canvas_smart_objects_calculate_count_get(const Eo *eo_e EINA_UNUSED, Evas_
EAPI Eina_Bool
evas_pointer_inside_get(const Evas *obj)
{
EVAS_TYPE_CHECK(obj, EINA_FALSE);
return efl_canvas_pointer_inside_get(obj, NULL);
}
EAPI Eina_Bool
evas_pointer_inside_by_device_get(const Evas *obj, Eo *dev)
{
EVAS_TYPE_CHECK(obj, EINA_FALSE);
return efl_canvas_pointer_inside_get(obj, dev);
}
EAPI Eina_List*
evas_objects_at_xy_get(Eo *eo_e, int x, int y, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects)
{
EVAS_TYPE_CHECK(eo_e, NULL);
return _efl_canvas_evas_canvas_objects_at_xy_get_helper(eo_e, efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS), x, y, include_pass_events_objects, include_hidden_objects);
}
/* Internal EO APIs */

View File

@ -739,10 +739,7 @@ evas_map_dup(const Evas_Map *m)
EAPI void
evas_map_free(Evas_Map *m)
{
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
return;
MAGIC_CHECK_END();
if (!m) return;
_evas_map_free(NULL, m);
}

View File

@ -443,10 +443,16 @@ _evas_box_efl_gfx_entity_size_set(Eo *o, Evas_Object_Box_Data *_pd EINA_UNUSED,
EOLIAN static void
_evas_box_efl_gfx_entity_position_set(Eo *o, Evas_Object_Box_Data *_pd EINA_UNUSED, Eina_Position2D pos)
{
Evas_Object_Smart_Clipped_Data *cso = evas_object_smart_data_get(o);
if (_evas_object_intercept_call(o, EVAS_OBJECT_INTERCEPT_CB_MOVE , 0, pos.x, pos.y))
return;
efl_gfx_entity_position_set(efl_super(o, MY_CLASS), pos);
efl_gfx_entity_position_set(cso->clipper, pos);
/* this skips the call to _evas_object_smart_clipped_smart_move_internal
* since box internals will automatically recalc all the child positions
* at a later point
*/
efl_gfx_entity_position_set(efl_super(o, EFL_CANVAS_GROUP_CLASS), pos);
evas_object_smart_changed(o);
}

View File

@ -2864,7 +2864,7 @@ evas_render_pre(Evas *eo_e, Evas_Public_Data *evas)
EAPI void
evas_render_pending_objects_flush(Evas *eo_e)
{
Evas_Public_Data *evas = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
Evas_Public_Data *evas = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
EINA_SAFETY_ON_NULL_RETURN(evas);
evas_render_pre(eo_e, evas);
}

View File

@ -517,7 +517,19 @@ OPAQUE_TYPE(Evas_Font_Instance); /* General type for RGBA_Font_Int */
#define MAGIC_MAP 0x7575177d
#define MAGIC_DEV 0x7d773738
#define EVAS_TYPE_CHECK(obj, ...) \
do { \
if (!efl_isa((obj), EVAS_CANVAS_CLASS)) \
{ \
CRI("non-Evas passed to %s", __func__); \
return __VA_ARGS__; \
} \
} \
while (0)
#ifdef EINA_MAGIC_DEBUG
# define MAGIC_CHECK_FAILED(o, t, m) \
{evas_debug_error(); \
if (!o) evas_debug_input_null(); \

View File

@ -427,8 +427,6 @@ EFL_START_TEST(utc_eldbus_signal_handler_free_cb_add_del_p)
eldbus_signal_handler_unref(signal_handler);
ecore_main_loop_begin();
ck_assert_msg(is_success_cb, "Callback is not called");
signal_handler = _signal_handler_get(conn);

View File

@ -159,7 +159,7 @@ EFL_START_TEST(elm_genlist_test_item_content)
evas_object_show(genlist);
evas_object_show(win);
ecore_main_loop_begin();
get_me_to_those_events(win);
end = elm_object_item_part_content_get(it, "elm.swallow.end");
parent = elm_object_parent_widget_get(end);

View File

@ -157,7 +157,6 @@ EFL_START_TEST(elm_test_widget_focus_simple_widget)
box = elm_box_add(win);
elm_win_resize_object_add(win, box);
evas_object_show(win);
evas_object_show(box);
resettor = o = elm_button_add(win);
@ -177,13 +176,9 @@ EFL_START_TEST(elm_test_widget_focus_simple_widget)
}
evas_object_resize(win, 200, 200);
//I have no idea why this is needed - but if this here is not done,
// then elements that are part of a layout will NOT be shown even if
// the window and layout is shown
evas_object_hide(win);
evas_object_show(win);
ecore_main_loop_begin();
get_me_to_those_events(win);
for (int i = 0; simple_widgets[i].name; ++i)
{

View File

@ -384,7 +384,7 @@ get_me_to_those_events(Eo *obj)
{
Evas *e = obj;
if (!efl_isa(obj, EFL_CANVAS_SCENE_INTERFACE))
if ((!efl_isa(obj, EFL_CANVAS_SCENE_INTERFACE)) || efl_isa(obj, EFL_UI_WIN_CLASS))
e = evas_object_evas_get(obj);
evas_smart_objects_calculate(e);
evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, events_norendered, NULL);