and improve factory massively.. no more "hangs" while scrolling massiv
massive massive lists of buttons. SVN revision: 62857
This commit is contained in:
parent
24e9083fd6
commit
7704b55936
|
@ -4,14 +4,21 @@
|
|||
#endif
|
||||
#ifndef ELM_LIB_QUICKLAUNCH
|
||||
|
||||
// 64 ^ 5 = 1 billion (or so)
|
||||
//#define BLOK 64
|
||||
// homogenous layout
|
||||
//#define HOMOG 1
|
||||
|
||||
// 32 ^ 5 = 33mil
|
||||
#define BLOK 32
|
||||
// homogenous layout
|
||||
//#define HOMOG 1
|
||||
|
||||
static void
|
||||
fac_unrealize(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
||||
{
|
||||
// setting factory content to null deletes it
|
||||
printf("DELETE for factory %p\n", obj);
|
||||
printf("--------DELETE for factory %p [f: %p]\n", elm_factory_content_get(obj), obj);
|
||||
elm_factory_content_set(obj, NULL);
|
||||
}
|
||||
|
||||
|
@ -22,10 +29,12 @@ fac_realize_end(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
|||
Evas_Object *bx, *bt;
|
||||
int i;
|
||||
|
||||
printf("ADD for factory 4 %p [%i]\n", obj, (BLOK * (int)evas_object_data_get(obj, "num")));
|
||||
bx = elm_box_add(win);
|
||||
printf(" ADD lv 4 = %p [%i]\n", bx, (BLOK * (int)evas_object_data_get(obj, "num")));
|
||||
#ifdef HOMOG
|
||||
elm_box_homogeneous_set(bx, EINA_TRUE);
|
||||
|
||||
#endif
|
||||
|
||||
for (i = 0; i < BLOK; i++)
|
||||
{
|
||||
char buf[32];
|
||||
|
@ -52,10 +61,12 @@ fac_realize3(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
|||
Evas_Object *bx, *fc;
|
||||
int i;
|
||||
|
||||
printf("ADD for factory 3 %p [%i]\n", obj, (BLOK * (int)evas_object_data_get(obj, "num")));
|
||||
bx = elm_box_add(win);
|
||||
printf(" ADD lv 3 = %p [%i]\n", bx, (BLOK * (int)evas_object_data_get(obj, "num")));
|
||||
#ifdef HOMOG
|
||||
elm_box_homogeneous_set(bx, EINA_TRUE);
|
||||
|
||||
#endif
|
||||
|
||||
for (i = 0; i < BLOK; i++)
|
||||
{
|
||||
fc = elm_factory_add(win);
|
||||
|
@ -84,10 +95,12 @@ fac_realize2(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
|||
Evas_Object *bx, *fc;
|
||||
int i;
|
||||
|
||||
printf("ADD for factory 2 %p [%i]\n", obj, (BLOK * (int)evas_object_data_get(obj, "num")));
|
||||
bx = elm_box_add(win);
|
||||
printf(" ADD lv 2 = %p [%i]\n", bx, (BLOK * (int)evas_object_data_get(obj, "num")));
|
||||
#ifdef HOMOG
|
||||
elm_box_homogeneous_set(bx, EINA_TRUE);
|
||||
|
||||
#endif
|
||||
|
||||
for (i = 0; i < BLOK; i++)
|
||||
{
|
||||
fc = elm_factory_add(win);
|
||||
|
@ -116,10 +129,12 @@ fac_realize1(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
|||
Evas_Object *bx, *fc;
|
||||
int i;
|
||||
|
||||
printf("ADD for factory 1 %p [%i]\n", obj, (BLOK * (int)evas_object_data_get(obj, "num")));
|
||||
bx = elm_box_add(win);
|
||||
printf(" ADD lv 1 = %p [%i]\n", bx, (BLOK * (int)evas_object_data_get(obj, "num")));
|
||||
#ifdef HOMOG
|
||||
elm_box_homogeneous_set(bx, EINA_TRUE);
|
||||
|
||||
#endif
|
||||
|
||||
for (i = 0; i < BLOK; i++)
|
||||
{
|
||||
fc = elm_factory_add(win);
|
||||
|
@ -157,7 +172,9 @@ test_factory(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_inf
|
|||
evas_object_show(bg);
|
||||
|
||||
bx = elm_box_add(win);
|
||||
#ifdef HOMOG
|
||||
elm_box_homogeneous_set(bx, EINA_TRUE);
|
||||
#endif
|
||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
|
||||
for (i = 0; i < BLOK; i++)
|
||||
|
|
|
@ -7,6 +7,7 @@ struct _Widget_Data
|
|||
{
|
||||
Evas_Object *obj;
|
||||
Evas_Object *content;
|
||||
int last_calc_count;
|
||||
Eina_Bool eval : 1;
|
||||
};
|
||||
|
||||
|
@ -70,31 +71,46 @@ _eval(Evas_Object *obj)
|
|||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
|
||||
evas_event_freeze(evas_object_evas_get(obj));
|
||||
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||
if (w < 1) w = 1;
|
||||
if (h < 1) h = 1;
|
||||
evas_output_viewport_get(evas_object_evas_get(obj),
|
||||
&cvx, &cvy, &cvw, &cvh);
|
||||
// this is a hack to get things sane for now.
|
||||
if ((w < 10) || (h < 10) || (cvw < 1) || (cvh < 1)) return;
|
||||
if ((cvw < 1) || (cvh < 1)) return;
|
||||
// need some fuzz value thats beyond the current viewport
|
||||
// for now just make it the viewport * 3 in size (so 1 vp in each direction)
|
||||
/*
|
||||
cvx -= cvw;
|
||||
cvy -= cvh;
|
||||
cvw *= 3;
|
||||
cvh *= 3;
|
||||
*/
|
||||
if (ELM_RECTS_INTERSECT(x, y, w, h, cvx, cvy, cvw, cvh))
|
||||
{
|
||||
if (!wd->content)
|
||||
{
|
||||
printf("intersect: %i %i %ix%i | %i %i %ix%i\n",
|
||||
x, y, w, h, cvx, cvy, cvw, cvh);
|
||||
evas_object_smart_callback_call(obj, SIG_REALIZE, NULL);
|
||||
if (wd->content)
|
||||
{
|
||||
if (evas_object_smart_data_get(wd->content))
|
||||
evas_object_smart_calculate(wd->content);
|
||||
}
|
||||
wd->last_calc_count =
|
||||
evas_smart_objects_calculate_count_get(evas_object_evas_get(obj));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wd->content)
|
||||
evas_object_smart_callback_call(obj, SIG_UNREALIZE, NULL);
|
||||
{
|
||||
if (wd->last_calc_count !=
|
||||
evas_smart_objects_calculate_count_get(evas_object_evas_get(obj)))
|
||||
evas_object_smart_callback_call(obj, SIG_UNREALIZE, NULL);
|
||||
}
|
||||
}
|
||||
evas_event_thaw(evas_object_evas_get(obj));
|
||||
evas_event_thaw_eval(evas_object_evas_get(obj));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -177,6 +193,7 @@ elm_factory_add(Evas_Object *parent)
|
|||
evas_object_smart_callbacks_descriptions_set(obj, _signals);
|
||||
|
||||
wd->obj = obj;
|
||||
wd->last_calc_count = -1;
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int
|
|||
Evas_Object_Box_Option *opt;
|
||||
|
||||
_smart_extents_calculate(o, priv, horizontal, homogeneous);
|
||||
if (evas_object_smart_need_recalculate_get(o)) return;
|
||||
|
||||
evas_object_geometry_get(o, &x, &y, &w, &h);
|
||||
|
||||
|
|
Loading…
Reference in New Issue