forked from enlightenment/enlightenment
resist now also support resisting when moving OUt of a box - not just into
one.. this is now applied to zones. SVN revision: 12866
This commit is contained in:
parent
da6168304d
commit
08dbb8e5c1
|
@ -44,6 +44,7 @@ e_container_new(E_Manager *man)
|
|||
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;
|
||||
|
@ -82,9 +83,19 @@ e_container_new(E_Manager *man)
|
|||
snprintf(name, sizeof(name), "Container %d", con->num);
|
||||
con->name = strdup(name);
|
||||
|
||||
/* FIXME: Add ecore code to fetch xinerama screens for zones */
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ typedef struct _E_Resist_Rect E_Resist_Rect;
|
|||
struct _E_Resist_Rect
|
||||
{
|
||||
int x, y, w, h;
|
||||
int v1, v2, v3, v4;
|
||||
int v1;
|
||||
int resist_out;
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -32,13 +33,26 @@ e_resist_container_position(E_Container *con, Evas_List *skiplist,
|
|||
}
|
||||
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) \
|
||||
{ \
|
||||
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 @@ e_resist_container_position(E_Container *con, Evas_List *skiplist,
|
|||
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,7 +112,21 @@ e_resist_container_position(E_Container *con, Evas_List *skiplist,
|
|||
{
|
||||
if (dx > 0)
|
||||
{
|
||||
/* moving right - check left edge of windows against right */
|
||||
/* 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))
|
||||
|
@ -99,9 +135,24 @@ e_resist_container_position(E_Container *con, Evas_List *skiplist,
|
|||
resist_x = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dx < 0)
|
||||
{
|
||||
/* moving left - check right edge of windows against left */
|
||||
/* 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))
|
||||
|
@ -111,11 +162,26 @@ e_resist_container_position(E_Container *con, Evas_List *skiplist,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (E_SPANS_COMMON(r->x, r->w, x, w))
|
||||
{
|
||||
if (dy > 0)
|
||||
{
|
||||
/* moving down - check top edge of windows against bottom */
|
||||
/* 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))
|
||||
|
@ -124,7 +190,22 @@ e_resist_container_position(E_Container *con, Evas_List *skiplist,
|
|||
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);
|
||||
|
@ -137,6 +218,7 @@ e_resist_container_position(E_Container *con, Evas_List *skiplist,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rects)
|
||||
{
|
||||
for (l = rects; l; l = l->next)
|
||||
|
|
|
@ -81,7 +81,8 @@ e_zone_new(E_Container *con, int x, int y, int w, int h)
|
|||
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_zone_desk_count_set(zone,
|
||||
e_config->zone_desks_x_count,
|
||||
e_config->zone_desks_y_count);
|
||||
|
||||
return zone;
|
||||
|
|
Loading…
Reference in New Issue