1. id3 album cover loader patches

2. i reduced list note memory usage by 20% - shoudl work better with malloc
as ti is now a power of 2 as well
3. optimised evas internals to make use of event freezes to make e17'sw menu
popups a LOT snappier
4. fixed using last member of list nodes - bad - shoudl use api as this is
private stuff really
5. added config profile stuff to e17  u can literally maintain multiple
config profiles and choose which one at any time etc.


SVN revision: 15864
This commit is contained in:
Carsten Haitzler 2005-07-22 10:28:11 +00:00
parent 898b69b88c
commit acc0701e10
13 changed files with 341 additions and 226 deletions

View File

@ -73,9 +73,7 @@ struct _Evas_List /** A linked list node */
void *data; /**< Pointer to list element payload */
Evas_List *next; /**< Next member in the list */
Evas_List *prev; /**< Previous member in the list */
Evas_List *last; /**< Private member. Don't use this */
int count; /**< Private member. Don't use this */
void *accounting; /**< Private list accounting info - don't touch */
};
struct _Evas_Rectangle /** A rectangle */

View File

@ -7,6 +7,7 @@ evas_object_clip_recalc(Evas_Object *obj)
int cx, cy, cw, ch, cvis, cr, cg, cb, ca;
int nx, ny, nw, nh, nvis, nr, ng, nb, na;
if (obj->layer->evas->events_frozen > 0) return;
evas_object_coords_recalc(obj);
cx = obj->cur.cache.geometry.x; cy = obj->cur.cache.geometry.y;
cw = obj->cur.cache.geometry.w; ch = obj->cur.cache.geometry.h;

View File

@ -4,8 +4,18 @@
int
evas_event_passes_through(Evas_Object *obj)
{
if (obj->layer->evas->events_frozen > 0) return 1;
if (obj->pass_events) return 1;
if (obj->smart.parent) return evas_event_passes_through(obj->smart.parent);
if (obj->parent_cache_valid) return obj->parent_pass_events;
if (obj->smart.parent)
{
int par_pass;
par_pass = evas_event_passes_through(obj->smart.parent);
obj->parent_cache_valid = 1;
obj->parent_pass_events = par_pass;
return par_pass;
}
return 0;
}
@ -115,6 +125,26 @@ evas_event_thaw(Evas *e)
return;
MAGIC_CHECK_END();
e->events_frozen--;
if (e->events_frozen == 0)
{
Evas_Object_List *l;
for (l = (Evas_Object_List *)e->layers; l; l = l->next)
{
Evas_Object_List *l2;
Evas_Layer *lay;
lay = (Evas_Layer *)l;
for (l2 = (Evas_Object_List *)lay->objects; l2; l2 = l2->next)
{
Evas_Object *obj;
obj = (Evas_Object *)l2;
evas_object_clip_recalc(obj);
evas_object_recalc_clippees(obj);
}
}
}
if (e->events_frozen < 0)
evas_debug_generic(" Thaw of events when already thawed!!!\n");
}
@ -820,6 +850,7 @@ evas_object_pass_events_set(Evas_Object *obj, Evas_Bool pass)
return;
MAGIC_CHECK_END();
obj->pass_events = pass;
evas_object_smart_member_cache_invalidate(obj);
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1))

View File

@ -111,10 +111,13 @@ evas_object_line_xy_set(Evas_Object *obj, Evas_Coord x1, Evas_Coord y1, Evas_Coo
MAGIC_CHECK_END();
if ((x1 == o->cur.x1) && (y1 == o->cur.y1) &&
(x2 == o->cur.x2) && (y2 == o->cur.y2)) return;
if (!evas_event_passes_through(obj))
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (obj->layer->evas->events_frozen != 0)
{
if (!evas_event_passes_through(obj))
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
}
if (x1 < x2)
{
min_x = x1;
@ -147,16 +150,19 @@ evas_object_line_xy_set(Evas_Object *obj, Evas_Coord x1, Evas_Coord y1, Evas_Coo
o->changed = 1;
evas_object_change(obj);
evas_object_coords_recalc(obj);
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
if ((is ^ was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (!evas_event_passes_through(obj))
{
if ((is ^ was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
}
}
evas_object_inform_call_move(obj);
evas_object_inform_call_resize(obj);

View File

@ -449,7 +449,7 @@ evas_object_del(Evas_Object *obj)
void
evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
int is, was = 0;
int is, was = 0, pass = 0;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
@ -467,28 +467,35 @@ evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
evas_object_inform_call_move(obj);
return;
}
if (!evas_event_passes_through(obj))
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (obj->layer->evas->events_frozen != 0)
{
pass = evas_event_passes_through(obj);
if (pass)
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
}
obj->cur.geometry.x = x;
obj->cur.geometry.y = y;
obj->cur.cache.geometry.validity = 0;
evas_object_change(obj);
evas_object_clip_dirty(obj);
evas_object_recalc_clippees(obj);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
if (!obj->smart.smart)
evas_object_recalc_clippees(obj);
if (!pass)
{
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is ^ was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
if (!obj->smart.smart)
{
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is ^ was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
}
}
}
evas_object_inform_call_move(obj);
@ -504,7 +511,7 @@ evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
void
evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
int is, was = 0;
int is, was = 0, pass = 0;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
@ -523,29 +530,36 @@ evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
evas_object_inform_call_resize(obj);
return;
}
if (!evas_event_passes_through(obj))
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (obj->layer->evas->events_frozen != 0)
{
pass = evas_event_passes_through(obj);
if (!pass)
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
}
obj->cur.geometry.w = w;
obj->cur.geometry.h = h;
obj->cur.cache.geometry.validity = 0;
evas_object_change(obj);
evas_object_clip_dirty(obj);
evas_object_recalc_clippees(obj);
// if (obj->func->coords_recalc) obj->func->coords_recalc(obj);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
if (!obj->smart.smart)
// if (obj->func->coords_recalc) obj->func->coords_recalc(obj);
if (!pass)
{
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is ^ was) && (obj->cur.visible))
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
if (!obj->smart.smart)
{
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is ^ was) && (obj->cur.visible))
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
}
}
}
evas_object_inform_call_resize(obj);
@ -618,18 +632,21 @@ evas_object_show(Evas_Object *obj)
obj->cur.visible = 1;
evas_object_change(obj);
evas_object_clip_dirty(obj);
evas_object_recalc_clippees(obj);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
if (!obj->smart.smart)
evas_object_recalc_clippees(obj);
if (!evas_event_passes_through(obj))
{
if (evas_object_is_in_output_rect(obj,
if (!obj->smart.smart)
{
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1))
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1))
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
obj->layer->evas->pointer.y,
NULL);
}
}
}
evas_object_inform_call_show(obj);
@ -661,48 +678,51 @@ evas_object_hide(Evas_Object *obj)
obj->cur.visible = 0;
evas_object_change(obj);
evas_object_clip_dirty(obj);
evas_object_recalc_clippees(obj);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
if (!obj->smart.smart)
evas_object_recalc_clippees(obj);
if (!evas_event_passes_through(obj))
{
if (evas_object_is_in_output_rect(obj,
if (!obj->smart.smart)
{
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1))
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1))
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
if (obj->mouse_grabbed > 0)
{
if (obj->layer->evas->pointer.mouse_grabbed >= obj->mouse_grabbed)
obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
}
{
obj->mouse_grabbed = 0;
if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
obj->layer->evas->pointer.y,
NULL);
if (obj->mouse_grabbed > 0)
{
obj->layer->evas->pointer.object.in = evas_list_remove(obj->layer->evas->pointer.object.in, obj);
if (obj->layer->evas->pointer.mouse_grabbed >= obj->mouse_grabbed)
obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
}
if (obj->layer->evas->events_frozen > 0)
{
obj->mouse_in = 0;
return;
}
if (obj->mouse_in)
{
Evas_Event_Mouse_Out ev;
obj->mouse_in = 0;
ev.buttons = obj->layer->evas->pointer.button;
ev.output.x = obj->layer->evas->pointer.x;
ev.output.y = obj->layer->evas->pointer.y;
ev.canvas.x = obj->layer->evas->pointer.canvas_x;
ev.canvas.y = obj->layer->evas->pointer.canvas_y;
ev.data = NULL;
ev.modifiers = &(obj->layer->evas->modifiers);
ev.locks = &(obj->layer->evas->locks);
evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
obj->mouse_grabbed = 0;
if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
{
obj->layer->evas->pointer.object.in = evas_list_remove(obj->layer->evas->pointer.object.in, obj);
}
if (obj->layer->evas->events_frozen > 0)
{
obj->mouse_in = 0;
return;
}
if (obj->mouse_in)
{
Evas_Event_Mouse_Out ev;
obj->mouse_in = 0;
ev.buttons = obj->layer->evas->pointer.button;
ev.output.x = obj->layer->evas->pointer.x;
ev.output.y = obj->layer->evas->pointer.y;
ev.canvas.x = obj->layer->evas->pointer.canvas_x;
ev.canvas.y = obj->layer->evas->pointer.canvas_y;
ev.data = NULL;
ev.modifiers = &(obj->layer->evas->modifiers);
ev.locks = &(obj->layer->evas->locks);
evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
}
}
}
}

View File

@ -105,10 +105,13 @@ evas_object_polygon_point_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
MAGIC_CHECK(o, Evas_Object_Polygon, MAGIC_OBJ_POLYGON);
return;
MAGIC_CHECK_END();
if (!evas_event_passes_through(obj))
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (obj->layer->evas->events_frozen != 0)
{
if (!evas_event_passes_through(obj))
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
}
p = malloc(sizeof(Evas_Polygon_Point));
if (!p) return;
p->x = x;
@ -142,16 +145,19 @@ evas_object_polygon_point_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
o->changed = 1;
evas_object_change(obj);
evas_object_coords_recalc(obj);
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
if ((is ^ was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (!evas_event_passes_through(obj))
{
if ((is ^ was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
}
}
evas_object_inform_call_move(obj);
evas_object_inform_call_resize(obj);

View File

@ -136,6 +136,7 @@ evas_object_smart_member_add(Evas_Object *obj, Evas_Object *smart_obj)
obj->smart.parent = smart_obj;
smart_obj->smart.contained = evas_list_append(smart_obj->smart.contained, obj);
evas_object_smart_member_cache_invalidate(obj);
}
/**
@ -155,6 +156,7 @@ evas_object_smart_member_del(Evas_Object *obj)
obj->smart.parent->smart.contained = evas_list_remove(obj->smart.parent->smart.contained, obj);
obj->smart.parent = NULL;
evas_object_smart_member_cache_invalidate(obj);
}
/**
@ -357,6 +359,21 @@ evas_object_smart_cleanup(Evas_Object *obj)
obj->smart.smart = NULL;
}
void
evas_object_smart_member_cache_invalidate(Evas_Object *obj)
{
Evas_List *l;
obj->parent_cache_valid = 0;
for (l = obj->smart.contained; l; l = l->next)
{
Evas_Object *obj2;
obj2 = l->data;
evas_object_smart_member_cache_invalidate(obj2);
}
}
/* all nice and private */
static void
evas_object_smart_init(Evas_Object *obj)

View File

@ -135,7 +135,7 @@ void
evas_object_text_font_set(Evas_Object *obj, const char *font, Evas_Font_Size size)
{
Evas_Object_Text *o;
int is, was = 0;
int is, was = 0, pass = 0;
int same_font = 0;
if (!font) return;
@ -152,10 +152,14 @@ evas_object_text_font_set(Evas_Object *obj, const char *font, Evas_Font_Size siz
same_font = 1;
if (size == o->cur.size) return;
}
if (!evas_event_passes_through(obj))
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (obj->layer->evas->events_frozen != 0)
{
pass = evas_event_passes_through(obj);
if (!pass)
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
}
/* DO IT */
if (o->engine_data)
{
@ -218,16 +222,19 @@ evas_object_text_font_set(Evas_Object *obj, const char *font, Evas_Font_Size siz
o->changed = 1;
evas_object_change(obj);
evas_object_coords_recalc(obj);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is ^ was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
if (!pass)
{
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is ^ was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
NULL);
}
}
evas_object_inform_call_resize(obj);
}

View File

@ -72,15 +72,18 @@ evas_object_raise(Evas_Object *obj)
}
obj->restack = 1;
evas_object_change(obj);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
if (!obj->smart.smart)
if (!evas_event_passes_through(obj))
{
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1) &&
obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, NULL);
if (!obj->smart.smart)
{
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1) &&
obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, NULL);
}
}
}
evas_object_inform_call_restack(obj);
@ -118,15 +121,18 @@ evas_object_lower(Evas_Object *obj)
}
obj->restack = 1;
evas_object_change(obj);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
if (!obj->smart.smart)
if (!evas_event_passes_through(obj))
{
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1) &&
obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, NULL);
if (!obj->smart.smart)
{
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1) &&
obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, NULL);
}
}
}
evas_object_inform_call_restack(obj);
@ -172,15 +178,18 @@ evas_object_stack_above(Evas_Object *obj, Evas_Object *above)
}
obj->restack = 1;
evas_object_change(obj);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
if (!obj->smart.smart)
if (!evas_event_passes_through(obj))
{
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1) &&
obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, NULL);
if (!obj->smart.smart)
{
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1) &&
obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, NULL);
}
}
}
evas_object_inform_call_restack(obj);
@ -226,15 +235,18 @@ evas_object_stack_below(Evas_Object *obj, Evas_Object *below)
}
obj->restack = 1;
evas_object_change(obj);
if (!evas_event_passes_through(obj))
if (obj->layer->evas->events_frozen != 0)
{
if (!obj->smart.smart)
if (!evas_event_passes_through(obj))
{
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1) &&
obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, NULL);
if (!obj->smart.smart)
{
if (evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1) &&
obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, NULL);
}
}
}
evas_object_inform_call_restack(obj);

View File

@ -4,6 +4,14 @@
#include "evas_common.h"
#include "evas_private.h"
typedef struct _Evas_List_Accounting Evas_List_Accounting;
struct _Evas_List_Accounting
{
Evas_List *last;
int count;
};
static int _evas_list_alloc_error = 0;
/**
@ -51,37 +59,27 @@ evas_list_append(Evas_List *list, const void *data)
return list;
}
new_l->next = NULL;
new_l->prev = NULL;
new_l->data = (void *)data;
if (!list)
{
new_l->last = new_l;
new_l->count = 1;
new_l->prev = NULL;
new_l->accounting = malloc(sizeof(Evas_List_Accounting));
if (!new_l->accounting)
{
_evas_list_alloc_error = 1;
free(new_l);
return list;
}
((Evas_List_Accounting *)(new_l->accounting))->last = new_l;
((Evas_List_Accounting *)(new_l->accounting))->count = 1;
return new_l;
}
if (list->last)
{
l = list->last;
l->next = new_l;
new_l->prev = l;
list->last = new_l;
list->count++;
return list;
}
else
{
for (l = list; l; l = l->next)
{
if (!l->next)
{
l->next = new_l;
new_l->prev = l;
list->last = new_l;
list->count++;
return list;
}
}
}
l = ((Evas_List_Accounting *)(list->accounting))->last;
l->next = new_l;
new_l->prev = l;
new_l->accounting = list->accounting;
((Evas_List_Accounting *)(list->accounting))->last = new_l;
((Evas_List_Accounting *)(list->accounting))->count++;
return list;
}
@ -128,15 +126,21 @@ evas_list_prepend(Evas_List *list, const void *data)
if (!list)
{
new_l->next = NULL;
new_l->last = new_l;
new_l->count = 1;
new_l->accounting = malloc(sizeof(Evas_List_Accounting));
if (!new_l->accounting)
{
_evas_list_alloc_error = 1;
free(new_l);
return list;
}
((Evas_List_Accounting *)(new_l->accounting))->last = new_l;
((Evas_List_Accounting *)(new_l->accounting))->count = 1;
return new_l;
}
new_l->next = list;
list->prev = new_l;
new_l->last = list->last;
list->last = NULL;
new_l->count = list->count + 1;
new_l->accounting = list->accounting;
((Evas_List_Accounting *)(list->accounting))->count++;
return new_l;
}
@ -206,8 +210,10 @@ evas_list_append_relative(Evas_List *list, const void *data, const void *relativ
l->next = new_l;
new_l->prev = l;
if (!new_l->next) list->last = new_l;
list->count++;
new_l->accounting = list->accounting;
((Evas_List_Accounting *)(list->accounting))->count++;
if (!new_l->next)
((Evas_List_Accounting *)(new_l->accounting))->last = new_l;
return list;
}
}
@ -281,19 +287,12 @@ evas_list_prepend_relative(Evas_List *list, const void *data, const void *relati
new_l->next = l;
if (l->prev) l->prev->next = new_l;
l->prev = new_l;
new_l->accounting = list->accounting;
((Evas_List_Accounting *)(list->accounting))->count++;
if (new_l->prev)
{
if (!new_l->next) list->last = new_l;
list->count++;
return list;
}
return list;
else
{
new_l->last = list->last;
list->last = NULL;
new_l->count = list->count + 1;
return new_l;
}
return new_l;
}
}
return evas_list_prepend(list, data);
@ -362,6 +361,7 @@ evas_list_remove_list(Evas_List *list, Evas_List *remove_list)
{
Evas_List *return_l;
if (!list) return NULL;
if (!remove_list) return list;
if (remove_list->next) remove_list->next->prev = remove_list->prev;
if (remove_list->prev)
@ -370,15 +370,13 @@ evas_list_remove_list(Evas_List *list, Evas_List *remove_list)
return_l = list;
}
else
{
if (remove_list->next)
remove_list->next->count = remove_list->count;
return_l = remove_list->next;
if (return_l) return_l->last = list->last;
}
if (remove_list == list->last) list->last = remove_list->prev;
return_l = remove_list->next;
if (remove_list == ((Evas_List_Accounting *)(list->accounting))->last)
((Evas_List_Accounting *)(list->accounting))->last = remove_list->prev;
((Evas_List_Accounting *)(list->accounting))->count--;
if (((Evas_List_Accounting *)(list->accounting))->count == 0)
free(list->accounting);
free(remove_list);
if (return_l) return_l->count--;
return return_l;
}
@ -479,6 +477,8 @@ evas_list_free(Evas_List *list)
{
Evas_List *l, *free_l;
if (!list) return NULL;
free(list->accounting);
for (l = list; l;)
{
free_l = l;
@ -523,7 +523,7 @@ Evas_List *
evas_list_last(Evas_List *list)
{
if (!list) return NULL;
return list->last;
return ((Evas_List_Accounting *)(list->accounting))->last;
}
/**
@ -640,7 +640,7 @@ int
evas_list_count(Evas_List *list)
{
if (!list) return 0;
return list->count;
return ((Evas_List_Accounting *)(list->accounting))->count;
}
/**
@ -668,8 +668,9 @@ evas_list_count(Evas_List *list)
void *
evas_list_nth(Evas_List *list, int n)
{
Evas_List *l = evas_list_nth_list(list, n);
Evas_List *l;
l = evas_list_nth_list(list, n);
return l ? l->data : NULL;
}
@ -702,14 +703,19 @@ evas_list_nth_list(Evas_List *list, int n)
Evas_List *l;
/* check for non-existing nodes */
if ((!list) || (n < 0) || (n > list->count - 1)) return NULL;
if ((!list) || (n < 0) ||
(n > ((Evas_List_Accounting *)(list->accounting))->count - 1))
return NULL;
/* if the node is in the 2nd half of the list, search from the end
* else, search from the beginning.
*/
if (n > list->count / 2)
if (n > (((Evas_List_Accounting *)(list->accounting))->count / 2))
{
for (i = list->count - 1, l = list->last; l; l = l->prev, i--)
for (i = ((Evas_List_Accounting *)(list->accounting))->count - 1,
l = ((Evas_List_Accounting *)(list->accounting))->last;
l;
l = l->prev, i--)
{
if (i == n) return l;
}
@ -753,7 +759,7 @@ evas_list_reverse(Evas_List *list)
if (!list) return NULL;
l1 = list;
l2 = list->last;
l2 = ((Evas_List_Accounting *)(list->accounting))->last;
while (l1 != l2)
{
void *data;
@ -859,31 +865,36 @@ evas_list_combine(Evas_List *l, Evas_List *ll, int (*func)(void *, void*))
Evas_List *
evas_list_sort(Evas_List *list, int size, int (*func)(void *, void *))
{
Evas_List *l = NULL, *ll = NULL;
Evas_List *l = NULL, *ll = NULL, *llast;
int mid;
if (!list || !func)
return NULL;
/* FIXME: this is really inefficient - calling evas_list_nth is not
* fast as it has to walk the list */
/* if the caller specified an invalid size, sort the whole list */
if (size <= 0 || size > list->count)
size = list->count;
if ((size <= 0) ||
(size > ((Evas_List_Accounting *)(list->accounting))->count))
size = ((Evas_List_Accounting *)(list->accounting))->count;
mid = size / 2;
if (mid < 1)
return list;
if (mid < 1) return list;
/* bleh evas list splicing */
llast = ((Evas_List_Accounting *)(list->accounting))->last;
ll = evas_list_nth_list(list, mid);
if (ll->prev)
{
list->last = ll->prev;
list->count = mid;
((Evas_List_Accounting *)(list->accounting))->last = ll->prev;
((Evas_List_Accounting *)(list->accounting))->count = mid;
ll->prev->next = NULL;
ll->prev = NULL;
}
ll->count = size - mid;
ll->accounting = malloc(sizeof(Evas_List_Accounting));
((Evas_List_Accounting *)(ll->accounting))->last = llast;
((Evas_List_Accounting *)(ll->accounting))->count = size - mid;
/* merge sort */
l = evas_list_sort(list, mid, func);

View File

@ -1,5 +1,6 @@
#include "evas_common.h"
#if 0
Regionbuf *
evas_common_regionbuf_new(int w, int h)
{
@ -353,3 +354,4 @@ evas_common_regionbuf_rects_get(Regionbuf *rb)
evas_common_regionbuf_clear(rb);
return rects;
}
#endif

View File

@ -160,10 +160,10 @@ typedef struct _Convert_Pal Convert_Pal;
typedef struct _Tilebuf Tilebuf;
typedef struct _Tilebuf_Tile Tilebuf_Tile;
typedef struct _Tilebuf_Rect Tilebuf_Rect;
/*
typedef struct _Regionbuf Regionbuf;
typedef struct _Regionspan Regionspan;
*/
typedef void (*Gfx_Func_Blend_Src_Dst) (DATA32 *src, DATA32 *dst, int len);
typedef void (*Gfx_Func_Blend_Color_Dst) (DATA32 src, DATA32 *dst, int len);
typedef void (*Gfx_Func_Blend_Src_Cmod_Dst) (DATA32 *src, DATA32 *dst, int len, DATA8 *rmod, DATA8 *gmod, DATA8 *bmod, DATA8 *amod);
@ -382,7 +382,7 @@ struct _Tilebuf
struct _Tilebuf_Tile
{
int redraw : 1;
unsigned char redraw : 1;
/* FIXME: need these flags later - but not now */
/*
int done : 1;
@ -400,7 +400,7 @@ struct _Tilebuf_Rect
Evas_Object_List _list_data;
int x, y, w, h;
};
/*
struct _Regionbuf
{
int w, h;
@ -412,7 +412,7 @@ struct _Regionspan
Evas_Object_List _list_data;
int x1, x2;
};
*/
struct _Cutout_Rect
{
Evas_Object_List _list_data;
@ -899,14 +899,15 @@ void evas_common_tilebuf_clear (Tilebuf *tb);
Tilebuf_Rect *evas_common_tilebuf_get_render_rects (Tilebuf *tb);
void evas_common_tilebuf_free_render_rects (Tilebuf_Rect *rects);
/*
Regionbuf *evas_common_regionbuf_new (int w, int h);
void evas_common_regionbuf_free (Regionbuf *rb);
void evas_common_regionbuf_clear (Regionbuf *rb);
void evas_common_regionbuf_span_add (Regionbuf *rb, int x1, int x2, int y);
void evas_common_regionbuf_span_del (Regionbuf *rb, int x1, int x2, int y);
Tilebuf_Rect *evas_common_regionbuf_rects_get (Regionbuf *rb);
*/
/****/
void evas_common_draw_init (void);

View File

@ -378,6 +378,8 @@ struct _Evas_Object
short store : 1;
short pass_events : 1;
short parent_pass_events : 1;
short parent_cache_valid : 1;
short repeat_events : 1;
short restack : 1;
short changed : 1;
@ -618,7 +620,8 @@ void evas_font_dir_cache_free(void);
char *evas_font_dir_cache_find(char *dir, char *font);
void evas_font_free(Evas *evas, void *font);
void *evas_font_load(Evas *evas, const char *name, const char *source, int size);
void evas_object_smart_member_cache_invalidate(Evas_Object *obj);
extern int _evas_alloc_error;
struct _Evas_Imaging_Image