edje: don't use 30K of pointers for an indirection in some event path.

This commit is contained in:
Cedric Bail 2013-04-07 11:39:20 +09:00
parent a645c8153f
commit 0cee296fa7
6 changed files with 34 additions and 36 deletions

View File

@ -523,6 +523,7 @@ open:
prev = ep2;
ep2 = edc->parts[ep2->dragable.event_id];
/* events_to may be used only with dragable */
if (!ep2->dragable.x && !ep2->dragable.y)
{
prev->dragable.event_id = -1;

View File

@ -107,9 +107,9 @@ _edje_mouse_down_signal_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, vo
_edje_emit(ed, buf, rp->part->name);
}
if (rp->events_to)
if (rp->part->dragable.event_id >= 0)
{
rp = rp->events_to;
rp = ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
if (!ignored)
{
snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
@ -167,9 +167,9 @@ _edje_mouse_up_signal_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void
_edje_emit(ed, buf, rp->part->name);
}
if (rp->events_to)
if (rp->part->dragable.event_id >= 0)
{
rp = rp->events_to;
rp = ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
if (!ignored)
{
snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
@ -221,7 +221,10 @@ _edje_mouse_move_signal_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, vo
ed = data;
rp = evas_object_data_get(obj, "real_part");
if (!rp) return;
if (rp->events_to) rp = rp->events_to;
if (rp->part->dragable.event_id >= 0)
{
rp = ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
}
ignored = rp->part->ignore_flags & ev->event_flags;

View File

@ -2226,10 +2226,10 @@ edje_edit_part_del(Evas_Object *obj, const char* part)
if (real->custom->rel2_to_y == rp) real->custom->rel2_to_y = NULL;
}
if (real->clip_to == rp)
if (real->part->clip_to_id == rp->part->id)
{
evas_object_clip_set(real->object, ed->base->clipper);
real->clip_to = NULL;
real->part->clip_to_id = -1;
}
if (real->drag && real->drag->confine_to == rp)
real->drag->confine_to = NULL;
@ -2472,9 +2472,11 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_
{
//printf("UnSet clip_to for part: %s\n", part);
if (rp->clip_to && rp->clip_to->object)
if (rp->part->clip_to_id >= 0)
{
evas_object_pointer_mode_set(rp->clip_to->object,
clip = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
evas_object_pointer_mode_set(clip->object,
EVAS_OBJECT_POINTER_MODE_AUTOGRAB);
evas_object_clip_unset(rp->object);
}
@ -2484,7 +2486,6 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_
evas_object_clip_set(rp->typedata.swallow->swallowed_object, ed->base->clipper);
rp->part->clip_to_id = -1;
rp->clip_to = NULL;
edje_object_calc_force(obj);
@ -2504,13 +2505,12 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_
}
rp->part->clip_to_id = clip->part->id;
rp->clip_to = clip;
evas_object_pass_events_set(rp->clip_to->object, 1);
evas_object_pointer_mode_set(rp->clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
evas_object_clip_set(rp->object, rp->clip_to->object);
evas_object_pass_events_set(clip->object, 1);
evas_object_pointer_mode_set(clip->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
evas_object_clip_set(rp->object, clip->object);
if (rp->typedata.swallow->swallowed_object)
evas_object_clip_set(rp->typedata.swallow->swallowed_object, rp->clip_to->object);
evas_object_clip_set(rp->typedata.swallow->swallowed_object, clip->object);
edje_object_calc_force(obj);

View File

@ -672,14 +672,16 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
}
if (rp->part->clip_to_id >= 0)
{
rp->clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
if (rp->clip_to &&
rp->clip_to->object &&
Edje_Real_Part *clip_to;
clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
if (clip_to &&
clip_to->object &&
rp->object)
{
evas_object_pass_events_set(rp->clip_to->object, 1);
evas_object_pointer_mode_set(rp->clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
evas_object_clip_set(rp->object, rp->clip_to->object);
evas_object_pass_events_set(clip_to->object, 1);
evas_object_pointer_mode_set(clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
evas_object_clip_set(rp->object, clip_to->object);
}
}
if (rp->drag)
@ -688,17 +690,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
}
/* replay events for dragable */
if (rp->part->dragable.event_id >= 0)
{
rp->events_to =
ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
/* events_to may be used only with dragable */
if (!rp->events_to->part->dragable.x &&
!rp->events_to->part->dragable.y)
rp->events_to = NULL;
}
if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
(rp->typedata.swallow))
{

View File

@ -1527,8 +1527,6 @@ struct _Edje_Real_Part
// WITH EDJE_CALC_CACHE: 307
Edje_Running_Program *program; // 4
Edje_Calc_Params *current; // 4
Edje_Real_Part *events_to; // 4
Edje_Real_Part *clip_to; // 4
#ifdef HAVE_EPHYSICS
Edje_Part_Description_Common *prev_description; // 4
EPhysics_Body *body; // 4

View File

@ -6418,8 +6418,13 @@ _edje_real_part_swallow(Edje *ed,
if (!obj_swallow) return;
rp->typedata.swallow->swallowed_object = obj_swallow;
evas_object_smart_member_add(rp->typedata.swallow->swallowed_object, ed->obj);
if (rp->clip_to)
evas_object_clip_set(rp->typedata.swallow->swallowed_object, rp->clip_to->object);
if (rp->part->clip_to_id >= 0)
{
Edje_Real_Part *clip_to;
clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
evas_object_clip_set(rp->typedata.swallow->swallowed_object, clip_to->object);
}
else evas_object_clip_set(rp->typedata.swallow->swallowed_object, ed->base->clipper);
evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
evas_object_event_callback_add(rp->typedata.swallow->swallowed_object,