add a call to get the number of smart caluclation counts. very useful

for one evil situation in elementary factory.



SVN revision: 62856
This commit is contained in:
Carsten Haitzler 2011-08-26 12:26:45 +00:00
parent c20670baa2
commit 3c456311b3
4 changed files with 38 additions and 3 deletions

View File

@ -9753,6 +9753,24 @@ EAPI void evas_object_smart_calculate (Evas_Object *obj) EINA
*/
EAPI void evas_smart_objects_calculate (Evas *e);
/**
* This gets the internal counter that counts the number of smart calculations
*
* @param e The canvas to get the calculate counter from
*
* Whenever evas performs smart object calculations on the whole canvas
* it increments a counter by 1. This is the smart object calculate counter
* that this function returns the value of. It starts at the value of 0 and
* will increase (and eventually wrap around to negative values and so on) by
* 1 every time objects are calculated. You can use this counter to ensure
* you dont re-do calculations withint the same calculation generation/run
* if the calculations maybe cause self-feeding effects.
*
* @ingroup Evas_Smart_Object_Group
* @since 1.1
*/
EAPI int evas_smart_objects_calculate_count_get (const Evas *e);
/**
* Moves all children objects of a given smart object relative to a
* given offset.

View File

@ -122,7 +122,7 @@ evas_new(void)
e->name_hash = eina_hash_string_superfast_new(NULL);
#define EVAS_ARRAY_SET(E, Array) \
eina_array_step_set(&E->Array, sizeof (E->Array), 256);
eina_array_step_set(&E->Array, sizeof (E->Array), 4096);
EVAS_ARRAY_SET(e, delete_objects);
EVAS_ARRAY_SET(e, active_objects);

View File

@ -619,6 +619,15 @@ evas_smart_objects_calculate(Evas *e)
evas_call_smarts_calculate(e);
}
EAPI int
evas_smart_objects_calculate_count_get(const Evas *e)
{
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
return 0;
MAGIC_CHECK_END();
return e->smart_calc_count;
}
/**
* Call calculate() on all smart objects that need_recalculate.
*
@ -632,6 +641,7 @@ evas_call_smarts_calculate(Evas *e)
Eina_Array_Iterator it;
unsigned int i;
evas_event_freeze(e);
e->in_smart_calc++;
calculate = &e->calculate_objects;
for (i = 0; i < eina_array_count_get(calculate); ++i)
@ -654,7 +664,13 @@ evas_call_smarts_calculate(Evas *e)
obj->recalculate_cycle = 0;
}
e->in_smart_calc--;
if (e->in_smart_calc == 0) eina_array_clean(calculate);
if (e->in_smart_calc == 0)
{
eina_array_clean(calculate);
e->smart_calc_count++;
}
evas_event_thaw(e);
evas_event_thaw_eval(e);
}
EAPI void

View File

@ -304,7 +304,7 @@ struct _Evas
Eina_Array temporary_objects;
Eina_Array calculate_objects;
Eina_Array clip_changes;
Eina_List *post_events; // free me on evas_free
Evas_Callbacks *callbacks;
@ -316,6 +316,7 @@ struct _Evas
Eina_List *font_path;
int in_smart_calc;
int smart_calc_count;
Evas_Object *focused;
void *attach_data;