forked from enlightenment/efl
elementary: add thaw/freeze to Elm_Layout and use it in Elm_Calendar.
NOTE: This improve calendar performance quite a lot, but a better improvement would be to populate the object when we really need it. I don't know how to do that in current Elementary source code. Reason for another expected massive improvement is that every time you set a property on an Elm_Calendar trigger a populate and that one is costly (Around 6 populates call per Elm_Calendar in our code example, meaning doing it could give us a 6 times boost...). SVN revision: 74553
This commit is contained in:
parent
937958c2da
commit
5e5d86df36
|
@ -354,3 +354,6 @@
|
||||||
|
|
||||||
* Patch in incomplete access supoprt in popup.
|
* Patch in incomplete access supoprt in popup.
|
||||||
|
|
||||||
|
2012-07-30 Cedric Bail
|
||||||
|
|
||||||
|
* Allow freeze/thaw on Elm_Layout and reduce number of object update.
|
||||||
|
|
|
@ -31,6 +31,7 @@ Fixes:
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
* Allocate once and reuse Evas_Map.
|
* Allocate once and reuse Evas_Map.
|
||||||
|
* Allow freeze/thaw on Elm_Layout and reduce number of object update.
|
||||||
|
|
||||||
Removal:
|
Removal:
|
||||||
|
|
||||||
|
|
|
@ -269,6 +269,8 @@ _populate(Evas_Object *obj)
|
||||||
|
|
||||||
ELM_CALENDAR_DATA_GET(obj, sd);
|
ELM_CALENDAR_DATA_GET(obj, sd);
|
||||||
|
|
||||||
|
elm_layout_freeze(obj);
|
||||||
|
|
||||||
if (sd->today_it > 0) _not_today(sd);
|
if (sd->today_it > 0) _not_today(sd);
|
||||||
|
|
||||||
maxdays = _maxdays_get(&sd->shown_time);
|
maxdays = _maxdays_get(&sd->shown_time);
|
||||||
|
@ -433,6 +435,8 @@ _populate(Evas_Object *obj)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elm_layout_thaw(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -442,12 +446,16 @@ _set_headers(Evas_Object *obj)
|
||||||
int i;
|
int i;
|
||||||
ELM_CALENDAR_DATA_GET(obj, sd);
|
ELM_CALENDAR_DATA_GET(obj, sd);
|
||||||
|
|
||||||
|
elm_layout_freeze(obj);
|
||||||
|
|
||||||
for (i = 0; i < ELM_DAY_LAST; i++)
|
for (i = 0; i < ELM_DAY_LAST; i++)
|
||||||
{
|
{
|
||||||
part[3] = i + '0';
|
part[3] = i + '0';
|
||||||
elm_layout_text_set
|
elm_layout_text_set
|
||||||
(obj, part, sd->weekdays[(i + sd->first_week_day) % ELM_DAY_LAST]);
|
(obj, part, sd->weekdays[(i + sd->first_week_day) % ELM_DAY_LAST]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elm_layout_thaw(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -458,9 +466,13 @@ _elm_calendar_smart_theme(Evas_Object *obj)
|
||||||
if (!ELM_WIDGET_CLASS(_elm_calendar_parent_sc)->theme(obj))
|
if (!ELM_WIDGET_CLASS(_elm_calendar_parent_sc)->theme(obj))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
elm_layout_freeze(obj);
|
||||||
|
|
||||||
_set_headers(obj);
|
_set_headers(obj);
|
||||||
_populate(obj);
|
_populate(obj);
|
||||||
|
|
||||||
|
elm_layout_thaw(obj);
|
||||||
|
|
||||||
edje_object_message_signal_process(ELM_WIDGET_DATA(sd)->resize_obj);
|
edje_object_message_signal_process(ELM_WIDGET_DATA(sd)->resize_obj);
|
||||||
|
|
||||||
elm_layout_sizing_eval(obj);
|
elm_layout_sizing_eval(obj);
|
||||||
|
@ -803,11 +815,15 @@ _elm_calendar_smart_add(Evas_Object *obj)
|
||||||
|
|
||||||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||||
|
|
||||||
|
elm_layout_freeze(obj);
|
||||||
|
|
||||||
elm_layout_theme_set(obj, "calendar", "base", elm_object_style_get(obj));
|
elm_layout_theme_set(obj, "calendar", "base", elm_object_style_get(obj));
|
||||||
|
|
||||||
_set_headers(obj);
|
_set_headers(obj);
|
||||||
_populate(obj);
|
_populate(obj);
|
||||||
|
|
||||||
|
elm_layout_thaw(obj);
|
||||||
|
|
||||||
elm_layout_sizing_eval(obj);
|
elm_layout_sizing_eval(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1086,8 +1102,13 @@ elm_calendar_first_day_of_week_set(Evas_Object *obj,
|
||||||
if (sd->first_week_day != day)
|
if (sd->first_week_day != day)
|
||||||
{
|
{
|
||||||
sd->first_week_day = day;
|
sd->first_week_day = day;
|
||||||
|
|
||||||
|
elm_layout_freeze(obj);
|
||||||
|
|
||||||
_set_headers(obj);
|
_set_headers(obj);
|
||||||
_populate(obj);
|
_populate(obj);
|
||||||
|
|
||||||
|
elm_layout_thaw(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,7 @@ _on_sub_object_size_hint_change(void *data,
|
||||||
void *event_info __UNUSED__)
|
void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
ELM_LAYOUT_DATA_GET(data, sd);
|
ELM_LAYOUT_DATA_GET(data, sd);
|
||||||
|
if (ELM_WIDGET_DATA(sd)->frozen) return ;
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(data);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,6 +452,7 @@ _elm_layout_smart_sub_object_del(Evas_Object *obj,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ELM_WIDGET_DATA(sd)->frozen) return EINA_TRUE;
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -655,7 +657,10 @@ _elm_layout_smart_text_set(Evas_Object *obj,
|
||||||
|
|
||||||
_text_signal_emit(sd, sub_d, !!text);
|
_text_signal_emit(sd, sub_d, !!text);
|
||||||
|
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
if (!ELM_WIDGET_DATA(sd)->frozen)
|
||||||
|
{
|
||||||
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
|
}
|
||||||
|
|
||||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON &&
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON &&
|
||||||
ELM_WIDGET_DATA(sd)->can_access && !(sub_d->obj))
|
ELM_WIDGET_DATA(sd)->can_access && !(sub_d->obj))
|
||||||
|
@ -734,6 +739,7 @@ _elm_layout_smart_content_set(Evas_Object *obj,
|
||||||
_icon_signal_emit(sd, sub_d, EINA_TRUE);
|
_icon_signal_emit(sd, sub_d, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ELM_WIDGET_DATA(sd)->frozen) return EINA_TRUE;
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -827,6 +833,7 @@ _elm_layout_smart_box_append(Evas_Object *obj,
|
||||||
sub_d->obj = child;
|
sub_d->obj = child;
|
||||||
sd->subs = eina_list_append(sd->subs, sub_d);
|
sd->subs = eina_list_append(sd->subs, sub_d);
|
||||||
|
|
||||||
|
if (ELM_WIDGET_DATA(sd)->frozen) return EINA_TRUE;
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -862,6 +869,7 @@ _elm_layout_smart_box_prepend(Evas_Object *obj,
|
||||||
sub_d->obj = child;
|
sub_d->obj = child;
|
||||||
sd->subs = eina_list_prepend(sd->subs, sub_d);
|
sd->subs = eina_list_prepend(sd->subs, sub_d);
|
||||||
|
|
||||||
|
if (ELM_WIDGET_DATA(sd)->frozen) return EINA_TRUE;
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -913,6 +921,7 @@ _elm_layout_smart_box_insert_before(Evas_Object *obj,
|
||||||
evas_object_event_callback_add
|
evas_object_event_callback_add
|
||||||
((Evas_Object *)reference, EVAS_CALLBACK_DEL, _box_reference_del, sub_d);
|
((Evas_Object *)reference, EVAS_CALLBACK_DEL, _box_reference_del, sub_d);
|
||||||
|
|
||||||
|
if (ELM_WIDGET_DATA(sd)->frozen) return EINA_TRUE;
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -951,6 +960,7 @@ _elm_layout_smart_box_insert_at(Evas_Object *obj,
|
||||||
sub_d->p.box.pos = pos;
|
sub_d->p.box.pos = pos;
|
||||||
sd->subs = eina_list_append(sd->subs, sub_d);
|
sd->subs = eina_list_append(sd->subs, sub_d);
|
||||||
|
|
||||||
|
if (ELM_WIDGET_DATA(sd)->frozen) return EINA_TRUE;
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -1093,6 +1103,7 @@ _elm_layout_smart_table_pack(Evas_Object *obj,
|
||||||
sub_d->p.table.rowspan = rowspan;
|
sub_d->p.table.rowspan = rowspan;
|
||||||
sd->subs = eina_list_append(sd->subs, sub_d);
|
sd->subs = eina_list_append(sd->subs, sub_d);
|
||||||
|
|
||||||
|
if (ELM_WIDGET_DATA(sd)->frozen) return EINA_TRUE;
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -1199,6 +1210,7 @@ _elm_layout_smart_add(Evas_Object *obj)
|
||||||
(ELM_WIDGET_DATA(priv)->resize_obj, "size,eval", "elm",
|
(ELM_WIDGET_DATA(priv)->resize_obj, "size,eval", "elm",
|
||||||
_on_size_evaluate_signal, obj);
|
_on_size_evaluate_signal, obj);
|
||||||
|
|
||||||
|
if (ELM_WIDGET_DATA(priv)->frozen) return ;
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(priv)->api)->sizing_eval(obj);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(priv)->api)->sizing_eval(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1603,6 +1615,36 @@ elm_layout_sizing_eval(Evas_Object *obj)
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
elm_layout_freeze(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
ELM_LAYOUT_CHECK(obj) 0;
|
||||||
|
ELM_LAYOUT_DATA_GET(obj, sd);
|
||||||
|
|
||||||
|
if ((ELM_WIDGET_DATA(sd)->frozen)++ != 0)
|
||||||
|
return ELM_WIDGET_DATA(sd)->frozen;
|
||||||
|
|
||||||
|
edje_object_freeze(ELM_WIDGET_DATA(sd)->resize_obj);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
elm_layout_thaw(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
ELM_LAYOUT_CHECK(obj) 0;
|
||||||
|
ELM_LAYOUT_DATA_GET(obj, sd);
|
||||||
|
|
||||||
|
if (--(ELM_WIDGET_DATA(sd)->frozen) != 0)
|
||||||
|
return ELM_WIDGET_DATA(sd)->frozen;
|
||||||
|
|
||||||
|
edje_object_thaw(ELM_WIDGET_DATA(sd)->resize_obj);
|
||||||
|
|
||||||
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
elm_layout_part_cursor_set(Evas_Object *obj,
|
elm_layout_part_cursor_set(Evas_Object *obj,
|
||||||
const char *part_name,
|
const char *part_name,
|
||||||
|
|
|
@ -189,6 +189,34 @@ EAPI Evas_Object *elm_layout_add(Evas_Object *parent);
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool elm_layout_file_set(Evas_Object *obj, const char *file, const char *group);
|
EAPI Eina_Bool elm_layout_file_set(Evas_Object *obj, const char *file, const char *group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Freezes the Elementary layout object.
|
||||||
|
*
|
||||||
|
* @param obj A handle to an Elementary layout object.
|
||||||
|
* @return The frozen state or 0 on Error
|
||||||
|
*
|
||||||
|
* This function puts all changes on hold. Successive freezes will
|
||||||
|
* nest, requiring an equal number of thaws.
|
||||||
|
*
|
||||||
|
* @see elm_layout_thaw()
|
||||||
|
*/
|
||||||
|
EAPI int elm_layout_freeze(Evas_Object *obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Thaws the Elementary object.
|
||||||
|
*
|
||||||
|
* @param obj A handle to an Elementary layout object.
|
||||||
|
* @return The frozen state or 0 if the object is not frozen or on error.
|
||||||
|
*
|
||||||
|
* This function thaws the given Edje object and the Elementary sizing calc.
|
||||||
|
*
|
||||||
|
* @note: If sucessives freezes were done, an equal number of
|
||||||
|
* thaws will be required.
|
||||||
|
*
|
||||||
|
* @see elm_layout_freeze()
|
||||||
|
*/
|
||||||
|
EAPI int elm_layout_thaw(Evas_Object *obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the edje group from the elementary theme that will be used as layout
|
* Set the edje group from the elementary theme that will be used as layout
|
||||||
*
|
*
|
||||||
|
|
|
@ -487,6 +487,8 @@ typedef struct _Elm_Widget_Smart_Data
|
||||||
Evas_Coord *w,
|
Evas_Coord *w,
|
||||||
Evas_Coord *h);
|
Evas_Coord *h);
|
||||||
|
|
||||||
|
int frozen;
|
||||||
|
|
||||||
Eina_Bool drag_x_locked : 1;
|
Eina_Bool drag_x_locked : 1;
|
||||||
Eina_Bool drag_y_locked : 1;
|
Eina_Bool drag_y_locked : 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue