From: SHILPA ONKAR SINGH <shilpa.singh@samsung.com>

Subject: [E-devel] [Edje]: Bug Fix: Edje draggable jumps when external
events is used.

Please find attached bug fix patch for edje draggable jump issue when
external event area is used.

Bug: When an external event area is used for edje draggable and when
after mouse move if immediate mouse down
is done then the draggable jumps back to its original position. 

Analysis: In  _edje_mouse_down_signal_cb  When an external event area
is set  i.e., when rp->events_to is set.  
tmp.x value is set to 0, need_reset is set to 1 and also
_edje_recalc_do is called including emitting "drag" signal. this code
is 
unnecessary/buggy  and instead it causes the jump.
1. In mouse down only drag->down.x and drag->down.y needs to be set
which is being set below and tmp value need not be reset to 
0 as tmp value is calculated in mouse move based on drag->down.x and
drag->down.y values.
2. need_reset is already set in mouse up hence need not be set in
mouse down again.
3. edje_recalc_do is the function which actually causes the movement
of draggable based on tmp value hence need not be called in mouse down.
because of the above code race condition happens and as tmp value is
being set to 0 and need reset is also enabled the draggable jumps back
to where it
started.
4. "drag": is sent even before "drag,start" [ should not /need not be
sent in mouse down ]
All the above code is added only when external event area is set and
the above code is not even related to whether external event is set or
not.

Solution: When an external event area is set directly equating rp =
rp->events_to and sending mouse,down would be enough, as down.x and
down.y is set below
including sending drag,start. Recalc_do should be called only in mouse
move as its responsible for movement including setting tmp value.
need_reset is already set in mouse up. drag should not be sent from
mouse down.


Change Description:
Bug Fix: Edje Draggable jumps when mouse down is done immediately
after mouse move when an external 
event area is used.

demo edc pasted below to reproduce the issue.
Please find attached bug fix patch for edje draggable jump issue when external event area is used.

Bug: When an external event area is used for edje draggable and when after mouse move if immediate mouse down
is done then the draggable jumps back to its original position. 

Analysis: In  _edje_mouse_down_signal_cb  When an external event area is set  i.e., when rp->events_to is set.  
tmp.x value is set to 0, need_reset is set to 1 and also _edje_recalc_do is called including emitting "drag" signal. this code is 
unnecessary/buggy  and instead it causes the jump.
1. In mouse down only drag->down.x and drag->down.y needs to be set which is being set below and tmp value need not be reset to 
0 as tmp value is calculated in mouse move based on drag->down.x and drag->down.y values.
2. need_reset is already set in mouse up hence need not be set in mouse down again.
3. edje_recalc_do is the function which actually causes the movement of draggable based on tmp value hence need not be called in mouse down.
because of the above code race condition happens and as tmp value is being set to 0 and need reset is also enabled the draggable jumps back to where it
started.
4. "drag": is sent even before "drag,start" [ should not /need not be sent in mouse down ]
All the above code is added only when external event area is set and the above code is not even related to whether external event is set or not.

Solution: When an external event area is set directly equating rp = rp->events_to and sending mouse,down would be enough, as down.x and down.y is set below
including sending drag,start. Recalc_do should be called only in mouse move as its responsible for movement including setting tmp value. need_reset is already set in mouse up. drag should not be sent from mouse down.


Change Description:
Bug Fix: Edje Draggable jumps when mouse down is done immediately after mouse move when an external 
event area is used.

demo edc pasted below to reproduce the issue.
Please find attached bug fix patch for edje draggable jump issue when
external event area is used.

Bug: When an external event area is used for edje draggable and when
after mouse move if immediate mouse down
is done then the draggable jumps back to its original position. 

Analysis: In  _edje_mouse_down_signal_cb  When an external event area
is set  i.e., when rp->events_to is set.  
tmp.x value is set to 0, need_reset is set to 1 and also
_edje_recalc_do is called including emitting "drag" signal. this code
is 
unnecessary/buggy  and instead it causes the jump.
1. In mouse down only drag->down.x and drag->down.y needs to be set
which is being set below and tmp value need not be reset to 
0 as tmp value is calculated in mouse move based on drag->down.x and
drag->down.y values.
2. need_reset is already set in mouse up hence need not be set in
mouse down again.
3. edje_recalc_do is the function which actually causes the movement
of draggable based on tmp value hence need not be called in mouse down.
because of the above code race condition happens and as tmp value is
being set to 0 and need reset is also enabled the draggable jumps back
to where it
started.
4. "drag": is sent even before "drag,start" [ should not /need not be
sent in mouse down ]
All the above code is added only when external event area is set and
the above code is not even related to whether external event is set or
not.

Solution: When an external event area is set directly equating rp =
rp->events_to and sending mouse,down would be enough, as down.x and
down.y is set below
including sending drag,start. Recalc_do should be called only in mouse
move as its responsible for movement including setting tmp value.
need_reset is already set in mouse up. drag should not be sent from
mouse down.


Change Description:
Bug Fix: Edje Draggable jumps when mouse down is done immediately
after mouse move when an external 
event area is used.

demo edc pasted below to reproduce the issue.

Please find attached bug fix patch for edje draggable jump issue when external event area is used.
  
  Bug: When an external event area is used for edje draggable and when after mouse move if immediate mouse down
is done then the draggable jumps back to its original position. 
  
  Analysis: In  _edje_mouse_down_signal_cb  When an external event area is set  i.e., when rp->events_to is set.  
  tmp.x value is set to 0, need_reset is set to 1 and also _edje_recalc_do is called including emitting "drag" signal. this code is 
unnecessary/buggy  and instead it causes the jump.
  1. In mouse down only drag->down.x and drag->down.y needs to be set which is being set below and tmp value need not be reset to 
0 as tmp value is calculated in mouse move based on drag->down.x and drag->down.y values.
  2. need_reset is already set in mouse up hence need not be set in mouse down again.
  3. edje_recalc_do is the function which actually causes the movement of draggable based on tmp value hence need not be called in mouse down.
  because of the above code race condition happens and as tmp value is being set to 0 and need reset is also enabled the draggable jumps back to where it
started.
  4. "drag": is sent even before "drag,start" [ should not /need not be sent in mouse down ]
All the above code is added only when external event area is set and the above code is not even related to whether external event is set or not.
  
  Solution: When an external event area is set directly equating rp = rp->events_to and sending mouse,down would be enough, as down.x and down.y is set below
including sending drag,start. Recalc_do should be called only in mouse move as its responsible for movement including setting tmp value. need_reset is already set in mouse up. drag should not be sent from mouse down.
  
  
  Change Description:
Bug Fix: Edje Draggable jumps when mouse down is done immediately after mouse move when an external 
event area is used.



SVN revision: 71277
This commit is contained in:
SHILPA ONKAR SINGH 2012-05-21 10:08:18 +00:00 committed by Carsten Haitzler
parent a028e6d566
commit 510cada94b
2 changed files with 11 additions and 58 deletions

View File

@ -466,3 +466,8 @@
2012-05-20 Cedric Bail
* Use Eina_File instead of fopen when possible in edje_cc.
2012-05-21 Shilpa Onkar Singh
* Fix patch for edje draggable jump issue when external event
area is used for the dragable.

View File

@ -109,64 +109,12 @@ _edje_mouse_down_signal_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, voi
if (rp->events_to)
{
int x = 0, y = 0;
Edje_Real_Part *events;
events = rp->events_to;
evas_object_geometry_get(rp->object, &x, &y, NULL, NULL);
if ((events->part->dragable.x) || (events->part->dragable.y))
{
if (events->part->dragable.x)
{
events->drag->down.x = ev->canvas.x;
events->drag->tmp.x = 0;
}
if (events->part->dragable.y)
{
events->drag->down.y = ev->canvas.y;
events->drag->tmp.y = 0;
}
if (!ignored)
{
snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
_edje_emit(ed, buf, events->part->name);
}
ed->dirty = 1;
ed->recalc_call = 1;
#ifdef EDJE_CALC_CACHE
rp->invalidate = 1;
#endif
}
_edje_recalc_do(ed);
/*
_edje_thaw(ed);
_edje_unref(ed);
_edje_ref(ed);
_edje_freeze(ed);
*/
rp = events;
{
FLOAT_T dx = ZERO, dy = ZERO;
_edje_part_dragable_calc(ed, rp, &dx, &dy);
if ((dx != rp->drag->val.x) || (dy != rp->drag->val.y))
{
rp->drag->val.x = dx;
rp->drag->val.y = dy;
if (!ignored)
_edje_emit(ed, "drag", rp->part->name);
ed->recalc_call = 1;
ed->dirty = 1;
#ifdef EDJE_CALC_CACHE
rp->invalidate = 1;
#endif
rp->drag->need_reset = 1;
_edje_recalc_do(ed);
}
}
rp = rp->events_to;
if (!ignored)
{
snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
_edje_emit(ed, buf, rp->part->name);
}
}
if (rp->drag)