Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e.h e_border.c e_border.h e_container.c e_place.c e_place.h 
        e_zone.c 


Log Message:


respect zones for resistance, window placement...

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e.h 3 Jan 2005 09:34:24 -0000       1.8
+++ e.h 11 Jan 2005 13:11:11 -0000      1.9
@@ -20,6 +20,7 @@
 #include <Ecore_Job.h>
 #include <Ecore_Txt.h>
 #include <Ecore_Config.h>
+#include <Ecore_X_Atoms.h>
 #include <Eet.h>
 #include <Edje.h>
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -3 -r1.60 -r1.61
--- e_border.c  11 Jan 2005 08:53:57 -0000      1.60
+++ e_border.c  11 Jan 2005 13:11:12 -0000      1.61
@@ -3,7 +3,6 @@
  */
 
 #include "e.h"
-#include <Ecore_X_Atoms.h>
 
 #define RESIZE_NONE 0
 #define RESIZE_TL   1
@@ -79,6 +78,8 @@
 static void _e_border_event_border_show_free(void *data, void *ev);
 static void _e_border_event_border_hide_free(void *data, void *ev);
 
+static void _e_border_zone_update(E_Border *bd);
+
 /* local subsystem globals */
 static Evas_List *handlers = NULL;
 static Evas_List *borders = NULL;
@@ -153,7 +154,7 @@
    
    bd = E_OBJECT_ALLOC(E_Border, _e_border_free);
    if (!bd) return NULL;
-   e_object_del_func_set(bd, _e_border_del);
+   e_object_del_func_set(E_OBJECT(bd), E_OBJECT_CLEANUP_FUNC(_e_border_del));
    
    printf("##- NEW CLIENT 0x%x\n", win);
    bd->container = con;
@@ -365,7 +366,7 @@
                                  bd->y + bd->client_inset.t, 
                                  bd->client.w,
                                  bd->client.h);
-
+   _e_border_zone_update(bd);
    ev = calloc(1, sizeof(E_Event_Border_Move));
    ev->border = bd;
    e_object_ref(E_OBJECT(bd));
@@ -389,7 +390,7 @@
                                  bd->y + bd->client_inset.t, 
                                  bd->client.w,
                                  bd->client.h);
-
+   _e_border_zone_update(bd);
    ev = calloc(1, sizeof(E_Event_Border_Resize));
    ev->border = bd;
    e_object_ref(E_OBJECT(bd));
@@ -418,7 +419,7 @@
                                  bd->y + bd->client_inset.t, 
                                  bd->client.w,
                                  bd->client.h);
-   
+   _e_border_zone_update(bd);
    mev = calloc(1, sizeof(E_Event_Border_Move));
    mev->border = bd;
    e_object_ref(E_OBJECT(bd));
@@ -781,6 +782,12 @@
    return NULL;
 }
 
+E_Border *
+e_border_focused_get(void)
+{
+   return focused;
+}
+
 void
 e_border_idler_before(void)
 {
@@ -2148,18 +2155,18 @@
                  
                  printf("##- AUTO POS 0x%x\n", bd->client.win);
                  if (bd->zone->w > bd->w)
-                   new_x = rand() % (bd->zone->w - bd->w);
+                   new_x = bd->zone->x + (rand() % (bd->zone->w - bd->w));
                  else
-                   new_x = 0;
+                   new_x = bd->zone->x;
                  if (bd->zone->h > bd->h)
-                   new_y = rand() % (bd->zone->h - bd->h);
+                   new_y = bd->zone->y + (rand() % (bd->zone->h - bd->h));
                  else
-                   new_y = 0;
+                   new_y = bd->zone->y;
                  
                  skiplist = evas_list_append(skiplist, bd);
-                 e_place_container_region_smart(bd->container, skiplist,
-                                                bd->x, bd->y, bd->w, bd->h,
-                                                &new_x, &new_y);
+                 e_place_zone_region_smart(bd->zone, skiplist,
+                                           bd->x, bd->y, bd->w, bd->h,
+                                           &new_x, &new_y);
                  evas_list_free(skiplist);
                  bd->x = new_x;
                  bd->y = new_y;
@@ -2811,3 +2818,28 @@
    free(e);
 }
 
+static void
+_e_border_zone_update(E_Border *bd)
+{
+   E_Container *con;
+   Evas_List *l;
+
+   /* still within old zone - leave it there */
+   if (E_INTERSECTS(bd->x, bd->y, bd->w, bd->h,
+                   bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h))
+     return;
+   /* find a new zone */
+   con = bd->zone->container;
+   for (l = con->zones; l; l = l->next)
+     {
+       E_Zone *zone;
+       
+       zone = l->data;
+       if (E_INTERSECTS(bd->x, bd->y, bd->w, bd->h,
+                        zone->x, zone->y, zone->w, zone->h))
+         {
+            bd->zone = zone;
+            return;
+         }
+     }
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- e_border.h  11 Jan 2005 08:00:05 -0000      1.19
+++ e_border.h  11 Jan 2005 13:11:12 -0000      1.20
@@ -255,6 +255,7 @@
 EAPI void      e_border_unstick(E_Border *bd);
 
 EAPI E_Border *e_border_find_by_client_window(Ecore_X_Window win);
+EAPI E_Border *e_border_focused_get(void);
 
 EAPI void      e_border_idler_before(void);
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_container.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- e_container.c       10 Jan 2005 14:07:42 -0000      1.17
+++ e_container.c       11 Jan 2005 13:11:12 -0000      1.18
@@ -410,7 +410,7 @@
 }
 
 static void
-  _e_container_event_container_resize_free(void *data, void *ev)
+_e_container_event_container_resize_free(void *data, void *ev)
 {
    E_Event_Container_Resize *e;
    
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_place.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_place.c   25 Nov 2004 03:37:44 -0000      1.1
+++ e_place.c   11 Jan 2005 13:11:12 -0000      1.2
@@ -1,7 +1,7 @@
 #include "e.h"
 
 int
-e_place_container_region_smart(E_Container *con, Evas_List *skiplist, int x, 
int y, int w, int h, int *rx, int *ry)
+e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int 
w, int h, int *rx, int *ry)
 {
    int                 a_w = 0, a_h = 0;
    int                *a_x = NULL, *a_y = NULL;
@@ -12,12 +12,15 @@
    a_x = E_NEW(int, 2);
    a_y = E_NEW(int, 2);
 
+   x -= zone->x;
+   y -= zone->y;
+   
    a_x[0] = 0;
-   a_x[1] = con->w;
+   a_x[1] = zone->w;
    a_y[0] = 0;
-   a_y[1] = con->h;
+   a_y[1] = zone->h;
 
-   for (l = con->clients; l; l = l->next)
+   for (l = zone->container->clients; l; l = l->next)
      {
        E_Border           *bd;
        int ok;
@@ -34,8 +37,8 @@
          }
        if ((ok) && (bd->visible))
          {
-            if (E_INTERSECTS(bd->x, bd->y, bd->w, bd->h,
-                           0, 0, con->w, con->h))
+            if (E_INTERSECTS((bd->x - zone->x), (bd->y - zone->y),
+                             bd->w, bd->h, 0, 0, zone->w, zone->h))
               {
                  int i, j;
 
@@ -43,18 +46,18 @@
                    {
                       int                 ok = 1;
 
-                      if (bd->x > 0)
+                      if ((bd->x - zone->x) > 0)
                         {
-                           if (a_x[i] == bd->x)
+                           if (a_x[i] == (bd->x - zone->x))
                               ok = 0;
-                           else if (a_x[i] > bd->x)
+                           else if (a_x[i] > (bd->x - zone->x))
                              {
                                 a_w++;
                                 E_REALLOC(a_x, int, a_w);
 
                                 for (j = a_w - 1; j > i; j--)
                                    a_x[j] = a_x[j - 1];
-                                a_x[i] = bd->x;
+                                a_x[i] = (bd->x - zone->x);
                                 ok = 0;
                              }
                         }
@@ -65,18 +68,18 @@
                    {
                       int ok = 1;
 
-                      if (bd->x + bd->w < con->w)
+                      if ((bd->x - zone->x) + bd->w < zone->w)
                         {
-                           if (a_x[i] == bd->x + bd->w)
+                           if (a_x[i] == (bd->x - zone->x) + bd->w)
                               ok = 0;
-                           else if (a_x[i] > bd->x + bd->w)
+                           else if (a_x[i] > (bd->x - zone->x) + bd->w)
                              {
                                 a_w++;
                                 E_REALLOC(a_x, int, a_w);
 
                                 for (j = a_w - 1; j > i; j--)
                                    a_x[j] = a_x[j - 1];
-                                a_x[i] = bd->x + bd->w;
+                                a_x[i] = (bd->x - zone->x) + bd->w;
                                 ok = 0;
                              }
                         }
@@ -87,18 +90,18 @@
                    {
                       int ok = 1;
 
-                      if (bd->y > 0)
+                      if ((bd->y - zone->y) > 0)
                         {
-                           if (a_y[i] == bd->y)
+                           if (a_y[i] == (bd->y - zone->y))
                               ok = 0;
-                           else if (a_y[i] > bd->y)
+                           else if (a_y[i] > (bd->y - zone->y))
                              {
                                 a_h++;
                                 E_REALLOC(a_y, int, a_h);
 
                                 for (j = a_h - 1; j > i; j--)
                                    a_y[j] = a_y[j - 1];
-                                a_y[i] = bd->y;
+                                a_y[i] = (bd->y - zone->y);
                                 ok = 0;
                              }
                         }
@@ -109,18 +112,18 @@
                    {
                       int ok = 1;
 
-                      if (bd->y + bd->h < con->h)
+                      if ((bd->y - zone->y) + bd->h < zone->h)
                         {
-                           if (a_y[i] == bd->y + bd->h)
+                           if (a_y[i] == (bd->y - zone->y) + bd->h)
                               ok = 0;
-                           else if (a_y[i] > bd->y + bd->h)
+                           else if (a_y[i] > (bd->y - zone->y) + bd->h)
                              {
                                 a_h++;
                                 E_REALLOC(a_y, int, a_h);
 
                                 for (j = a_h - 1; j > i; j--)
                                    a_y[j] = a_y[j - 1];
-                                a_y[i] = bd->y + bd->h;
+                                a_y[i] = (bd->y - zone->y) + bd->h;
                                 ok = 0;
                              }
                         }
@@ -138,12 +141,12 @@
        {
           for (i = 0; i < a_w - 1; i++)
             {
-               if ((a_x[i] < (con->w - w)) &&
-                   (a_y[j] < (con->h - h)))
+               if ((a_x[i] < (zone->w - w)) &&
+                   (a_y[j] < (zone->h - h)))
                  {
                     int ar = 0;
 
-                    for (l = con->clients; l; l = l->next)
+                    for (l = zone->container->clients; l; l = l->next)
                       {
                          E_Border *bd;
                          int x1, y1, w1, h1, x2, y2, w2, h2;
@@ -155,8 +158,8 @@
                          y1 = a_y[j];
                          w1 = w;
                          h1 = h;
-                         x2 = bd->x;
-                         y2 = bd->y;
+                         x2 = (bd->x - zone->x);
+                         y2 = (bd->y - zone->y);
                          w2 = bd->w;
                          h2 = bd->h;
                          for (ll = skiplist; ll; ll = ll->next)
@@ -201,11 +204,11 @@
                             goto done;
                       }
                  }
-               if ((a_x[i + 1] - w > 0) && (a_y[j] < (con->h - h)))
+               if ((a_x[i + 1] - w > 0) && (a_y[j] < (zone->h - h)))
                  {
                     int ar = 0;
 
-                    for (l = con->clients; l; l = l->next)
+                    for (l = zone->container->clients; l; l = l->next)
                       {
                          E_Border *bd;
                          int x1, y1, w1, h1, x2, y2, w2, h2;
@@ -217,8 +220,8 @@
                          y1 = a_y[j];
                          w1 = w;
                          h1 = h;
-                         x2 = bd->x;
-                         y2 = bd->y;
+                         x2 = (bd->x - zone->x);
+                         y2 = (bd->y - zone->y);
                          w2 = bd->w;
                          h2 = bd->h;
                          for (ll = skiplist; ll; ll = ll->next)
@@ -267,7 +270,7 @@
                  {
                     int ar = 0;
 
-                    for (l = con->clients; l; l = l->next)
+                    for (l = zone->container->clients; l; l = l->next)
                       {
                          E_Border *bd;
                          int x1, y1, w1, h1, x2, y2, w2, h2;
@@ -279,8 +282,8 @@
                          y1 = a_y[j + 1] - h;
                          w1 = w;
                          h1 = h;
-                         x2 = bd->x;
-                         y2 = bd->y;
+                         x2 = (bd->x - zone->x);
+                         y2 = (bd->y - zone->y);
                          w2 = bd->w;
                          h2 = bd->h;
                          for (ll = skiplist; ll; ll = ll->next)
@@ -325,11 +328,11 @@
                             goto done;
                       }
                  }
-               if ((a_x[i] < (con->w - w)) && (a_y[j + 1] - h > 0))
+               if ((a_x[i] < (zone->w - w)) && (a_y[j + 1] - h > 0))
                  {
                     int ar = 0;
 
-                    for (l = con->clients; l; l = l->next)
+                    for (l = zone->container->clients; l; l = l->next)
                       {
                          E_Border *bd;
                          int x1, y1, w1, h1, x2, y2, w2, h2;
@@ -341,8 +344,8 @@
                          y1 = a_y[j + 1] - h;
                          w1 = w;
                          h1 = h;
-                         x2 = bd->x;
-                         y2 = bd->y;
+                         x2 = (bd->x - zone->x);
+                         y2 = (bd->y - zone->y);
                          w2 = bd->w;
                          h2 = bd->h;
                          for (ll = skiplist; ll; ll = ll->next)
@@ -393,5 +396,7 @@
  done:
    E_FREE(a_x);
    E_FREE(a_y);
+   *rx += zone->x;
+   *ry += zone->y;
    return 1;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_place.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_place.h   25 Nov 2004 05:31:20 -0000      1.2
+++ e_place.h   11 Jan 2005 13:11:12 -0000      1.3
@@ -1,6 +1,6 @@
 #ifndef E_PLACE_H
 #define E_PLACE_H
 
-EAPI int e_place_container_region_smart(E_Container *con, Evas_List *skiplist, 
int x, int y, int w, int h, int *rx, int *ry);
+EAPI int e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, 
int y, int w, int h, int *rx, int *ry);
     
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_zone.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- e_zone.c    10 Jan 2005 14:07:42 -0000      1.12
+++ e_zone.c    11 Jan 2005 13:11:12 -0000      1.13
@@ -144,10 +144,31 @@
 e_zone_current_get(E_Container *con)
 {
    Evas_List *l;
-
+   E_Border *bd;
+   
    E_OBJECT_CHECK_RETURN(con, NULL);
+   bd = e_border_focused_get();
+   if (bd)
+     {
+       /* the current zone is whatever zone has the focused window */
+       return bd->zone;
+     }
+   else
+     {
+       int x, y;
+       
+       ecore_x_pointer_last_xy_get(&x, &y);
+       for (l = con->zones; l; l = l->next)
+         {
+            E_Zone *zone;
+            
+            zone = l->data;
+            if (E_INTERSECTS(x, y, 1, 1,
+                             zone->x, zone->y, zone->w, zone->h))
+              return zone;
+         }
+     }
    l = con->zones;
-   /* FIXME: Should return the zone the pointer is currently in */
    return (E_Zone *)l->data;
 }
 




-------------------------------------------------------
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
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to