evas - fix smart clipped if a move happens to recurse within itself

so since this uses new pos - cur pos to move BY x pixels... there is
an issue that if the move of the obj ends up re-moving the current obj
TO the same pos. it moved BY the same delta again thus racing ahead.
not great. because x/y is not stored until the call stack returns to
after the smart move func and the pos set storce the new position in
the object struct. the easiest way atm until we have relative
positioning etc. is to store this in the smart obj and use the delta
at that time of the call then store it immediately so a recursion ends
up with a delta of 0 if its the same pos, so go back to where we were.

this fixes a nasty issue i spotted in fileselector that made filesel
icons race along when scrolling 2x as fast as everything else. oddly i
couldnt see this in any other widget that scrolled when i looked...
which is odd, but... either way a nasty issue... subtle... and now
fixed. never saw this before so this seems new.
This commit is contained in:
Carsten Haitzler 2016-10-28 08:17:11 +09:00
parent 51eafa137d
commit b533f15880
3 changed files with 15 additions and 1 deletions

View File

@ -36,6 +36,8 @@ struct _Evas_Smart_Data
Evas_Smart_Cb_Description_Array callbacks_descriptions;
Evas_Coord x, y;
int walking_list;
int member_count; /** number of smart member objects */
@ -913,6 +915,17 @@ _evas_canvas_smart_objects_calculate_count_get(Eo *eo_e EINA_UNUSED, Evas_Public
return e->smart_calc_count;
}
void
_evas_object_smart_xy_update(Eo *eo_obj, Evas_Coord *px, Evas_Coord *py,
Evas_Coord x, Evas_Coord y)
{
EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj);
*px = o->x;
*py = o->y;
o->x = x;
o->y = y;
}
/**
* Call calculate() on all smart objects that need_recalculate.
*

View File

@ -86,7 +86,7 @@ evas_object_smart_clipped_smart_move(Evas_Object *eo_obj, Evas_Coord x, Evas_Coo
{
Evas_Coord orig_x, orig_y;
efl_gfx_position_get(eo_obj, &orig_x, &orig_y);
_evas_object_smart_xy_update(eo_obj, &orig_x, &orig_y, x, y);
evas_object_smart_move_children_relative(eo_obj, x - orig_x, y - orig_y);
}

View File

@ -1601,6 +1601,7 @@ void evas_object_smart_member_stack_above(Evas_Object *member, Evas_Object *othe
void evas_object_smart_member_stack_below(Evas_Object *member, Evas_Object *other);
const Eina_Inlist *evas_object_smart_members_get_direct(const Evas_Object *obj);
void _efl_canvas_group_group_members_all_del(Evas_Object *obj);
void _evas_object_smart_xy_update(Eo *eo_obj, Evas_Coord *px, Evas_Coord *py, Evas_Coord x, Evas_Coord y);
void evas_call_smarts_calculate(Evas *e);
void evas_object_smart_bounding_box_update(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj);
void evas_object_smart_need_bounding_box_update(Evas_Object *eo_obj, Evas_Smart_Data *o, Evas_Object_Protected_Data *obj);