Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_container.c e_resist.c e_zone.c
Log Message:
resist now also support resisting when moving OUt of a box - not just into
one.. this is now applied to zones.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_container.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- e_container.c 5 Jan 2005 10:37:53 -0000 1.16
+++ e_container.c 10 Jan 2005 14:07:42 -0000 1.17
@@ -44,6 +44,7 @@
E_Zone *zone;
Evas_Object *o;
char name[40];
+ int i, n;
con = E_OBJECT_ALLOC(E_Container, _e_container_free);
if (!con) return NULL;
@@ -66,15 +67,15 @@
ecore_evas_callback_resize_set(con->bg_ecore_evas,
_e_container_cb_bg_ecore_evas_resize);
- o = evas_object_rectangle_add(con->bg_evas);
- con->bg_blank_object = o;
- evas_object_layer_set(o, -100);
- evas_object_move(o, 0, 0);
- evas_object_resize(o, con->w, con->h);
- evas_object_color_set(o, 255, 255, 255, 255);
+ o = evas_object_rectangle_add(con->bg_evas);
+ con->bg_blank_object = o;
+ evas_object_layer_set(o, -100);
+ evas_object_move(o, 0, 0);
+ evas_object_resize(o, con->w, con->h);
+ evas_object_color_set(o, 255, 255, 255, 255);
evas_object_name_set(o, "desktop/background");
evas_object_data_set(o, "e_container", con);
- evas_object_show(o);
+ evas_object_show(o);
e_pointer_container_set(con);
@@ -82,9 +83,19 @@
snprintf(name, sizeof(name), "Container %d", con->num);
con->name = strdup(name);
- /* FIXME: Add ecore code to fetch xinerama screens for zones */
- zone = e_zone_new(con, 0, 0, con->w, con->h);
-
+ n = ecore_x_xinerama_screen_count_get();
+ if (n == 0)
+ zone = e_zone_new(con, 0, 0, con->w, con->h);
+ else
+ {
+ for (i = 0; i < n; i++)
+ {
+ int zx, zy, zw, zh;
+
+ if (ecore_x_xinerama_screen_geometry_get(i, &zx, &zy, &zw, &zh))
+ zone = e_zone_new(con, zx, zy, zw, zh);
+ }
+ }
return con;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_resist.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_resist.c 25 Nov 2004 03:37:44 -0000 1.1
+++ e_resist.c 10 Jan 2005 14:07:42 -0000 1.2
@@ -5,7 +5,8 @@
struct _E_Resist_Rect
{
int x, y, w, h;
- int v1, v2, v3, v4;
+ int v1;
+ int resist_out;
};
int
@@ -32,13 +33,26 @@
}
dx = x - px;
dy = y - py;
- /* edges of screen */
+
+ /* 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) \
{ \
r = E_NEW(E_Resist_Rect, 1); \
r->x = _x; r->y = _y; r->w = _w; r->h = _h; r->v1 = _resist; \
+ r->resist_out = 0; \
rects = evas_list_append(rects, r); \
}
+#define HOLDER(_x, _y, _w, _h, _resist) \
+ { \
+ r = E_NEW(E_Resist_Rect, 1); \
+ r->x = _x; r->y = _y; r->w = _w; r->h = _h; r->v1 = _resist; \
+ 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,
@@ -47,6 +61,14 @@
desk_resist);
OBSTACLE(con->w, -1000000, 1000000, 2000000 + con->h,
desk_resist);
+#endif
+ for (l = con->zones; l; l = l->next)
+ {
+ E_Zone *zone;
+
+ zone = l->data;
+ HOLDER(zone->x, zone->y, zone->w, zone->h, desk_resist);
+ }
/* FIXME: need to add resist or complete BLOCKS for things like ibar */
/* can add code here to add more fake obstacles with custom resist values */
/* here if need be - ie xinerama middle between screens and panels etc. */
@@ -90,24 +112,54 @@
{
if (dx > 0)
{
- /* moving right - 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))
+ /* 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
{
- if (resist_x > d)
- resist_x = d;
+ /* 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 - 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))
+ /* 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
{
- if (-resist_x > d)
- resist_x = -d;
+ /* 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;
+ }
}
}
}
@@ -115,24 +167,54 @@
{
if (dy > 0)
{
- /* moving down - 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))
+ /* moving down */
+ if (r->resist_out)
{
- if (resist_y > d)
- resist_y = d;
+ /* 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 - 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))
+ /* 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
{
- if (-resist_y > d)
- resist_y = -d;
+ /* 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;
+ }
}
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_zone.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- e_zone.c 9 Jan 2005 18:58:13 -0000 1.11
+++ e_zone.c 10 Jan 2005 14:07:42 -0000 1.12
@@ -81,8 +81,9 @@
zone->desk_y_count = 0;
zone->desk_x_current = 0;
zone->desk_y_current = 0;
- e_zone_desk_count_set(zone, e_config->zone_desks_x_count,
- e_config->zone_desks_y_count);
+ e_zone_desk_count_set(zone,
+ e_config->zone_desks_x_count,
+ e_config->zone_desks_y_count);
return zone;
}
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs