Enlightenment CVS committal
Author : rephorm
Project : e17
Module : proto
Dir : e17/proto/esmart/src/container
Modified Files:
container.c container.h container_plugin.c
Log Message:
...don't segv on setting/freeing plugins
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/esmart/src/container/container.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- container.c 13 Jan 2004 19:49:02 -0000 1.9
+++ container.c 14 Jan 2004 04:32:02 -0000 1.10
@@ -297,6 +297,31 @@
if (cont->plugin && cont->plugin->scroll_to)
cont->plugin->scroll_to(cont, el);
}
+
+double
+e_container_elements_orig_length_get(Evas_Object *container)
+{
+ Container *cont;
+ Evas_List *l;
+ double length = 0;
+
+ cont = _container_fetch(container);
+ if (!cont) return 0.0;
+
+ for (l = cont->elements; l; l = l->next)
+ {
+ Container_Element *el = l->data;
+ double w, h;
+
+ evas_object_geometry_get(el->obj, NULL, NULL, &w, &h);
+
+ length += cont->direction ? el->orig_h : el->orig_w;
+ }
+
+ return length;
+}
+
+
/**************** internal functions *******************/
Container_Element *
@@ -340,247 +365,6 @@
cont->plugin->layout(cont);
}
-void
-_contianer_elements_layout_normal(Container *cont)
-{
- Evas_List *l;
- double ax, ay, aw, ah; // element area geom
- double ix, iy, iw, ih; // new x, y, w, h
- double L; // length of all objects at original size (for nonhomog)
- int num; // number of elements
- double error = 0;
- int r,g,b;
-
- /* FIXME: add a 'changed' flag to prevent excessive recalcs */
-
-// evas_object_geometry_get(cont->grabber, &ax, &ay, &aw, &ah);
- ax = cont->x;
- ay = cont->y;
- aw = cont->w;
- ah = cont->h;
-
- /* adjust for padding */
- ax += cont->padding.l;
- ay += cont->padding.t;
- aw -= cont->padding.l + cont->padding.r;
- ah -= cont->padding.t + cont->padding.b;
-
- if (aw == 0 || ah == 0)
- return;
-
- ix = ax;
- iy = ay;
-
- if (cont->direction) iy += cont->scroll_offset;
- else ix += cont->scroll_offset;
-
- L = e_container_elements_orig_length_get(cont->obj);
- num = evas_list_count(cont->elements);
-
-
- evas_object_color_get(cont->clipper, &r, &g, &b, NULL);
- if(num > 0)
- evas_object_color_set(cont->clipper, r,g,b, cont->clipper_orig_alpha);
- else
- evas_object_color_set(cont->clipper, r,g,b, 0);
-
- for (l = cont->elements; l; l = l->next)
- {
- Container_Element *el = l->data;
- double ew, eh; // old element size
-
- if(!el)
- {
- continue;
- }
- evas_object_geometry_get(el->obj, NULL, NULL, &ew, &eh);
- if (ew == 0) ew = el->orig_w;
- if (eh == 0) eh = el->orig_h;
-
- evas_object_resize(el->grabber, ew, eh);
-
- /* vertical */
- if (cont->direction)
- {
- if (cont->fill & CONTAINER_FILL_POLICY_FILL)
- {
- iw = aw;
-
- if (cont->fill & CONTAINER_FILL_POLICY_HOMOGENOUS)
- ih = (ah - cont->spacing * (num - 1) ) / num;
- else
- ih = el->orig_h * (ah - cont->spacing * (num - 1) ) / L;
-
- }
- else if (cont->fill & CONTAINER_FILL_POLICY_FILL_X)
- {
- if (cont->fill & CONTAINER_FILL_POLICY_KEEP_ASPECT)
- {
- iw = aw;
- ih = eh * iw/ew;
- }
- else
- {
- iw = aw;
- ih = eh;
- }
- }
- else if (cont->fill & CONTAINER_FILL_POLICY_FILL_Y)
- {
- if (cont->fill & CONTAINER_FILL_POLICY_HOMOGENOUS)
- ih = (ah - cont->spacing * (num - 1) ) / num;
- else
- ih = el->orig_h * (ah - cont->spacing * (num - 1) ) / L;
-
- if (cont->fill & CONTAINER_FILL_POLICY_KEEP_ASPECT)
- iw = ew * ih/eh;
- else
- iw = ew;
- }
- else
- {
- iw = ew;
- ih = eh;
- }
-
- if (cont->align == CONTAINER_ALIGN_LEFT)
- ix = ax;
- else if (cont->align == CONTAINER_ALIGN_CENTER)
- ix = ax + (aw - iw) / 2;
- else if (cont->align == CONTAINER_ALIGN_RIGHT)
- ix = ax + aw - iw;
-
- evas_object_move(el->obj, ix, iy);
- evas_object_resize(el->obj, iw, ih);
- if (!strcmp(evas_object_type_get(el->obj), "image"))
- {
- evas_object_image_fill_set(el->obj, 0, 0, iw, ih);
- }
- evas_object_move(el->grabber, ix, iy);
- evas_object_resize(el->grabber, iw, ih);
-
- iy += ih + cont->spacing;
- }
-
- /* horizontal */
- else
- {
- if (cont->fill & CONTAINER_FILL_POLICY_FILL)
- {
- //printf("fill\n");
- ih = ah;
-
- if (cont->fill & CONTAINER_FILL_POLICY_HOMOGENOUS)
- iw = (aw - cont->spacing * (num - 1) ) / num;
- else
- {
- //printf("nonhomog\n");
- iw = el->orig_w * (aw - cont->spacing * (num - 1) ) / L;
- }
- }
- else if (cont->fill & CONTAINER_FILL_POLICY_FILL_X)
- {
- //printf("fill x\n");
-
- if (cont->fill & CONTAINER_FILL_POLICY_HOMOGENOUS)
- {
- //printf ("homog\n");
- iw = (aw - cont->spacing * (num - 1) ) / num;
- }
- else
- {
- //printf("nonhomog - L: %f, ew: %f\n", L, ew);
- iw = el->orig_w * (aw - cont->spacing * (num - 1) ) / L;
- }
-
- if (cont->fill & CONTAINER_FILL_POLICY_KEEP_ASPECT)
- ih = eh * iw/ew;
- else
- ih = eh;
- }
- else if (cont->fill & CONTAINER_FILL_POLICY_FILL_Y)
- {
- if (cont->fill & CONTAINER_FILL_POLICY_KEEP_ASPECT)
- {
- ih = ah;
- iw = ew * ih/eh;
- }
- else
- {
- ih = ah;
- iw = ew;
- }
- }
- else
- {
- iw = ew;
- ih = eh;
- }
-
- if (cont->align == CONTAINER_ALIGN_TOP)
- iy = ay;
- else if (cont->align == CONTAINER_ALIGN_CENTER)
- iy = ay + (ah - ih) / 2;
- else if (cont->align == CONTAINER_ALIGN_BOTTOM)
- iy = ay + ah - ih;
-
- /* make sure that the elements fill the container exactly */
- if (error >= 1)
- {
- iw++;
- error -= 1;
- }
- else if (error <= -1)
- {
- iw--;
- error += 1;
- }
-
- error += iw - (int)iw;
-
- iw = (int)iw;
-
- evas_object_move(el->obj, ix, iy);
- evas_object_resize(el->obj, iw, ih);
- if (!strcmp(evas_object_type_get(el->obj), "image"))
- {
- evas_object_image_fill_set(el->obj, 0, 0, iw, ih);
- }
- evas_object_move(el->grabber, ix, iy);
- evas_object_resize(el->grabber, iw, ih);
- ix += iw + cont->spacing;
- }
-
-
- evas_object_geometry_get(el->obj, NULL, NULL, &ew, &eh);
- evas_object_resize(el->grabber, ew, eh);
- }
-}
-
-double
-e_container_elements_orig_length_get(Evas_Object *container)
-{
- Container *cont;
- Evas_List *l;
- double length = 0;
-
- cont = _container_fetch(container);
- if (!cont) return 0.0;
-
- for (l = cont->elements; l; l = l->next)
- {
- Container_Element *el = l->data;
- double w, h;
-
- evas_object_geometry_get(el->obj, NULL, NULL, &w, &h);
-
- length += cont->direction ? el->orig_h : el->orig_w;
- }
-
- return length;
-}
-
-
void
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/esmart/src/container/container.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- container.h 13 Jan 2004 07:35:36 -0000 1.10
+++ container.h 14 Jan 2004 04:32:02 -0000 1.11
@@ -109,7 +109,7 @@
struct _Container_Layout_Plugin{
void *handle;
- void (*shutdown)();
+ void (*shutdown)(void);
void (*layout)(Container *cont);
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/esmart/src/container/container_plugin.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- container_plugin.c 13 Jan 2004 20:33:51 -0000 1.5
+++ container_plugin.c 14 Jan 2004 04:32:02 -0000 1.6
@@ -106,10 +106,20 @@
if (!p) return;
if (p->shutdown)
+ {
+ printf("shutdown\n");
p->shutdown();
-
+ printf("ok\n");
+ }
+
if (p->handle)
- lt_dlclose(p->handle);
+ {
+ int error = lt_dlclose(p->handle);
+ if (error)
+ {
+ fprintf("ERROR: lt_dlclose (%s)\n", lt_dlerror());
+ }
+ }
free(p);
@@ -130,7 +140,6 @@
if (cont->plugin)
{
- lt_dlclose(cont->plugin->handle);
_container_layout_plugin_free(cont->plugin);
cont->plugin = NULL;
}
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs