Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_border.c e_border.h Log Message: add hook to borders to allow layout to b adjusted by modules add a layout module - good proof of concept =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_border.c,v retrieving revision 1.594 retrieving revision 1.595 diff -u -3 -r1.594 -r1.595 --- e_border.c 10 Jun 2007 04:39:51 -0000 1.594 +++ e_border.c 1 Jul 2007 15:59:39 -0000 1.595 @@ -100,7 +100,9 @@ static void _e_border_pointer_resize_end(E_Border *bd); static void _e_border_pointer_move_begin(E_Border *bd); static void _e_border_pointer_move_end(E_Border *bd); - + +static void _e_border_hook_call(E_Border_Hook_Point hookpoint, E_Border *bd); + /* local subsystem globals */ static Evas_List *handlers = NULL; static Evas_List *borders = NULL; @@ -1704,7 +1706,7 @@ { int x1, y1, x2, y2; - int w, h; + int w, h, pw, ph; bd->pre_res_change.valid = 0; if (!(bd->maximized & E_MAXIMIZE_HORIZONTAL)) @@ -1753,8 +1755,8 @@ } w = bd->zone->w; h = bd->zone->h; + e_border_resize_limit(bd, &w, &h); /* center x-direction */ -// e_border_resize_limit(bd, &w, &h); x1 = bd->zone->x + (bd->zone->w - w) / 2; /* center y-direction */ y1 = bd->zone->y + (bd->zone->h - h) / 2; @@ -1782,7 +1784,13 @@ w = x2 - x1; h = y2 - y1; + pw = w; + ph = h; e_border_resize_limit(bd, &w, &h); + /* center x-direction */ + x1 = x1 + (pw - w) / 2; + /* center y-direction */ + y1 = y1 + (ph - h) / 2; if ((max & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_BOTH) e_border_move_resize(bd, x1, y1, w, h); else if ((max & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL) @@ -1805,7 +1813,13 @@ w = x2 - x1; h = y2 - y1; + pw = w; + ph = h; e_border_resize_limit(bd, &w, &h); + /* center x-direction */ + x1 = x1 + (pw - w) / 2; + /* center y-direction */ + y1 = y1 + (ph - h) / 2; if ((max & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_BOTH) e_border_move_resize(bd, x1, y1, w, h); else if ((max & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL) @@ -5631,6 +5645,8 @@ bd->user_skip_winlist = rem->prop.skip_winlist; } } + + _e_border_hook_call(E_BORDER_HOOK_EVAL_POST_FETCH, bd); if ((bd->client.border.changed) && (!bd->shaded) && (!(((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN)))) @@ -7344,4 +7360,74 @@ _e_border_pointer_move_end(E_Border *bd) { e_pointer_type_pop(bd->pointer, bd, "move"); +} + +static Evas_List *_e_border_hooks = NULL; +static int _e_border_hooks_delete = 0; +static int _e_border_hooks_walking = 0; + +static void +_e_border_hooks_clean(void) +{ + Evas_List *l, *pl; + + for (l = _e_border_hooks; l;) + { + E_Border_Hook *bh; + + bh = l->data; + pl = l; + l = l->next; + if (bh->delete_me) + { + _e_border_hooks = evas_list_remove_list(_e_border_hooks, pl); + free(bh); + } + } +} + +static void +_e_border_hook_call(E_Border_Hook_Point hookpoint, E_Border *bd) +{ + Evas_List *l; + + _e_border_hooks_walking++; + for (l = _e_border_hooks; l; l = l->next) + { + E_Border_Hook *bh; + + bh = l->data; + if (bh->delete_me) continue; + if (bh->hookpoint == hookpoint) bh->func(bh->data, bd); + } + _e_border_hooks_walking--; + if ((_e_border_hooks_walking == 0) && (_e_border_hooks_delete > 0)) + _e_border_hooks_clean(); +} + +EAPI E_Border_Hook * +e_border_hook_add(E_Border_Hook_Point hookpoint, void (*func) (void *data, E_Border *bd), void *data) +{ + E_Border_Hook *bh; + + bh = E_NEW(E_Border_Hook, 1); + if (!bh) return NULL; + bh->hookpoint = hookpoint; + bh->func = func; + bh->data = data; + _e_border_hooks = evas_list_append(_e_border_hooks, bh); + return bh; +} + +EAPI void +e_border_hook_del(E_Border_Hook *bh) +{ + bh->delete_me = 1; + if (_e_border_hooks_walking == 0) + { + _e_border_hooks = evas_list_remove(_e_border_hooks, bh); + free(bh); + } + else + _e_border_hooks_delete++; } =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_border.h,v retrieving revision 1.160 retrieving revision 1.161 diff -u -3 -r1.160 -r1.161 --- e_border.h 10 Jun 2007 04:21:05 -0000 1.160 +++ e_border.h 1 Jul 2007 15:59:39 -0000 1.161 @@ -71,8 +71,14 @@ E_WINDOW_PLACEMENT_MANUAL } E_Window_Placement; +typedef enum _E_Border_Hook_Point +{ + E_BORDER_HOOK_EVAL_POST_FETCH +} E_Border_Hook_Point; + typedef struct _E_Border E_Border; typedef struct _E_Border_Pending_Move_Resize E_Border_Pending_Move_Resize; +typedef struct _E_Border_Hook E_Border_Hook; typedef struct _E_Event_Border_Resize E_Event_Border_Resize; typedef struct _E_Event_Border_Move E_Event_Border_Move; typedef struct _E_Event_Border_Add E_Event_Border_Add; @@ -472,6 +478,14 @@ unsigned char resize : 1; }; +struct _E_Border_Hook +{ + E_Border_Hook_Point hookpoint; + void (*func) (void *data, E_Border *bd); + void *data; + unsigned char delete_me : 1; +}; + struct _E_Event_Border_Resize { E_Border *border; @@ -643,6 +657,9 @@ EAPI void e_border_signal_resize_begin(E_Border *bd, const char *dir, const char *sig, const char *src); EAPI void e_border_signal_resize_end(E_Border *bd, const char *dir, const char *sig, const char *src); EAPI void e_border_resize_limit(E_Border *bd, int *w, int *h); + +EAPI E_Border_Hook *e_border_hook_add(E_Border_Hook_Point hookpoint, void (*func) (void *data, E_Border *bd), void *data); +EAPI void e_border_hook_del(E_Border_Hook *bh); extern EAPI int E_EVENT_BORDER_RESIZE; extern EAPI int E_EVENT_BORDER_MOVE; ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs