Enlightenment CVS committal

Author  : sebastid
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_container.c e_container.h e_desk.c e_zone.c 


Log Message:
New border looping interface.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_container.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- e_container.c       13 May 2005 09:23:50 -0000      1.48
+++ e_container.c       13 May 2005 10:09:55 -0000      1.49
@@ -605,20 +605,96 @@
       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 */
 static void
 _e_container_free(E_Container *con)
 {
    Evas_List *l, *tmp;
-   
+   int i;
+
    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
     * when it is removed, and the ref is never unref'ed */
-   for (l = con->clients; l;)
+   for (i = 0; i < 7; i++)
      {
-       tmp = l;
-       l = l->next;
-       e_object_free(E_OBJECT(tmp->data));
+       for (l = con->layers[i].clients; l;)
+         {
+            tmp = l;
+            l = l->next;
+            e_object_free(E_OBJECT(tmp->data));
+         }
      }
    for (l = con->zones; l;)
      {
@@ -675,6 +751,7 @@
 {
    E_Event_Container_Resize *ev;
    Evas_List *l, *screens;
+   int i;
    
    ev = calloc(1, sizeof(E_Event_Container_Resize));
    ev->container = con;
@@ -717,21 +794,24 @@
    e_gadman_container_resize(con->gadman);
    e_object_ref(E_OBJECT(con));
    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;
-       
-       bd = l->data;
-       
-       if (bd->w > bd->zone->w)
-         e_border_resize(bd, bd->zone->w, bd->h);
-       if ((bd->x + bd->w) > (bd->zone->x + bd->zone->w))
-         e_border_move(bd, bd->zone->x + bd->zone->w - bd->w, bd->y);
-           
-       if (bd->h > bd->zone->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);
+       for (l = con->layers[i].clients; l; l = l->next)
+         {
+            E_Border *bd;
+
+            bd = l->data;
+
+            if (bd->w > bd->zone->w)
+              e_border_resize(bd, bd->zone->w, bd->h);
+            if ((bd->x + bd->w) > (bd->zone->x + bd->zone->w))
+              e_border_move(bd, bd->zone->x + bd->zone->w - bd->w, bd->y);
+
+            if (bd->h > bd->zone->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);
+         }
      }
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_container.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- e_container.h       13 May 2005 09:23:51 -0000      1.20
+++ e_container.h       13 May 2005 10:09:55 -0000      1.21
@@ -15,6 +15,7 @@
 } E_Container_Shape_Change;
 
 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_Callback E_Container_Shape_Callback;
 typedef struct _E_Event_Container_Resize   E_Event_Container_Resize;
@@ -46,8 +47,8 @@
    
    Evas_List           *shapes;
    Evas_List           *shape_change_cb;
-   Evas_List           *zones;
    Evas_List           *clients;
+   Evas_List           *zones;
 
    struct {
        Ecore_X_Window win;
@@ -55,6 +56,13 @@
    } layers[7];
 };
 
+struct _E_Border_List
+{
+   E_Container *container;
+   int layer;
+   Evas_List *clients;
+};
+
 struct _E_Container_Shape
 {
    E_Object       e_obj_inherit;
@@ -92,6 +100,12 @@
 EAPI void         e_container_raise(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_number_get(E_Container *con, int num);
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_desk.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- e_desk.c    13 May 2005 07:24:47 -0000      1.31
+++ e_desk.c    13 May 2005 10:09:55 -0000      1.32
@@ -58,18 +58,18 @@
 void
 e_desk_show(E_Desk *desk)
 {
-   Evas_List         *l;
+   E_Border_List     *bl;
    int                x, y;
    E_Event_Desk_Show *ev;
-   
+   E_Border *bd;
+
    E_OBJECT_CHECK(desk);
    E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
    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 == desk) || (bd->sticky))
@@ -78,6 +78,7 @@
               e_border_hide(bd, 1);
          }
      }
+   e_container_border_list_free(bl);
    
    for (x = 0; x < desk->zone->desk_x_count; x++)
      {
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_zone.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -3 -r1.50 -r1.51
--- e_zone.c    12 May 2005 07:29:17 -0000      1.50
+++ e_zone.c    13 May 2005 10:09:55 -0000      1.51
@@ -441,9 +441,9 @@
    E_Desk   **new_desks;
    E_Desk    *desk, *new_desk;
    int        x, y, xx, yy, moved;
-   Evas_List *l;
    E_Border  *bd;
    E_Event_Zone_Desk_Count_Set *ev;
+   E_Border_List *bl;
    
    xx = x_count;
    if (xx < 1) xx = 1;
@@ -473,12 +473,13 @@
               {
                  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)
                         e_border_desk_set(bd, new_desk);
                    }
+                 e_container_border_list_free(bl);
                  e_object_del(E_OBJECT(desk));
               }
          }
@@ -492,12 +493,13 @@
               {
                  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)
                         e_border_desk_set(bd, new_desk);
                    }
+                 e_container_border_list_free(bl);
                  e_object_del(E_OBJECT(desk));
               }
          }     




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to