Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_border.c e_gadman.c e_gadman.h e_main.c e_resist.c e_resist.h e_zone.c e_zone.h Log Message: more gadman work... on the way there... =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -3 -r1.76 -r1.77 --- e_border.c 19 Jan 2005 14:44:03 -0000 1.76 +++ e_border.c 20 Jan 2005 13:42:51 -0000 1.77 @@ -1797,10 +1797,10 @@ new_x = x; new_y = y; skiplist = evas_list_append(skiplist, bd); - e_resist_container_position(bd->container, skiplist, - bd->x, bd->y, bd->w, bd->h, - x, y, bd->w, bd->h, - &new_x, &new_y); + e_resist_container_border_position(bd->container, skiplist, + bd->x, bd->y, bd->w, bd->h, + x, y, bd->w, bd->h, + &new_x, &new_y); evas_list_free(skiplist); e_border_move(bd, new_x, new_y); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_gadman.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- e_gadman.c 19 Jan 2005 15:55:27 -0000 1.11 +++ e_gadman.c 20 Jan 2005 13:42:51 -0000 1.12 @@ -5,13 +5,10 @@ /* FIXME: corner case if module is sized to full screen... cant stop edit or */ /* re-enter edit mode (cant access root menu) */ +/* FIXME: resist can still jump on top of other gads... */ -/* FIXME: evas_clip to the zone - make a zone clip for gadman obj's */ -/* FIXME: actully call callbacks */ /* FIXME: handle save */ /* FIXME: handle load */ -/* FIXME: if u set align, or minmax size or edge then figure out new-coords */ -/* FIXME: handle move resist */ /* FIXME: handle resize resist */ /* local subsystem functions */ @@ -24,6 +21,7 @@ static void _e_gadman_client_geometry_to_align(E_Gadman_Client *gmc); static void _e_gadman_client_aspect_enforce(E_Gadman_Client *gmc, double cx, double cy, int use_horiz); static void _e_gadman_client_geometry_apply(E_Gadman_Client *gmc); +static void _e_gadman_client_callback_call(E_Gadman_Client *gmc, E_Gadman_Change change); static void _e_gadman_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info); static void _e_gadman_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info); @@ -408,6 +406,8 @@ else edje_object_signal_emit(gmc->control_object, "move", "off"); + evas_object_clip_set(gmc->event_object, gmc->zone->bg_clip_object); + evas_object_clip_set(gmc->control_object, gmc->zone->bg_clip_object); evas_object_show(gmc->event_object); evas_object_show(gmc->control_object); } @@ -502,6 +502,12 @@ } static void +_e_gadman_client_callback_call(E_Gadman_Client *gmc, E_Gadman_Change change) +{ + if (gmc->func) gmc->func(gmc->data, gmc, change); +} + +static void _e_gadman_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info) { Evas_Event_Mouse_Down *ev; @@ -573,7 +579,7 @@ gmc->moving = 1; evas_object_raise(gmc->control_object); evas_object_raise(gmc->event_object); - /* FIXME: call callback to raise */ + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_RAISE); } static void @@ -593,11 +599,23 @@ E_Gadman_Client *gmc; Evas_Coord x, y; int new_edge = 0; + int nx, ny, nxx, nyy; int new_zone = 0; + Evas_List *skiplist = NULL; gmc = data; if (!gmc->moving) return; evas_pointer_canvas_xy_get(gmc->gadman->container->bg_evas, &x, &y); + nxx = nx = gmc->down_store_x + (x - gmc->down_x); + nyy = ny = gmc->down_store_y + (y - gmc->down_y); + skiplist = evas_list_append(skiplist, gmc); + e_resist_container_gadman_position(gmc->zone->container, skiplist, + gmc->x, gmc->y, gmc->w, gmc->h, + nx, ny, gmc->w, gmc->h, + &nxx, &nyy); + evas_list_free(skiplist); + x += (nxx - nx); + y += (nyy - ny); if ((gmc->policy & 0xff) == E_GADMAN_POLICY_EDGES) { double xr, yr; @@ -614,6 +632,8 @@ { gmc->zone = nz; new_zone = 1; + evas_object_clip_set(gmc->event_object, gmc->zone->bg_clip_object); + evas_object_clip_set(gmc->control_object, gmc->zone->bg_clip_object); } } @@ -640,6 +660,7 @@ { gmc->x = gmc->zone->x; gmc->y = gmc->down_store_y + (y - gmc->down_y); + if (gmc->h > gmc->zone->h) gmc->h = gmc->zone->h; if (gmc->y < gmc->zone->y) gmc->y = gmc->zone->y; else if ((gmc->y + gmc->h) > (gmc->zone->y + gmc->zone->h)) @@ -649,6 +670,7 @@ { gmc->x = gmc->zone->x + gmc->zone->w - gmc->w; gmc->y = gmc->down_store_y + (y - gmc->down_y); + if (gmc->h > gmc->zone->h) gmc->h = gmc->zone->h; if (gmc->y < gmc->zone->y) gmc->y = gmc->zone->y; else if ((gmc->y + gmc->h) > (gmc->zone->y + gmc->zone->h)) @@ -658,6 +680,7 @@ { gmc->x = gmc->down_store_x + (x - gmc->down_x); gmc->y = gmc->zone->y; + if (gmc->w > gmc->zone->w) gmc->w = gmc->zone->w; if (gmc->x < gmc->zone->x) gmc->x = gmc->zone->x; else if ((gmc->x + gmc->w) > (gmc->zone->x + gmc->zone->w)) @@ -667,6 +690,7 @@ { gmc->x = gmc->down_store_x + (x - gmc->down_x); gmc->y = gmc->zone->y + gmc->zone->h - gmc->h; + if (gmc->w > gmc->zone->w) gmc->w = gmc->zone->w; if (gmc->x < gmc->zone->x) gmc->x = gmc->zone->x; else if ((gmc->x + gmc->w) > (gmc->zone->x + gmc->zone->w)) @@ -696,6 +720,8 @@ new_zone = 1; } } + if (gmc->h > gmc->zone->h) gmc->h = gmc->zone->h; + if (gmc->w > gmc->zone->w) gmc->w = gmc->zone->w; if (gmc->x < gmc->zone->x) gmc->x = gmc->zone->x; else if ((gmc->x + gmc->w) > (gmc->zone->x + gmc->zone->w)) @@ -706,15 +732,21 @@ gmc->y = gmc->zone->y + gmc->zone->h - gmc->h; } _e_gadman_client_geometry_to_align(gmc); - if (new_zone) + _e_gadman_client_geometry_apply(gmc); + e_object_ref(E_OBJECT(gmc)); + if (!e_object_del_get(E_OBJECT(gmc))) { - /* FIXME: callback for zone change */ + if (new_zone) + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_ZONE); } - if (new_edge) + if (!e_object_del_get(E_OBJECT(gmc))) { - /* FIXME: callback for edge change */ + if (new_edge) + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_EDGE); } - _e_gadman_client_geometry_apply(gmc); + if (!e_object_del_get(E_OBJECT(gmc))) + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); + e_object_unref(E_OBJECT(gmc)); } static void @@ -783,6 +815,7 @@ _e_gadman_client_aspect_enforce(gmc, 1.0, 0.5, 1); _e_gadman_client_geometry_to_align(gmc); _e_gadman_client_geometry_apply(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } static void @@ -847,6 +880,7 @@ _e_gadman_client_aspect_enforce(gmc, 0.0, 0.5, 1); _e_gadman_client_geometry_to_align(gmc); _e_gadman_client_geometry_apply(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } static void @@ -915,6 +949,7 @@ _e_gadman_client_aspect_enforce(gmc, 0.5, 1.0, 0); _e_gadman_client_geometry_to_align(gmc); _e_gadman_client_geometry_apply(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } static void @@ -979,6 +1014,7 @@ _e_gadman_client_aspect_enforce(gmc, 0.5, 0.0, 0); _e_gadman_client_geometry_to_align(gmc); _e_gadman_client_geometry_apply(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } static void @@ -1008,6 +1044,7 @@ _e_gadman_client_geometry_apply(gmc); _e_gadman_client_geometry_to_align(gmc); e_gadman_client_save(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } static void @@ -1028,6 +1065,7 @@ _e_gadman_client_geometry_apply(gmc); _e_gadman_client_geometry_to_align(gmc); e_gadman_client_save(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } static void @@ -1050,6 +1088,7 @@ _e_gadman_client_geometry_apply(gmc); _e_gadman_client_geometry_to_align(gmc); e_gadman_client_save(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } static void @@ -1062,6 +1101,7 @@ _e_gadman_client_geometry_apply(gmc); _e_gadman_client_geometry_to_align(gmc); e_gadman_client_save(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } static void @@ -1081,6 +1121,7 @@ _e_gadman_client_geometry_apply(gmc); _e_gadman_client_geometry_to_align(gmc); e_gadman_client_save(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } static void @@ -1101,6 +1142,7 @@ _e_gadman_client_geometry_apply(gmc); _e_gadman_client_geometry_to_align(gmc); e_gadman_client_save(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } static void @@ -1123,6 +1165,7 @@ _e_gadman_client_geometry_apply(gmc); _e_gadman_client_geometry_to_align(gmc); e_gadman_client_save(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } @@ -1136,5 +1179,6 @@ _e_gadman_client_geometry_apply(gmc); _e_gadman_client_geometry_to_align(gmc); e_gadman_client_save(gmc); + _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE); } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_gadman.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- e_gadman.h 19 Jan 2005 14:31:40 -0000 1.7 +++ e_gadman.h 20 Jan 2005 13:42:51 -0000 1.8 @@ -15,10 +15,10 @@ typedef enum _E_Gadman_Change { - E_GADMAN_CHANGE_MOVE, - E_GADMAN_CHANGE_RESIZE, + E_GADMAN_CHANGE_MOVE_RESIZE, E_GADMAN_CHANGE_EDGE, - E_GADMAN_CHANGE_ZONE + E_GADMAN_CHANGE_ZONE, + E_GADMAN_CHANGE_RAISE } E_Gadman_Change; typedef enum _E_Gadman_Edge =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_main.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -3 -r1.33 -r1.34 --- e_main.c 20 Jan 2005 10:48:50 -0000 1.33 +++ e_main.c 20 Jan 2005 13:42:51 -0000 1.34 @@ -542,7 +542,41 @@ gmc->x = 0; gmc->y = 300; gmc->w = 100; - gmc->h = 200; + gmc->h = 100; + e_gadman_client_policy_set(gmc, +// E_GADMAN_POLICY_EDGES | + E_GADMAN_POLICY_ANYWHERE | + E_GADMAN_POLICY_HMOVE | + E_GADMAN_POLICY_VMOVE | + E_GADMAN_POLICY_HSIZE | + E_GADMAN_POLICY_VSIZE); + e_gadman_client_min_size_set(gmc, 20, 20); + e_gadman_client_auto_size_set(gmc, 50, 200); + e_gadman_client_align_set(gmc, 0.0, 0.5); + e_client_gadman_edge_set(gmc, E_GADMAN_EDGE_LEFT); + + gmc = e_gadman_client_new(con->gadman); + gmc->x = 0; + gmc->y = 400; + gmc->w = 100; + gmc->h = 100; + e_gadman_client_policy_set(gmc, +// E_GADMAN_POLICY_EDGES | + E_GADMAN_POLICY_ANYWHERE | + E_GADMAN_POLICY_HMOVE | + E_GADMAN_POLICY_VMOVE | + E_GADMAN_POLICY_HSIZE | + E_GADMAN_POLICY_VSIZE); + e_gadman_client_min_size_set(gmc, 20, 20); + e_gadman_client_auto_size_set(gmc, 50, 200); + e_gadman_client_align_set(gmc, 0.0, 0.5); + e_client_gadman_edge_set(gmc, E_GADMAN_EDGE_LEFT); + + gmc = e_gadman_client_new(con->gadman); + gmc->x = 0; + gmc->y = 500; + gmc->w = 100; + gmc->h = 100; e_gadman_client_policy_set(gmc, // E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_ANYWHERE | =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_resist.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_resist.c 10 Jan 2005 14:07:42 -0000 1.2 +++ e_resist.c 20 Jan 2005 13:42:51 -0000 1.3 @@ -10,10 +10,10 @@ }; int -e_resist_container_position(E_Container *con, Evas_List *skiplist, - int px, int py, int pw, int ph, - int x, int y, int w, int h, - int *rx, int *ry) +e_resist_container_border_position(E_Container *con, Evas_List *skiplist, + int px, int py, int pw, int ph, + int x, int y, int w, int h, + int *rx, int *ry) { int resist = 1; int desk_resist = 32; @@ -34,9 +34,6 @@ dx = x - px; dy = y - py; - /* FIXME: need to make resist obscales where it resists being moved OUT */ - /* of the box */ - /* edges of screen */ #define OBSTACLE(_x, _y, _w, _h, _resist) \ { \ @@ -52,16 +49,7 @@ r->resist_out = 1; \ rects = evas_list_append(rects, r); \ } -#if 0 /* dont need this anymore */ - OBSTACLE(-1000000, -1000000, 2000000 + con->w, 1000000, - desk_resist); - OBSTACLE(-1000000, -1000000, 1000000, 2000000 + con->h, - desk_resist); - OBSTACLE(-1000000, con->h, 2000000 + con->w, 1000000, - desk_resist); - OBSTACLE(con->w, -1000000, 1000000, 2000000 + con->h, - desk_resist); -#endif + for (l = con->zones; l; l = l->next) { E_Zone *zone; @@ -237,3 +225,188 @@ *ry = y; return 1; } + +int +e_resist_container_gadman_position(E_Container *con, Evas_List *skiplist, + int px, int py, int pw, int ph, + int x, int y, int w, int h, + int *rx, int *ry) +{ + int resist = 1; + int gad_resist = 4800; + int dx, dy, d, pd; + int resist_x = 0, resist_y = 0; + Evas_List *l, *ll, *rects = NULL; + E_Resist_Rect *r; + + /* FIXME: get resist values from config */ + if (!resist) + { + *rx = x; + *ry = y; + return 0; + } + + dx = x - px; + dy = y - py; + + for (l = con->gadman->clients; l; l = l->next) + { + E_Gadman_Client *gmc; + int ok; + + gmc = l->data; + ok = 1; + for (ll = skiplist; ll; ll = ll->next) + { + if (ll->data == gmc) + { + ok = 0; + break; + } + } + if (ok) + { + r = E_NEW(E_Resist_Rect, 1); + + r->x = gmc->x; + r->y = gmc->y; + r->w = gmc->w; + r->h = gmc->h; + r->v1 = gad_resist; + rects = evas_list_append(rects, r); + } + } + + for (l = rects; l; l = l->next) + { + r = l->data; + if (E_SPANS_COMMON(r->y, r->h, y, h)) + { + if (dx > 0) + { + /* moving right */ + if (r->resist_out) + { + /* check right edge of windows against left */ + d = x + w - (r->x + r->w); + pd = px + pw - (r->x + r->w); + if ((d > 0) && (pd <= 0) && (d <= r->v1)) + { + if (-resist_x < d) + resist_x = -d; + } + } + else + { + /* check left edge of windows against right */ + d = r->x - (x + w); + pd = r->x - (px + pw); + if ((d < 0) && (pd >= 0) && (d >= -r->v1)) + { + if (resist_x > d) + resist_x = d; + } + } + } + else if (dx < 0) + { + /* moving left */ + if (r->resist_out) + { + /* check left edge of windows against right */ + d = r->x - x; + pd = r->x - px; + if ((d > 0) && (pd <= 0) && (d <= r->v1)) + { + if (resist_x < d) + resist_x = d; + } + } + else + { + /* check right edge of windows against left */ + d = x - (r->x + r->w); + pd = px - (r->x + r->w); + if ((d < 0) && (pd >= 0) && (d >= -r->v1)) + { + if (-resist_x > d) + resist_x = -d; + } + } + } + } + if (E_SPANS_COMMON(r->x, r->w, x, w)) + { + if (dy > 0) + { + /* moving down */ + if (r->resist_out) + { + /* check bottom edge of windows against top */ + d = y + h - (r->y + r->h); + pd = py + ph - (r->y + r->h); + if ((d > 0) && (pd <= 0) && (d <= r->v1)) + { + if (-resist_y < d) + resist_y = -d; + } + } + else + { + /* check top edge of windows against bottom */ + d = r->y - (y + h); + pd = r->y - (py + ph); + if ((d < 0) && (pd >= 0) && (d >= -r->v1)) + { + if (resist_y > d) + resist_y = d; + } + } + } + else if (dy < 0) + { + /* moving up */ + if (r->resist_out) + { + /* check top edge of windows against bottom */ + d = r->y - y; + pd = r->y - py; + if ((d > 0) && (pd <= 0) && (d <= r->v1)) + { + if (resist_y < d) + resist_y = d; + } + } + else + { + /* moving up - check bottom edge of windows against top */ + d = y - (r->y + r->h); + pd = py - (r->y + r->h); + if ((d < 0) && (pd >= 0) && (d >= -r->v1)) + { + if (-resist_y > d) + resist_y = -d; + } + } + } + } + } + if (rects) + { + for (l = rects; l; l = l->next) + { + E_FREE(l->data); + } + evas_list_free(rects); + } + if (dx != 0) + *rx = x + resist_x; + else + *rx = x; + if (dy != 0) + *ry = y + resist_y; + else + *ry = y; + return 1; +} =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_resist.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_resist.h 12 Jan 2005 16:03:08 -0000 1.3 +++ e_resist.h 20 Jan 2005 13:42:51 -0000 1.4 @@ -3,7 +3,8 @@ #ifndef E_RESIST_H #define E_RESIST_H -EAPI int e_resist_container_position(E_Container *con, Evas_List *skiplist, int px, int py, int pw, int ph, int x, int y, int w, int h, int *rx, int *ry); +EAPI int e_resist_container_border_position(E_Container *con, Evas_List *skiplist, int px, int py, int pw, int ph, int x, int y, int w, int h, int *rx, int *ry); +EAPI int e_resist_container_gadman_position(E_Container *con, Evas_List *skiplist, int px, int py, int pw, int ph, int x, int y, int w, int h, int *rx, int *ry); #endif #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_zone.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- e_zone.c 17 Jan 2005 08:54:37 -0000 1.19 +++ e_zone.c 20 Jan 2005 13:42:51 -0000 1.20 @@ -58,6 +58,13 @@ char name[40]; Evas_Object *o; + o = evas_object_rectangle_add(con->bg_evas); + zone->bg_clip_object = o; + evas_object_move(o, x, y); + evas_object_resize(o, w, h); + evas_object_color_set(o, 255, 255, 255, 255); + evas_object_show(o); + o = edje_object_add(con->bg_evas); zone->bg_object = o; evas_object_layer_set(o, -1); @@ -69,10 +76,12 @@ edje_object_file_set(o, e_config->desktop_default_background, "desktop/background"); + evas_object_clip_set(o, zone->bg_clip_object); evas_object_show(o); o = evas_object_rectangle_add(con->bg_evas); zone->bg_event_object = o; + evas_object_clip_set(o, zone->bg_clip_object); evas_object_move(o, x, y); evas_object_resize(o, w, h); evas_object_color_set(o, 255, 255, 255, 0); @@ -111,6 +120,7 @@ zone->y = y; evas_object_move(zone->bg_object, x, y); evas_object_move(zone->bg_event_object, x, y); + evas_object_move(zone->bg_clip_object, x, y); } void @@ -123,6 +133,7 @@ zone->h = h; evas_object_resize(zone->bg_object, w, h); evas_object_resize(zone->bg_event_object, w, h); + evas_object_resize(zone->bg_clip_object, w, h); } void @@ -140,8 +151,10 @@ evas_object_move(zone->bg_object, x, y); evas_object_move(zone->bg_event_object, x, y); + evas_object_move(zone->bg_clip_object, x, y); evas_object_resize(zone->bg_object, w, h); evas_object_resize(zone->bg_event_object, w, h); + evas_object_resize(zone->bg_clip_object, w, h); } E_Zone * @@ -207,6 +220,9 @@ con = zone->container; if (zone->name) free(zone->name); con->zones = evas_list_remove(con->zones, zone); + evas_object_del(zone->bg_event_object); + evas_object_del(zone->bg_clip_object); + evas_object_del(zone->bg_object); free(zone); } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_zone.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- e_zone.h 15 Jan 2005 08:31:38 -0000 1.9 +++ e_zone.h 20 Jan 2005 13:42:51 -0000 1.10 @@ -19,6 +19,7 @@ Evas_Object *bg_object; Evas_Object *bg_event_object; + Evas_Object *bg_clip_object; int desk_x_count, desk_y_count; int desk_x_current, desk_y_current; ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs