Compare commits

...

36 Commits

Author SHA1 Message Date
Marcel Hollerbach 64c45e94cd make things work better 2019-09-02 20:27:26 +02:00
Marcel Hollerbach 2cbb0d382e that was too noisy 2019-09-02 18:42:15 +02:00
Marcel Hollerbach c41c873e27 add so many hacks that it finally works
sooo, this commit disables the complete logic arround pd->viewport, and
works alone with the cache. This fixes most of the bugs of requesting
elements that are already there, fixes issues where elements are not
getting deleted probebly, fixes weird sizes. Fixes random NULL objects.

This commit also fixes parts of the flush logic, however, there is still
one case where a NULL ptr is added to the list ... i do not know why
2019-09-02 18:35:35 +02:00
Marcel Hollerbach 21a908224c init the size probebly. 2019-09-02 16:54:18 +02:00
Marcel Hollerbach 5dd8f5686f Revert "typooooo"
This reverts commit 9aee8a4ca2.

that typo was ... neccessary ?
2019-09-01 10:48:02 +02:00
Marcel Hollerbach 571274727e track widgets 2019-09-01 10:47:58 +02:00
Marcel Hollerbach 9aee8a4ca2 typooooo 2019-09-01 10:45:25 +02:00
Marcel Hollerbach baa65dfed9 fixes 2019-09-01 10:45:09 +02:00
Marcel Hollerbach bb595941cc more debug and element removal
elements where safed if they already existed -> delete, delete, delete

viewport caching is fucked -> debug debug debug
2019-08-31 15:03:35 +02:00
Marcel Hollerbach 0d42bfee26 remove too much debug 2019-08-31 15:03:34 +02:00
Marcel Hollerbach 798284ea5a code fixes after rebase 2019-08-31 15:03:34 +02:00
Marcel Hollerbach 00d7815322 fix build after rebase 2019-08-31 15:03:34 +02:00
Marcel Hollerbach a05b3bc723 emit event earliers 2019-08-31 15:03:34 +02:00
Marcel Hollerbach b7c98fbb8a debug output update 2019-08-31 15:03:34 +02:00
Marcel Hollerbach 31034caf37 sizing adjust fix 2019-08-31 15:03:34 +02:00
Marcel Hollerbach a19b4a5ee4 more fixes 2019-08-31 15:03:34 +02:00
Marcel Hollerbach 5de20f525e HACKNSLAY 2019-08-31 15:03:34 +02:00
Mike Blumenkrantz ba5188c8de wip 2019-08-31 15:03:34 +02:00
Mike Blumenkrantz 402675c413 w 2019-08-31 15:03:33 +02:00
Mike Blumenkrantz 02f887ebf4 Revert "enforce a minsize of 10"
This reverts commit d32fe945aef5c157ff8422c9b13c376d502ad5af.
2019-08-31 15:03:33 +02:00
Mike Blumenkrantz 7152b43b70 Revert "elementary: fix the size calculation on the collection view."
This reverts commit af371da2f423f3b5554999329ac9cb0c95f334e6.
2019-08-31 15:03:33 +02:00
Mike Blumenkrantz 6ecfd0d205 wip 2019-08-31 15:03:33 +02:00
SangHyeon Jade Lee 0223136649 elementary: fix the size calculation on the collection view.
Summary:
fixing size calculation errors in the collection view.
edje object need to be restricted calculation for giving min size properly.
by calling efl_layout_calc_size_min() instead of efl_gfx_hint_size_min_get()
get proper minimum size of item based on restricted finger size.

Depends on D9741

Reviewers: cedric, bu5hm4n, felipealmeida, lauromoura, zmike

Reviewed By: zmike

Subscribers: zmike

Tags: #efl_widgets

Differential Revision: https://phab.enlightenment.org/D9742
2019-08-31 15:03:33 +02:00
Marcel Hollerbach 284af3ad7d hack and slay position manager
we have to randomly enable here visibility changes, entity is not
available sometimes during item_added.
2019-08-31 15:03:33 +02:00
Marcel Hollerbach 5deffc2ef4 random fixes for the collection view constructor
the orientation should be set correctly here, otherwise the list is
looking weirder than weird.
2019-08-31 15:03:33 +02:00
Marcel Hollerbach d1e9717d0d we have to set the model somewhere 2019-08-31 15:03:33 +02:00
Marcel Hollerbach 5916bb2252 enforce a minsize of 10
the list items are not minsizing only because of text, properties for
content do not work yet (afaics). With this commit we have at least a
minsize of 10 pixels ... yey.
2019-08-31 15:03:33 +02:00
Marcel Hollerbach c564704a68 hack widget factory
this is needed to be called after finalize, otherwise the theme will be
reapplied, and all the properties set during building call are GONE.
2019-08-31 15:03:32 +02:00
Marcel Hollerbach f05a30966b random NULL checks for seeing things more easily 2019-08-31 15:03:32 +02:00
Marcel Hollerbach a8d1167954 fixes for the example
the position manager should be set earlier, otherwise the first model
setting is going to hell.

Additionally, efl.text is wrong as key i think.
2019-08-31 15:03:32 +02:00
Cedric BAIL fd679b06fc elementary: add an example to test Efl.Ui.CollectionView. 2019-08-31 15:03:32 +02:00
Cedric BAIL db937d8486 elementary: Efl.Ui.Layout_Factory bind property during widget creation.
In the same vain as previous patch this will initialize more of the widget during its
creation and reduce unecessary recalc.
2019-08-31 15:03:32 +02:00
Cedric BAIL 50c48b8cc3 elementary: Efl.Ui.Image_Factory bind property also during widget creation.
In the same vain as previous patch this will initialize more of the widget during its
creation and reduce unecessary recalc.
2019-08-31 15:03:32 +02:00
Cedric BAIL c7dcea7174 elementary: Efl.Ui.Widget_Factory bind widget property before finalizing the widget.
In the same vain as previous patch this will initialize more of the widget during its
creation and reduce unecessary recalc.
2019-08-31 15:03:32 +02:00
Cedric BAIL a942da2779 elementary: leverage sizing information from model if available to avoid unecessary calc.
With the new Efl unified infrastructure, we do delay a lot of the computation to finalize,
by filling the object information before finalize we reduce unecessary computation.
2019-08-31 15:03:32 +02:00
Cedric BAIL 01bae2360a elementary: introduce Efl.Ui.CollectionView a generic listing View.
The idea of this widget is to provide to MVVM what Efl.Ui.Collection provide and
leverage the same shared logic for layout.
2019-08-31 15:03:32 +02:00
16 changed files with 2298 additions and 97 deletions

View File

@ -0,0 +1,118 @@
// gcc -o efl_ui_list_view_example_1 efl_ui_list_view_example_1.c `pkg-config --cflags --libs elementary`
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#else
# define EFL_BETA_API_SUPPORT 1
#endif
#include <Efl_Ui.h>
#include <Elementary.h>
#include <Efl.h>
#include <Eio.h>
#include <stdio.h>
#define NUM_ITEMS 400
const char *styles[] = {
"odd",
"even"
};
char edj_path[PATH_MAX];
static void
_realized_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Efl_Ui_List_View_Item_Event *ie = event->info;
if (!ie->layout) return;
Efl_Ui_Layout *layout = ie->layout;
elm_object_focus_allow_set(layout, EINA_TRUE);
}
/*
static void
_unrealized_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Efl_Ui_List_View_Item_Event *ie = event->info;
efl_ui_view_model_set(ie->layout, NULL);
efl_del(ie->layout);
}
*/
static Efl_Model*
_make_model(Evas_Object *win)
{
Eina_Value vtext;
Eina_Value w, h;
Efl_Generic_Model *model, *child;
unsigned int i, s;
char buf[256];
model = efl_add(EFL_GENERIC_MODEL_CLASS, win);
eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
w = eina_value_int_init(91);
h = eina_value_int_init(18);
efl_model_property_set(model, "item.width", &w);
efl_model_property_set(model, "item.height", &h);
for (i = 0; i < (NUM_ITEMS); i++)
{
s = i%2;
child = efl_model_child_add(model);
eina_value_set(&vtext, styles[s]);
efl_model_property_set(child, "odd_style", &vtext);
snprintf(buf, sizeof(buf), "Item # %i", i);
eina_value_set(&vtext, buf);
efl_model_property_set(child, "title", &vtext);
}
eina_value_flush(&vtext);
return model;
}
EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
Efl_Ui_Factory *factory;
Evas_Object *win, *li;
Eo *model;
Efl_Select_Model *selmodel;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC));
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
elm_win_autodel_set(win, EINA_TRUE);
model = _make_model(win);
selmodel = efl_add(EFL_SELECT_MODEL_CLASS, efl_main_loop_get()
, efl_ui_view_model_set(efl_added, model)
);
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS);
efl_ui_property_bind(factory, "signal/efl,state,%v", "odd_style");
efl_ui_property_bind(factory, "signal/efl,state,%{selected;unselected}", "selected");
efl_ui_property_bind(factory, "text", "title");
Eo *lst = efl_new(EFL_UI_POSITION_MANAGER_LIST_CLASS);
li = efl_add(EFL_UI_COLLECTION_VIEW_CLASS, win,
efl_ui_collection_view_position_manager_set(efl_added, lst),
efl_ui_view_model_set(efl_added, selmodel),
efl_ui_collection_view_factory_set(efl_added, factory));
// efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_cb, NULL);
// efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, _unrealized_cb, NULL);
efl_content_set(win, li);
//showall
evas_object_resize(win, 320, 320);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -114,6 +114,7 @@ examples = [
'efl_ui_list_view_example_1',
'efl_ui_list_view_example_2',
'efl_ui_list_view_example_3',
'efl_ui_collection_view_example_1',
'efl_canvas_layout_text',
'efl_ui_theme_example_01',
'efl_ui_theme_example_02',

View File

@ -135,6 +135,7 @@ _efl_ui_view_factory_item_created(Eo *factory, void *data EINA_UNUSED, const Ein
static Eina_Future *
_efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models, Efl_Gfx_Entity *parent)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(factory, NULL);
return efl_future_then(factory, efl_ui_factory_create(factory, models, parent),
.success_type = EINA_VALUE_TYPE_ARRAY,
.success = _efl_ui_view_factory_item_created);

View File

@ -154,6 +154,7 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel);
# include <efl_ui_focus_manager_calc.eo.h>
# include <efl_ui_focus_manager_sub.eo.h>
# include <efl_ui_focus_manager_root_focus.eo.h>
# include <efl_ui_widget_focus_manager.eo.h>
# include <efl_ui_focus_util.eo.h>
# include <efl_ui_textpath.eo.h>
# include <efl_ui_l10n.eo.h>
@ -168,6 +169,9 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel);
# include <efl_access_editable_text.eo.h>
# include <efl_access_selection.eo.h>
# include <efl_access_value.eo.h>
# include <efl_access_selection.eo.h>
# include <efl_access_object.eo.h>
# include <efl_access_widget_action.eo.h>
# include <efl_ui_theme.eo.h>
# include <efl_config_global.eo.h>
@ -276,6 +280,9 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
# include <efl_ui_tab_bar.eo.h>
# include <efl_ui_tab_page.eo.h>
# include <efl_ui_tab_pager.eo.h>
# include <efl_ui_collection_view.eo.h>
/**
* Initialize Elementary
*

View File

@ -246,8 +246,8 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj,
EINA_ITERATOR_FOREACH(models, model)
{
w = efl_add(pd->klass, parent,
efl_ui_factory_building(obj, efl_added),
efl_ui_view_model_set(efl_added, model));
efl_ui_factory_building(obj, w);
eina_value_array_append(&gr->done, w);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
struct @beta Efl.Ui.Collection_View_Item_Event
{
item: Efl.Ui.Widget;
model: Efl.Model;
}
class @beta Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements
Efl.Ui.Scrollable_Interactive,
Efl.Ui.Scrollbar,
Efl.Ui.Layout_Orientable,
Efl.Ui.Selectable,
Efl.Ui.Multi_Selectable,
Efl.Ui.Focus.Manager_Sub,
Efl.Ui.Widget_Focus_Manager
{
methods {
@property factory {
[[Define the factory used to create all the items.]]
get {}
set {}
values {
factory: Efl.Ui.Factory; [[The factory.]]
}
}
@property position_manager {
[[Position manager object that handles placement of items.]]
values {
position_manager : Efl.Ui.Position_Manager.Entity @owned; [[The objects ownership is passed to the item container.]]
}
}
}
implements {
Efl.Object.constructor;
Efl.Object.invalidate;
Efl.Ui.Layout_Orientable.orientation { get; set; }
Efl.Ui.Widget.theme_apply;
Efl.Ui.Scrollable_Interactive.match_content { set; }
Efl.Ui.Multi_Selectable.select_mode {get; set;}
Efl.Ui.Widget_Focus_Manager.focus_manager_create;
Efl.Ui.Focus.Manager.move;
}
events {
item,realized : Efl.Ui.Collection_View_Item_Event;
item,unrealized : Efl.Ui.Collection_View_Item_Event;
item,focused : Efl.Ui.Collection_View_Item_Event;
item,unfocused : Efl.Ui.Collection_View_Item_Event;
item,highlighted : Efl.Ui.Collection_View_Item_Event;
item,unhighlighted : Efl.Ui.Collection_View_Item_Event;
}
composite {
Efl.Ui.Scrollable_Interactive;
Efl.Ui.Scrollbar;
}
}

View File

@ -0,0 +1,7 @@
class @beta Efl.Ui.Collection_View_Focus_Manager extends Efl.Ui.Focus.Manager_Calc {
[[Internal class which implements collection specific behaviour, cannot be used outside of collection]]
implements {
Efl.Ui.Focus.Manager.manager_focus { set; }
Efl.Ui.Focus.Manager.request_move;
}
}

View File

@ -35,34 +35,22 @@ _efl_ui_image_factory_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa
efl_destructor(efl_super(obj, MY_CLASS));
}
static Eina_Value
_efl_ui_image_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value value)
static void
_efl_ui_image_factory_efl_ui_factory_building(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, Efl_Gfx_Entity *ui_view)
{
Efl_Ui_Image_Factory_Data *pd = data;
Efl_Gfx_Entity *entity;
int len, i;
efl_ui_property_bind(ui_view, "filename", pd->property);
EINA_VALUE_ARRAY_FOREACH(&value, len, i, entity)
efl_ui_property_bind(entity, "filename", pd->property);
return value;
efl_ui_factory_building(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), ui_view);
}
EOLIAN static Eina_Future *
_efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd,
Eina_Iterator *models, Efl_Gfx_Entity *parent)
{
Eina_Future *f;
if (!parent) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED);
if (!pd->property) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED);
f = efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models, parent);
return efl_future_then(obj, f,
.success_type = EINA_VALUE_TYPE_ARRAY,
.success = _efl_ui_image_factory_bind,
.data = pd);
return efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models, parent);
}
EOLIAN static Eina_Error

View File

@ -5,6 +5,7 @@ class @beta Efl.Ui.Image_Factory extends Efl.Ui.Caching_Factory
Efl.Object.constructor;
Efl.Object.destructor;
Efl.Ui.Factory.create;
Efl.Ui.Factory.building;
Efl.Ui.Property_Bind.property_bind;
}
}

View File

@ -70,48 +70,21 @@ _efl_ui_layout_factory_efl_object_destructor(Eo *obj, Efl_Ui_Layout_Factory_Data
efl_destructor(efl_super(obj, MY_CLASS));
}
static Eina_Value
_efl_ui_layout_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value value)
{
Efl_Ui_Layout_Factory_Data *pd = data;
Efl_Gfx_Entity *layout;
int len, i;
EINA_VALUE_ARRAY_FOREACH(&value, len, i, layout)
{
eina_hash_foreach(pd->bind.properties, _property_bind, layout);
eina_hash_foreach(pd->bind.factories, _factory_bind, layout);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
}
return value;
}
static void
_efl_ui_layout_factory_efl_ui_factory_building(const Eo *obj, Efl_Ui_Layout_Factory_Data *pd, Efl_Gfx_Entity *ui_view)
{
if (pd->klass || pd->group || pd->style)
efl_ui_layout_theme_set(ui_view, pd->klass, pd->group, pd->style);
eina_hash_foreach(pd->bind.properties, _property_bind, ui_view);
eina_hash_foreach(pd->bind.factories, _factory_bind, ui_view);
evas_object_size_hint_weight_set(ui_view, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(ui_view, EVAS_HINT_FILL, EVAS_HINT_FILL);
efl_ui_factory_building(efl_super(obj, EFL_UI_LAYOUT_FACTORY_CLASS), ui_view);
}
EOLIAN static Eina_Future *
_efl_ui_layout_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Layout_Factory_Data *pd,
Eina_Iterator *models, Efl_Gfx_Entity *parent)
{
Eina_Future *f;
f = efl_ui_factory_create(efl_super(obj, EFL_UI_LAYOUT_FACTORY_CLASS), models, parent);
return efl_future_then(obj, f,
.success_type = EINA_VALUE_TYPE_ARRAY,
.success = _efl_ui_layout_factory_bind,
.data = pd);
}
EOLIAN static void
_efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd,
const char *key, Efl_Ui_Factory *factory)

View File

@ -15,7 +15,6 @@ class @beta Efl.Ui.Layout_Factory extends Efl.Ui.Caching_Factory
implements {
Efl.Object.constructor;
Efl.Object.destructor;
Efl.Ui.Factory.create;
Efl.Ui.Factory.building;
Efl.Ui.Property_Bind.property_bind;
Efl.Ui.Factory_Bind.factory_bind;

View File

@ -96,12 +96,13 @@ vis_change_segment(Api_Callbacks cb, int a, int b, Eina_Bool flag)
for (int i = MIN(a, b); i < MAX(a, b); ++i)
{
Efl_Gfx_Entity *ent = NULL;
int buffer_id = (i-MIN(a,b)) % len;
int buffer_id = abs(i-MIN(a,b)) % 50;
if (buffer_id == 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)))
{

View File

@ -28,6 +28,13 @@ typedef struct {
Api_Callbacks callbacks;
} Efl_Ui_Position_Manager_List_Data;
static void
cache_invalidate(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
{
if (pd->size_cache)
free(pd->size_cache);
pd->size_cache = NULL;
}
/*
* The here used cache is a sum map
* Every element in the cache contains the sum of the previous element, and the size of the current item
@ -82,19 +89,15 @@ cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
}
pd->size_cache[i + 1] = pd->size_cache[i] + step;
pd->maximum_min_size = MAX(pd->maximum_min_size, min);
/* no point iterating further if size calc can't be done yet */
//if ((!i) && (!pd->maximum_min_size)) break;
}
pd->average_item_size = pd->size_cache[pd->size]/pd->size;
if ((!pd->average_item_size) && (!pd->maximum_min_size))
cache_invalidate(obj, pd);
}
static void
cache_invalidate(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
{
if (pd->size_cache)
free(pd->size_cache);
pd->size_cache = NULL;
}
static inline int
static int
cache_access(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, unsigned int idx)
{
EINA_SAFETY_ON_FALSE_RETURN_VAL(idx <= pd->size, 0);
@ -105,7 +108,12 @@ static void
recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd)
{
Eina_Size2D min_size = EINA_SIZE2D(-1, -1);
Eina_Size2D pabs_size = pd->abs_size;
int pmin_size = pd->maximum_min_size;
cache_require(obj, pd);
/* deferred */
if (!pd->size_cache) return;
pd->abs_size = pd->viewport.size;
@ -116,8 +124,8 @@ recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd)
else
pd->abs_size.w = MAX(cache_access(obj, pd, pd->size), pd->abs_size.w);
}
efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_SIZE_CHANGED, &pd->abs_size);
if ((pabs_size.w != pd->abs_size.w) || (pabs_size.h != pd->abs_size.h))
efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_SIZE_CHANGED, &pd->abs_size);
if (pd->dir == EFL_UI_LAYOUT_ORIENTATION_VERTICAL)
{
@ -127,8 +135,8 @@ recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd)
{
min_size.h = pd->maximum_min_size;
}
efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_MIN_SIZE_CHANGED, &min_size);
if ((pd->maximum_min_size > 0) && (pmin_size > 0) && (pd->maximum_min_size != pmin_size))
efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_MIN_SIZE_CHANGED, &min_size);
}
static inline Vis_Segment
@ -210,6 +218,12 @@ _position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_
size = size_buffer[buffer_id].size;
ent = obj_buffer[buffer_id].entity;
int diff = cache_access(obj, pd, i + 1) - cache_access(obj, pd, i);
if (size.h != diff)
ERR("WTF %d %d %d", i, size.h, diff);
if (ent == pd->last_group)
{
pd->last_group = NULL;
@ -228,7 +242,14 @@ _position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_
}
if (ent)
efl_gfx_entity_geometry_set(ent, geom);
{
if (!size.w || !size.h) ERR("NULL SIZE ENT");
efl_gfx_entity_geometry_set(ent, geom);
if (!efl_gfx_entity_visible_get(ent))
efl_gfx_entity_visible_set(ent, EINA_TRUE);
}
else
if (!size.w || !size.h) ERR("ENT(%d) NOT FOUND", i);
if (pd->dir == EFL_UI_LAYOUT_ORIENTATION_VERTICAL)
geom.y += size.h;
else
@ -278,6 +299,8 @@ position_content(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
if (!pd->size) return;
if (pd->average_item_size <= 0) return;
cache_require(obj, pd);
//space size contains the amount of space that is outside the viewport (either to the top or to the left)
space_size.w = (MAX(pd->abs_size.w - pd->viewport.w, 0))*pd->scroll_position.x;
space_size.h = (MAX(pd->abs_size.h - pd->viewport.h, 0))*pd->scroll_position.y;
@ -294,6 +317,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->callbacks, cur, pd->prev_run);
@ -306,7 +330,6 @@ position_content(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
ev.end_id = pd->prev_run.end_id = cur.end_id;
efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_VISIBLE_RANGE_CHANGED, &ev);
}
}
static Eina_Value
@ -336,6 +359,8 @@ schedule_recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd)
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)
{
if ((!pd->viewport.w) && (!size.w) && (!pd->viewport.h) && (!size.h)) return;
pd->viewport = size;
recalc_absolut_size(obj, pd);
@ -408,7 +433,6 @@ _efl_ui_position_manager_list_efl_ui_position_manager_entity_position_single_ite
geom = pd->viewport;
BATCH_ACCESS_SIZE_VAL(pd->callbacks, idx, 1, EINA_FALSE, size_buffer, EINA_RECT_EMPTY());
size = size_buffer[0].size;
if (pd->dir == EFL_UI_LAYOUT_ORIENTATION_VERTICAL)
@ -442,6 +466,7 @@ _efl_ui_position_manager_list_efl_ui_layout_orientable_orientation_set(Eo *obj E
cache_invalidate(obj, pd);
cache_require(obj,pd);
if (!efl_finalized_get(obj)) return;
recalc_absolut_size(obj, pd);
position_content(obj, pd);
}

View File

@ -69,16 +69,49 @@ _efl_ui_widget_factory_item_class_get(const Eo *obj EINA_UNUSED,
}
static void
_efl_ui_widget_factory_efl_ui_factory_building(const Eo *obj EINA_UNUSED, Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED, Efl_Gfx_Entity *ui_view)
_efl_ui_widget_factory_efl_ui_factory_building(const Eo *factory EINA_UNUSED, Efl_Ui_Widget_Factory_Data *pd, Efl_Gfx_Entity *ui_view)
{
const Efl_Model *model;
Eina_Value *property;
Eina_Value *property, *width, *height;
Efl_Ui_Bind_Part_Data *bpd;
Eina_Iterator *it;
char *style;
model = efl_ui_view_model_get(ui_view);
// Bind all property before the object is finalize
it = eina_hash_iterator_data_new(pd->parts);
EINA_ITERATOR_FOREACH(it, bpd)
{
Efl_Ui_Property_Bind_Data *bppd;
Eina_List *l;
EINA_LIST_FOREACH(bpd->properties, l, bppd)
efl_ui_property_bind(efl_part(ui_view, bpd->part),
bppd->part_property,
bppd->model_property);
}
eina_iterator_free(it);
// Fetch min size from model if available to avoid recalculcating it
width = efl_model_property_get(model, "self.width");
height = efl_model_property_get(model, "self.height");
if (eina_value_type_get(width) != EINA_VALUE_TYPE_ERROR &&
eina_value_type_get(height) != EINA_VALUE_TYPE_ERROR)
{
Eina_Size2D s;
if (!eina_value_int_convert(width, &s.w)) s.w = 0;
if (!eina_value_int_convert(height, &s.h)) s.h = 0;
efl_gfx_hint_size_min_set(ui_view, s);
}
eina_value_free(width);
eina_value_free(height);
// As we have already waited for the property to be ready, we should get the right style now
if (!pd->style) return ;
model = efl_ui_view_model_get(ui_view);
// As we have already waited for the property to be ready, we should get the right style now
property = efl_model_property_get(model, pd->style);
if (!property) return ;
@ -89,34 +122,21 @@ _efl_ui_widget_factory_efl_ui_factory_building(const Eo *obj EINA_UNUSED, Efl_Ui
eina_value_free(property);
}
static int created_widgets = 0;
static Efl_Ui_Widget *
_efl_ui_widget_create(const Efl_Ui_Factory *factory,
const Efl_Class *klass, Eo *parent,
Efl_Model *model,
const Eina_Hash *parts)
Efl_Model *model)
{
Efl_Ui_Bind_Part_Data *bpd;
Eina_Iterator *it;
Efl_Ui_Widget *w;
w = efl_add(klass, parent,
efl_ui_view_model_set(efl_added, model),
efl_ui_factory_building(factory, efl_added));
if (!parts) return w;
it = eina_hash_iterator_data_new(parts);
EINA_ITERATOR_FOREACH(it, bpd)
{
Efl_Ui_Property_Bind_Data *bppd;
Eina_List *l;
EINA_LIST_FOREACH(bpd->properties, l, bppd)
efl_ui_property_bind(efl_part(w, bpd->part),
bppd->part_property,
bppd->model_property);
}
eina_iterator_free(it);
efl_ui_view_model_set(efl_added, model)
);
efl_ui_factory_building(factory, w);
created_widgets++;
printf("------------------------------------------------> WIDGETS %d\n", created_widgets);
return w;
}
@ -126,7 +146,7 @@ _efl_ui_widget_factory_create_then(Eo *model, void *data, const Eina_Value v EIN
Efl_Ui_Widget_Factory_Request *r = data;
Efl_Ui_Widget *w;
w = _efl_ui_widget_create(r->factory, r->pd->klass, r->parent, model, r->pd->parts);
w = _efl_ui_widget_create(r->factory, r->pd->klass, r->parent, model);
if (!w) return eina_value_error_init(ENOMEM);
return eina_value_object_init(w);
}
@ -168,7 +188,7 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data
EINA_ITERATOR_FOREACH(models, model)
{
w = _efl_ui_widget_create(obj, pd->klass, parent, model, pd->parts);
w = _efl_ui_widget_create(obj, pd->klass, parent, model);
if (!w) return efl_loop_future_rejected(obj, ENOMEM);
eina_value_array_append(&r, w);
@ -212,6 +232,8 @@ _efl_ui_widget_factory_efl_ui_factory_release(Eo *obj EINA_UNUSED,
Efl_Gfx_Entity *ui_view)
{
// We do not cache or track this item, just get rid of them asap
created_widgets--;
printf("------------------------------------------------> WIDGETS %d\n", created_widgets);
efl_del(ui_view);
}

View File

@ -182,6 +182,8 @@ pub_eo_files = [
'efl_ui_single_selectable.eo',
'efl_ui_position_manager_data_access_v1.eo',
'efl_ui_tab_bar_default_item.eo',
'efl_ui_collection_view.eo',
'efl_ui_collection_view_focus_manager.eo',
]
foreach eo_file : pub_eo_files
@ -939,7 +941,8 @@ elementary_src = [
'efl_ui_position_manager_entity.c',
'efl_ui_position_manager_list.c',
'efl_ui_position_manager_grid.c',
'efl_ui_tab_bar_default_item.c'
'efl_ui_tab_bar_default_item.c',
'efl_ui_collection_view.c',
]
elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl]