2005-02-07 05:51:09 -08:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
2004-11-24 19:37:45 -08:00
|
|
|
#include "e.h"
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2005-05-12 21:05:43 -07:00
|
|
|
e_place_zone_region_smart_cleanup(E_Zone *zone)
|
|
|
|
{
|
|
|
|
E_Desk *desk;
|
2005-05-13 06:34:21 -07:00
|
|
|
Evas_List *borders = NULL;
|
|
|
|
E_Border_List *bl;
|
|
|
|
E_Border *border;
|
2005-05-12 21:05:43 -07:00
|
|
|
|
|
|
|
E_OBJECT_CHECK(zone);
|
|
|
|
desk = e_desk_current_get(zone);
|
2005-05-13 06:34:21 -07:00
|
|
|
bl = e_container_border_list_first(desk->zone->container);
|
|
|
|
while ((border = e_container_border_list_next(bl)))
|
2005-05-12 21:05:43 -07:00
|
|
|
{
|
|
|
|
/* Build a list of windows on this desktop and not iconified. */
|
2005-07-30 23:22:31 -07:00
|
|
|
if ((border->desk == desk) && (!border->iconic) &&
|
|
|
|
(!border->lock_user_location))
|
2005-05-12 21:05:43 -07:00
|
|
|
{
|
|
|
|
int area;
|
|
|
|
Evas_List *ll;
|
|
|
|
|
|
|
|
/* Ordering windows largest to smallest gives better results */
|
|
|
|
area = border->w * border->h;
|
|
|
|
for (ll = borders; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
int testarea;
|
2005-07-30 23:22:31 -07:00
|
|
|
E_Border *bd;
|
|
|
|
|
|
|
|
bd = ll->data;
|
2005-05-12 21:05:43 -07:00
|
|
|
testarea = bd->w * bd->h;
|
|
|
|
/* Insert the border if larger than the current border */
|
|
|
|
if (area >= testarea)
|
|
|
|
{
|
|
|
|
borders = evas_list_prepend_relative(borders, border, bd);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Looped over all borders without placing, so place at end */
|
|
|
|
if (!ll) borders = evas_list_append(borders, border);
|
|
|
|
}
|
|
|
|
}
|
2005-05-13 06:34:21 -07:00
|
|
|
e_container_border_list_free(bl);
|
2005-05-12 21:05:43 -07:00
|
|
|
|
|
|
|
/* Loop over the borders moving each one using the smart placement */
|
|
|
|
while (borders)
|
|
|
|
{
|
|
|
|
int new_x, new_y;
|
|
|
|
|
|
|
|
border = borders->data;
|
|
|
|
e_place_zone_region_smart(zone, borders, border->x, border->y,
|
|
|
|
border->w, border->h, &new_x, &new_y);
|
|
|
|
e_border_move(border, new_x, new_y);
|
|
|
|
borders = evas_list_remove(borders, border);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-27 23:04:11 -07:00
|
|
|
static int
|
|
|
|
_e_place_cb_sort_cmp(const void *v1, const void *v2)
|
|
|
|
{
|
|
|
|
return (*((int *)v1)) - (*((int *)v2));
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2005-01-11 05:11:12 -08:00
|
|
|
e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w, int h, int *rx, int *ry)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2005-05-27 23:04:11 -07:00
|
|
|
int a_w = 0, a_h = 0, a_alloc_w = 0, a_alloc_h = 0;
|
2004-11-24 19:37:45 -08:00
|
|
|
int *a_x = NULL, *a_y = NULL;
|
2005-05-27 23:04:11 -07:00
|
|
|
int zw, zh;
|
|
|
|
char *u_x = NULL, *u_y = NULL;
|
2005-05-13 06:34:21 -07:00
|
|
|
Evas_List *ll;
|
|
|
|
E_Border_List *bl;
|
|
|
|
E_Border *bd;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2005-05-27 22:03:27 -07:00
|
|
|
#if 0
|
|
|
|
/* DISABLE placement entirely for speed testing */
|
|
|
|
*rx = x;
|
|
|
|
*ry = y;
|
|
|
|
return 1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* FIXME: this NEEDS optimizing */
|
2004-11-24 19:37:45 -08:00
|
|
|
a_w = 2;
|
|
|
|
a_h = 2;
|
|
|
|
a_x = E_NEW(int, 2);
|
|
|
|
a_y = E_NEW(int, 2);
|
|
|
|
|
2005-01-11 05:11:12 -08:00
|
|
|
x -= zone->x;
|
|
|
|
y -= zone->y;
|
|
|
|
|
2005-05-27 23:04:11 -07:00
|
|
|
zw = zone->w;
|
|
|
|
zh = zone->h;
|
|
|
|
|
|
|
|
u_x = calloc(zw + 1, sizeof(char));
|
|
|
|
u_y = calloc(zh + 1, sizeof(char));
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
a_x[0] = 0;
|
2005-05-27 23:04:11 -07:00
|
|
|
a_x[1] = zw;
|
2004-11-24 19:37:45 -08:00
|
|
|
a_y[0] = 0;
|
2005-05-27 23:04:11 -07:00
|
|
|
a_y[1] = zh;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2005-05-13 06:34:21 -07:00
|
|
|
bl = e_container_border_list_first(zone->container);
|
|
|
|
while ((bd = e_container_border_list_next(bl)))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
int ok;
|
2005-05-27 23:04:11 -07:00
|
|
|
int bx, by, bw, bh;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
|
|
|
ok = 1;
|
|
|
|
for (ll = skiplist; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
if (ll->data == bd)
|
|
|
|
{
|
|
|
|
ok = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-05-27 23:04:11 -07:00
|
|
|
if ((!ok) || (!bd->visible)) continue;
|
|
|
|
|
|
|
|
bx = bd->x - zone->x;
|
|
|
|
by = bd->y - zone->y;
|
|
|
|
bw = bd->w;
|
|
|
|
bh = bd->h;
|
|
|
|
|
|
|
|
if (E_INTERSECTS(bx, by, bw, bh, 0, 0, zw, zh))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2005-05-27 23:04:11 -07:00
|
|
|
if ((bx > 0) && (bx <= zw) && (!u_x[bx]))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2005-05-27 23:04:11 -07:00
|
|
|
a_w++;
|
|
|
|
if (a_w > a_alloc_w)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2005-05-27 23:04:11 -07:00
|
|
|
a_alloc_w += 32;
|
|
|
|
E_REALLOC(a_x, int, a_alloc_w);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2005-05-27 23:04:11 -07:00
|
|
|
a_x[a_w - 1] = bx;
|
|
|
|
u_x[bx] = 1;
|
|
|
|
}
|
|
|
|
if (((bx + bw) > 0) && ((bx + bw) <= zw) && (!u_x[bx + bw]))
|
|
|
|
{
|
|
|
|
a_w++;
|
|
|
|
if (a_w > a_alloc_w)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2005-05-27 23:04:11 -07:00
|
|
|
a_alloc_w += 32;
|
|
|
|
E_REALLOC(a_x, int, a_alloc_w);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2005-05-27 23:04:11 -07:00
|
|
|
a_x[a_w - 1] = bx + bw;
|
|
|
|
u_x[bx + bw] = 1;
|
|
|
|
}
|
|
|
|
if ((by > 0) && (by <= zh) && (!u_y[by]))
|
|
|
|
{
|
|
|
|
a_h++;
|
|
|
|
if (a_h > a_alloc_h)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2005-05-27 23:04:11 -07:00
|
|
|
a_alloc_h += 32;
|
|
|
|
E_REALLOC(a_y, int, a_alloc_h);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2005-05-27 23:04:11 -07:00
|
|
|
a_y[a_h - 1] = by;
|
|
|
|
u_y[by] = 1;
|
|
|
|
}
|
|
|
|
if (((by + bh) > 0) && ((by + bh) <= zh) && (!u_y[by + bh]))
|
|
|
|
{
|
|
|
|
a_h++;
|
|
|
|
if (a_h > a_alloc_h)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2005-05-27 23:04:11 -07:00
|
|
|
a_alloc_h += 32;
|
|
|
|
E_REALLOC(a_y, int, a_alloc_h);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2005-05-27 23:04:11 -07:00
|
|
|
a_y[a_h - 1] = by + bh;
|
|
|
|
u_y[by + bh] = 1;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-05-27 23:04:11 -07:00
|
|
|
qsort(a_x, a_w, sizeof(int), _e_place_cb_sort_cmp);
|
|
|
|
qsort(a_y, a_h, sizeof(int), _e_place_cb_sort_cmp);
|
2005-05-13 06:34:21 -07:00
|
|
|
e_container_border_list_free(bl);
|
2005-05-27 23:04:11 -07:00
|
|
|
free(u_x);
|
|
|
|
free(u_y);
|
2005-05-13 06:34:21 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
int area = 0x7fffffff;
|
|
|
|
|
|
|
|
for (j = 0; j < a_h - 1; j++)
|
|
|
|
{
|
|
|
|
for (i = 0; i < a_w - 1; i++)
|
|
|
|
{
|
2005-01-11 05:11:12 -08:00
|
|
|
if ((a_x[i] < (zone->w - w)) &&
|
|
|
|
(a_y[j] < (zone->h - h)))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
int ar = 0;
|
|
|
|
|
2005-05-13 06:34:21 -07:00
|
|
|
bl = e_container_border_list_first(zone->container);
|
|
|
|
while ((bd = e_container_border_list_next(bl)))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
int x1, y1, w1, h1, x2, y2, w2, h2;
|
|
|
|
int ok;
|
|
|
|
|
|
|
|
ok = 1;
|
|
|
|
x1 = a_x[i];
|
|
|
|
y1 = a_y[j];
|
|
|
|
w1 = w;
|
|
|
|
h1 = h;
|
2005-01-11 05:11:12 -08:00
|
|
|
x2 = (bd->x - zone->x);
|
|
|
|
y2 = (bd->y - zone->y);
|
2004-11-24 19:37:45 -08:00
|
|
|
w2 = bd->w;
|
|
|
|
h2 = bd->h;
|
|
|
|
for (ll = skiplist; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
if (ll->data == bd)
|
|
|
|
{
|
|
|
|
ok = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((ok) && (bd->visible) &&
|
|
|
|
E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
|
|
|
|
{
|
|
|
|
int iw, ih;
|
|
|
|
int x0, x00, y0, y00;
|
|
|
|
|
|
|
|
x0 = x1;
|
|
|
|
if (x1 < x2)
|
|
|
|
x0 = x2;
|
|
|
|
x00 = (x1 + w1);
|
|
|
|
if ((x2 + w2) < (x1 + w1))
|
|
|
|
x00 = (x2 + w2);
|
|
|
|
|
|
|
|
y0 = y1;
|
|
|
|
if (y1 < y2)
|
|
|
|
y0 = y2;
|
|
|
|
y00 = (y1 + h1);
|
|
|
|
if ((y2 + h2) < (y1 + h1))
|
|
|
|
y00 = (y2 + h2);
|
|
|
|
|
|
|
|
iw = x00 - x0;
|
|
|
|
ih = y00 - y0;
|
|
|
|
ar += (iw * ih);
|
|
|
|
}
|
|
|
|
}
|
2005-05-13 06:34:21 -07:00
|
|
|
e_container_border_list_free(bl);
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
if (ar < area)
|
|
|
|
{
|
|
|
|
area = ar;
|
|
|
|
*rx = a_x[i];
|
|
|
|
*ry = a_y[j];
|
|
|
|
if (ar == 0)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
2005-01-11 05:11:12 -08:00
|
|
|
if ((a_x[i + 1] - w > 0) && (a_y[j] < (zone->h - h)))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
int ar = 0;
|
|
|
|
|
2005-05-13 06:34:21 -07:00
|
|
|
bl = e_container_border_list_first(zone->container);
|
|
|
|
while ((bd = e_container_border_list_next(bl)))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
int x1, y1, w1, h1, x2, y2, w2, h2;
|
|
|
|
int ok;
|
|
|
|
|
|
|
|
ok = 1;
|
|
|
|
x1 = a_x[i + 1] - w;
|
|
|
|
y1 = a_y[j];
|
|
|
|
w1 = w;
|
|
|
|
h1 = h;
|
2005-01-11 05:11:12 -08:00
|
|
|
x2 = (bd->x - zone->x);
|
|
|
|
y2 = (bd->y - zone->y);
|
2004-11-24 19:37:45 -08:00
|
|
|
w2 = bd->w;
|
|
|
|
h2 = bd->h;
|
|
|
|
for (ll = skiplist; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
if (ll->data == bd)
|
|
|
|
{
|
|
|
|
ok = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((ok) && (bd->visible) &&
|
|
|
|
E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
|
|
|
|
{
|
|
|
|
int iw, ih;
|
|
|
|
int x0, x00, y0, y00;
|
|
|
|
|
|
|
|
x0 = x1;
|
|
|
|
if (x1 < x2)
|
|
|
|
x0 = x2;
|
|
|
|
x00 = (x1 + w1);
|
|
|
|
if ((x2 + w2) < (x1 + w1))
|
|
|
|
x00 = (x2 + w2);
|
|
|
|
|
|
|
|
y0 = y1;
|
|
|
|
if (y1 < y2)
|
|
|
|
y0 = y2;
|
|
|
|
y00 = (y1 + h1);
|
|
|
|
if ((y2 + h2) < (y1 + h1))
|
|
|
|
y00 = (y2 + h2);
|
|
|
|
|
|
|
|
iw = x00 - x0;
|
|
|
|
ih = y00 - y0;
|
|
|
|
ar += (iw * ih);
|
|
|
|
}
|
|
|
|
}
|
2005-05-13 06:34:21 -07:00
|
|
|
e_container_border_list_free(bl);
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
if (ar < area)
|
|
|
|
{
|
|
|
|
area = ar;
|
|
|
|
*rx = a_x[i + 1] - w;
|
|
|
|
*ry = a_y[j];
|
|
|
|
if (ar == 0)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((a_x[i + 1] - w > 0) && (a_y[j + 1] - h > 0))
|
|
|
|
{
|
|
|
|
int ar = 0;
|
|
|
|
|
2005-05-13 06:34:21 -07:00
|
|
|
bl = e_container_border_list_first(zone->container);
|
|
|
|
while ((bd = e_container_border_list_next(bl)))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
int x1, y1, w1, h1, x2, y2, w2, h2;
|
|
|
|
int ok;
|
|
|
|
|
|
|
|
ok = 1;
|
|
|
|
x1 = a_x[i + 1] - w;
|
|
|
|
y1 = a_y[j + 1] - h;
|
|
|
|
w1 = w;
|
|
|
|
h1 = h;
|
2005-01-11 05:11:12 -08:00
|
|
|
x2 = (bd->x - zone->x);
|
|
|
|
y2 = (bd->y - zone->y);
|
2004-11-24 19:37:45 -08:00
|
|
|
w2 = bd->w;
|
|
|
|
h2 = bd->h;
|
|
|
|
for (ll = skiplist; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
if (ll->data == bd)
|
|
|
|
{
|
|
|
|
ok = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((ok) && (bd->visible) &&
|
|
|
|
E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
|
|
|
|
{
|
|
|
|
int iw, ih;
|
|
|
|
int x0, x00, y0, y00;
|
|
|
|
|
|
|
|
x0 = x1;
|
|
|
|
if (x1 < x2)
|
|
|
|
x0 = x2;
|
|
|
|
x00 = (x1 + w1);
|
|
|
|
if ((x2 + w2) < (x1 + w1))
|
|
|
|
x00 = (x2 + w2);
|
|
|
|
|
|
|
|
y0 = y1;
|
|
|
|
if (y1 < y2)
|
|
|
|
y0 = y2;
|
|
|
|
y00 = (y1 + h1);
|
|
|
|
if ((y2 + h2) < (y1 + h1))
|
|
|
|
y00 = (y2 + h2);
|
|
|
|
|
|
|
|
iw = x00 - x0;
|
|
|
|
ih = y00 - y0;
|
|
|
|
ar += (iw * ih);
|
|
|
|
}
|
|
|
|
}
|
2005-05-13 06:34:21 -07:00
|
|
|
e_container_border_list_free(bl);
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
if (ar < area)
|
|
|
|
{
|
|
|
|
area = ar;
|
|
|
|
*rx = a_x[i + 1] - w;
|
|
|
|
*ry = a_y[j + 1] - h;
|
|
|
|
if (ar == 0)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
2005-01-11 05:11:12 -08:00
|
|
|
if ((a_x[i] < (zone->w - w)) && (a_y[j + 1] - h > 0))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
int ar = 0;
|
|
|
|
|
2005-05-13 06:34:21 -07:00
|
|
|
bl = e_container_border_list_first(zone->container);
|
|
|
|
while ((bd = e_container_border_list_next(bl)))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
int x1, y1, w1, h1, x2, y2, w2, h2;
|
|
|
|
int ok;
|
|
|
|
|
|
|
|
ok = 1;
|
|
|
|
x1 = a_x[i];
|
|
|
|
y1 = a_y[j + 1] - h;
|
|
|
|
w1 = w;
|
|
|
|
h1 = h;
|
2005-01-11 05:11:12 -08:00
|
|
|
x2 = (bd->x - zone->x);
|
|
|
|
y2 = (bd->y - zone->y);
|
2004-11-24 19:37:45 -08:00
|
|
|
w2 = bd->w;
|
|
|
|
h2 = bd->h;
|
|
|
|
for (ll = skiplist; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
if (ll->data == bd)
|
|
|
|
{
|
|
|
|
ok = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((ok) && (bd->visible) &&
|
|
|
|
E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
|
|
|
|
{
|
|
|
|
int iw, ih;
|
|
|
|
int x0, x00, y0, y00;
|
|
|
|
|
|
|
|
x0 = x1;
|
|
|
|
if (x1 < x2)
|
|
|
|
x0 = x2;
|
|
|
|
x00 = (x1 + w1);
|
|
|
|
if ((x2 + w2) < (x1 + w1))
|
|
|
|
x00 = (x2 + w2);
|
|
|
|
|
|
|
|
y0 = y1;
|
|
|
|
if (y1 < y2)
|
|
|
|
y0 = y2;
|
|
|
|
y00 = (y1 + h1);
|
|
|
|
if ((y2 + h2) < (y1 + h1))
|
|
|
|
y00 = (y2 + h2);
|
|
|
|
|
|
|
|
iw = x00 - x0;
|
|
|
|
ih = y00 - y0;
|
|
|
|
ar += (iw * ih);
|
|
|
|
}
|
|
|
|
}
|
2005-05-13 06:34:21 -07:00
|
|
|
e_container_border_list_free(bl);
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
if (ar < area)
|
|
|
|
{
|
|
|
|
area = ar;
|
|
|
|
*rx = a_x[i];
|
|
|
|
*ry = a_y[j + 1] - h;
|
|
|
|
if (ar == 0)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
E_FREE(a_x);
|
|
|
|
E_FREE(a_y);
|
2005-01-11 05:11:12 -08:00
|
|
|
*rx += zone->x;
|
|
|
|
*ry += zone->y;
|
2004-11-24 19:37:45 -08:00
|
|
|
return 1;
|
|
|
|
}
|
2005-09-12 22:19:25 -07:00
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2005-09-19 22:14:57 -07:00
|
|
|
e_place_zone_cursor(E_Zone *zone, int x, int y, int w, int h, int it, int *rx, int *ry)
|
2005-09-12 22:19:25 -07:00
|
|
|
{
|
|
|
|
int cursor_x = 0, cursor_y = 0;
|
2005-09-19 22:14:57 -07:00
|
|
|
int zone_right, zone_bottom;
|
2005-09-12 22:19:25 -07:00
|
|
|
|
|
|
|
E_OBJECT_CHECK(zone);
|
|
|
|
|
|
|
|
ecore_x_pointer_xy_get(zone->container->win, &cursor_x, &cursor_y);
|
2005-09-29 05:48:32 -07:00
|
|
|
*rx = cursor_x - (w >> 1);
|
|
|
|
*ry = cursor_y - (it >> 1);
|
2005-09-19 22:14:57 -07:00
|
|
|
|
|
|
|
if (*rx < zone->x)
|
|
|
|
*rx = zone->x;
|
|
|
|
|
|
|
|
if (*ry < zone->y)
|
|
|
|
*ry = zone->y;
|
|
|
|
|
|
|
|
zone_right = zone->x + zone->w;
|
|
|
|
zone_bottom = zone->y + zone->h;
|
|
|
|
|
|
|
|
if ((*rx + w) > zone_right)
|
|
|
|
*rx = zone_right - w;
|
|
|
|
|
|
|
|
if ((*ry + h) > zone_bottom)
|
|
|
|
*ry = zone_bottom - h;
|
|
|
|
|
2005-09-12 22:19:25 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2005-09-26 03:30:38 -07:00
|
|
|
e_place_zone_manual(E_Zone *zone, int w, int h, int *rx, int *ry)
|
2005-09-22 10:10:02 -07:00
|
|
|
{
|
|
|
|
int cursor_x = 0, cursor_y = 0;
|
2005-09-12 22:19:25 -07:00
|
|
|
|
2005-09-22 10:10:02 -07:00
|
|
|
E_OBJECT_CHECK_RETURN(zone, 0);
|
2005-09-12 22:19:25 -07:00
|
|
|
|
2005-09-22 10:10:02 -07:00
|
|
|
ecore_x_pointer_xy_get(zone->container->win, &cursor_x, &cursor_y);
|
2005-09-29 05:48:32 -07:00
|
|
|
if (rx) *rx = cursor_x - (w >> 1);
|
|
|
|
if (ry) *ry = cursor_y - (h >> 1);
|
2005-09-22 10:10:02 -07:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|