Merge branch 'master' into devs/hermet/lottie

This commit is contained in:
Hermet Park 2019-08-28 11:00:13 +09:00
commit 1a9d2dd759
24 changed files with 566 additions and 440 deletions

View File

@ -227,7 +227,11 @@ endif
config_h.set_quoted('SHARED_LIB_SUFFIX', '.'+sys_lib_extension)
config_h.set_quoted('MOD_SUFFIX', '.'+sys_mod_extension)
config_h.set_quoted('EXE_SUFFIX', '.'+sys_exe_extension)
if sys_exe_extension == ''
config_h.set_quoted('EXE_SUFFIX', '')
else
config_h.set_quoted('EXE_SUFFIX', '.'+sys_exe_extension)
endif
config_h.set('EFL_BUILD', '1')
if get_option('tslib') == true

View File

@ -16,6 +16,36 @@ _slider_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
efl_ui_range_value_set(ev->object, 100);
}
static void
_slider_steady_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
double val;
val = efl_ui_range_value_get(ev->object);
printf("steady callbck : val = %f\n", val);
}
static void
_slider_drag_start_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
double val;
val = efl_ui_range_value_get(ev->object);
printf("drag start callbck : val = %f\n", val);
}
static void
_slider_drag_stop_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
double val;
val = efl_ui_range_value_get(ev->object);
printf("drag stop callbck : val = %f\n", val);
}
void
test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@ -37,6 +67,9 @@ test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
efl_add(EFL_UI_SLIDER_CLASS, bx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(160, 0)),
efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0.0),
efl_event_callback_add(efl_added, EFL_UI_RANGE_EVENT_STEADY, _slider_steady_cb, NULL),
efl_event_callback_add(efl_added, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_START, _slider_drag_start_cb, NULL),
efl_event_callback_add(efl_added, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, _slider_drag_stop_cb, NULL),
efl_pack(bx, efl_added));
efl_add(EFL_UI_TEXT_CLASS, bx,

View File

@ -165,7 +165,9 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
unsigned int j;
Edje_Part *ep;
Eina_List *hist;
Eina_Array hist;
eina_array_step_set(&hist, sizeof(Eina_Array), 5);
for (j = 0; j < edc->parts_count; ++j)
{
@ -173,8 +175,7 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
ep = edc->parts[j];
/* Register any color classes in this parts descriptions. */
hist = NULL;
hist = eina_list_append(hist, ep);
eina_array_push(&hist, ep);
ep2 = ep;
while (ep2->dragable.confine_id >= 0)
{
@ -186,17 +187,17 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
}
ep2 = edc->parts[ep2->dragable.confine_id];
if (eina_list_data_find(hist, ep2))
if (eina_array_find(&hist, ep2, NULL))
{
ERR("confine_to loops. invalidating loop.");
ep2->dragable.confine_id = -1;
break;
}
hist = eina_list_append(hist, ep2);
eina_array_push(&hist, ep2);
}
eina_list_free(hist);
hist = NULL;
hist = eina_list_append(hist, ep);
eina_array_clean(&hist);
eina_array_push(&hist, ep);
ep2 = ep;
while (ep2->dragable.event_id >= 0)
{
@ -218,17 +219,17 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
break;
}
if (eina_list_data_find(hist, ep2))
if (eina_array_find(&hist, ep2, NULL))
{
ERR("events_to loops. invalidating loop.");
ep2->dragable.event_id = -1;
break;
}
hist = eina_list_append(hist, ep2);
eina_array_push(&hist, ep2);
}
eina_list_free(hist);
hist = NULL;
hist = eina_list_append(hist, ep);
eina_array_clean(&hist);
eina_array_push(&hist, ep);
ep2 = ep;
while (ep2->clip_to_id >= 0)
{
@ -240,17 +241,17 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
}
ep2 = edc->parts[ep2->clip_to_id];
if (eina_list_data_find(hist, ep2))
if (eina_array_find(&hist, ep2, NULL))
{
ERR("clip_to loops. invalidating loop.");
ep2->clip_to_id = -1;
break;
}
hist = eina_list_append(hist, ep2);
eina_array_push(&hist, ep2);
}
eina_list_free(hist);
hist = NULL;
eina_array_clean(&hist);
}
eina_array_flush(&hist);
}
static Edje_Part_Collection *

View File

@ -53,7 +53,7 @@ _edje_smart_nested_smart_class_new(void)
}
void
_edje_extract_mo_files(Edje *ed)
_edje_extract_mo_files(Edje_File *edf)
{
Eina_Strbuf *mo_id_str;
const void *data;
@ -67,19 +67,19 @@ _edje_extract_mo_files(Edje *ed)
cache_path = efreet_cache_home_get();
t = eina_file_mtime_get(ed->file->f);
sz = eina_file_size_get(ed->file->f);
filename = eina_file_filename_get(ed->file->f);
t = eina_file_mtime_get(edf->f);
sz = eina_file_size_get(edf->f);
filename = eina_file_filename_get(edf->f);
crc = eina_crc(filename, strlen(filename), 0xffffffff, EINA_TRUE);
snprintf(ed->file->fid, sizeof(ed->file->fid), "%lld-%lld-%x",
snprintf(edf->fid, sizeof(edf->fid), "%lld-%lld-%x",
(long long int)t,
(long long int)sz,
crc);
mo_id_str = eina_strbuf_new();
for (i = 0; i < ed->file->mo_dir->mo_entries_count; i++)
for (i = 0; i < edf->mo_dir->mo_entries_count; i++)
{
Edje_Mo *mo_entry;
char out[PATH_MAX + PATH_MAX + 128];
@ -87,13 +87,13 @@ _edje_extract_mo_files(Edje *ed)
char *sub_str;
char *mo_src;
mo_entry = &ed->file->mo_dir->mo_entries[i];
mo_entry = &edf->mo_dir->mo_entries[i];
eina_strbuf_append_printf(mo_id_str,
"edje/mo/%i/%s/LC_MESSAGES",
mo_entry->id,
mo_entry->locale);
data = eet_read_direct(ed->file->ef,
data = eet_read_direct(edf->ef,
eina_strbuf_string_get(mo_id_str),
&len);
@ -110,10 +110,10 @@ _edje_extract_mo_files(Edje *ed)
sub_str[1] = 'm';
snprintf(out, sizeof(out), "%s/%s-%s",
outdir, ed->file->fid, mo_src);
outdir, edf->fid, mo_src);
if (ecore_file_exists(out))
{
if (ed->file->mtime > ecore_file_mod_time(out))
if (edf->mtime > ecore_file_mod_time(out))
ecore_file_remove(out);
}
if (!ecore_file_exists(out))
@ -847,7 +847,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
ed->has_entries = EINA_FALSE;
if (ed->file && ed->file->mo_dir)
_edje_extract_mo_files(ed);
_edje_extract_mo_files(ed->file);
if (ed->collection)
{

View File

@ -1,46 +1,42 @@
interface @beta Efl.Ui.Range_Display
{
[[Interface that contains properties regarding the displaying of a range.]]
[[Interface that contains properties regarding the displaying of a value within a range.
A value range contains a value restricted between specified minimum and maximum
limits at all times.
This can be used for progressbars, sliders or spinners, for example.
]]
c_prefix: efl_ui_range;
methods {
@property range_value {
[[Control the range value (in percentage) on a given range widget
[[Control the value (position) of the widget within its valid range.
Use this call to set range levels.
Note: If you pass a value out of the specified interval for
$val, it will be interpreted as the closest of the boundary
values in the interval.]]
Values outside the limits defined in @.range_limits are ignored and an error
is printed.
]]
set {
}
get {
}
values {
val: double; [[The range value (must be between $0.0 and 1.0)]]
val: double; [[The range value (must be within the bounds of @.range_limits).]]
}
}
@property range_limits {
[[Set the minimum and maximum values for given range widget.
If the current value is less than $min, it will be updated to $min.
If it is bigger then $max, will be updated to $max. The resulting value
can be obtained with @Efl.Ui.Range_Display.range_value.get.
The default minimum and maximum values may be different for each class.
Note: maximum must be greater than minimum, otherwise behavior
is undefined.
]]
set {
[[Set the minimum and maximum values for given range widget.
Define the allowed range of values to be selected by the user.
If actual value is less than $min, it will be updated to $min.
If it is bigger then $max, will be updated to $max. The actual value
can be obtained with @Efl.Ui.Range_Display.range_value.get
The minimum and maximum values may be different for each class.
Warning: maximum must be greater than minimum, otherwise behavior
is undefined.
]]
}
get {
[[Get the minimum and maximum values of the given range widget.
Note: If only one value is needed, the other pointer can be passed
as $null.
]]
}
values {
min: double; [[The minimum value.]]
@ -49,8 +45,8 @@ interface @beta Efl.Ui.Range_Display
}
}
events {
changed: void; [[Emitted when the $range_value is getting changed]]
min,reached: void; [[Emitted when the $range_value has reached the minimum of $range_limits]]
max,reached: void; [[Emitted when the $range_value has reached the maximum of $range_limits]]
changed: void; [[Emitted when the @.range_value is getting changed.]]
min,reached: void; [[Emitted when the @.range_value has reached the minimum of @.range_limits.]]
max,reached: void; [[Emitted when the $range_value has reached the maximum of @.range_limits.]]
}
}

View File

@ -258,6 +258,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
# include <efl_ui_slider.eo.h>
# include <efl_ui_item.eo.h>
# include <efl_ui_position_manager_entity.eo.h>
# include <efl_ui_position_manager_data_access_v1.eo.h>
# include <efl_ui_collection.eo.h>
# include <efl_ui_position_manager_list.eo.h>
# include <efl_ui_position_manager_grid.eo.h>

View File

@ -43,9 +43,9 @@ _efl_ui_bg_efl_object_constructor(Eo *obj, Efl_Ui_Bg_Data *pd)
efl_gfx_color_set(efl_added, 0, 0, 0, 0),
efl_content_set(efl_part(obj, "elm.swallow.rectangle"), efl_added));
pd->img = efl_add(EFL_UI_IMAGE_CLASS, obj,
efl_gfx_image_scale_type_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_EXPAND),
efl_content_set(efl_part(obj, "elm.swallow.background"), efl_added));
pd->img = elm_image_add(obj);
efl_gfx_image_scale_type_set(pd->img, EFL_GFX_IMAGE_SCALE_TYPE_EXPAND);
elm_layout_content_set(obj, "elm.swallow.background", pd->img);
}
else
{

View File

@ -266,38 +266,47 @@ _efl_ui_collection_efl_ui_multi_selectable_selected_items_get(Eo *obj EINA_UNUSE
}
static inline void
_fill_group_flag(Eo *item, Efl_Ui_Position_Manager_Batch_Group_State *flag)
_fill_depth(Eo *item, unsigned char *depth, Eina_Bool *leader)
{
if (efl_isa(item, EFL_UI_GROUP_ITEM_CLASS))
*flag = EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_GROUP;
{
*depth = 1;
*leader = EINA_TRUE;
}
else if (efl_ui_item_parent_get(item))
*flag = EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_PART_OF_GROUP;
{
*depth = 1;
*leader = EINA_FALSE;
}
else
*flag = EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_NO_GROUP;
{
*leader = EINA_FALSE;
*depth = 0;
}
}
static Efl_Ui_Position_Manager_Batch_Result
_size_accessor_get_at(void *data, int start_id, Eina_Rw_Slice memory)
static Efl_Ui_Position_Manager_Size_Batch_Result
_size_accessor_get_at(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_Rw_Slice memory)
{
Fast_Accessor *accessor = data;
size_t i;
const Eina_List *lst = _fast_accessor_get_at(accessor, start_id);
Efl_Ui_Position_Manager_Batch_Size_Access *sizes = memory.mem;
Efl_Ui_Position_Manager_Batch_Result result = {-1, 0};
const Eina_List *lst = _fast_accessor_get_at(accessor, conf.range.start_id);
Efl_Ui_Position_Manager_Size_Batch_Entity *sizes = memory.mem;
Efl_Ui_Position_Manager_Size_Batch_Result result = {0};
EINA_SAFETY_ON_NULL_RETURN_VAL(lst, result);
for (i = 0; i < memory.len; ++i)
for (i = 0; i < (conf.range.end_id - conf.range.start_id); ++i)
{
Efl_Gfx_Entity *geom = eina_list_data_get(lst), *parent;
Eina_Size2D size = efl_gfx_hint_size_min_get(geom);
parent = efl_ui_item_parent_get(geom);
sizes[i].size = size;
_fill_group_flag(geom, &sizes[i].group);
if (i == 0 && sizes[0].group != EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_GROUP && parent)
_fill_depth(geom, &sizes[i].element_depth, &sizes[i].depth_leader);
if (i == 0 && !sizes[0].depth_leader && parent)
{
result.group_id = efl_pack_index_get(efl_ui_item_container_get(parent), parent);
result.parent_size = efl_gfx_hint_size_min_get(parent);
}
lst = eina_list_next(lst);
if (!lst)
@ -311,25 +320,25 @@ _size_accessor_get_at(void *data, int start_id, Eina_Rw_Slice memory)
return result;
}
static Efl_Ui_Position_Manager_Batch_Result
_obj_accessor_get_at(void *data, int start_id, Eina_Rw_Slice memory)
static Efl_Ui_Position_Manager_Object_Batch_Result
_obj_accessor_get_at(void *data, Efl_Ui_Position_Manager_Request_Range range, Eina_Rw_Slice memory)
{
Fast_Accessor *accessor = data;
size_t i;
const Eina_List *lst = _fast_accessor_get_at(accessor, start_id);
Efl_Ui_Position_Manager_Batch_Entity_Access *objs = memory.mem;
Efl_Ui_Position_Manager_Batch_Result result = {-1, 0};
const Eina_List *lst = _fast_accessor_get_at(accessor, range.start_id);
Efl_Ui_Position_Manager_Object_Batch_Entity *objs = memory.mem;
Efl_Ui_Position_Manager_Object_Batch_Result result = {0};
for (i = 0; i < memory.len; ++i)
for (i = 0; i < range.end_id - range.start_id; ++i)
{
Efl_Gfx_Entity *geom = eina_list_data_get(lst), *parent;
parent = efl_ui_item_parent_get(geom);
objs[i].entity = geom;
_fill_group_flag(geom, &objs[i].group);
if (i == 0 && objs[0].group != EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_GROUP && parent)
_fill_depth(geom, &objs[i].element_depth, &objs[i].depth_leader);
if (i == 0 && !objs[0].depth_leader && parent)
{
result.group_id = efl_pack_index_get(efl_ui_item_container_get(parent), parent);
result.group = parent;
}
lst = eina_list_next(lst);
@ -344,6 +353,7 @@ _obj_accessor_get_at(void *data, int start_id, Eina_Rw_Slice memory)
return result;
}
EOLIAN static Efl_Object*
_efl_ui_collection_efl_object_constructor(Eo *obj, Efl_Ui_Collection_Data *pd EINA_UNUSED)
{
@ -864,7 +874,6 @@ _efl_ui_collection_position_manager_set(Eo *obj, Efl_Ui_Collection_Data *pd, Efl
if (pd->pos_man)
{
efl_event_callback_array_del(pd->pos_man, pos_manager_cbs(), obj);
efl_ui_position_manager_entity_data_access_set(pd->pos_man, NULL, NULL, NULL, NULL, NULL, NULL, 0);
efl_del(pd->pos_man);
}
pd->pos_man = layouter;
@ -872,11 +881,16 @@ _efl_ui_collection_position_manager_set(Eo *obj, Efl_Ui_Collection_Data *pd, Efl
{
efl_parent_set(pd->pos_man, obj);
efl_event_callback_array_add(pd->pos_man, pos_manager_cbs(), obj);
//efl_ui_position_manager_entity_data_access_set(pd->pos_man, &pd->obj_accessor.acc, &pd->size_accessor.acc, eina_list_count(pd->items));
efl_ui_position_manager_entity_data_access_set(pd->pos_man,
&pd->obj_accessor, _obj_accessor_get_at, NULL,
&pd->size_accessor, _size_accessor_get_at, NULL,
eina_list_count(pd->items));
switch(efl_ui_position_manager_entity_version(pd->pos_man, 1))
{
case 1:
efl_ui_position_manager_data_access_v1_data_access_set(pd->pos_man,
&pd->obj_accessor, _obj_accessor_get_at, NULL,
&pd->size_accessor, _size_accessor_get_at, NULL,
eina_list_count(pd->items));
break;
}
efl_ui_position_manager_entity_viewport_set(pd->pos_man, efl_ui_scrollable_viewport_geometry_get(obj));
efl_ui_layout_orientation_set(pd->pos_man, pd->dir);
}

View File

@ -40,7 +40,8 @@ _efl_ui_focus_parent_provider_gen_container_set(Eo *obj, Efl_Ui_Focus_Parent_Pro
ELM_WIDGET_DATA_GET(pd->container, wid_pd);
((Efl_Ui_Shared_Win_Data*)wid_pd->shared_win_data)->custom_parent_provider = EINA_TRUE;
if (wid_pd->shared_win_data)
((Efl_Ui_Shared_Win_Data*)wid_pd->shared_win_data)->custom_parent_provider = EINA_TRUE;
}
EOLIAN static Efl_Ui_Widget*

View File

@ -6,36 +6,90 @@
#include "efl_ui_position_manager_entity.eo.h"
typedef struct {
void *data;
Efl_Ui_Position_Manager_Batch_Access_Entity access; //this can also be the size accessor, but that does not matter here
Eina_Free_Cb free_cb;
} Api_Callback;
struct {
void *data;
Efl_Ui_Position_Manager_Size_Batch_Callback access; //this can also be the size accessor, but that does not matter here
Eina_Free_Cb free_cb;
} size;
struct {
void *data;
Efl_Ui_Position_Manager_Object_Batch_Callback access; //this can also be the size accessor, but that does not matter here
Eina_Free_Cb free_cb;
} object;
} Api_Callbacks;
typedef struct {
unsigned int start_id, end_id;
} Vis_Segment;
static inline int
_fill_buffer(Api_Callback *cb , int start_id, int len, int *group_id, void *data)
static Efl_Ui_Position_Manager_Size_Batch_Result
_batch_request_size(Api_Callbacks cb , int start_id, int len, Eina_Bool cache, void *data)
{
Efl_Ui_Position_Manager_Batch_Result res;
Efl_Ui_Position_Manager_Size_Batch_Result res;
Eina_Rw_Slice slice;
slice.mem = data;
slice.len = len;
res = cb->access(cb->data, start_id, slice);
Efl_Ui_Position_Manager_Size_Call_Config conf;
conf.cache_request = cache;
conf.range.start_id = start_id;
conf.range.end_id = start_id + len;
if (group_id)
*group_id = res.group_id;
res = cb.size.access(cb.size.data, conf, slice);
return res.filled_items;
return res;
}
#define BATCH_ACCESS_SIZE(cb, start_id, len, cache, data) \
do { \
size_result = _batch_request_size((cb), (start_id), (len), (cache), (data)); \
EINA_SAFETY_ON_FALSE_RETURN(size_result.filled_items > 0); \
} while(0);
#define BATCH_ACCESS_SIZE_VAL(cb, start_id, len, cache, data, V) \
do { \
size_result = _batch_request_size((cb), (start_id), (len), (cache), (data)); \
EINA_SAFETY_ON_FALSE_RETURN_VAL(size_result.filled_items > 0, V); \
} while(0);
static Efl_Ui_Position_Manager_Object_Batch_Result
_batch_request_objects(Api_Callbacks cb , int start_id, int len, void *data)
{
Efl_Ui_Position_Manager_Object_Batch_Result res;
Eina_Rw_Slice slice;
slice.mem = data;
slice.len = len;
Efl_Ui_Position_Manager_Request_Range range;
range.start_id = start_id;
range.end_id = start_id + len;
res = cb.object.access(cb.object.data, range, slice);
return res;
}
#define BATCH_ACCESS_OBJECT(cb, start_id, len, data) \
do { \
object_result = _batch_request_objects((cb), (start_id), (len), (data)); \
EINA_SAFETY_ON_FALSE_RETURN(object_result.filled_items > 0); \
} while(0);
#define BATCH_ACCESS_OBJECT_VAL(cb, start_id, len, data, v) \
do { \
object_result = _batch_request_objects((cb), (start_id), (len), (data)); \
EINA_SAFETY_ON_FALSE_RETURN_VAL(object_result.filled_items > 0, v); \
} while(0);
static inline void
vis_change_segment(Api_Callback *cb, int a, int b, Eina_Bool flag)
vis_change_segment(Api_Callbacks cb, int a, int b, Eina_Bool flag)
{
const int len = 50;
Efl_Ui_Position_Manager_Batch_Entity_Access data[len];
Efl_Ui_Position_Manager_Object_Batch_Entity data[len];
Efl_Ui_Position_Manager_Object_Batch_Result object_result;
if (a == b) return;
@ -46,7 +100,7 @@ vis_change_segment(Api_Callback *cb, int a, int b, Eina_Bool flag)
if (buffer_id == 0)
{
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(cb, MIN(a,b), len, NULL, data) >= 0);
BATCH_ACCESS_OBJECT(cb, i, len, data);
}
ent = data[buffer_id].entity;
if (ent && !flag && (efl_ui_focus_object_focus_get(ent) || efl_ui_focus_object_child_focus_get(ent)))
@ -60,10 +114,9 @@ vis_change_segment(Api_Callback *cb, int a, int b, Eina_Bool flag)
}
}
}
#endif
static inline void
vis_segment_swap(Api_Callback *cb, Vis_Segment new, Vis_Segment old)
vis_segment_swap(Api_Callbacks cb, Vis_Segment new, Vis_Segment old)
{
if (new.end_id <= old.start_id || new.start_id >= old.end_id)
{
@ -78,3 +131,5 @@ vis_segment_swap(Api_Callback *cb, Vis_Segment new, Vis_Segment old)
vis_change_segment(cb, old.end_id, new.end_id, (old.end_id < new.end_id));
}
}
#endif

View File

@ -0,0 +1,101 @@
struct @beta Efl.Ui.Position_Manager.Request_Range {
[[Representing the range of a request.]]
start_id : uint; [[The first item that must be filled into the passed slice.]]
end_id : uint; [[The last item that must be filled into the passed slice.]]
}
struct @beta Efl.Ui.Position_Manager.Object_Batch_Entity{
[[Struct that is getting filled by the object function callback.]]
entity : Efl.Gfx.Entity; [[The canvas object.]]
element_depth : ubyte; [[The depth change in this returned entity.
Every Element has a depth, if the parent is $null the depth is 0.
Every step deeper into the hirachy is exactly one depth deeper.
If this depth has been different to the previous item, then this element can be seen as the group leader. The following elements with the same depth are in the same group.]]
depth_leader : bool; [[$true if this is the leader of a group]]
}
struct @beta Efl.Ui.Position_Manager.Size_Batch_Entity{
[[Struct that is getting filled by the size function callback.]]
size : Eina.Size2D; [[The size of the element.]]
element_depth : ubyte; [[The depth change in this returned entity.
Every Element has a depth, if the parent is $null the depth is 0.
Every step deeper into the hirachy is exactly one depth deeper.
If this depth has been different to the previous item, then this element can be seen as the group leader. The following elements with the same depth are in the same group.]]
depth_leader : bool; [[$true if this is the leader of a group]]
}
struct @beta Efl.Ui.Position_Manager.Size_Batch_Result {
[[Struct returned by the size access callback.]]
parent_size : Eina.Size2D; [[The group size of the group where the first item is part of.]]
parent_depth : ubyte; [[The depth of the parent]]
filled_items : uint; [[The number of items that are filled into the slice.]]
}
struct @beta Efl.Ui.Position_Manager.Size_Call_Config {
[[Struct that is returned by the function callbacks.]]
range : Efl.Ui.Position_Manager.Request_Range; [[The range of items to fill into @.memory. The length of memory must be bigger or equal to the requested items]] // This struct does not contain a @.memory field.
cache_request : bool; [[Indicate if this request is made for caching or displaying. If its for caching, the data-provider will fill in approximations, instead of doing heavy lifting from some backend. If this is not a caching call, the exact size should be requested and delivered at some later point.]]
}
struct @beta Efl.Ui.Position_Manager.Object_Batch_Result {
[[Struct returned by the object access callback]]
group : Efl.Ui.Item; [[The group where the first item is part of]]
parent_depth : ubyte; [[The depth of the parent]]
filled_items : uint; [[The number of items that are filled into the slice]]
}
function @beta Efl.Ui.Position_Manager.Object_Batch_Callback {
[[ Function callback for getting a batch of items.]]
params {
range : Efl.Ui.Position_Manager.Request_Range; [[The range of items to fill into @.memory. The length of memory must be bigger or equal to the requested items]]
memory : rw_slice<Efl.Ui.Position_Manager.Object_Batch_Entity>; [[The slice to fill the information in, the full slice will be filled if there are enough items]]
}
return: Efl.Ui.Position_Manager.Object_Batch_Result; [[The returned stats of this function call.]]
};
function @beta Efl.Ui.Position_Manager.Size_Batch_Callback {
[[ Function callback for getting sizes of a batch of items.]]
params {
conf : Efl.Ui.Position_Manager.Size_Call_Config; [[The configution for this call]]
memory : rw_slice<Efl.Ui.Position_Manager.Size_Batch_Entity>; [[The slice to fill the information in, the full slice will be filled if there are enough items]]
}
return: Efl.Ui.Position_Manager.Size_Batch_Result; [[The returned stats of this function call]]
};
interface @beta Efl.Ui.Position_Manager.Data_Access_V1 {
[[Interface for abstracting the data access of the position managers.
The idea here is that a data-provider, calls @.data_access on the positon manager object and passes the functions that are defined here. At any pointer later in time, the position manager can call these function callbacks to get sizes or objects.
A data-provider should always fill all requested items. If a item is not available $null is inserted. If a size is not available, a as-close-as-possible approximation should be inserted.
The Size callback is equipped with a parameter for if this is a caching request or not. This flag can be used to differentiate between two usecases. The size can be requested for building up a cache over all items. The size can also be requested for applying it to the object. The data-provider might needs to do heavy loading for getting the right size available, in case of a cache build up the as-close-as-possible aproximation is enough there. If it is real placement, the size should be correct.
If a size changes after it was returned due to batching, this change still should be annonced with the @Efl.Ui.Position_Manager.Entity.item_size_changed function.
The depth of the items is used to express a hierachical structure on the items themselves.
Any given depth might or might not have a $depth_leader.
A group is ended when there is either a lower depth, or another depth_leader.
]]
methods {
@property data_access {
[[This gives access to items to be managed. The manager reads this information and modifies the retrieved items' positions and sizes.
$obj_access gives access to the graphical entitites to manage. Some of them might be NULL, meaning they are not yet ready to be displayed. Their size in the $size_access array will be correct, though, so other entities can still be positioned correctly.
Typically, only entities inside the viewport will be retrieved.
$size_access gives access to the 2D sizes for the items to manage. All sizes will always be valid, and might change over time (indicated through the @Efl.Ui.Position_Manager.Entity.item_size_changed method).
The whole range might need to be traversed in order to calculate the position of all items in some arrangements.
You can access a batch of objects or sizes by calling the here passed function callbacks. Further details can be found at the function definitions.
]]
set {
}
values {
obj_access : Efl.Ui.Position_Manager.Object_Batch_Callback; [[Function callback for canvas objects, even if the start_id is valid, the returned objects may be NULL.]]
size_access : Efl.Ui.Position_Manager.Size_Batch_Callback; [[Function callback for the size, returned values are always valid, but might be changed later on.]]
size : int; [[valid size for start_id, 0 <= i < size]]
}
}
}
}

View File

@ -12,3 +12,4 @@
#define MY_CLASS EFL_UI_POSITION_MANAGER_ENTITY_CLASS
#include "efl_ui_position_manager_entity.eo.c"
#include "efl_ui_position_manager_data_access_v1.eo.c"

View File

@ -1,49 +1,5 @@
import efl_ui;
enum Efl.Ui.Position_Manager.Batch_Group_State{
[[Enum expressing the group related state of a item.]]
no_group = 0, [[This item is not a group item and is not part of any group.]]
group = 1, [[This item is a group item.]]
part_of_group = 2 [[This item is part of a group.]]
}
struct Efl.Ui.Position_Manager.Batch_Entity_Access{
[[Struct that is getting filled by the object function callback.]]
entity : Efl.Gfx.Entity; [[The canvas object.]]
group : Efl.Ui.Position_Manager.Batch_Group_State; [[If this is a group item.]]
}
struct Efl.Ui.Position_Manager.Batch_Size_Access{
[[Struct that is getting filled by the size function callback.]]
size : Eina.Size2D; [[The size of the element.]]
group : Efl.Ui.Position_Manager.Batch_Group_State; [[If this is a group item.]]
}
struct Efl.Ui.Position_Manager.Batch_Result {
[[Struct that is returned by the function callbacks.]]
group_id : int; [[The group of the first item. If the first item is a group, or the first item does not have a group, -1 will be the id]]
filled_items : int; [[The number of items that are filled into the slice]]
}
function Efl.Ui.Position_Manager.Batch_Access_Entity {
[[ Function callback for getting a batch of items.]]
params {
start_id : int; [[The id of the first item to fetch]]
memory : rw_slice<Efl.Ui.Position_Manager.Batch_Entity_Access>; [[The slice to fill the information in, the full slice will be filled if there are enough items]]
}
return: Efl.Ui.Position_Manager.Batch_Result; [[The returned stats of this function call.]]
};
function Efl.Ui.Position_Manager.Batch_Access_Size {
[[ Function callback for getting sizes of a batch of items]]
params {
start_id : int; [[The id of the first item to fetch]]
memory : rw_slice<Efl.Ui.Position_Manager.Batch_Size_Access>; [[The slice to fill the information in, the full slice will be filled if there are enough items]]
}
return: Efl.Ui.Position_Manager.Batch_Result; [[The returned stats of this function call]]
};
struct Efl.Ui.Position_Manager.Range_Update {
[[A struct containing the the updated range of visible items in this position manger.]]
start_id : uint; [[The first item that is visible]]
@ -58,25 +14,14 @@ interface @beta Efl.Ui.Position_Manager.Entity extends Efl.Ui.Layout_Orientable
The interface gets a defined set of elements that is meant to be displayed. The implementation provides a way to calculate the size that is required to display all items. Every time this absolut size of items is changed, content_size,changed is called.
]]
methods {
@property data_access {
[[This gives access to items to be managed. The manager reads this information and modifies the retrieved items' positions and sizes.
$obj_access gives access to the graphical entitites to manage. Some of them might be NULL, meaning they are not yet ready to be displayed. Their size in the $size_access array will be correct, though, so other entities can still be positioned correctly.
Typically, only entities inside the viewport will be retrieved.
$size_access gives access to the 2D sizes for the items to manage. All sizes will always be valid, and might change over time (indicated through the @.item_size_changed method).
The whole range might need to be traversed in order to calculate the position of all items in some arrangements.
You can access a batch of objects or sizes by calling the here passed function callbacks. Further details can be found at the function definitions.
]]
set {
}
values {
obj_access : Efl.Ui.Position_Manager.Batch_Access_Entity; [[Function callback for canvas objects, even if the start_id is valid, the returned objects may be NULL]]
size_access : Efl.Ui.Position_Manager.Batch_Access_Size; [[Function callback for the size, returned values are always valid, but might be changed / updated]]
size : int; [[valid size for start_id, 0 <= i < size]]
}
version {
[[ Return the version of Data_Access that is used.
This object needs to implement the interface Efl.Ui.Position_Manager.Data_Access_V1 if 1 is returned. 2 if V2 (not available yet) is implemented.
]]
params {
max : int; [[The maximum version that is available from the data-provider.]]
}
return : int; [[The version that should be used here. 0 is an error.]]
}
@property viewport {
[[This is the position and size of the viewport, where elements are displayed in.
@ -118,7 +63,7 @@ interface @beta Efl.Ui.Position_Manager.Entity extends Efl.Ui.Layout_Orientable
item_added {
[[The new item $subobj has been added at the $added_index field.
The accessor provided through @.data_access will contain updated Entities.]]
The accessor provided through @Efl.Ui.Position_Manager.Data_Access_V1.data_access will contain updated Entities.]]
params {
added_index : int;
subobj : Efl.Gfx.Entity;
@ -126,7 +71,7 @@ interface @beta Efl.Ui.Position_Manager.Entity extends Efl.Ui.Layout_Orientable
}
item_removed {
[[The item $subobj previously at position $removed_index has been removed.
The accessor provided through @.data_access will contain updated Entities.
The accessor provided through @Efl.Ui.Position_Manager.Data_Access_V1.data_access will contain updated Entities.
]]
params {
removed_index : int;

View File

@ -13,7 +13,6 @@
Efl_Ui_Position_Manager_Grid_Data *pd = efl_data_scope_get(obj, MY_CLASS);
typedef struct {
Api_Callback min_size, object;
unsigned int size;
unsigned int groups;
Eina_Rect viewport;
@ -30,6 +29,7 @@ typedef struct {
Eina_Bool size_cache_dirty;
Eo *last_group;
Eina_Future *rebuild_absolut_size;
Api_Callbacks callbacks;
} Efl_Ui_Position_Manager_Grid_Data;
typedef struct {
@ -43,7 +43,8 @@ _group_cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd)
{
unsigned int i;
const int len = 100;
Efl_Ui_Position_Manager_Batch_Size_Access size_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
Group_Cache_Line line = { 0 };
if (!pd->group_cache_dirty)
@ -60,22 +61,22 @@ _group_cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd)
if (buffer_id == 0)
{
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->min_size, i, len, NULL, size_buffer) > 0);
BATCH_ACCESS_SIZE(pd->callbacks, i, MIN(len, pd->size - i), EINA_TRUE, size_buffer);
}
if (size_buffer[buffer_id].group == EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_GROUP)
if (size_buffer[buffer_id].depth_leader)
{
eina_inarray_push(pd->group_cache, &line);
line.real_group = EINA_TRUE;
line.group_header_size = size_buffer[buffer_id].size;
line.items = 1;
}
else if (size_buffer[buffer_id].group == EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_PART_OF_GROUP ||
(!line.real_group && size_buffer[buffer_id].group == EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_NO_GROUP))
else if (size_buffer[buffer_id].element_depth > 0 ||
(!line.real_group && size_buffer[buffer_id].element_depth == 0))
{
line.items ++;
}
else if (size_buffer[buffer_id].group == EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_NO_GROUP && line.real_group)
else if (size_buffer[buffer_id].element_depth == 0 && line.real_group)
{
eina_inarray_push(pd->group_cache, &line);
line.real_group = EINA_FALSE;
@ -240,7 +241,10 @@ _position_items_vertical(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data
unsigned int i;
const int len = 100;
int columns, last_block_start = ctx->new.start_id;
Efl_Ui_Position_Manager_Batch_Entity_Access obj_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
Efl_Ui_Position_Manager_Object_Batch_Entity obj_buffer[len];
Efl_Ui_Position_Manager_Object_Batch_Result object_result;
if (!pd->viewport.w || !pd->viewport.h) return;
@ -252,17 +256,13 @@ _position_items_vertical(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data
int buffer_id = (i-ctx->new.start_id) % len;
if (buffer_id == 0)
{
int tmp_group;
BATCH_ACCESS_SIZE(pd->callbacks, i, len, EINA_FALSE, size_buffer);
BATCH_ACCESS_OBJECT(pd->callbacks, i, len, obj_buffer);
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->object, i, len, &tmp_group, obj_buffer) > 0);
if (tmp_group != -1 && i == ctx->new.start_id)
if (i == ctx->new.start_id)
{
Efl_Ui_Position_Manager_Batch_Size_Access size_buffer[1];
Efl_Ui_Position_Manager_Batch_Entity_Access obj_buffer[1];
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->min_size, tmp_group, 1, NULL, size_buffer) != 0);
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->object, tmp_group, 1, NULL, obj_buffer) != 0);
ctx->floating_group = obj_buffer[0].entity;
ctx->floating_size.h = size_buffer[0].size.h;
ctx->floating_group = object_result.group;
ctx->floating_size = size_result.parent_size;
ctx->floating_size.w = pd->viewport.w;
}
}
@ -274,19 +274,16 @@ _position_items_vertical(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data
if (obj_buffer[buffer_id].entity == pd->last_group)
pd->last_group = NULL;
if (obj_buffer[buffer_id].group == EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_GROUP)
if (obj_buffer[buffer_id].depth_leader)
{
Efl_Ui_Position_Manager_Batch_Size_Access size_buffer[1];
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->min_size, i, 1, NULL, size_buffer) == 1);
if (x != 0)
y += 1;
last_block_start = i + 1;
start.y += size_buffer[0].size.h + y*pd->max_min_size.h;
start.y += size_buffer[buffer_id].size.h + y*pd->max_min_size.h;
geom.size = pd->viewport.size;
geom.h = size_buffer[0].size.h;
geom.h = size_buffer[buffer_id].size.h;
geom.y += y*pd->max_min_size.h;
if (!ctx->placed_item)
ctx->placed_item = obj_buffer[buffer_id].entity;
@ -307,7 +304,10 @@ _position_items_horizontal(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Dat
unsigned int i;
const int len = 100;
int columns, last_block_start = ctx->new.start_id;
Efl_Ui_Position_Manager_Batch_Entity_Access obj_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
Efl_Ui_Position_Manager_Object_Batch_Entity obj_buffer[len];
Efl_Ui_Position_Manager_Object_Batch_Result object_result;
if (!pd->viewport.w || !pd->viewport.h) return;
@ -319,20 +319,16 @@ _position_items_horizontal(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Dat
int buffer_id = (i-ctx->new.start_id) % len;
if (buffer_id == 0)
{
int tmp_group;
BATCH_ACCESS_SIZE(pd->callbacks, i, len, EINA_FALSE, size_buffer);
BATCH_ACCESS_OBJECT(pd->callbacks, i, len, obj_buffer);
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->object, i, len, &tmp_group, obj_buffer) > 0);
if (tmp_group != -1 && i == ctx->new.start_id && pd->dir != EFL_UI_LAYOUT_ORIENTATION_VERTICAL)
if (i == ctx->new.start_id)
{
Efl_Ui_Position_Manager_Batch_Size_Access size_buffer[1];
Efl_Ui_Position_Manager_Batch_Entity_Access obj_buffer[1];
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->min_size, tmp_group, 1, NULL, size_buffer) != 0);
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->object, tmp_group, 1, NULL, obj_buffer) != 0);
start.y += size_buffer[0].size.h;
columns = (pd->viewport.h - size_buffer[0].size.h)/pd->max_min_size.h;
ctx->floating_group = obj_buffer[0].entity;
ctx->floating_size.h = size_buffer[0].size.h;
ctx->floating_group = object_result.group;
ctx->floating_size = size_result.parent_size;
ctx->floating_size.w = pd->viewport.w;
start.y += size_result.parent_size.h;
columns = (pd->viewport.h - size_result.parent_size.h)/pd->max_min_size.h;
}
}
Eina_Rect geom;
@ -344,21 +340,18 @@ _position_items_horizontal(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Dat
if (obj_buffer[buffer_id].entity == pd->last_group)
pd->last_group = NULL;
if (obj_buffer[buffer_id].group == EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_GROUP)
if (obj_buffer[buffer_id].depth_leader)
{
Efl_Ui_Position_Manager_Batch_Size_Access size_buffer[1];
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->min_size, i, 1, NULL, size_buffer) == 1);
last_block_start = i + 1;
start.y = pd->viewport.y + size_buffer[0].size.h;
start.y = pd->viewport.y + size_buffer[buffer_id].size.h;
start.x += x*pd->max_min_size.w;
geom.size.h = size_buffer[0].size.h;
geom.size.h = size_buffer[buffer_id].size.h;
geom.size.w = pd->viewport.w;
geom.x += x*pd->max_min_size.w;
geom.y = pd->viewport.y;
columns = (pd->viewport.h - size_buffer[0].size.h)/pd->max_min_size.h;
columns = (pd->viewport.h - size_buffer[buffer_id].size.h)/pd->max_min_size.h;
if (!ctx->placed_item)
ctx->placed_item = obj_buffer[buffer_id].entity;
}
@ -456,7 +449,7 @@ _reposition_content(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd)
//to performance optimize the whole widget, we are setting the objects that are outside the viewport to visibility false
//The code below ensures that things outside the viewport are always hidden, and things inside the viewport are visible
vis_segment_swap(&pd->object, cur, pd->prev_run);
vis_segment_swap(pd->callbacks, cur, pd->prev_run);
ctx.new = cur;
ctx.consumed_space = consumed_space;
@ -539,18 +532,6 @@ _flush_min_size(Eo *obj, Efl_Ui_Position_Manager_Grid_Data *pd)
}
}
EOLIAN static void
_efl_ui_position_manager_grid_efl_ui_position_manager_entity_data_access_set(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd, void *obj_access_data, Efl_Ui_Position_Manager_Batch_Access_Entity obj_access, Eina_Free_Cb obj_access_free_cb, void *size_access_data, Efl_Ui_Position_Manager_Batch_Access_Size size_access, Eina_Free_Cb size_access_free_cb, int size)
{
pd->object.data = obj_access_data;
pd->object.access = obj_access;
pd->object.free_cb = obj_access_free_cb;
pd->min_size.data = size_access_data;
pd->min_size.access = size_access;
pd->min_size.free_cb = size_access_free_cb;
pd->size = size;
}
EOLIAN static void
_efl_ui_position_manager_grid_efl_ui_position_manager_entity_viewport_set(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd, Eina_Rect viewport)
{
@ -594,13 +575,14 @@ _schedule_recalc_abs_size(Eo *obj, Efl_Ui_Position_Manager_Grid_Data *pd)
EOLIAN static void
_efl_ui_position_manager_grid_efl_ui_position_manager_entity_item_added(Eo *obj, Efl_Ui_Position_Manager_Grid_Data *pd, int added_index, Efl_Gfx_Entity *subobj EINA_UNUSED)
{
Efl_Ui_Position_Manager_Batch_Size_Access size[1];
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[1];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
pd->size ++;
efl_gfx_entity_visible_set(subobj, EINA_FALSE);
_group_cache_invalidate(obj, pd);
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->min_size, added_index, 1, NULL, &size) == 1);
_update_min_size(obj, pd, added_index, size[0].size);
BATCH_ACCESS_SIZE(pd->callbacks, added_index, 1, EINA_TRUE, size_buffer);
_update_min_size(obj, pd, added_index, size_buffer[0].size);
_flush_min_size(obj, pd);
_schedule_recalc_abs_size(obj, pd);
}
@ -622,16 +604,17 @@ EOLIAN static void
_efl_ui_position_manager_grid_efl_ui_position_manager_entity_item_size_changed(Eo *obj, Efl_Ui_Position_Manager_Grid_Data *pd, int start_id, int end_id)
{
const int len = 50;
Efl_Ui_Position_Manager_Batch_Size_Access data[len];
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
for (int i = start_id; i <= end_id; ++i)
{
int buffer_id = (i-start_id) % len;
if (buffer_id == 0)
{
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->min_size, start_id, len, NULL, data) >= 0);
BATCH_ACCESS_SIZE(pd->callbacks, i, len, EINA_TRUE, size_buffer);
}
_update_min_size(obj, pd, i, data[i-start_id].size);
_update_min_size(obj, pd, i, size_buffer[buffer_id].size);
}
_size_cache_invalidate(obj, pd);
_flush_min_size(obj, pd);
@ -662,11 +645,12 @@ _efl_ui_position_manager_grid_efl_ui_position_manager_entity_position_single_ite
unsigned int relevant_space_size;
unsigned int group_consumed_size = 0;
unsigned int group_consumed_ids = 0;
Efl_Ui_Position_Manager_Batch_Size_Access size_buffer[1];
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[1];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
if (!pd->size) return EINA_RECT(0, 0, 0, 0);
if (pd->max_min_size.w <= 0 || pd->max_min_size.h <= 0) return EINA_RECT(0, 0, 0, 0);
EINA_SAFETY_ON_FALSE_RETURN_VAL(_fill_buffer(&pd->min_size, idx, 1, NULL, size_buffer) == 1, EINA_RECT_EMPTY());
BATCH_ACCESS_SIZE_VAL(pd->callbacks, idx, 1, EINA_TRUE, size_buffer, EINA_RECT_EMPTY());
_size_cache_require(obj, pd);
_flush_abs_size(obj, pd);
@ -761,4 +745,23 @@ _efl_ui_position_manager_grid_efl_ui_position_manager_entity_relative_item(Eo *o
return new_id;
}
EOLIAN static int
_efl_ui_position_manager_grid_efl_ui_position_manager_entity_version(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd EINA_UNUSED, int max EINA_UNUSED)
{
return 1;
}
EOLIAN static void
_efl_ui_position_manager_grid_efl_ui_position_manager_data_access_v1_data_access_set(Eo *obj, Efl_Ui_Position_Manager_Grid_Data *pd, void *obj_access_data, Efl_Ui_Position_Manager_Object_Batch_Callback obj_access, Eina_Free_Cb obj_access_free_cb, void *size_access_data, Efl_Ui_Position_Manager_Size_Batch_Callback size_access, Eina_Free_Cb size_access_free_cb, int size)
{
_group_cache_invalidate(obj, pd);
pd->callbacks.object.data = obj_access_data;
pd->callbacks.object.access = obj_access;
pd->callbacks.object.free_cb = obj_access_free_cb;
pd->callbacks.size.data = size_access_data;
pd->callbacks.size.access = size_access;
pd->callbacks.size.free_cb = size_access_free_cb;
pd->size = size;
}
#include "efl_ui_position_manager_grid.eo.c"

View File

@ -1,11 +1,11 @@
class @beta Efl.Ui.Position_Manager.Grid extends Efl.Object implements Efl.Ui.Position_Manager.Entity
class @beta Efl.Ui.Position_Manager.Grid extends Efl.Object implements Efl.Ui.Position_Manager.Entity, Efl.Ui.Position_Manager.Data_Access_V1
{
[[Implementation of @Efl.Ui.Position_Manager.Entity for two-dimensional grids.
Every item in the grid has the same size, which is the biggest minimum size of all items.
]]
implements {
Efl.Ui.Position_Manager.Entity.data_access {set;}
Efl.Ui.Position_Manager.Entity.version;
Efl.Ui.Position_Manager.Entity.viewport {set;}
Efl.Ui.Position_Manager.Entity.scroll_position {set;}
Efl.Ui.Position_Manager.Entity.item_added;
@ -14,5 +14,6 @@ class @beta Efl.Ui.Position_Manager.Grid extends Efl.Object implements Efl.Ui.Po
Efl.Ui.Position_Manager.Entity.item_size_changed;
Efl.Ui.Position_Manager.Entity.relative_item;
Efl.Ui.Layout_Orientable.orientation {set; get;}
Efl.Ui.Position_Manager.Data_Access_V1.data_access {set;}
}
}

View File

@ -14,7 +14,6 @@
Efl_Ui_Position_Manager_List_Data *pd = efl_data_scope_get(obj, MY_CLASS);
typedef struct {
Api_Callback min_size, object;
unsigned int size;
Eina_Future *rebuild_absolut_size;
Eina_Rect viewport;
@ -26,6 +25,7 @@ typedef struct {
int maximum_min_size;
Vis_Segment prev_run;
Efl_Gfx_Entity *last_group;
Api_Callbacks callbacks;
} Efl_Ui_Position_Manager_List_Data;
/*
@ -41,8 +41,8 @@ cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
{
unsigned int i;
const int len = 100;
Efl_Ui_Position_Manager_Batch_Size_Access size_buffer[100];
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
if (pd->size_cache) return;
@ -66,7 +66,7 @@ cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
if (buffer_id == 0)
{
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->min_size, i, len, NULL, size_buffer) > 0);
BATCH_ACCESS_SIZE(pd->callbacks, i, MIN(len, pd->size - i), EINA_TRUE, size_buffer);
}
size = size_buffer[buffer_id].size;
@ -166,13 +166,14 @@ err:
static inline void
_position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_Segment new, int relevant_space_size)
{
int group_id = -1;
Efl_Gfx_Entity *first_group = NULL, *first_fully_visual_group = NULL;
Eina_Size2D first_group_size;
Eina_Rect geom;
const int len = 100;
Efl_Ui_Position_Manager_Batch_Size_Access size_buffer[len];
Efl_Ui_Position_Manager_Batch_Entity_Access obj_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
Efl_Ui_Position_Manager_Object_Batch_Entity obj_buffer[len];
Efl_Ui_Position_Manager_Object_Batch_Result object_result;
unsigned int i;
//placement of the plain items
@ -191,20 +192,18 @@ _position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_
if (buffer_id == 0)
{
int tmp_group;
int res1, res2;
res1 = _fill_buffer(&pd->object, i, len, &tmp_group, obj_buffer);
res2 = _fill_buffer(&pd->min_size, i, len, NULL, size_buffer);
EINA_SAFETY_ON_FALSE_RETURN(res1 == res2);
EINA_SAFETY_ON_FALSE_RETURN(res2 > 0);
BATCH_ACCESS_SIZE(pd->callbacks, i, len, EINA_FALSE, size_buffer);
BATCH_ACCESS_OBJECT(pd->callbacks, i, len, obj_buffer);
if (i == new.start_id)
{
if (tmp_group > 0)
group_id = tmp_group;
else if (obj_buffer[0].group == EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_GROUP)
group_id = i;
first_group = object_result.group;
first_group_size = size_result.parent_size;
if (obj_buffer[0].depth_leader)
{
first_group = obj_buffer[0].entity;
first_group_size = size_buffer[0].size;
}
}
}
@ -221,7 +220,7 @@ _position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_
else
geom.w = size.w;
if (!first_fully_visual_group && obj_buffer[buffer_id].group == EFL_UI_POSITION_MANAGER_BATCH_GROUP_STATE_GROUP &&
if (!first_fully_visual_group && obj_buffer[buffer_id].depth_leader &&
eina_spans_intersect(geom.x, geom.w, pd->viewport.x, pd->viewport.w) &&
eina_spans_intersect(geom.y, geom.h, pd->viewport.y, pd->viewport.h))
{
@ -236,14 +235,6 @@ _position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_
geom.x += size.w;
}
//Now place group items
if (group_id > 0)
{
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->object, group_id, 1, NULL, obj_buffer) == 1);
EINA_SAFETY_ON_FALSE_RETURN(_fill_buffer(&pd->min_size, group_id, 1, NULL, size_buffer) == 1);
first_group = obj_buffer[0].entity;
first_group_size = size_buffer[0].size;
}
if (pd->dir == EFL_UI_LAYOUT_ORIENTATION_VERTICAL)
first_group_size.w = pd->viewport.w;
else
@ -305,7 +296,7 @@ position_content(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
cur = _search_visual_segment(obj, pd, relevant_space_size, relevant_viewport);
//to performance optimize the whole widget, we are setting the objects that are outside the viewport to visibility false
//The code below ensures that things outside the viewport are always hidden, and things inside the viewport are visible
vis_segment_swap(&pd->object, cur, pd->prev_run);
vis_segment_swap(pd->callbacks, cur, pd->prev_run);
_position_items(obj, pd, cur, relevant_space_size);
@ -342,19 +333,6 @@ schedule_recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd)
eina_future_then(pd->rebuild_absolut_size, _rebuild_job_cb, obj);
}
EOLIAN static void
_efl_ui_position_manager_list_efl_ui_position_manager_entity_data_access_set(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd, void *obj_access_data, Efl_Ui_Position_Manager_Batch_Access_Entity obj_access, Eina_Free_Cb obj_access_free_cb, void *size_access_data, Efl_Ui_Position_Manager_Batch_Access_Size size_access, Eina_Free_Cb size_access_free_cb, int size)
{
cache_invalidate(obj, pd);
pd->object.data = obj_access_data;
pd->object.access = obj_access;
pd->object.free_cb = obj_access_free_cb;
pd->min_size.data = size_access_data;
pd->min_size.access = size_access;
pd->min_size.free_cb = size_access_free_cb;
pd->size = size;
}
EOLIAN static void
_efl_ui_position_manager_list_efl_ui_position_manager_entity_viewport_set(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd, Eina_Rect size)
{
@ -408,7 +386,8 @@ _efl_ui_position_manager_list_efl_ui_position_manager_entity_position_single_ite
Eina_Size2D space_size;
int relevant_space_size;
Eina_Size2D size;
Efl_Ui_Position_Manager_Batch_Size_Access size_buffer[1];
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[1];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
if (!pd->size) return EINA_RECT(0,0,0,0);
@ -428,7 +407,7 @@ _efl_ui_position_manager_list_efl_ui_position_manager_entity_position_single_ite
geom = pd->viewport;
EINA_SAFETY_ON_FALSE_RETURN_VAL(_fill_buffer(&pd->min_size, idx, 1, NULL, size_buffer) == 1, EINA_RECT_EMPTY());
BATCH_ACCESS_SIZE_VAL(pd->callbacks, idx, 1, EINA_FALSE, size_buffer, EINA_RECT_EMPTY());
size = size_buffer[0].size;
@ -457,7 +436,7 @@ _efl_ui_position_manager_list_efl_ui_layout_orientable_orientation_set(Eo *obj E
{
pd->dir = dir;
//in order to reset the state of the visible items, just hide everything and set the old segment accordingly
vis_change_segment(&pd->object, pd->prev_run.start_id, pd->prev_run.end_id, EINA_FALSE);
vis_change_segment(pd->callbacks, pd->prev_run.start_id, pd->prev_run.end_id, EINA_FALSE);
pd->prev_run.start_id = 0;
pd->prev_run.end_id = 0;
@ -509,5 +488,24 @@ _efl_ui_position_manager_list_efl_ui_position_manager_entity_relative_item(Eo *o
return new_id;
}
EOLIAN static int
_efl_ui_position_manager_list_efl_ui_position_manager_entity_version(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd EINA_UNUSED, int max EINA_UNUSED)
{
return 1;
}
EOLIAN static void
_efl_ui_position_manager_list_efl_ui_position_manager_data_access_v1_data_access_set(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd, void *obj_access_data, Efl_Ui_Position_Manager_Object_Batch_Callback obj_access, Eina_Free_Cb obj_access_free_cb, void *size_access_data, Efl_Ui_Position_Manager_Size_Batch_Callback size_access, Eina_Free_Cb size_access_free_cb, int size)
{
cache_invalidate(obj, pd);
pd->callbacks.object.data = obj_access_data;
pd->callbacks.object.access = obj_access;
pd->callbacks.object.free_cb = obj_access_free_cb;
pd->callbacks.size.data = size_access_data;
pd->callbacks.size.access = size_access;
pd->callbacks.size.free_cb = size_access_free_cb;
pd->size = size;
}
#include "efl_ui_position_manager_list.eo.c"

View File

@ -1,4 +1,4 @@
class @beta Efl.Ui.Position_Manager.List extends Efl.Object implements Efl.Ui.Position_Manager.Entity
class @beta Efl.Ui.Position_Manager.List extends Efl.Object implements Efl.Ui.Position_Manager.Entity, Efl.Ui.Position_Manager.Data_Access_V1
{
[[Implementation of @Efl.Ui.Position_Manager.Entity for a list
@ -6,7 +6,7 @@ class @beta Efl.Ui.Position_Manager.List extends Efl.Object implements Efl.Ui.Po
]]
implements {
Efl.Object.destructor;
Efl.Ui.Position_Manager.Entity.data_access {set;}
Efl.Ui.Position_Manager.Entity.version;
Efl.Ui.Position_Manager.Entity.viewport {set;}
Efl.Ui.Position_Manager.Entity.scroll_position {set;}
Efl.Ui.Position_Manager.Entity.item_added;
@ -15,5 +15,6 @@ class @beta Efl.Ui.Position_Manager.List extends Efl.Object implements Efl.Ui.Po
Efl.Ui.Position_Manager.Entity.item_size_changed;
Efl.Ui.Position_Manager.Entity.relative_item;
Efl.Ui.Layout_Orientable.orientation {set; get;}
Efl.Ui.Position_Manager.Data_Access_V1.data_access {set;}
}
}

View File

@ -52,19 +52,39 @@ static void
_emit_events(Eo *obj, Efl_Ui_Slider_Data *sd)
{
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL);
if (sd->val == sd->val_min)
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MIN_REACHED, NULL);
if (sd->val == sd->val_max)
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MAX_REACHED, NULL);
// emit accessibility event also if value was changed by API
if (_elm_config->atspi_mode)
efl_access_value_changed_signal_emit(obj);
}
static void
_efl_ui_slider_val_fetch(Evas_Object *obj, Efl_Ui_Slider_Data *sd, Eina_Bool user_event)
_user_value_update(Evas_Object *obj, double value)
{
double posx = 0.0, posy = 0.0, pos = 0.0, val;
EFL_UI_SLIDER_DATA_GET(obj, sd);
efl_ui_range_value_set(obj, value);
ecore_timer_del(sd->delay);
sd->delay = ecore_timer_add(SLIDER_DELAY_CHANGED_INTERVAL, _delay_change, obj);
evas_object_smart_changed(obj);
}
static void
_drag_value_fetch(Evas_Object *obj)
{
EFL_UI_SLIDER_DATA_GET(obj, sd);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
double posx = 0.0, posy = 0.0, pos = 0.0, val;
efl_ui_drag_value_get(efl_part(wd->resize_obj, "efl.dragable.slider"),
&posx, &posy);
if (_is_horizontal(sd->dir)) pos = posx;
@ -79,36 +99,19 @@ _efl_ui_slider_val_fetch(Evas_Object *obj, Efl_Ui_Slider_Data *sd, Eina_Bool us
if (fabs(val - sd->val) > DBL_EPSILON)
{
sd->val = val;
if (user_event)
{
_emit_events(obj, sd);
efl_event_callback_legacy_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL);
ecore_timer_del(sd->delay);
sd->delay = ecore_timer_add(SLIDER_DELAY_CHANGED_INTERVAL, _delay_change, obj);
}
_user_value_update(obj, val);
}
}
static void
_efl_ui_slider_val_set(Evas_Object *obj, Efl_Ui_Slider_Data *sd)
_drag_value_update(Evas_Object *obj)
{
EFL_UI_SLIDER_DATA_GET(obj, sd);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
double pos;
if (sd->val_max > sd->val_min)
{
pos = (sd->val - sd->val_min) / (sd->val_max - sd->val_min);
}
else
{
pos = 0.0;
}
if (pos < 0.0) pos = 0.0;
else if (pos > 1.0)
pos = 1.0;
pos = (sd->val - sd->val_min) / (sd->val_max - sd->val_min);
if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir))
{
@ -118,35 +121,6 @@ _efl_ui_slider_val_set(Evas_Object *obj, Efl_Ui_Slider_Data *sd)
efl_ui_drag_value_set(efl_part(wd->resize_obj, "efl.dragable.slider"),
pos, pos);
// emit accessibility event also if value was changed by API
if (_elm_config->atspi_mode)
efl_access_value_changed_signal_emit(obj);
evas_object_smart_changed(obj);
}
static void
_efl_ui_slider_down_knob(Evas_Object *obj, Efl_Ui_Slider_Data *sd EINA_UNUSED, double button_x, double button_y)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
efl_ui_drag_value_set(efl_part(wd->resize_obj, "efl.dragable.slider"),
button_x, button_y);
}
static void
_efl_ui_slider_move_knob(Evas_Object *obj, Efl_Ui_Slider_Data *sd EINA_UNUSED, double button_x, double button_y)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
efl_ui_drag_value_set(efl_part(wd->resize_obj, "efl.dragable.slider"),
button_x, button_y);
}
static void
_slider_update(Evas_Object *obj, Eina_Bool user_event)
{
efl_ui_slider_val_fetch(obj, user_event);
evas_object_smart_changed(obj);
}
@ -156,7 +130,7 @@ _drag(void *data,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
_slider_update(data, EINA_TRUE);
_drag_value_fetch(data);
}
static void
@ -167,8 +141,8 @@ _drag_start(void *data,
{
if (!efl_ui_focus_object_focus_get(data))
elm_object_focus_set(data, EINA_TRUE);
_slider_update(data, EINA_TRUE);
efl_event_callback_call(data, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_START, NULL);
_drag_value_fetch(data);
elm_widget_scroll_freeze_push(data);
}
@ -178,7 +152,7 @@ _drag_stop(void *data,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
_slider_update(data, EINA_TRUE);
_drag_value_fetch(data);
efl_event_callback_call(data, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, NULL);
elm_widget_scroll_freeze_pop(data);
}
@ -189,51 +163,47 @@ _drag_step(void *data,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
_slider_update(data, EINA_TRUE);
_drag_value_fetch(data);
}
static void
_drag_up(void *data,
Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
_drag_up(Evas_Object *obj)
{
double step;
double relative_step;
EFL_UI_SLIDER_DATA_GET(data, sd);
EFL_UI_SLIDER_DATA_GET(obj, sd);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
step = sd->step;
if (efl_ui_layout_orientation_is_inverted(sd->dir)) step *= -1.0;
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
relative_step = step/(sd->val_max - sd->val_min);
efl_ui_drag_step_move(efl_part(wd->resize_obj, "efl.dragable.slider"),
relative_step, relative_step);
_slider_update(data, EINA_TRUE);
_drag_value_fetch(obj);
}
static void
_drag_down(void *data,
Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
_drag_down(Evas_Object *obj)
{
double step;
double relative_step;
EFL_UI_SLIDER_DATA_GET(data, sd);
EFL_UI_SLIDER_DATA_GET(obj, sd);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
step = -sd->step;
if (efl_ui_layout_orientation_is_inverted(sd->dir)) step *= -1.0;
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
relative_step = step/(sd->val_max - sd->val_min);
efl_ui_drag_step_move(efl_part(wd->resize_obj, "efl.dragable.slider"),
relative_step, relative_step);
_slider_update(data, EINA_TRUE);
_drag_value_fetch(obj);
}
static Eina_Bool
@ -250,32 +220,32 @@ _key_action_drag(Evas_Object *obj, const char *params)
if (!_is_horizontal(sd->dir))
return EINA_FALSE;
if (!efl_ui_layout_orientation_is_inverted(sd->dir))
_drag_down(obj, NULL, NULL, NULL);
else _drag_up(obj, NULL, NULL, NULL);
_drag_down(obj);
else _drag_up(obj);
}
else if (!strcmp(dir, "right"))
{
if (!_is_horizontal(sd->dir))
return EINA_FALSE;
if (!efl_ui_layout_orientation_is_inverted(sd->dir))
_drag_up(obj, NULL, NULL, NULL);
else _drag_down(obj, NULL, NULL, NULL);
_drag_up(obj);
else _drag_down(obj);
}
else if (!strcmp(dir, "up"))
{
if (_is_horizontal(sd->dir))
return EINA_FALSE;
if (efl_ui_layout_orientation_is_inverted(sd->dir))
_drag_up(obj, NULL, NULL, NULL);
else _drag_down(obj, NULL, NULL, NULL);
_drag_up(obj);
else _drag_down(obj);
}
else if (!strcmp(dir, "down"))
{
if (_is_horizontal(sd->dir))
return EINA_FALSE;
if (efl_ui_layout_orientation_is_inverted(sd->dir))
_drag_down(obj, NULL, NULL, NULL);
else _drag_up(obj, NULL, NULL, NULL);
_drag_down(obj);
else _drag_up(obj);
}
else return EINA_FALSE;
@ -306,22 +276,22 @@ _efl_ui_slider_efl_ui_widget_widget_input_event_handler(Eo *obj, Efl_Ui_Slider_D
if (efl_input_pointer_wheel_delta_get(ev) < 0)
{
if (_is_horizontal(sd->dir))
_drag_up(obj, NULL, NULL, NULL);
_drag_up(obj);
else
_drag_down(obj, NULL, NULL, NULL);
_drag_down(obj);
}
else
{
if (_is_horizontal(sd->dir))
_drag_down(obj, NULL, NULL, NULL);
_drag_down(obj);
else
_drag_up(obj, NULL, NULL, NULL);
_drag_up(obj);
}
efl_input_processed_set(ev, EINA_TRUE);
}
else return EINA_FALSE;
_slider_update(obj, EINA_TRUE);
_drag_value_fetch(obj);
return EINA_TRUE;
}
@ -336,18 +306,18 @@ _efl_ui_slider_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Slider_Data *sd,
(act == EFL_UI_ACTIVATE_RIGHT))
{
if (!efl_ui_layout_orientation_is_inverted(sd->dir))
_drag_up(obj, NULL, NULL, NULL);
else _drag_down(obj, NULL, NULL, NULL);
_drag_up(obj);
else _drag_down(obj);
}
else if ((act == EFL_UI_ACTIVATE_DOWN) ||
(act == EFL_UI_ACTIVATE_LEFT))
{
if (!efl_ui_layout_orientation_is_inverted(sd->dir))
_drag_down(obj, NULL, NULL, NULL);
else _drag_up(obj, NULL, NULL, NULL);
_drag_down(obj);
else _drag_up(obj);
}
_slider_update(obj, EINA_TRUE);
_drag_value_fetch(obj);
return EINA_TRUE;
}
@ -426,7 +396,7 @@ _efl_ui_slider_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Slider_Data *sd)
else
efl_layout_signal_emit(obj, "efl,state,inverted,off", "efl");
efl_ui_slider_val_set(obj);
_drag_value_update(obj);
efl_layout_signal_process(wd->resize_obj, EINA_FALSE);
evas_object_smart_changed(obj);
@ -441,6 +411,7 @@ _spacer_down_cb(void *data,
void *event_info)
{
EFL_UI_SLIDER_DATA_GET(data, sd);
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
Evas_Event_Mouse_Down *ev = event_info;
Eina_Rect sr;
@ -463,12 +434,13 @@ _spacer_down_cb(void *data,
if (button_y < 0) button_y = 0;
}
efl_ui_slider_down_knob(data, button_x, button_y);
efl_ui_drag_value_set(efl_part(wd->resize_obj, "efl.dragable.slider"),
button_x, button_y);
if (!efl_ui_focus_object_focus_get(data))
elm_object_focus_set(data, EINA_TRUE);
_slider_update(data, EINA_TRUE);
efl_event_callback_call(data, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_START, NULL);
_drag_value_fetch(data);
}
static void
@ -478,6 +450,7 @@ _spacer_move_cb(void *data,
void *event_info)
{
EFL_UI_SLIDER_DATA_GET(data, sd);
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
Eina_Rect sr;
double button_x = 0.0, button_y = 0.0;
@ -504,7 +477,7 @@ _spacer_move_cb(void *data,
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
{
if (sd->spacer_down) sd->spacer_down = EINA_FALSE;
_slider_update(data, EINA_TRUE);
_drag_value_fetch(data);
efl_event_callback_call
(data, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, NULL);
if (sd->frozen)
@ -527,8 +500,9 @@ _spacer_move_cb(void *data,
if (button_y < 0) button_y = 0;
}
efl_ui_slider_move_knob(data, button_x, button_y);
_slider_update(data, EINA_TRUE);
efl_ui_drag_value_set(efl_part(wd->resize_obj, "efl.dragable.slider"),
button_x, button_y);
_drag_value_fetch(data);
}
}
@ -543,7 +517,7 @@ _spacer_up_cb(void *data,
if (!sd->spacer_down) return;
if (sd->spacer_down) sd->spacer_down = EINA_FALSE;
_slider_update(data, EINA_TRUE);
_drag_value_fetch(data);
efl_event_callback_call(data, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, NULL);
if (sd->frozen)
@ -691,6 +665,8 @@ _efl_ui_slider_efl_ui_layout_orientable_orientation_get(const Eo *obj EINA_UNUSE
EOLIAN static void
_efl_ui_slider_efl_ui_range_display_range_limits_set(Eo *obj, Efl_Ui_Slider_Data *sd, double min, double max)
{
double val;
if (max < min)
{
ERR("Wrong params. min(%lf) is greater than max(%lf).", min, max);
@ -702,12 +678,15 @@ _efl_ui_slider_efl_ui_range_display_range_limits_set(Eo *obj, Efl_Ui_Slider_Data
return;
}
if ((EINA_DBL_EQ(sd->val_min, min)) && (EINA_DBL_EQ(sd->val_max, max))) return;
sd->val_min = min;
sd->val_max = max;
if (sd->val < sd->val_min) sd->val = sd->val_min;
if (sd->val > sd->val_max) sd->val = sd->val_max;
efl_ui_slider_val_set(obj);
val = sd->val;
if (val < sd->val_min) val = sd->val_min;
if (val > sd->val_max) val = sd->val_max;
efl_ui_range_value_set(obj, val);
}
EOLIAN static void
@ -734,11 +713,8 @@ _efl_ui_slider_efl_ui_range_display_range_value_set(Eo *obj, Efl_Ui_Slider_Data
if (EINA_DBL_EQ(val, sd->val)) return;
sd->val = val;
if (sd->val < sd->val_min) sd->val = sd->val_min;
if (sd->val > sd->val_max) sd->val = sd->val_max;
_drag_value_update(obj);
_emit_events(obj, sd);
efl_ui_slider_val_set(obj);
}
EOLIAN static double
@ -789,16 +765,16 @@ _efl_ui_slider_efl_access_value_value_and_text_get(const Eo *obj EINA_UNUSED, Ef
EOLIAN static Eina_Bool
_efl_ui_slider_efl_access_value_value_and_text_set(Eo *obj, Efl_Ui_Slider_Data *sd, double value, const char *text EINA_UNUSED)
{
double oldval = sd->val;
if (value < sd->val_min) value = sd->val_min;
if (value > sd->val_max) value = sd->val_max;
efl_event_callback_call(obj, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_START, NULL);
sd->val = value;
efl_ui_slider_val_set(obj);
sd->val = oldval;
_slider_update(obj, EINA_TRUE);
if (fabs(value - sd->val) > DBL_EPSILON)
{
_user_value_update(obj, value);
}
efl_event_callback_call(obj, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, NULL);
return EINA_TRUE;
@ -832,17 +808,5 @@ _efl_ui_slider_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSE
}
// A11Y Accessibility - END
/* Internal EO APIs and hidden overrides */
EFL_VOID_FUNC_BODYV(efl_ui_slider_val_fetch, EFL_FUNC_CALL(user_event), Eina_Bool user_event)
EFL_VOID_FUNC_BODY(efl_ui_slider_val_set)
EFL_VOID_FUNC_BODYV(efl_ui_slider_down_knob, EFL_FUNC_CALL(button_x, button_y), double button_x, double button_y)
EFL_VOID_FUNC_BODYV(efl_ui_slider_move_knob, EFL_FUNC_CALL(button_x, button_y), double button_x, double button_y)
#define EFL_UI_SLIDER_EXTRA_OPS \
EFL_UI_SLIDER_VAL_FETCH_OPS(efl_ui_slider), \
EFL_UI_SLIDER_VAL_SET_OPS(efl_ui_slider), \
EFL_UI_SLIDER_DOWN_KNOB_OPS(efl_ui_slider), \
EFL_UI_SLIDER_MOVE_KNOB_OPS(efl_ui_slider), \
#include "efl_ui_slider.eo.c"

View File

@ -22,18 +22,6 @@ struct _Efl_Ui_Slider_Data
* @}
*/
# define EFL_UI_SLIDER_VAL_FETCH_OPS(_pfx) \
EFL_OBJECT_OP_FUNC(efl_ui_slider_val_fetch, _##_pfx##_val_fetch)
# define EFL_UI_SLIDER_VAL_SET_OPS(_pfx) \
EFL_OBJECT_OP_FUNC(efl_ui_slider_val_set, _##_pfx##_val_set)
# define EFL_UI_SLIDER_DOWN_KNOB_OPS(_pfx) \
EFL_OBJECT_OP_FUNC(efl_ui_slider_down_knob, _##_pfx##_down_knob)
# define EFL_UI_SLIDER_MOVE_KNOB_OPS(_pfx) \
EFL_OBJECT_OP_FUNC(efl_ui_slider_move_knob, _##_pfx##_move_knob)
#define EFL_UI_SLIDER_DATA_GET(o, sd) \
Efl_Ui_Slider_Data * sd = efl_data_scope_get(o, EFL_UI_SLIDER_CLASS)

View File

@ -396,7 +396,7 @@ _eval_registration_candidate(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool *shou
pd->tree_unfocusable > 0)
return;
if (((Efl_Ui_Shared_Win_Data*)pd->shared_win_data)->legacy_focus_api_used)
if (!pd->shared_win_data || ((Efl_Ui_Shared_Win_Data*)pd->shared_win_data)->legacy_focus_api_used)
{
if (_legacy_focus_eval(obj))
return;
@ -456,7 +456,7 @@ _logical_parent_eval(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd, Eina_Bool s
Efl_Ui_Widget *parent;
Efl_Ui_Focus_Parent_Provider *provider;
if (((Efl_Ui_Shared_Win_Data*)pd->shared_win_data)->custom_parent_provider)
if (!pd->shared_win_data || ((Efl_Ui_Shared_Win_Data*)pd->shared_win_data)->custom_parent_provider)
{
if (should)
{
@ -4788,13 +4788,16 @@ elm_widget_tree_dot_dump(const Evas_Object *top,
EOLIAN static Eo *
_efl_ui_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED)
{
Eina_Bool parent_is_widget = EINA_FALSE;
sd->on_create = EINA_TRUE;
sd->window = efl_provider_find(efl_parent_get(obj), EFL_UI_WIN_CLASS);
if (!efl_isa(obj, EFL_UI_WIN_CLASS))
{
Eo *parent = efl_parent_get(obj);
if (!efl_isa(parent, EFL_UI_WIDGET_CLASS))
parent_is_widget = efl_isa(parent, EFL_UI_WIDGET_CLASS);
if (!parent_is_widget)
{
ERR("You passed a wrong parent parameter (%p %s). "
"Elementary widget's parent should be an elementary widget.",
@ -4822,7 +4825,11 @@ _efl_ui_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UN
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_UNKNOWN);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->shared_win_data, NULL);
if (!sd->shared_win_data)
{
if (sd->window && parent_is_widget)
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->shared_win_data, NULL);
}
return obj;
}

View File

@ -22,7 +22,8 @@
EINA_SAFETY_ON_FALSE_RETURN_VAL(elm_widget_is_legacy(obj), val);
#define MARK_WINDOW_LEGACY_USAGE() \
((Efl_Ui_Shared_Win_Data*)pd->shared_win_data)->legacy_focus_api_used = EINA_TRUE;
if (pd->shared_win_data) \
((Efl_Ui_Shared_Win_Data*)pd->shared_win_data)->legacy_focus_api_used = EINA_TRUE;
#define MAPPING() \
MAP(PREVIOUS, prev) \

View File

@ -182,6 +182,7 @@ pub_eo_files = [
'efl_ui_selectable.eo',
'efl_ui_multi_selectable.eo',
'efl_ui_single_selectable.eo',
'efl_ui_position_manager_data_access_v1.eo',
]
foreach eo_file : pub_eo_files

View File

@ -25,41 +25,43 @@ item_container_teardown()
win = NULL;
}
static Efl_Ui_Position_Manager_Batch_Result
_size_accessor_get_at(void *data EINA_UNUSED, int start_id, Eina_Rw_Slice memory)
static Efl_Ui_Position_Manager_Size_Batch_Result
_size_accessor_get_at(void *data EINA_UNUSED, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_Rw_Slice memory)
{
int i;
Efl_Ui_Position_Manager_Batch_Size_Access *sizes = memory.mem;
Efl_Ui_Position_Manager_Batch_Result result;
Efl_Ui_Position_Manager_Size_Batch_Entity *sizes = memory.mem;
Efl_Ui_Position_Manager_Size_Batch_Result result;
for (i = start_id; i < (int)(MIN(start_id + memory.len, eina_inarray_count(arr_size))); ++i)
for (i = conf.range.start_id; i < (int)(MIN(conf.range.end_id, eina_inarray_count(arr_size))); ++i)
{
Eina_Size2D *size = eina_inarray_nth(arr_size, i);
sizes[i - start_id].size = *size;
sizes[i - start_id].group = 0;
sizes[i - conf.range.start_id].size = *size;
sizes[i - conf.range.start_id].depth_leader = 0;
sizes[i - conf.range.start_id].element_depth = 0;
}
result.filled_items = i - start_id;
result.group_id = -1;
result.filled_items = i - conf.range.start_id;
result.parent_size = EINA_SIZE2D(0, 0);
return result;
}
static Efl_Ui_Position_Manager_Batch_Result
_obj_accessor_get_at(void *data EINA_UNUSED, int start_id, Eina_Rw_Slice memory)
static Efl_Ui_Position_Manager_Object_Batch_Result
_obj_accessor_get_at(void *data EINA_UNUSED, Efl_Ui_Position_Manager_Request_Range range, Eina_Rw_Slice memory)
{
int i;
Efl_Ui_Position_Manager_Batch_Entity_Access *objs = memory.mem;
Efl_Ui_Position_Manager_Batch_Result result;
Efl_Ui_Position_Manager_Object_Batch_Entity *objs = memory.mem;
Efl_Ui_Position_Manager_Object_Batch_Result result;
for (i = start_id; i < (int)(MIN(start_id + memory.len, eina_array_count(arr_obj))); ++i)
for (i = range.start_id; i < (int)(MIN(range.end_id, eina_array_count(arr_obj))); ++i)
{
Efl_Gfx_Entity *geom = eina_array_data_get(arr_obj, i);
objs[i - start_id].entity = geom;
objs[i - start_id].group = 0;
objs[i - range.start_id].entity = geom;
objs[i - range.start_id].depth_leader = 0;
objs[i - range.start_id].element_depth = 0;
}
result.filled_items = i - start_id;
result.group_id = -1;
result.filled_items = i - range.start_id;
result.group = NULL;
return result;
}
static void
@ -68,7 +70,7 @@ _initial_setup(void)
arr_obj = eina_array_new(10);
arr_size = eina_inarray_new(sizeof(Eina_Size2D), 10);
efl_ui_position_manager_entity_data_access_set(position_manager,
efl_ui_position_manager_data_access_v1_data_access_set(position_manager,
NULL, _obj_accessor_get_at, NULL,
NULL, _size_accessor_get_at, NULL,
0);

View File

@ -13,8 +13,12 @@ slider_changed(void *data EINA_UNUSED, const Efl_Event *ev)
{
event_counter++;
if (event_counter == 1)
efl_event_callback_del(ev->object, EFL_UI_RANGE_EVENT_CHANGED, slider_changed, NULL);
efl_event_callback_del(ev->object, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_START, slider_changed, NULL);
else if (event_counter == 2)
efl_event_callback_del(ev->object, EFL_UI_RANGE_EVENT_CHANGED, slider_changed, NULL);
else if (event_counter == 3)
efl_event_callback_del(ev->object, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, slider_changed, NULL);
else if (event_counter == 4)
ecore_main_loop_quit();
}
@ -28,6 +32,8 @@ EFL_START_TEST(efl_ui_test_slider_events)
slider = efl_add(EFL_UI_SLIDER_CLASS, win,
efl_event_callback_add(efl_added, EFL_UI_RANGE_EVENT_CHANGED, slider_changed, NULL),
efl_event_callback_add(efl_added, EFL_UI_RANGE_EVENT_STEADY, slider_changed, NULL),
efl_event_callback_add(efl_added, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_START, slider_changed, NULL),
efl_event_callback_add(efl_added, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, slider_changed, NULL),
efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(400, 100))
);
@ -48,7 +54,7 @@ EFL_START_TEST(efl_ui_test_slider_events)
evas_event_feed_mouse_move(e, sx + (sw / 2), sy + (sh / 2), 0, NULL);
evas_event_feed_mouse_up(e, 1, 0, 0, NULL);
ecore_main_loop_begin();
ck_assert_int_eq(event_counter, 2);
ck_assert_int_eq(event_counter, 4);
}
EFL_END_TEST
@ -62,6 +68,8 @@ EFL_START_TEST(efl_ui_test_slider_step)
slider = efl_add(EFL_UI_SLIDER_CLASS, win,
efl_event_callback_add(efl_added, EFL_UI_RANGE_EVENT_CHANGED, slider_changed, NULL),
efl_event_callback_add(efl_added, EFL_UI_RANGE_EVENT_STEADY, slider_changed, NULL),
efl_event_callback_add(efl_added, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_START, slider_changed, NULL),
efl_event_callback_add(efl_added, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, slider_changed, NULL),
efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(400, 100))
);
efl_ui_range_limits_set(slider, 0, 100);