New border looping interface.

SVN revision: 14750
This commit is contained in:
sebastid 2005-05-13 10:09:55 +00:00 committed by sebastid
parent e174baf5d1
commit 61baf25921
4 changed files with 127 additions and 30 deletions

View File

@ -605,20 +605,96 @@ e_container_border_lower(E_Border *bd)
evas_list_prepend(bd->zone->container->layers[pos].clients, bd); evas_list_prepend(bd->zone->container->layers[pos].clients, bd);
} }
E_Border_List *
e_container_border_list_first(E_Container *con)
{
E_Border_List *list;
list = E_NEW(E_Border_List, 1);
if (!list) return NULL;
list->container = con;
e_object_ref(E_OBJECT(con));
list->layer = 0;
list->clients = list->container->layers[list->layer].clients;
while ((list->layer < 6) && (!list->clients))
list->clients = list->container->layers[++list->layer].clients;
return list;
}
E_Border_List *
e_container_border_list_last(E_Container *con)
{
E_Border_List *list;
list = E_NEW(E_Border_List, 1);
if (!list) return NULL;
list->container = con;
e_object_ref(E_OBJECT(con));
list->layer = 6;
while ((list->layer > 0) && (!list->clients))
{
list->layer--;
if (list->container->layers[list->layer].clients)
list->clients = list->container->layers[list->layer].clients->last;
}
return list;
}
E_Border *
e_container_border_list_next(E_Border_List *list)
{
E_Border *bd;
if (!list->clients) return NULL;
bd = list->clients->data;
list->clients = list->clients->next;
while ((list->layer < 6) && (!list->clients))
list->clients = list->container->layers[++list->layer].clients;
return bd;
}
E_Border *
e_container_border_list_prev(E_Border_List *list)
{
E_Border *bd;
if (!list->clients) return NULL;
bd = list->clients->data;
list->clients = list->clients->prev;
while ((list->layer > 0) && (!list->clients))
list->clients = list->container->layers[--list->layer].clients;
return bd;
}
void
e_container_border_list_free(E_Border_List *list)
{
e_object_unref(E_OBJECT(list->container));
free(list);
}
/* local subsystem functions */ /* local subsystem functions */
static void static void
_e_container_free(E_Container *con) _e_container_free(E_Container *con)
{ {
Evas_List *l, *tmp; Evas_List *l, *tmp;
int i;
if (con->gadman) e_object_del(E_OBJECT(con->gadman)); if (con->gadman) e_object_del(E_OBJECT(con->gadman));
/* We can't use e_object_del here, because border adds a ref to itself /* We can't use e_object_del here, because border adds a ref to itself
* when it is removed, and the ref is never unref'ed */ * when it is removed, and the ref is never unref'ed */
for (l = con->clients; l;) for (i = 0; i < 7; i++)
{ {
tmp = l; for (l = con->layers[i].clients; l;)
l = l->next; {
e_object_free(E_OBJECT(tmp->data)); tmp = l;
l = l->next;
e_object_free(E_OBJECT(tmp->data));
}
} }
for (l = con->zones; l;) for (l = con->zones; l;)
{ {
@ -675,6 +751,7 @@ _e_container_resize_handle(E_Container *con)
{ {
E_Event_Container_Resize *ev; E_Event_Container_Resize *ev;
Evas_List *l, *screens; Evas_List *l, *screens;
int i;
ev = calloc(1, sizeof(E_Event_Container_Resize)); ev = calloc(1, sizeof(E_Event_Container_Resize));
ev->container = con; ev->container = con;
@ -717,21 +794,24 @@ _e_container_resize_handle(E_Container *con)
e_gadman_container_resize(con->gadman); e_gadman_container_resize(con->gadman);
e_object_ref(E_OBJECT(con)); e_object_ref(E_OBJECT(con));
ecore_event_add(E_EVENT_CONTAINER_RESIZE, ev, _e_container_event_container_resize_free, NULL); ecore_event_add(E_EVENT_CONTAINER_RESIZE, ev, _e_container_event_container_resize_free, NULL);
for (l = con->clients; l; l = l->next) for (i = 0; i < 7; i++)
{ {
E_Border *bd; for (l = con->layers[i].clients; l; l = l->next)
{
bd = l->data; E_Border *bd;
if (bd->w > bd->zone->w) bd = l->data;
e_border_resize(bd, bd->zone->w, bd->h);
if ((bd->x + bd->w) > (bd->zone->x + bd->zone->w)) if (bd->w > bd->zone->w)
e_border_move(bd, bd->zone->x + bd->zone->w - bd->w, bd->y); e_border_resize(bd, bd->zone->w, bd->h);
if ((bd->x + bd->w) > (bd->zone->x + bd->zone->w))
if (bd->h > bd->zone->h) e_border_move(bd, bd->zone->x + bd->zone->w - bd->w, bd->y);
e_border_resize(bd, bd->w, bd->zone->h);
if ((bd->y + bd->h) > (bd->zone->y + bd->zone->h)) if (bd->h > bd->zone->h)
e_border_move(bd, bd->x, bd->zone->y + bd->zone->h - bd->h); e_border_resize(bd, bd->w, bd->zone->h);
if ((bd->y + bd->h) > (bd->zone->y + bd->zone->h))
e_border_move(bd, bd->x, bd->zone->y + bd->zone->h - bd->h);
}
} }
} }

View File

@ -15,6 +15,7 @@ typedef enum _E_Container_Shape_Change
} E_Container_Shape_Change; } E_Container_Shape_Change;
typedef struct _E_Container E_Container; typedef struct _E_Container E_Container;
typedef struct _E_Border_List E_Border_List;
typedef struct _E_Container_Shape E_Container_Shape; typedef struct _E_Container_Shape E_Container_Shape;
typedef struct _E_Container_Shape_Callback E_Container_Shape_Callback; typedef struct _E_Container_Shape_Callback E_Container_Shape_Callback;
typedef struct _E_Event_Container_Resize E_Event_Container_Resize; typedef struct _E_Event_Container_Resize E_Event_Container_Resize;
@ -46,8 +47,8 @@ struct _E_Container
Evas_List *shapes; Evas_List *shapes;
Evas_List *shape_change_cb; Evas_List *shape_change_cb;
Evas_List *zones;
Evas_List *clients; Evas_List *clients;
Evas_List *zones;
struct { struct {
Ecore_X_Window win; Ecore_X_Window win;
@ -55,6 +56,13 @@ struct _E_Container
} layers[7]; } layers[7];
}; };
struct _E_Border_List
{
E_Container *container;
int layer;
Evas_List *clients;
};
struct _E_Container_Shape struct _E_Container_Shape
{ {
E_Object e_obj_inherit; E_Object e_obj_inherit;
@ -92,6 +100,12 @@ EAPI void e_container_move_resize(E_Container *con, int x, int y, int w,
EAPI void e_container_raise(E_Container *con); EAPI void e_container_raise(E_Container *con);
EAPI void e_container_lower(E_Container *con); EAPI void e_container_lower(E_Container *con);
EAPI E_Border_List *e_container_border_list_first(E_Container *con);
EAPI E_Border_List *e_container_border_list_last(E_Container *con);
EAPI E_Border *e_container_border_list_next(E_Border_List *list);
EAPI E_Border *e_container_border_list_prev(E_Border_List *list);
EAPI void e_container_border_list_free(E_Border_List *list);
EAPI E_Zone *e_container_zone_at_point_get(E_Container *con, int x, int y); EAPI E_Zone *e_container_zone_at_point_get(E_Container *con, int x, int y);
EAPI E_Zone *e_container_zone_number_get(E_Container *con, int num); EAPI E_Zone *e_container_zone_number_get(E_Container *con, int num);

View File

@ -58,18 +58,18 @@ e_desk_name_set(E_Desk *desk, const char *name)
void void
e_desk_show(E_Desk *desk) e_desk_show(E_Desk *desk)
{ {
Evas_List *l; E_Border_List *bl;
int x, y; int x, y;
E_Event_Desk_Show *ev; E_Event_Desk_Show *ev;
E_Border *bd;
E_OBJECT_CHECK(desk); E_OBJECT_CHECK(desk);
E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE); E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
if (desk->visible) return; if (desk->visible) return;
for (l = desk->zone->container->clients; l; l = l->next) bl = e_container_border_list_first(desk->zone->container);
while ((bd = e_container_border_list_next(bl)))
{ {
E_Border *bd = l->data;
if ((bd->desk->zone == desk->zone) && (!bd->iconic)) if ((bd->desk->zone == desk->zone) && (!bd->iconic))
{ {
if ((bd->desk == desk) || (bd->sticky)) if ((bd->desk == desk) || (bd->sticky))
@ -78,6 +78,7 @@ e_desk_show(E_Desk *desk)
e_border_hide(bd, 1); e_border_hide(bd, 1);
} }
} }
e_container_border_list_free(bl);
for (x = 0; x < desk->zone->desk_x_count; x++) for (x = 0; x < desk->zone->desk_x_count; x++)
{ {

View File

@ -441,9 +441,9 @@ e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count)
E_Desk **new_desks; E_Desk **new_desks;
E_Desk *desk, *new_desk; E_Desk *desk, *new_desk;
int x, y, xx, yy, moved; int x, y, xx, yy, moved;
Evas_List *l;
E_Border *bd; E_Border *bd;
E_Event_Zone_Desk_Count_Set *ev; E_Event_Zone_Desk_Count_Set *ev;
E_Border_List *bl;
xx = x_count; xx = x_count;
if (xx < 1) xx = 1; if (xx < 1) xx = 1;
@ -473,12 +473,13 @@ e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count)
{ {
desk = zone->desks[x + (y * zone->desk_x_count)]; desk = zone->desks[x + (y * zone->desk_x_count)];
for (l = zone->container->clients; l; l = l->next) bl = e_container_border_list_first(zone->container);
while ((bd = e_container_border_list_next(bl)))
{ {
bd = l->data;
if (bd->desk == desk) if (bd->desk == desk)
e_border_desk_set(bd, new_desk); e_border_desk_set(bd, new_desk);
} }
e_container_border_list_free(bl);
e_object_del(E_OBJECT(desk)); e_object_del(E_OBJECT(desk));
} }
} }
@ -492,12 +493,13 @@ e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count)
{ {
desk = zone->desks[x + (y * zone->desk_x_count)]; desk = zone->desks[x + (y * zone->desk_x_count)];
for (l = zone->container->clients; l; l = l->next) bl = e_container_border_list_first(zone->container);
while ((bd = e_container_border_list_next(bl)))
{ {
bd = l->data;
if (bd->desk == desk) if (bd->desk == desk)
e_border_desk_set(bd, new_desk); e_border_desk_set(bd, new_desk);
} }
e_container_border_list_free(bl);
e_object_del(E_OBJECT(desk)); e_object_del(E_OBJECT(desk));
} }
} }