Edje: (trivial) Put the clipper/evas pointer in the base structure.

I say trivial in the sense it has no functional changes, however it's a large
patch.  Recommendation from Gustavo.

SVN revision: 58080
This commit is contained in:
Brett Nash 2011-03-25 03:21:07 +00:00
parent 0651665be0
commit 6894af9d5e
10 changed files with 60 additions and 57 deletions

View File

@ -469,7 +469,7 @@ _edje_import_image_file(Edje *ed, const char *path, int id)
int bytes;
/* Try to load the file */
im = evas_object_image_add(ed->evas);
im = evas_object_image_add(ed->base.evas);
if (!im) return EINA_FALSE;
evas_object_image_file_set(im, path, NULL);
@ -877,7 +877,7 @@ _edje_edit_group_references_update(Evas_Object *obj, const char *old_group_name,
// pc = ed->collection;
part_obj = edje_edit_object_add(ed->evas);
part_obj = edje_edit_object_add(ed->base.evas);
old = eina_stringshare_add(old_group_name);
@ -2138,26 +2138,26 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
rp->part = ep;
if (ep->type == EDJE_PART_TYPE_RECTANGLE)
rp->object = evas_object_rectangle_add(ed->evas);
rp->object = evas_object_rectangle_add(ed->base.evas);
else if (ep->type == EDJE_PART_TYPE_IMAGE || ep->type == EDJE_PART_TYPE_PROXY)
rp->object = evas_object_image_add(ed->evas);
rp->object = evas_object_image_add(ed->base.evas);
else if (ep->type == EDJE_PART_TYPE_TEXT)
{
_edje_text_part_on_add(ed, rp);
rp->object = evas_object_text_add(ed->evas);
rp->object = evas_object_text_add(ed->base.evas);
evas_object_text_font_source_set(rp->object, ed->path);
}
else if (ep->type == EDJE_PART_TYPE_SWALLOW ||
ep->type == EDJE_PART_TYPE_GROUP ||
ep->type == EDJE_PART_TYPE_EXTERNAL)
{
rp->object = evas_object_rectangle_add(ed->evas);
rp->object = evas_object_rectangle_add(ed->base.evas);
evas_object_color_set(rp->object, 0, 0, 0, 0);
evas_object_pass_events_set(rp->object, 1);
evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
}
else if (ep->type == EDJE_PART_TYPE_TEXTBLOCK)
rp->object = evas_object_textblock_add(ed->evas);
rp->object = evas_object_textblock_add(ed->base.evas);
else
ERR("wrong part type %i!", ep->type);
if (rp->object)
@ -2192,8 +2192,8 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
if (child)
_edje_real_part_swallow(rp, child);
}
evas_object_clip_set(rp->object, ed->clipper);
evas_object_show(ed->clipper);
evas_object_clip_set(rp->object, ed->base.clipper);
evas_object_show(ed->base.clipper);
}
/* Update table_parts */
@ -2293,7 +2293,7 @@ edje_edit_part_del(Evas_Object *obj, const char* part)
if (real->clip_to == rp)
{
evas_object_clip_set(real->object, ed->clipper);
evas_object_clip_set(real->object, ed->base.clipper);
real->clip_to = NULL;
}
if (real->drag && real->drag->confine_to == rp)
@ -2335,7 +2335,7 @@ edje_edit_part_del(Evas_Object *obj, const char* part)
/* if all parts are gone, hide the clipper */
if (ed->table_parts_size == 0)
evas_object_hide(ed->clipper);
evas_object_hide(ed->base.clipper);
edje_object_calc_force(obj);
@ -2544,9 +2544,9 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_
evas_object_clip_unset(rp->object);
}
evas_object_clip_set(rp->object, ed->clipper);
evas_object_clip_set(rp->object, ed->base.clipper);
if (rp->swallowed_object)
evas_object_clip_set(rp->swallowed_object, ed->clipper);
evas_object_clip_set(rp->swallowed_object, ed->base.clipper);
rp->part->clip_to_id = -1;
rp->clip_to = NULL;
@ -2729,7 +2729,7 @@ edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source
if (source)
{
rp->part->source = eina_stringshare_add(source);
child_obj = edje_object_add(ed->evas);
child_obj = edje_object_add(ed->base.evas);
edje_object_file_set(child_obj, ed->file->path, source);
_edje_real_part_swallow(rp, child_obj);
}
@ -7233,7 +7233,7 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p
Edje_Part_Collection *pc;
Eina_Bool ret = EINA_TRUE;
obj = edje_edit_object_add(ed->evas);
obj = edje_edit_object_add(ed->base.evas);
if (!edje_object_file_set(obj, ed->file->path, group)) return EINA_FALSE;
ef = eet_open(ed->file->path, EET_FILE_MODE_READ);

View File

@ -764,7 +764,7 @@ _edje_embryo_fn_get_mouse(Embryo_Program *ep, Embryo_Cell *params)
CHKPARAM(2);
ed = embryo_program_data_get(ep);
evas_pointer_canvas_xy_get(ed->evas, &x, &y);
evas_pointer_canvas_xy_get(ed->base.evas, &x, &y);
x -= ed->x;
y -= ed->y;
SETINT((int)x, params[1]);
@ -780,7 +780,7 @@ _edje_embryo_fn_get_mouse_buttons(Embryo_Program *ep, Embryo_Cell *params)
CHKPARAM(0);
ed = embryo_program_data_get(ep);
return evas_pointer_button_down_mask_get(ed->evas);
return evas_pointer_button_down_mask_get(ed->base.evas);
}
/* emit(sig[], src[]) */
@ -2564,7 +2564,7 @@ _edje_embryo_fn_part_swallow(Embryo_Program *ep, Embryo_Cell *params)
rp = ed->table_parts[part_id % ed->table_parts_size];
if (!rp) return 0;
new_obj = edje_object_add(ed->evas);
new_obj = edje_object_add(ed->base.evas);
if (!new_obj) return 0;
if (!edje_object_file_set(new_obj, ed->file->path, group_name))

View File

@ -516,7 +516,7 @@ _sel_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
sel = calloc(1, sizeof(Sel));
en->sel = eina_list_append(en->sel, sel);
ob = edje_object_add(en->rp->edje->evas);
ob = edje_object_add(en->rp->edje->base.evas);
edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source);
evas_object_smart_member_add(ob, smart);
evas_object_stack_below(ob, o);
@ -526,7 +526,7 @@ _sel_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
sel->obj_bg = ob;
en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_bg);
ob = edje_object_add(en->rp->edje->evas);
ob = edje_object_add(en->rp->edje->base.evas);
edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source2);
evas_object_smart_member_add(ob, smart);
evas_object_stack_above(ob, o);
@ -781,7 +781,7 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
sel = calloc(1, sizeof(Sel));
an->sel = eina_list_append(an->sel, sel);
ob = edje_object_add(en->rp->edje->evas);
ob = edje_object_add(en->rp->edje->base.evas);
edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source5);
evas_object_smart_member_add(ob, smart);
evas_object_stack_below(ob, o);
@ -791,7 +791,7 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
sel->obj_bg = ob;
en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_bg);
ob = edje_object_add(en->rp->edje->evas);
ob = edje_object_add(en->rp->edje->base.evas);
edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source6);
evas_object_smart_member_add(ob, smart);
evas_object_stack_above(ob, o);
@ -801,7 +801,7 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
sel->obj_fg = ob;
en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_fg);
ob = evas_object_rectangle_add(en->rp->edje->evas);
ob = evas_object_rectangle_add(en->rp->edje->base.evas);
evas_object_color_set(ob, 0, 0, 0, 0);
evas_object_smart_member_add(ob, smart);
evas_object_stack_above(ob, o);
@ -1763,8 +1763,8 @@ _edje_entry_init(Edje *ed)
evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_FOCUS_OUT, _edje_focus_out_cb, ed);
evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_DOWN, _edje_key_down_cb, ed);
evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_UP, _edje_key_up_cb, ed);
evas_event_callback_add(ed->evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed);
evas_event_callback_add(ed->evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed);
evas_event_callback_add(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed);
evas_event_callback_add(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed);
}
void
@ -1780,9 +1780,9 @@ _edje_entry_shutdown(Edje *ed)
evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_FOCUS_OUT, _edje_focus_out_cb);
evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_DOWN, _edje_key_down_cb);
evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_UP, _edje_key_up_cb);
if (evas_event_callback_del_full(ed->evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed) != ed)
if (evas_event_callback_del_full(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed) != ed)
ERR("could not unregister EVAS_CALLBACK_FOCUS_IN");
if (evas_event_callback_del_full(ed->evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed) != ed)
if (evas_event_callback_del_full(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed) != ed)
ERR("could not unregister EVAS_CALLBACK_FOCUS_OUT");
}
@ -1820,7 +1820,7 @@ _edje_entry_real_part_init(Edje_Real_Part *rp)
evas_object_textblock_replace_char_set(rp->object, "*");
}
en->cursor_bg = edje_object_add(rp->edje->evas);
en->cursor_bg = edje_object_add(rp->edje->base.evas);
edje_object_file_set(en->cursor_bg, rp->edje->path, rp->part->source3);
evas_object_smart_member_add(en->cursor_bg, rp->edje->obj);
evas_object_stack_below(en->cursor_bg, rp->object);
@ -1828,7 +1828,7 @@ _edje_entry_real_part_init(Edje_Real_Part *rp)
evas_object_pass_events_set(en->cursor_bg, EINA_TRUE);
rp->edje->subobjs = eina_list_append(rp->edje->subobjs, en->cursor_bg);
en->cursor_fg = edje_object_add(rp->edje->evas);
en->cursor_fg = edje_object_add(rp->edje->base.evas);
edje_object_file_set(en->cursor_fg, rp->edje->path, rp->part->source4);
evas_object_smart_member_add(en->cursor_fg, rp->edje->obj);
evas_object_stack_above(en->cursor_fg, rp->object);
@ -1870,7 +1870,7 @@ _edje_entry_real_part_init(Edje_Real_Part *rp)
if (!en->imf_context) goto done;
ecore_imf_context_client_window_set(en->imf_context, rp->object);
ecore_imf_context_client_canvas_set(en->imf_context, rp->edje->evas);
ecore_imf_context_client_canvas_set(en->imf_context, rp->edje->base.evas);
ecore_imf_context_retrieve_surrounding_callback_set(en->imf_context,
_edje_entry_imf_retrieve_surrounding_cb, rp->edje);

View File

@ -462,35 +462,35 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
switch (ep->type)
{
case EDJE_PART_TYPE_RECTANGLE:
rp->object = evas_object_rectangle_add(ed->evas);
rp->object = evas_object_rectangle_add(ed->base.evas);
break;
case EDJE_PART_TYPE_PROXY:
case EDJE_PART_TYPE_IMAGE:
rp->object = evas_object_image_add(ed->evas);
rp->object = evas_object_image_add(ed->base.evas);
break;
case EDJE_PART_TYPE_TEXT:
_edje_text_part_on_add(ed, rp);
rp->object = evas_object_text_add(ed->evas);
rp->object = evas_object_text_add(ed->base.evas);
evas_object_text_font_source_set(rp->object, ed->path);
break;
case EDJE_PART_TYPE_SWALLOW:
case EDJE_PART_TYPE_GROUP:
case EDJE_PART_TYPE_EXTERNAL:
rp->object = evas_object_rectangle_add(ed->evas);
rp->object = evas_object_rectangle_add(ed->base.evas);
evas_object_color_set(rp->object, 0, 0, 0, 0);
evas_object_pass_events_set(rp->object, 1);
evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
_edje_callbacks_focus_add(rp->object, ed, rp);
break;
case EDJE_PART_TYPE_TEXTBLOCK:
rp->object = evas_object_textblock_add(ed->evas);
rp->object = evas_object_textblock_add(ed->base.evas);
break;
case EDJE_PART_TYPE_BOX:
rp->object = evas_object_box_add(ed->evas);
rp->object = evas_object_box_add(ed->base.evas);
rp->anim = _edje_box_layout_anim_new(rp->object);
break;
case EDJE_PART_TYPE_TABLE:
rp->object = evas_object_table_add(ed->evas);
rp->object = evas_object_table_add(ed->base.evas);
break;
case EDJE_PART_TYPE_GRADIENT:
ERR("SPANK ! SPANK ! SPANK ! YOU ARE USING GRADIENT IN PART %s FROM GROUP %s INSIDE FILE %s !! THEY ARE NOW REMOVED !",
@ -524,7 +524,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
evas_object_precise_is_inside_set(rp->object, 1);
}
if (rp->part->clip_to_id < 0)
evas_object_clip_set(rp->object, ed->clipper);
evas_object_clip_set(rp->object, ed->base.clipper);
}
}
if (n > 0)
@ -670,9 +670,9 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
#ifdef EDJE_CALC_CACHE
ed->all_part_change = 1;
#endif
if ((evas_object_clipees_get(ed->clipper)) &&
if ((evas_object_clipees_get(ed->base.clipper)) &&
(evas_object_visible_get(obj)))
evas_object_show(ed->clipper);
evas_object_show(ed->base.clipper);
/* instantiate 'internal swallows' */
for (i = 0; i < ed->table_parts_size; i++)
@ -765,7 +765,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
}
}
child_obj = edje_object_add(ed->evas);
child_obj = edje_object_add(ed->base.evas);
group_path = eina_list_append(group_path, group_path_entry);
if (!_edje_object_file_set_internal(child_obj, file, source, group_path))
{

View File

@ -1757,7 +1757,7 @@ _elua_rect(lua_State *L)
elo->obj.is_evas_obj = 1;
elo->evas_obj = evas_object_rectangle_add(evas_object_evas_get(ed->obj));
evas_object_smart_member_add(elo->evas_obj, ed->obj);
evas_object_clip_set(elo->evas_obj, ed->clipper);
evas_object_clip_set(elo->evas_obj, ed->base.clipper);
evas_object_move(elo->evas_obj, ed->x, ed->y);
evas_object_resize(elo->evas_obj, 0, 0);
evas_object_data_set(elo->evas_obj, ELO, elo);

View File

@ -273,10 +273,10 @@ _edje_del(Edje *ed)
void
_edje_clean_objects(Edje *ed)
{
evas_object_del(ed->clipper);
ed->evas = NULL;
evas_object_del(ed->base.clipper);
ed->base.evas = NULL;
ed->obj = NULL;
ed->clipper = NULL;
ed->base.clipper = NULL;
}
void

View File

@ -969,8 +969,11 @@ typedef struct _Edje_Signals_Sources_Patterns Edje_Signals_Sources_Patterns;
struct _Edje
{
Evas_Object *clipper; /* a big rect to clip this Edje to */
Evas *evas; /* the Evas this Edje belongs to */
Evas_Object_Smart_Clipped_Data base;
/* This contains (or should):
Evas_Object *clipper; // a big rect to clip this Edje to
Evas *evas; // the Evas this Edje belongs to
*/
const Edje_Smart_Api *api;
const char *path;
const char *group;

View File

@ -128,7 +128,7 @@ _oid_track(Edje * ed, Evas_Object * o)
oi->ed = ed;
oi->obj = o;
evas_object_smart_member_add(oi->obj, oi->ed->obj);
evas_object_clip_set(oi->obj, oi->ed->clipper);
evas_object_clip_set(oi->obj, oi->ed->base.clipper);
evas_object_geometry_get(oi->obj, &(oi->x), &(oi->y), &(oi->w), &(oi->h));
snprintf(buf, sizeof(buf), "%i", oi->oid);
if (!si->oid.hash)

View File

@ -104,14 +104,14 @@ _edje_smart_add(Evas_Object *obj)
evas_object_smart_data_set(obj, ed);
}
ed->evas = evas_object_evas_get(obj);
ed->clipper = evas_object_rectangle_add(ed->evas);
evas_object_static_clip_set(ed->clipper, 1);
evas_object_smart_member_add(ed->clipper, obj);
evas_object_color_set(ed->clipper, 255, 255, 255, 255);
evas_object_move(ed->clipper, -10000, -10000);
evas_object_resize(ed->clipper, 20000, 20000);
evas_object_pass_events_set(ed->clipper, 1);
ed->base.evas = evas_object_evas_get(obj);
ed->base.clipper = evas_object_rectangle_add(ed->base.evas);
evas_object_static_clip_set(ed->base.clipper, 1);
evas_object_smart_member_add(ed->base.clipper, obj);
evas_object_color_set(ed->base.clipper, 255, 255, 255, 255);
evas_object_move(ed->base.clipper, -10000, -10000);
evas_object_resize(ed->base.clipper, 20000, 20000);
evas_object_pass_events_set(ed->base.clipper, 1);
ed->is_rtl = EINA_FALSE;
ed->have_objects = 1;
ed->references = 1;

View File

@ -5057,7 +5057,7 @@ _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow)
evas_object_smart_member_add(rp->swallowed_object, rp->edje->obj);
if (rp->clip_to)
evas_object_clip_set(rp->swallowed_object, rp->clip_to->object);
else evas_object_clip_set(rp->swallowed_object, rp->edje->clipper);
else evas_object_clip_set(rp->swallowed_object, rp->edje->base.clipper);
evas_object_stack_above(rp->swallowed_object, rp->object);
evas_object_event_callback_add(rp->swallowed_object,
EVAS_CALLBACK_FREE,