From 6405b22494bf1df6d4a06441b68faf3be6341ac7 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sat, 15 Jan 2005 09:50:26 +0000 Subject: [PATCH] evas_object_free? what posessed you to use that? it isnt in Evas' header (api) at all (it HAPPENS by LUCK to be an internal call) also fix shudwon/startup order SVN revision: 12975 --- src/bin/Makefile.am | 4 ++- src/bin/e_container.c | 4 +++ src/bin/e_container.h | 1 + src/bin/e_gadman.c | 38 +++++++++++++++++++++++++ src/bin/e_gadman.h | 52 ++++++++++++++++++++++++++++++++++ src/bin/e_includes.h | 1 + src/bin/e_main.c | 12 +++----- src/modules/pager/e_mod_main.c | 31 ++++---------------- 8 files changed, 108 insertions(+), 35 deletions(-) create mode 100644 src/bin/e_gadman.c create mode 100644 src/bin/e_gadman.h diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 3ad442397..cb5499fd0 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -39,7 +39,8 @@ e_place.h \ e_resist.h \ e_startup.h \ e_iconify.h \ -e_hints.h +e_hints.h \ +e_gadman.h enlightenment_SOURCES = \ @@ -73,6 +74,7 @@ e_resist.c \ e_startup.c \ e_iconify.c \ e_hints.c \ +e_gadman.c \ $(ENLIGHTENMENTHEADERS) enlightenment_LDFLAGS = -export-dynamic @e_libs@ @dlopen_libs@ diff --git a/src/bin/e_container.c b/src/bin/e_container.c index f345032bf..743769a4e 100644 --- a/src/bin/e_container.c +++ b/src/bin/e_container.c @@ -95,6 +95,9 @@ e_container_new(E_Manager *man) zone = e_zone_new(con, zx, zy, zw, zh); } } + + con->gadman = e_gadman_new(con); + return con; } @@ -320,6 +323,7 @@ e_container_shape_rects_get(E_Container_Shape *es) static void _e_container_free(E_Container *con) { + if (con->gadman) e_object_del(E_OBJECT(con->gadman)); while (con->clients) e_object_free(E_OBJECT(con->clients->data)); while (con->zones) e_object_free(E_OBJECT(con->zones->data)); con->manager->containers = evas_list_remove(con->manager->containers, con); diff --git a/src/bin/e_container.h b/src/bin/e_container.h index 2ba508fea..840a3fa33 100644 --- a/src/bin/e_container.h +++ b/src/bin/e_container.h @@ -28,6 +28,7 @@ struct _E_Container int x, y, w, h; char visible : 1; E_Manager *manager; + E_Gadman *gadman; int num; char *name; diff --git a/src/bin/e_gadman.c b/src/bin/e_gadman.c new file mode 100644 index 000000000..683bfb0cc --- /dev/null +++ b/src/bin/e_gadman.c @@ -0,0 +1,38 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#include "e.h" + +/* local subsystem functions */ +static void _e_gadman_free(E_Gadman *gm); + +/* externally accessible functions */ +int +e_gadman_init(void) +{ + return 1; +} + +int +e_gadman_shutdown(void) +{ + return 1; +} + +E_Gadman * +e_gadman_new(E_Container *con) +{ + E_Gadman *gm; + + gm = E_OBJECT_ALLOC(E_Gadman, _e_gadman_free); + if (!gm) return NULL; + gm->container = con; + return gm; +} + +/* local subsystem functions */ +static void +_e_gadman_free(E_Gadman *gm) +{ + free(gm); +} diff --git a/src/bin/e_gadman.h b/src/bin/e_gadman.h new file mode 100644 index 000000000..bcdcce234 --- /dev/null +++ b/src/bin/e_gadman.h @@ -0,0 +1,52 @@ +#ifdef E_TYPEDEFS + +typedef enum _E_Gadman_Policy +{ + /* type */ + E_GADMAN_ANYWHERE = 0, + E_GADMAN_EDGES = 1, + E_GADMAN_LEFT_EDGE = 2, + E_GADMAN_RIGHT_EDGE = 3, + E_GADMAN_TOP_EDGE = 4, + E_GADMAN_BOTTOM_EDGE = 5, + /* extra flags */ + E_GADMAN_FIXED_ZONE = 1 << 8, + E_GADMAN_HSIZE = 1 << 9, + E_GADMAN_VSIZE = 1 << 10, + E_GADMAN_HMOVE = 1 << 11, + E_GADMAN_VMOVE = 1 << 12 +} E_Gadman_Policy; + +typedef struct _E_Gadman E_Gadman; +typedef struct _E_Gadman_Client E_Gadman_Client; + +#else +#ifndef E_GADMAN_H +#define E_GADMAN_H + +struct _E_Gadman +{ + E_Object e_obj_inherit; + + E_Container *container; + Evas_List *clients; +}; + +struct _E_Gadman_Client +{ + E_Object e_obj_inherit; + + E_Gadman *gadman; +}; + +EAPI int e_gadman_init(void); +EAPI int e_gadman_shutdown(void); +EAPI E_Gadman *e_gadman_new(E_Container *con); +EAPI E_Gadman_Client *e_gadman_client_new(E_Gadman *gm); +EAPI void e_gadman_client_policy_set(E_Gadman_Client *gmc, E_Gadman_Policy pol); +EAPI void e_gadman_client_min_size_set(E_Gadman_Client *gmc, Evas_Coord minw, Evas_Coord minh); +EAPI void e_gadman_client_max_size_set(E_Gadman_Client *gmc, Evas_Coord minw, Evas_Coord minh); +EAPI void e_gadman_client_default_align_set(E_Gadman_Client *gmc, double xalign, double yalign); + +#endif +#endif diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h index f238bd24b..68b66f799 100644 --- a/src/bin/e_includes.h +++ b/src/bin/e_includes.h @@ -27,3 +27,4 @@ #include "e_startup.h" #include "e_iconify.h" #include "e_hints.h" +#include "e_gadman.h" diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 19f3a93f1..d29559a02 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -148,14 +148,6 @@ main(int argc, char **argv) /* Init window manager hints */ e_hints_init(); - /* setup menu handlers etc. */ - if (!e_menu_init()) - { - e_error_message_show("Enlightenment cannot initialize the menu system.\n" - "Perhaps you are out of memory?"); - _e_main_shutdown(-1); - } - _e_main_shutdown_push(e_menu_shutdown); /* init generic communications */ if (!ecore_con_init()) { @@ -480,6 +472,8 @@ _e_main_screens_init(void) if (!e_container_init()) return 0; if (!e_zone_init()) return 0; if (!e_desk_init()) return 0; + if (!e_gadman_init()) return 0; + if (!e_menu_init()) return 0; num = 0; roots = ecore_x_window_root_list(&num); @@ -551,6 +545,8 @@ _e_main_screens_shutdown(void) { e_border_shutdown(); e_focus_shutdown(); + e_menu_shutdown(); + e_gadman_shutdown(); e_desk_shutdown(); e_zone_shutdown(); e_container_shutdown(); diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index ac97dcf52..19c063b1c 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -231,16 +231,8 @@ _pager_shutdown(Pager *e) free(e->conf); E_CONFIG_DD_FREE(e->conf_edd); - if (e->base) - { - evas_object_del(e->base); - evas_object_free(e->base); - } - if (e->screen) - { - evas_object_del(e->screen); - evas_object_free(e->screen); - } + if (e->base) evas_object_del(e->base); + if (e->screen) evas_object_del(e->screen); _pager_zone_leave(e); ecore_event_handler_del(e->ev_handler_container_resize); @@ -325,12 +317,7 @@ _pager_desk_create(Pager *e, E_Desk *desk) static void _pager_desk_destroy(Pager_Desk *d) { - if (d->obj) - { - evas_object_del(d->obj); - evas_object_free(d->obj); - } - + if (d->obj) evas_object_del(d->obj); e_object_unref(E_OBJECT(d->desk)); while (d->wins) @@ -405,16 +392,8 @@ _pager_window_create(Pager *e, E_Border *border, Pager_Desk *owner) static void _pager_window_destroy(Pager_Win *w) { - if (w->obj) - { - evas_object_del(w->obj); - evas_object_free(w->obj); - } - if (w->icon) - { - evas_object_del(w->icon); - evas_object_free(w->icon); - } + if (w->obj) evas_object_del(w->obj); + if (w->icon) evas_object_del(w->icon); e_object_unref(E_OBJECT(w->border)); E_FREE(w);