Enlightenment CVS committal Author : rephorm Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_border.c e_border.h Log Message: Don't allow resizing when maximized. (this is actually debatable, e16 lets you do it, and it can be nice if your resize handles are all of screen to be able to maximize it to get at the handles. anyway, let me know if you think i should re-enable this) Animate shading. Emit "shading" and "unshading" signals at start of (un)shade. Emit "shaded" and "unshaded" signals at finish of (un)shade. i still need to handle attempting to (un)shade while already (un)shading. Should this a) be disallowed (i.e. ignore shade requests while shading) or b) go the other direction from the current point in the shade anim =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- e_border.c 18 Dec 2004 05:47:08 -0000 1.19 +++ e_border.c 18 Dec 2004 22:26:20 -0000 1.20 @@ -1,3 +1,7 @@ +/* + * * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ + #include "e.h" #include <Ecore_X_Atoms.h> @@ -55,7 +59,9 @@ static void _e_border_resize_limit(E_Border *bd, int *w, int *h); static void _e_border_moveinfo_gather(E_Border *bd, const char *source); static void _e_border_resize_handle(E_Border *bd); - + +static int _e_border_shade_animator(void *data); + /* local subsystem globals */ static Evas_List *handlers = NULL; static Evas_List *borders = NULL; @@ -384,13 +390,20 @@ if (!bd->shaded) { printf("SHADE!\n"); + /* bd->h = bd->client_inset.t + bd->client_inset.b; bd->changes.size = 1; bd->shaded = 1; bd->changes.shaded = 1; bd->changed = 1; + */ + bd->shade.start = ecore_time_get(); + bd->shading = 1; + bd->changes.shading = 1; + bd->changed = 1; - edje_object_signal_emit(bd->bg_object, "shade", ""); + bd->shade.anim = ecore_animator_add(_e_border_shade_animator, bd); + edje_object_signal_emit(bd->bg_object, "shading", ""); } } @@ -401,13 +414,20 @@ if (bd->shaded) { printf("UNSHADE!\n"); + /* bd->h = bd->client_inset.t + bd->client.h + bd->client_inset.b; bd->changes.size = 1; bd->shaded = 0; bd->changes.shaded = 1; bd->changed = 1; + */ + bd->shade.start = ecore_time_get(); + bd->shading = 1; + bd->changes.shading = 1; + bd->changed = 1; - edje_object_signal_emit(bd->bg_object, "unshade", ""); + bd->shade.anim = ecore_animator_add(_e_border_shade_animator, bd); + edje_object_signal_emit(bd->bg_object, "unshading", ""); } } @@ -424,8 +444,8 @@ bd->saved.h = bd->h; /* FIXME maximize intelligently */ - e_border_move_resize(bd, 0, 0, bd->container->w, bd->container->h); - bd->maximized = 1; + e_border_move_resize(bd, 0, 0, bd->container->w, bd->container->h); + bd->maximized = 1; bd->changes.pos = 1; bd->changes.size = 1; bd->changed = 1; @@ -441,9 +461,9 @@ if (bd->maximized) { printf("UNMAXIMIZE!!\n"); - e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h); + e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h); - bd->maximized = 0; + bd->maximized = 0; bd->changes.pos = 1; bd->changes.size = 1; bd->changed = 1; @@ -921,7 +941,7 @@ bd = data; - if (bd->shaded) return; + if (bd->shaded || bd->maximized) return; bd->resize_mode = RESIZE_TL; _e_border_moveinfo_gather(bd, source); @@ -935,7 +955,7 @@ bd = data; - if (bd->shaded) return; + if (bd->shaded || bd->maximized) return; bd->resize_mode = RESIZE_T; _e_border_moveinfo_gather(bd, source); @@ -950,7 +970,7 @@ bd = data; - if (bd->shaded) return; + if (bd->shaded || bd->maximized) return; bd->resize_mode = RESIZE_TR; _e_border_moveinfo_gather(bd, source); @@ -964,7 +984,7 @@ bd = data; - if (bd->shaded) return; + if (bd->shaded || bd->maximized) return; bd->resize_mode = RESIZE_R; _e_border_moveinfo_gather(bd, source); @@ -978,7 +998,7 @@ bd = data; - if (bd->shaded) return; + if (bd->shaded || bd->maximized) return; bd->resize_mode = RESIZE_BR; _e_border_moveinfo_gather(bd, source); @@ -992,7 +1012,7 @@ bd = data; - if (bd->shaded) return; + if (bd->shaded || bd->maximized) return; bd->resize_mode = RESIZE_B; _e_border_moveinfo_gather(bd, source); @@ -1006,7 +1026,7 @@ bd = data; - if (bd->shaded) return; + if (bd->shaded || bd->maximized) return; bd->resize_mode = RESIZE_BL; _e_border_moveinfo_gather(bd, source); @@ -1020,7 +1040,7 @@ bd = data; - if (bd->shaded) return; + if (bd->shaded || bd->maximized) return; bd->resize_mode = RESIZE_L; _e_border_moveinfo_gather(bd, source); @@ -1035,7 +1055,7 @@ bd = data; - if (bd->shaded) return; + if (bd->shaded || bd->maximized) return; _e_border_resize_handle(bd); bd->resize_mode = RESIZE_NONE; @@ -1750,6 +1770,15 @@ bd->changes.visible = 0; } + if ((bd->changes.shading)) + { + /* FIXME support other directions */ + bd->changes.shading = 0; + bd->changes.size = 1; + + /* show at start of unshade (but don't hide until end of shade) */ + if (bd->shaded) ecore_x_window_show(bd->client.shell_win); + } if ((bd->changes.shaded) && (bd->changes.pos) && (bd->changes.size)) { if (bd->shaded) @@ -1788,7 +1817,29 @@ if ((bd->changes.pos) && (bd->changes.size)) { printf("border move resize\n"); - if (bd->shaded) + if (bd->shading) + { + evas_obscured_clear(bd->bg_evas); + evas_obscured_rectangle_add(bd->bg_evas, + bd->client_inset.l, bd->client_inset.t, + bd->w - (bd->client_inset.l + bd->client_inset.r), + bd->h - (bd->client_inset.t + bd->client_inset.b)); + ecore_x_window_move_resize(bd->event_win, 0, 0, bd->w, bd->h); + ecore_x_window_resize(bd->win, bd->w, bd->h); + /* make sure the shell win doesn't cover up the borders */ + /* FIXME could we just do this normally? */ + ecore_x_window_move_resize(bd->client.shell_win, + bd->client_inset.l, bd->client_inset.t, + bd->w - (bd->client_inset.l + bd->client_inset.r), + bd->h - (bd->client_inset.t + bd->client_inset.b)); + ecore_x_window_move_resize(bd->client.win, 0, 0, + bd->client.w, bd->client.h); + ecore_evas_move_resize(bd->bg_ecore_evas, 0, 0, bd->w, bd->h); + evas_object_resize(bd->bg_object, bd->w, bd->h); + e_container_shape_resize(bd->shape, bd->w, bd->h); + e_container_shape_move(bd->shape, bd->x, bd->y); + } + else if (bd->shaded) { evas_obscured_clear(bd->bg_evas); ecore_x_window_move_resize(bd->win, bd->x, bd->y, bd->w, bd->h); @@ -1832,7 +1883,27 @@ else if (bd->changes.size) { printf("border move resize\n"); - if (bd->shaded) + if (bd->shading) + { + evas_obscured_clear(bd->bg_evas); + evas_obscured_rectangle_add(bd->bg_evas, + bd->client_inset.l, bd->client_inset.t, + bd->w - (bd->client_inset.l + bd->client_inset.r), bd->h - (bd->client_inset.t + bd->client_inset.b)); + ecore_x_window_move_resize(bd->event_win, 0, 0, bd->w, bd->h); + ecore_x_window_resize(bd->win, bd->w, bd->h); + /* make sure the shell win doesn't cover up the borders */ + /* FIXME could we just do this normally? */ + ecore_x_window_move_resize(bd->client.shell_win, + bd->client_inset.l, bd->client_inset.t, + bd->w - (bd->client_inset.l + bd->client_inset.r), + bd->h - (bd->client_inset.t + bd->client_inset.b)); + ecore_x_window_move_resize(bd->client.win, 0, 0, + bd->client.w, bd->client.h); + ecore_evas_move_resize(bd->bg_ecore_evas, 0, 0, bd->w, bd->h); + evas_object_resize(bd->bg_object, bd->w, bd->h); + e_container_shape_resize(bd->shape, bd->w, bd->h); + } + else if (bd->shaded) { evas_obscured_clear(bd->bg_evas); ecore_x_window_move_resize(bd->event_win, 0, 0, bd->w, bd->h); @@ -2005,3 +2076,55 @@ e_border_move_resize(bd, x, y, w, h); } + +static int +_e_border_shade_animator(void *data) +{ + E_Border *bd = data; + double dt; + double dur = 0.15; /* FIXME make this configurable */ + + dt = ecore_time_get() - bd->shade.start; + + if (bd->shaded) + bd->shade.val = dt / dur; /* unshading */ + else + bd->shade.val = 1 - (dt / dur); /* shading */ + + if (bd->shade.val < 0.0) bd->shade.val = 0.0; + else if (bd->shade.val > 1.0) bd->shade.val = 1.0; + + + /* FIXME support other directions */ + bd->h = bd->client_inset.t + bd->client_inset.b + bd->client.h * bd->shade.val; + + bd->changes.size = 1; + bd->changed = 1; + + if ( (bd->shaded && (bd->shade.val == 1)) || + (!(bd->shaded) && (bd->shade.val == 0)) ) + { + bd->shading = 0; + bd->shaded = !(bd->shaded); + printf("shaded: %d\n", bd->shaded); + bd->changes.size = 1; + bd->changes.shaded = 1; + bd->changes.shading = 1; + bd->changed = 1; + + if (bd->shaded) + { + bd->h = bd->client_inset.t + bd->client_inset.b; + edje_object_signal_emit(bd->bg_object, "shaded", ""); + } + else + { + bd->h = bd->client_inset.t + bd->client.h + bd->client_inset.b; + edje_object_signal_emit(bd->bg_object, "unshaded", ""); + } + return 0; + } + + return 1; +} + =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- e_border.h 18 Dec 2004 05:47:08 -0000 1.8 +++ e_border.h 18 Dec 2004 22:26:21 -0000 1.9 @@ -113,6 +113,7 @@ unsigned char focused : 1; unsigned char new_client : 1; unsigned char re_manage : 1; + unsigned char shading : 1; unsigned char shaded : 1; unsigned char maximized : 1; unsigned char minimized : 1; @@ -127,6 +128,12 @@ } saved; struct { + double start; + double val; + Ecore_Animator *anim; + } shade; + + struct { unsigned int visible : 1; unsigned int pos : 1; unsigned int size : 1; @@ -134,6 +141,7 @@ unsigned int prop : 1; unsigned int border : 1; unsigned int reset_gravity : 1; + unsigned int shading : 1; unsigned int shaded : 1; } changes; }; ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs