2 pending patches in my inbox.
authorCarsten Haitzler <raster@rasterman.com>
Fri, 20 Jan 2006 04:04:14 +0000 (04:04 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Fri, 20 Jan 2006 04:04:14 +0000 (04:04 +0000)
1. "allow overlap" patch for modules - needs better names in the gui (Allow
windows to overlap maybe - as allow overlap is very vague)
2. itray module (buggy - buggy - beware. i know why. beware i said!)
3. TODO items

SVN revision: 19911

40 files changed:
TODO
configure.in
data/themes/Makefile.am
data/themes/default.edc
data/themes/default_itray.edc [new file with mode: 0644]
src/bin/e_border.c
src/bin/e_gadman.h
src/bin/e_maximize.c
src/modules/Makefile.am
src/modules/battery/e_mod_config.c
src/modules/battery/e_mod_main.c
src/modules/battery/e_mod_main.h
src/modules/clock/e_mod_config.c
src/modules/clock/e_mod_main.c
src/modules/clock/e_mod_main.h
src/modules/cpufreq/e_mod_main.c
src/modules/cpufreq/e_mod_main.h
src/modules/ibar/e_mod_config.c
src/modules/ibar/e_mod_main.c
src/modules/ibar/e_mod_main.h
src/modules/ibox/e_mod_config.c
src/modules/ibox/e_mod_main.c
src/modules/ibox/e_mod_main.h
src/modules/itray/Makefile.am [new file with mode: 0644]
src/modules/itray/e_mod_config.c [new file with mode: 0644]
src/modules/itray/e_mod_config.h [new file with mode: 0644]
src/modules/itray/e_mod_main.c [new file with mode: 0644]
src/modules/itray/e_mod_main.h [new file with mode: 0644]
src/modules/itray/module_icon.png [new file with mode: 0644]
src/modules/pager/e_mod_config.c
src/modules/pager/e_mod_main.c
src/modules/pager/e_mod_main.h
src/modules/start/Makefile.am
src/modules/start/e_mod_config.c [new file with mode: 0644]
src/modules/start/e_mod_config.h [new file with mode: 0644]
src/modules/start/e_mod_main.c
src/modules/start/e_mod_main.h
src/modules/temperature/e_mod_config.c
src/modules/temperature/e_mod_main.c
src/modules/temperature/e_mod_main.h

diff --git a/TODO b/TODO
index cc1ebe1..29f38be 100644 (file)
--- a/TODO
+++ b/TODO
@@ -8,6 +8,9 @@ Some of the things (in very short form) that need to be done to E17...
   BUGS / FIXES
 -------------------------------------------------------------------------------
 
+* BUG: edge flip for desktops still active if turned off when dragging a window
+  off the desktop - either a separate config value (recommended) or turn it
+  off for window dragging too
 * BUG: general settings is too... general
 * BUG: desktop settings is missing preview
 * BUG: modules need to destroy config dialogs on shutdown (otherwise - segv!)
@@ -126,6 +129,7 @@ Some of the things (in very short form) that need to be done to E17...
   "NICE TO HAVE" FEATURES
 -------------------------------------------------------------------------------
 
+* winlist and exebuf can let the mouse select items
 * option to NOT raise on focus in click to focus
 * switch to desktop of a new window if it opens on another desktop than the
   current one
index 14b7ee4..acd10db 100644 (file)
@@ -296,6 +296,7 @@ src/modules/battery/Makefile
 src/modules/temperature/Makefile
 src/modules/cpufreq/Makefile
 src/modules/ibox/Makefile
+src/modules/itray/Makefile
 src/modules/start/Makefile
 src/modules/randr/Makefile
 src/preload/Makefile
index 4acb8fb..ec0a517 100644 (file)
@@ -28,6 +28,7 @@ default_temperature.edc \
 default_error.edc \
 default_cpufreq.edc \
 default_ibox.edc \
+default_itray.edc \
 default_start.edc \
 default_winlist.edc \
 default_transitions.edc \
index 0f4f3aa..7bde1f9 100644 (file)
@@ -36,6 +36,7 @@ collections {
 #include "default_error.edc"
 #include "default_cpufreq.edc"
 #include "default_ibox.edc"
+#include "default_itray.edc"
 #include "default_start.edc"
 #include "default_winlist.edc"
 #include "default_transitions.edc"
diff --git a/data/themes/default_itray.edc b/data/themes/default_itray.edc
new file mode 100644 (file)
index 0000000..cb2079a
--- /dev/null
@@ -0,0 +1,275 @@
+images {
+   image: "e17_ibar_bg_h.png" COMP;
+   image: "e17_ibar_bg_v.png" COMP;
+   image: "e17_ibar_lamp_d.png" COMP;
+   image: "e17_ibar_lamp_l.png" COMP;
+   image: "e17_ibar_lamp_r.png" COMP;
+   image: "e17_ibar_lamp_u.png" COMP;
+   image: "e17_ibar_over_h.png" COMP;
+   image: "e17_ibar_over_v.png" COMP;
+}
+group {
+   name: "modules/itray/main";
+   data {
+      //        item: "item_list", "item item2 item3";
+   }
+   script {
+      public orient;
+   }
+   parts {
+      part {
+        name:          "background";
+        mouse_events:  1;
+        description {
+           state:    "default" 0.0;
+           rel1 {
+              to:       "overlay";
+           }
+           rel2 {
+              to:       "overlay";
+           }
+           image {
+              normal: "e17_ibar_bg_h.png";
+              border: 6 6 6 6;
+           }
+           fill {
+              smooth: 0;
+           }
+        }
+        description {
+           state:    "vert" 0.0;
+           inherit:  "default" 0.0;
+           image {
+              normal: "e17_ibar_bg_v.png";
+           }
+        }
+      }
+      part {
+        name:          "items_clip";
+        type:          RECT;
+        mouse_events:  0;
+        description {
+           state:    "default" 0.0;
+           rel1 {
+              to:       "background";
+              offset:   4    4;
+           }
+           rel2 {
+              to:       "background";
+              offset:   -5    -5;
+           }
+           color: 255 255 255 255;
+        }
+      }
+      part {
+        name:          "items";
+        type:          SWALLOW;
+        mouse_events:  0;
+        clip_to:       "items_clip";
+        description {
+           state:    "default" 0.0;
+           align: 0.5 0.5;
+           rel1 {
+              offset:   4    4;
+           }
+           rel2 {
+              offset:   -5    -5;
+           }
+           color: 0 0 0 0;
+        }
+        description {
+           state:    "top" 0.0;
+           inherit:  "default" 0.0;
+        }
+        description {
+           state:    "left" 0.0;
+           inherit:  "default" 0.0;
+        }
+        description {
+           state:    "right" 0.0;
+           inherit:  "default" 0.0;
+        }
+      }
+      part {
+       name:          "tray";
+       type:          SWALLOW;
+       mouse_events:  0;
+       description {
+         state: "default" 0.0;
+         align: 0.5 0.5;
+         rel1 { offset: 7 6; }
+         rel2 { offset: -7 -6; }
+         color: 0 0 255 64;
+       }
+      }
+      part {
+        name:          "overlay";
+        mouse_events:  0;
+        description {
+           state:    "default" 0.0;
+           image {
+              normal: "e17_ibar_over_h.png";
+              border: 13 13 13 13;
+              middle: 0;
+           }
+           fill {
+              smooth: 0;
+           }
+        }
+        description {
+           state:    "top" 0.0;
+           inherit:  "default" 0.0;
+        }
+        description {
+           state:    "left" 0.0;
+           inherit:  "default" 0.0;
+        }
+        description {
+           state:    "right" 0.0;
+           inherit:  "default" 0.0;
+        }
+      }
+      part {
+        name:          "inn";
+        type:          RECT;
+        repeat_events: 1;
+        description {
+           state:    "default" 0.0;
+           color: 0 0 0 0;
+        }
+      }
+   }
+   programs {
+      program {
+        name:    "orient";
+        signal:  "set_orientation";
+        source:  "*";
+        script {
+           // sig, src
+           if (!strcmp(src, "left")) {
+              set_int(orient, 0);
+              set_state(PART:"background", "vert", 0.0);
+              set_state(PART:"overlay", "left", 0.0);
+              set_state(PART:"items", "left", 0.0);
+           }
+           else if (!strcmp(src, "right")) {
+              set_int(orient, 1);
+              set_state(PART:"background", "vert", 0.0);
+              set_state(PART:"overlay", "right", 0.0);
+              set_state(PART:"items", "right", 0.0);
+           }
+           else if (!strcmp(src, "top")) {
+              set_int(orient, 2);
+              set_state(PART:"background", "default", 0.0);
+              set_state(PART:"overlay", "top", 0.0);
+              set_state(PART:"items", "top", 0.0);
+           }
+           else if (!strcmp(src, "bottom")) {
+              set_int(orient, 3);
+              set_state(PART:"background", "default", 0.0);
+              set_state(PART:"overlay", "default", 0.0);
+              set_state(PART:"items", "default", 0.0);
+           }
+        }
+      }
+   }
+}
+
+group {
+   name: "modules/itray/follower";
+   min: 56 56;
+   data {
+      //        item: "item_list", "item item2 item3";
+   }
+   parts {
+      part {
+        name:          "top";
+        mouse_events:  0;
+        description {
+           state:    "default" 0.0;
+           rel1 {
+              relative: 0.0  0.0;
+              offset:   0   -14;
+           }
+           rel2 {
+              relative: 1.0  0.0;
+              offset:   -1   26;
+           }
+           image {
+              normal: "e17_ibar_lamp_d.png";
+           }
+        }
+        description {
+           state:    "top" 0.0;
+           rel1 {
+              relative: 0.0  1.0;
+              offset:   0   -26;
+           }
+           rel2 {
+              relative: 1.0  1.0;
+              offset:   -1   14;
+           }
+           image {
+              normal: "e17_ibar_lamp_u.png";
+           }
+        }
+        description {
+           state:    "right" 0.0;
+           rel1 {
+              relative: 0.0 0.0;
+              offset:   -14 0;
+           }
+           rel2 {
+              relative: 0.0 1.0;
+              offset:   26 -1;
+           }
+           image {
+              normal: "e17_ibar_lamp_r.png";
+           }
+        }
+        description {
+           state:    "left" 0.0;
+           rel1 {
+              relative: 1.0 0.0;
+              offset:   -26  0;
+           }
+           rel2 {
+              relative: 1.0 1.0;
+              offset:   14  -1;
+           }
+           image {
+              normal: "e17_ibar_lamp_l.png";
+           }
+        }
+      }
+      program {
+        name:    "orient";
+        signal:  "set_orientation";
+        source:  "bottom";
+        action:  STATE_SET "default" 0.0;
+        target:  "top";
+      }
+      program {
+        name:    "orient2";
+        signal:  "set_orientation";
+        source:  "top";
+        action:  STATE_SET "top" 0.0;
+        target:  "top";
+      }
+      program {
+        name:    "orient3";
+        signal:  "set_orientation";
+        source:  "left";
+        action:  STATE_SET "left" 0.0;
+        target:  "top";
+      }
+      program {
+        name:    "orient4";
+        signal:  "set_orientation";
+        source:  "right";
+        action:  STATE_SET "right" 0.0;
+        target:  "top";
+      }
+   }
+}
+
index 0b8b7b7..33d7067 100644 (file)
@@ -1481,14 +1481,13 @@ e_border_maximize(E_Border *bd, E_Maximize max)
    if ((bd->shaded) || (bd->shading)) return;
    if (bd->fullscreen)
      e_border_unfullscreen(bd);
-   if( bd->maximized == E_MAXIMIZE_VERTICAL && max == E_MAXIMIZE_VERTICAL )
+   if (bd->maximized == E_MAXIMIZE_VERTICAL && max == E_MAXIMIZE_VERTICAL)
      ; // ignore. we are already maximized vertical.
-   else if( bd->maximized == E_MAXIMIZE_HORIZONTAL && max == E_MAXIMIZE_HORIZONTAL )
+   else if (bd->maximized == E_MAXIMIZE_HORIZONTAL && max == E_MAXIMIZE_HORIZONTAL)
      ; // ignore. we are already maximized horizontaly.
-   else if ( ( bd->maximized == E_MAXIMIZE_NONE ||
-              bd->maximized == E_MAXIMIZE_VERTICAL ||
-              bd->maximized == E_MAXIMIZE_HORIZONTAL )
-          )
+   else if (( bd->maximized == E_MAXIMIZE_NONE ||
+             bd->maximized == E_MAXIMIZE_VERTICAL ||
+             bd->maximized == E_MAXIMIZE_HORIZONTAL))
      {
        int x1, y1, x2, y2;
        int w, h;
@@ -1499,13 +1498,13 @@ e_border_maximize(E_Border *bd, E_Maximize max)
             return;
          }
        
-       if( !bd->maximized ) // E_MAXIMIZE_NONE
-       {
-         bd->saved.x = bd->x;
-         bd->saved.y = bd->y;
-         bd->saved.w = bd->w;
-         bd->saved.h = bd->h;
-       }
+       if (!bd->maximized) // E_MAXIMIZE_NONE
+         {
+            bd->saved.x = bd->x; 
+            bd->saved.y = bd->y; 
+            bd->saved.w = bd->w; 
+            bd->saved.h = bd->h;
+         }
        e_hints_window_size_set(bd);
 
        e_border_raise(bd);
@@ -1582,13 +1581,13 @@ e_border_maximize(E_Border *bd, E_Maximize max)
              e_border_move_resize(bd, x1, y1, w, h);
              break;
            case E_MAXIMIZE_VERTICAL:
-             x1 = bd->zone->x;
+             x1 = bd->x;
              y1 = bd->zone->y;
-             x2 = bd->zone->x + bd->zone->w;
+             x2 = bd->x + bd->w;
              y2 = bd->zone->y + bd->zone->h;
 
              /* walk through all gadgets */
-             e_maximize_border_gadman_fill(bd, &x1, &y1, &x2, &y2);
+             e_maximize_border_gadman_fit(bd, &x1, &y1, &x2, &y2);
 
              /* walk through docks and toolbars */
              //e_maximize_border_dock_fit(bd, &x1, &y1, &x2, &y2);
@@ -1604,12 +1603,12 @@ e_border_maximize(E_Border *bd, E_Maximize max)
              break;
            case E_MAXIMIZE_HORIZONTAL:
              x1 = bd->zone->x;
-             y1 = bd->zone->y;
+             y1 = bd->y;
              x2 = bd->zone->x + bd->zone->w;
-             y2 = bd->zone->y + bd->zone->h;
+             y2 = bd->y + bd->h;
 
              /* walk through all gadgets */
-             e_maximize_border_gadman_fill(bd, &x1, &y1, &x2, &y2);
+             e_maximize_border_gadman_fit(bd, &x1, &y1, &x2, &y2);
 
              /* walk through docks and toolbars */
              //e_maximize_border_dock_fit(bd, &x1, &y1, &x2, &y2);
@@ -1624,8 +1623,8 @@ e_border_maximize(E_Border *bd, E_Maximize max)
              e_border_move_resize(bd,x1,y1,w,h);
              break;
          }
-       if(bd->maximized == E_MAXIMIZE_HORIZONTAL && max == E_MAXIMIZE_VERTICAL) ||
-           (bd->maximized == E_MAXIMIZE_VERTICAL && max == E_MAXIMIZE_HORIZONTAL) )
+       if ((bd->maximized == E_MAXIMIZE_HORIZONTAL && max == E_MAXIMIZE_VERTICAL) ||
+           (bd->maximized == E_MAXIMIZE_VERTICAL && max == E_MAXIMIZE_HORIZONTAL))
          bd->maximized = e_config->maximize_policy;
        else
          bd->maximized = max;
@@ -1659,47 +1658,47 @@ e_border_unmaximize_vh(E_Border *bd, E_Maximize max)
         case E_MAXIMIZE_SMART:
         case E_MAXIMIZE_EXPAND:
         case E_MAXIMIZE_FILL:
-          if( max == E_MAXIMIZE_VERTICAL )
-          {
-            bd->maximized = E_MAXIMIZE_NONE;
-            e_hints_window_maximized_set(bd, 0);
+          if (max == E_MAXIMIZE_VERTICAL)
+            { 
+               bd->maximized = E_MAXIMIZE_NONE;
+               e_hints_window_maximized_set(bd, 0);
 
-            bd->maximized = E_MAXIMIZE_HORIZONTAL;
-            e_hints_window_maximized_set(bd, 1);
+               bd->maximized = E_MAXIMIZE_HORIZONTAL;
+               e_hints_window_maximized_set(bd, 1);
 
-            e_border_move_resize( bd, bd->x, bd->saved.y, bd->w, bd->saved.h);
-            e_hints_window_size_unset(bd);
+               e_border_move_resize(bd, bd->x, bd->saved.y, bd->w, bd->saved.h);
+               e_hints_window_size_unset(bd);
 
-            //edje_object_signal_emit(bd->bg_object, "unmaximize", "");
-          }
-          if( max == E_MAXIMIZE_HORIZONTAL )
-          {
-            bd->maximized = E_MAXIMIZE_NONE;
-            e_hints_window_maximized_set(bd, 0);
+               //edje_object_signal_emit(bd->bg_object, "unmaximize", "");
+            }
+          if (max == E_MAXIMIZE_HORIZONTAL)
+            { 
+               bd->maximized = E_MAXIMIZE_NONE;
+               e_hints_window_maximized_set(bd, 0);
 
-            bd->maximized = E_MAXIMIZE_VERTICAL;
-            e_hints_window_maximized_set(bd, 1);
+               bd->maximized = E_MAXIMIZE_VERTICAL;
+               e_hints_window_maximized_set(bd, 1);
 
-            e_border_move_resize( bd, bd->saved.x, bd->y, bd->saved.w, bd->h);
-            e_hints_window_size_unset(bd);
+               e_border_move_resize(bd, bd->saved.x, bd->y, bd->saved.w, bd->h);
+               e_hints_window_size_unset(bd);
 
-            //edje_object_signal_emit(bd->bg_object, "unmaximize", "");
-          }
+               //edje_object_signal_emit(bd->bg_object, "unmaximize", "");
+            }
           break;
         case E_MAXIMIZE_VERTICAL:
-          if( max == E_MAXIMIZE_HORIZONTAL )
+          if (max == E_MAXIMIZE_HORIZONTAL)
             ; // do nothing in this case
-          if( max == E_MAXIMIZE_VERTICAL )
-          {
-            bd->maximized = E_MAXIMIZE_NONE;
-            e_hints_window_maximized_set(bd, 0);
+          if (max == E_MAXIMIZE_VERTICAL)
+            { 
+               bd->maximized = E_MAXIMIZE_NONE;
+               e_hints_window_maximized_set(bd, 0);
 
-            e_border_move_resize( bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h);
-            bd->saved.x = bd->saved.y = bd->saved.w = bd->saved.h = 0;
-            e_hints_window_size_unset(bd);
+               e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h);
+               bd->saved.x = bd->saved.y = bd->saved.w = bd->saved.h = 0;
+               e_hints_window_size_unset(bd);
 
-            edje_object_signal_emit(bd->bg_object, "unmaximize", "");
-          }
+               edje_object_signal_emit(bd->bg_object, "unmaximize", "");
+            }
           break;
         case E_MAXIMIZE_HORIZONTAL:
           if( max == E_MAXIMIZE_VERTICAL )
index 93fb855..3cd1ee7 100644 (file)
@@ -13,7 +13,10 @@ typedef enum _E_Gadman_Policy
    E_GADMAN_POLICY_HSIZE = 1 << 9,
    E_GADMAN_POLICY_VSIZE = 1 << 10,
    E_GADMAN_POLICY_HMOVE = 1 << 11,
-   E_GADMAN_POLICY_VMOVE = 1 << 12
+   E_GADMAN_POLICY_VMOVE = 1 << 12,
+   /* more extra flags */
+   E_GADMAN_POLICY_ALLOW_OVERLAP = 1 << 15,
+   E_GADMAN_POLICY_ALWAYS_ON_TOP = 1 << 16 // not used yet
 } E_Gadman_Policy;
 
 typedef enum _E_Gadman_Change
index 349714d..69927a8 100644 (file)
@@ -10,6 +10,15 @@ struct _E_Maximize_Rect
    int x1, y1, x2, y2;
 };
 
+struct _m_zone
+{
+  int x1;
+  int y1;
+  int x2;
+  int y2;
+  int area;
+};
+
 #define OBSTACLE(_x1, _y1, _x2, _y2) \
    { \
       r = E_NEW(E_Maximize_Rect, 1); \
@@ -19,61 +28,140 @@ struct _E_Maximize_Rect
 
 static void _e_maximize_border_rects_fill(E_Border *bd, Evas_List *list, int *x1, int *y1, int *x2, int *y2);
 
+static int _e_mzone_split(Evas_List **add_splits_to, struct _m_zone *mzone, E_Gadman_Client *gmc);
+
+int _e_mzone_cb_square_reverse_sort(void *e1, void *e2);
+int _e_mzone_cb_width_reverse_sort(void *e1, void *e2);
+int _e_mzone_cb_height_reverse_sort(void *e1, void *e2); // not used yet
+
 EAPI void
 e_maximize_border_gadman_fit(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
 {
-   Evas_List *l;
-   int cx1, cx2, cy1, cy2;
+  int ii, jj;
+  Evas_List *l, *ll;
 
-   cx1 = bd->zone->x;
-   if (x1) cx1 = *x1;
-   
-   cy1 = bd->zone->y;
-   if (y1) cy1 = *y1;
-   
-   cx2 = bd->zone->x + bd->zone->w;
-   if (x2) cx2 = *x2;
+  Evas_List *mzones = NULL;
+  Evas_List *tmp_mzones = NULL;
 
-   cy2 = bd->zone->y + bd->zone->h;
-   if (y2) cy2 = *y2;
+  struct _m_zone *mzone = NULL;
+  struct _m_zone *mzone_split;
 
-   /* Find the smallest box */
-   for (l = bd->zone->container->gadman->clients; l; l = l->next)
-     {
-       E_Gadman_Client *gmc;
-       double ax, ay;
+  mzone = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+  if (mzone == NULL)
+    return;
 
-       gmc = l->data;
-       if ((gmc->zone != bd->zone)) continue;
+  mzone->x1 = bd->zone->x;
+  if (x1) mzone->x1 = *x1;
+
+  mzone->y1 = bd->zone->y;
+  if (y1) mzone->y1 = *y1;
 
-       ax = gmc->ax;
-       ay = gmc->ay;
+  mzone->x2 = bd->zone->x + bd->zone->w;
+  if (x2) mzone->x2 = *x2;
 
-       if (((ax == 0.0) || (ax == 1.0)) &&
-           ((ay == 0.0) || (ay == 1.0)))
+  mzone->y2 = bd->zone->y + bd->zone->h;
+  if (y2) mzone->y2 = *y2;
+
+  mzones = evas_list_append(mzones, mzone);
+
+  for(l = bd->zone->container->gadman->clients; l; l = l->next)
+    {
+      E_Gadman_Client *gmc;
+
+      gmc = l->data;
+      if (gmc->zone != bd->zone || gmc->policy & E_GADMAN_POLICY_ALLOW_OVERLAP) continue;
+
+      tmp_mzones = mzones;
+      mzones = NULL;
+
+      for (ll = tmp_mzones; ll; ll = ll->next)
+      {
+        int res;
+        mzone = ll->data;
+
+        res = _e_mzone_split(&mzones, mzone, gmc);
+        if (res == 0)
          {
-            /* corner gadget */
-            /* Fake removal from one alignment :) */
-            if (gmc->w > gmc->h)
-              ax = 0.5;
-            else
-              ay = 0.5;
+           if(mzones == NULL)
+             mzones = evas_list_append(mzones, mzone);
+           else
+             evas_list_append(mzones , mzone);
+           ll->data = NULL;
          }
+        else if (res == 2)
+          ;
+        else if (res == -1)
+          ; /* mem problems. Let ignor them yet */
 
-       if ((ax == 0.0) && (gmc->x + gmc->w) > cx1)
-         cx1 = (gmc->x + gmc->w);
-       else if ((ax == 1.0) && (gmc->x < cx2))
-         cx2 = gmc->x;
-       else if ((ay == 0.0) && ((gmc->y + gmc->h) > cy1))
-         cy1 = (gmc->y + gmc->h);
-       else if ((ay == 1.0) && (gmc->y < cy2))
-         cy2 = gmc->y;
-     }
+        if (ll->data != NULL)
+         {
+           free(ll->data);
+           ll->data = NULL;
+         }
+      }
+      evas_list_free(tmp_mzones);
+      tmp_mzones = NULL;
+    }
 
-   if (x1) *x1 = cx1;
-   if (y1) *y1 = cy1;
-   if (x2) *x2 = cx2;
-   if (y2) *y2 = cy2;
+  for (l = mzones; l; l = l->next)
+    {
+      mzone = l->data;
+      mzone->area = (mzone->x2 - mzone->x1) * (mzone->y2 - mzone->y1);
+    }
+
+  tmp_mzones = evas_list_sort(mzones, evas_list_count(mzones), _e_mzone_cb_square_reverse_sort);
+  mzones = NULL;
+
+  mzones = evas_list_append(mzones, tmp_mzones->data);
+
+  for (l = tmp_mzones->next; l; l = l->next)
+    {
+      if ( ((struct _m_zone *)l->data)->area ==
+           ((struct _m_zone *)mzones->data)->area)
+        evas_list_append(mzones, l->data);
+      else
+        free(l->data);
+    }
+  tmp_mzones = evas_list_free(tmp_mzones);
+  tmp_mzones = NULL;
+
+  if (mzones != NULL && mzones->next == NULL)
+    {
+      mzone = mzones->data;
+      *x1 = mzone->x1;
+      *y1 = mzone->y1;
+      *x2 = mzone->x2;
+      *y2 = mzone->y2;
+    }
+  else if (mzones != NULL && mzones->next != NULL)
+    {
+      Evas_List *wl = NULL, *hl = NULL;
+
+      /* The use of *_width_reverse_sort or *_height_reverse_sort depends
+       * on the preferences of the user - what window he/she would like to
+       * have: (i) maximized verticaly or (ii) horisontaly.
+       */
+      wl = evas_list_sort(mzones, evas_list_count(mzones), _e_mzone_cb_width_reverse_sort);
+      mzones = NULL;
+     // hl = evas_list_sort(mzones, -1, _e_mzone_cb_height_reverse_sort);
+
+      mzone = wl->data;
+      //mzone = hl->data;
+      *x1 = mzone->x1;
+      *y1 = mzone->y1;
+      *x2 = mzone->x2;
+      *y2 = mzone->y2;
+
+     // evas_list_free( wl );
+     // evas_list_free( hl );
+
+      mzones = wl;
+    }
+
+  for (l = mzones; l ; l = l->next)
+    if (l->data != NULL)
+      free(l->data);
+  mzones = evas_list_free(mzones);
 }
 
 EAPI void
@@ -302,3 +390,698 @@ _e_maximize_border_rects_fill(E_Border *bd, Evas_List *rects, int *x1, int *y1,
    if (x2) *x2 = cx2;
    if (y2) *y2 = cy2;
 }
+
+int _e_mzone_split(Evas_List **add_splits_to, struct _m_zone *mzone, E_Gadman_Client *gmc)
+{
+  int ii;
+  int mzone_splitted = 0;
+  struct _m_zone *mzone_split = NULL;
+
+  if (mzone == NULL || gmc == NULL)
+    return -1;
+
+  if ((mzone->x2 - mzone->x1) <= 0 || (mzone->y2 - mzone->y1) <= 0)
+    return 1;
+
+  if (gmc->x > mzone->x1 && gmc->y > mzone->y1 && 
+      gmc->x + gmc->w < mzone->x2 && gmc->y + gmc->h < mzone->y2)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 8; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if(mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 1:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = gmc->y;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y + gmc->h;
+            break;
+          case 2:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 3:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = gmc->y + gmc->h;
+            break;
+          case 4:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 5:
+            mzone_split->x1 = gmc->x;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x + gmc->w;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 6:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 7:
+            mzone_split->x1 = gmc->x;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = gmc->x + gmc->w;
+            mzone_split->y2 = mzone->y2;
+            break;
+        }
+        if (*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    } // if
+  else if (gmc->x + gmc->w > mzone->x1 && gmc->x + gmc->w < mzone->x2 &&
+          gmc->y + gmc->h > mzone->y1 && gmc->y + gmc->h < mzone->y2 &&
+          gmc->x <= mzone->x1 && gmc->y <= mzone->y1)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 4; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if (mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y + gmc->h;
+            break;
+          case 1:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 2:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 3:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = gmc->x + gmc->w;
+            mzone_split->y2 = mzone->y2;
+            break;
+        }
+        if (*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    }
+  else if (gmc->x > mzone->x1 && gmc->y <= mzone->y1 &&
+          gmc->x + gmc->w < mzone->x2 &&
+          gmc->y + gmc->h > mzone->y1 && gmc->y + gmc->h < mzone->y2)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 6; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if (mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = gmc->y + gmc->h;
+            break;
+          case 1:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y + gmc->h;
+            break;
+          case 2:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 3:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 4:
+            mzone_split->x1 = gmc->x;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = gmc->x + gmc->w;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 5:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+        }
+        if (*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    }
+  else if (gmc->x > mzone->x1 && gmc->x < mzone->x2 &&
+          gmc->y + gmc->h > mzone->y1 && gmc->y + gmc->h < mzone->y2 &&
+          gmc->y <= mzone->y1 &&
+          gmc->x + gmc->w >= mzone->x2)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 4; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if (mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = gmc->y + gmc->h;
+            break;
+          case 1:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 2:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 3:
+            mzone_split->x1 = gmc->x;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+        }
+        if (*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    }
+  else if (gmc->x > mzone->x1 && gmc->x < mzone->x2 &&
+          gmc->y > mzone->y1 &&
+          gmc->y + gmc->h < mzone->y2 &&
+          gmc->x + gmc->w >= mzone->x2)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 6; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if (mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 1:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = gmc->y + gmc->h;
+            break;
+          case 2:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 3:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 4:
+            mzone_split->x1 = gmc->x;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 5:
+            mzone_split->x1 = gmc->x;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+        }
+        if (*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    }
+  else if (gmc->x > mzone->x1 && gmc->x < mzone->x2 &&
+          gmc->y > mzone->y1 && gmc->y < mzone->y2 &&
+          gmc->x + gmc->w >= mzone->x2 &&
+          gmc->y + gmc->h >= mzone->y2)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 4; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if (mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 1:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 2:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 3:
+            mzone_split->x1 = gmc->x;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y;
+            break;
+        }
+        if (*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    }
+  else if (gmc->x > mzone->x1 &&
+          gmc->y > mzone->y1 && gmc->y < mzone->y2 &&
+          gmc->x + gmc->w < mzone->x2 &&
+          gmc->y + gmc->h >= mzone->y2)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 6; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if (mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 1:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 2:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = gmc->y;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 3:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 4:
+            mzone_split->x1 = gmc->x;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x + gmc->w;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 5:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+        }
+        if(*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    }
+  else if (gmc->x <= mzone->x1 &&
+          gmc->y > mzone->y1 && gmc->y < mzone->y2 &&
+          gmc->x + gmc->w > mzone->x1 && gmc->x + gmc->w < mzone->x2 &&
+          gmc->y + gmc->h >= mzone->y2)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 4; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if (mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y;
+            break;
+         case 1:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = gmc->y;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 2:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x + gmc->w;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 3:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+        }
+        if (*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    }
+  else if (gmc->x <= mzone->x1 &&
+          gmc->y > mzone->y1 &&
+          gmc->y + gmc->h < mzone->y2 &&
+          gmc->x + gmc->w > mzone->x1 && gmc->x + gmc->w < mzone->x2)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 6; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if (mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 1:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = gmc->y;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y + gmc->h;
+            break;
+          case 2:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 3:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x + gmc->w;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 4:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 5:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = gmc->x + gmc->w;
+            mzone_split->y2 = mzone->y2;
+            break;
+        }
+        if (*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    }
+  else if (gmc->x <= mzone->x1 && gmc->y <= mzone->y1 &&
+          gmc->x + gmc->w >= mzone->x2 &&
+          gmc->y + gmc->h > mzone->y1 &&
+          gmc->y + gmc->h < mzone->y2)
+    {
+      mzone_splitted = 1;
+      mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+      if (mzone_split == NULL)
+        return -1;
+
+      mzone_split->x1 = mzone->x1;
+      mzone_split->y1 = gmc->y + gmc->h;
+      mzone_split->x2 = mzone->x2;
+      mzone_split->y2 = mzone->y2;
+
+      if (*add_splits_to == NULL)
+        *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+      else
+        evas_list_append(*add_splits_to, mzone_split);
+    }
+  else if (gmc->x <= mzone->x1 &&
+          gmc->x + gmc->w >= mzone->x2 &&
+          gmc->y > mzone->y1 && gmc->y < mzone->y2)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 2; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if (mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = gmc->y;
+            break;
+          case 1:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = gmc->y + gmc->h;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+        }
+        if (*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    }
+  else if (gmc->x <= mzone->x1 &&
+          gmc->x + gmc->w >= mzone->x2 &&
+          gmc->y > mzone->y1 && gmc->y < mzone->y2 &&
+          gmc->y + gmc->h >= mzone->y2)
+    {
+      mzone_splitted = 1;
+      mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+      if (mzone_split == NULL)
+        return -1;
+
+      mzone_split->x1 = mzone->x1;
+      mzone_split->y1 = mzone->y1;
+      mzone_split->x2 = mzone->x2;
+      mzone_split->y2 = gmc->y;
+
+      if (*add_splits_to == NULL)
+        *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+      else
+        evas_list_append(*add_splits_to, mzone_split);
+    }
+  else if (gmc->x <= mzone->x1 &&
+          gmc->y <= mzone->y1 &&
+          gmc->y + gmc->h >= mzone->y2 &&
+          gmc->x + gmc->w > mzone->x1 && gmc->x + gmc->w < mzone->x2)
+    {
+      mzone_splitted = 1;
+      mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+      if (mzone_split == NULL)
+        return -1;
+
+      mzone_split->x1 = gmc->x + gmc->w;
+      mzone_split->y1 = mzone->y1;
+      mzone_split->x2 = mzone->x2;
+      mzone_split->y2 = mzone->y2;
+
+      if (*add_splits_to == NULL)
+        *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+      else
+        evas_list_append(*add_splits_to, mzone_split);
+    }
+  else if (gmc->x > mzone->x1 &&
+          gmc->x + gmc->w < mzone->x2 &&
+          gmc->y <= mzone->y1 &&
+          gmc->y + gmc->h >= mzone->y2)
+    {
+      mzone_splitted = 1;
+      for (ii = 0; ii < 2; ii ++)
+      {
+        mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+        if (mzone_split == NULL)
+          return -1;
+
+        switch(ii)
+        {
+          case 0:
+            mzone_split->x1 = mzone->x1;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = gmc->x;
+            mzone_split->y2 = mzone->y2;
+            break;
+          case 1:
+            mzone_split->x1 = gmc->x + gmc->w;
+            mzone_split->y1 = mzone->y1;
+            mzone_split->x2 = mzone->x2;
+            mzone_split->y2 = mzone->y2;
+            break;
+        }
+        if (*add_splits_to == NULL)
+          *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+        else
+          evas_list_append(*add_splits_to, mzone_split);
+      }
+    }
+  else if (gmc->x > mzone->x1 && gmc->x < mzone->x2 &&
+          gmc->y <= mzone->y1 &&
+          gmc->x + gmc->w >= mzone->x2 &&
+          gmc->y + gmc->h >= mzone->y2)
+    {
+      mzone_splitted = 1;
+      mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+      if (mzone_split == NULL)
+        return -1;
+
+      mzone_split->x1 = mzone->x1;
+      mzone_split->y1 = mzone->y1;
+      mzone_split->x2 = gmc->x;
+      mzone_split->y2 = mzone->y2;
+
+      if (*add_splits_to == NULL)
+        *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+      else
+        evas_list_append(*add_splits_to, mzone_split);
+    }
+  else if (gmc->x <= mzone->x1 && gmc->y <= mzone->y1 &&
+          gmc->x + gmc->w >= mzone->x2 && gmc->y + gmc->h >= mzone->y2)
+    {
+      mzone_splitted = 2;
+    }
+
+  return mzone_splitted;
+}
+int _e_mzone_cb_square_reverse_sort(void *e1, void *e2)
+{
+  struct _m_zone *mz1 = (struct _m_zone *)e1;
+  struct _m_zone *mz2 = (struct _m_zone *)e2;
+
+  if (e1 == NULL) return 1;
+  if (e2 == NULL) return -1;
+
+  if (mz1->area > mz2->area)
+    return -1;
+  else if (mz1->area <  mz2->area)
+    return 1;
+
+  return 0;
+}
+
+int _e_mzone_cb_width_reverse_sort(void *e1, void *e2)
+{
+  int w1, w2;
+  struct _m_zone *mz1 = (struct _m_zone *)e1;
+  struct _m_zone *mz2 = (struct _m_zone *)e2;
+
+  if (e1 == NULL) return 1;
+  if (e2 == NULL) return -1;
+  
+  w1 = mz1->x2 - mz1->x1;
+  w2 = mz2->x2 - mz2->x1;
+
+  if (w1 > w2)
+    return -1;
+  else if (w1 < w2)
+    return 1;
+
+  return 0;
+}
+
+int _e_mzone_cb_height_reverse_sort(void *e1, void *e2)
+{
+  int h1, h2;
+  struct _m_zone *mz1 = (struct _m_zone *)e1;
+  struct _m_zone *mz2 = (struct _m_zone *)e2;
+  
+  if (e1 == NULL) return 1;
+  if (e2 == NULL) return -1;
+
+  h1 = mz1->y2 - mz1->y1;
+  h2 = mz2->y2 - mz2->y1;
+
+  if (h1 > h2)
+    return -1;
+  else if (h1 < h2)
+    return 1;
+
+  return 0;
+}
+
index 885514c..9ddf447 100644 (file)
@@ -9,6 +9,7 @@ battery \
 temperature \
 cpufreq \
 ibox \
+itray \
 start \
 randr \
 gadget_test
index f81a665..9f8f11a 100644 (file)
@@ -10,6 +10,7 @@ struct _E_Config_Dialog_Data
    int show_alert;   
    double poll_time;   
    int alarm_time;
+   int allow_overlap;
 };
 
 struct _Cfg_File_Data 
@@ -56,6 +57,7 @@ _fill_data(Battery *b, E_Config_Dialog_Data *cfdata)
      {
        cfdata->show_alert = 0;
      }
+   cfdata->allow_overlap = b->conf->allow_overlap;
 }
 
 static void *
@@ -94,6 +96,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
    ob = e_widget_check_add(evas, _("Show alert when battery is low"), &(cfdata->show_alert));
    e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
    return o;
 }
 
@@ -105,6 +112,12 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
    b = cfd->data;
    e_border_button_bindings_ungrab_all();
    b->conf->poll_time = 10.0;   
+
+   if (cfdata->allow_overlap && !b->conf->allow_overlap)
+     b->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && b->conf->allow_overlap)
+     b->conf->allow_overlap = 0;
+
    e_border_button_bindings_grab_all();
    e_config_save_queue();
    
@@ -141,6 +154,11 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
    e_widget_frametable_object_append(of, ob, 0, 5, 1, 1, 1, 0, 1, 0);
 
    e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
    return o;
 }
 
@@ -161,6 +179,11 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
      {
        b->conf->alarm = 0;
      }
+
+   if (cfdata->allow_overlap && !b->conf->allow_overlap)
+     b->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && b->conf->allow_overlap)
+     b->conf->allow_overlap = 0;
    
    e_border_button_bindings_grab_all();
    e_config_save_queue();
index 127054d..f010224 100644 (file)
@@ -49,7 +49,7 @@ static Status       *_battery_bsd_apm_check(Battery *ef);
 static Status       *_battery_darwin_check(Battery *ef);
 #endif
 
-static Battery_Face *_battery_face_new(E_Container *con);
+static Battery_Face *_battery_face_new(Battery *bat, E_Container *con);
 static void          _battery_face_free(Battery_Face *ef);
 static void          _battery_face_menu_new(Battery_Face *face);
 static void          _battery_face_enable(Battery_Face *face);
@@ -64,6 +64,8 @@ static char         *_battery_string_get(char *buf);
 
 static void          _battery_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
 
+static void        _battery_face_cb_update_policy(void *data);
+
 static E_Config_DD *conf_edd;
 static E_Config_DD *conf_face_edd;
 
@@ -189,6 +191,7 @@ _battery_new()
 #define D conf_edd
    E_CONFIG_VAL(D, T, poll_time, DOUBLE);
    E_CONFIG_VAL(D, T, alarm, INT);
+   E_CONFIG_VAL(D, T, allow_overlap, INT);
    E_CONFIG_LIST(D, T, faces, conf_face_edd);
 
    e->conf = e_config_domain_load("module.battery", conf_edd);
@@ -197,9 +200,11 @@ _battery_new()
        e->conf = E_NEW(Config, 1);
        e->conf->poll_time = 30.0;
        e->conf->alarm = 30;
+       e->conf->allow_overlap = 0;
      }
    E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 1000.0);
    E_CONFIG_LIMIT(e->conf->alarm, 0, 60);
+   E_CONFIG_LIMIT(e->conf->allow_overlap, 0, 1);
 
    _battery_config_menu_new(e);
 
@@ -222,7 +227,7 @@ _battery_new()
             Battery_Face *ef;
 
             con = l2->data;
-            ef = _battery_face_new(con);
+            ef = _battery_face_new(e, con);
             if (ef)
               {
                  ef->battery = e;
@@ -298,10 +303,11 @@ _battery_config_menu_new(Battery *e)
 }
 
 static Battery_Face *
-_battery_face_new(E_Container *con)
+_battery_face_new(Battery *bat, E_Container *con)
 {
    Evas_Object *o;
    Battery_Face *ef;
+   E_Gadman_Policy  policy;
 
    ef = E_NEW(Battery_Face, 1);
    if (!ef) return NULL;
@@ -327,12 +333,17 @@ _battery_face_new(E_Container *con)
 
    ef->gmc = e_gadman_client_new(con->gadman);
    e_gadman_client_domain_set(ef->gmc, "module.battery", battery_count++);
-   e_gadman_client_policy_set(ef->gmc,
-                             E_GADMAN_POLICY_ANYWHERE |
-                             E_GADMAN_POLICY_HMOVE |
-                             E_GADMAN_POLICY_VMOVE |
-                             E_GADMAN_POLICY_HSIZE |
-                             E_GADMAN_POLICY_VSIZE);
+
+   policy = E_GADMAN_POLICY_ANYWHERE | 
+           E_GADMAN_POLICY_HMOVE | 
+           E_GADMAN_POLICY_VMOVE | 
+           E_GADMAN_POLICY_HSIZE |
+           E_GADMAN_POLICY_VSIZE;
+   if (bat->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+   e_gadman_client_policy_set(ef->gmc, policy);
    e_gadman_client_min_size_set(ef->gmc, 4, 4);
    e_gadman_client_max_size_set(ef->gmc, 128, 128);
    e_gadman_client_auto_size_set(ef->gmc, 40, 40);
@@ -1626,8 +1637,30 @@ void
 _battery_face_cb_config_updated(Battery *bat) 
 {
    /* Call all functions needed to update battery */
+   _battery_face_cb_update_policy((void*)bat);
    
    /* Update Poll Time */
    ecore_timer_del(bat->battery_check_timer);
    bat->battery_check_timer = ecore_timer_add(bat->conf->poll_time, _battery_cb_check, bat);   
 }
+
+static void _battery_face_cb_update_policy(void *data)
+{
+  Battery     *bat;
+  Battery_Face *bf;
+  Evas_List   *l;
+  E_Gadman_Policy policy;
+
+  bat = data;
+  for (l = bat->faces; l; l = l->next)
+    {
+      bf = l->data;
+      policy = bf->gmc->policy;
+
+      if (bat->conf->allow_overlap ==0)
+        policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+      else
+        policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+      e_gadman_client_policy_set(bf->gmc , policy);
+    }
+}
index 6420821..fb7d41c 100644 (file)
@@ -20,6 +20,7 @@ struct _Config
 {
    double     poll_time;
    int        alarm;
+   int       allow_overlap;
    Evas_List *faces;
 };
 
index d3244ac..157f5bf 100644 (file)
@@ -8,6 +8,7 @@ typedef struct _Cfg_File_Data Cfg_File_Data;
 struct _E_Config_Dialog_Data
 {   
    int digital_style;
+   int allow_overlap;
 };
 
 struct _Cfg_File_Data 
@@ -45,6 +46,7 @@ static void
 _fill_data(Clock_Face *clk, E_Config_Dialog_Data *cfdata) 
 {
    cfdata->digital_style = clk->conf->digitalStyle;
+   cfdata->allow_overlap = clk->clock->conf->allow_overlap;
 }
 
 static void *
@@ -86,6 +88,12 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
    ob = e_widget_radio_add(evas, _("24 Hour Display"), 2, rg);
    e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+
    return o;
 }
 
@@ -97,6 +105,12 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
    clk = cfd->data;
    e_border_button_bindings_ungrab_all();
    clk->conf->digitalStyle = cfdata->digital_style;
+
+   if (cfdata->allow_overlap && !clk->clock->conf->allow_overlap)
+     clk->clock->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && clk->clock->conf->allow_overlap)
+     clk->clock->conf->allow_overlap = 0;
+
    e_border_button_bindings_grab_all();
    e_config_save_queue();
    
index 65792df..a56dee8 100644 (file)
@@ -14,7 +14,7 @@ static Clock  *_clock_new();
 static void    _clock_shutdown(Clock *clock);
 static void    _clock_config_menu_new(Clock *clock);
 
-static Clock_Face *_clock_face_new(E_Container *con);
+static Clock_Face *_clock_face_new(Clock *clock, E_Container *con);
 static void    _clock_face_free(Clock_Face *face);
 /* static void    _clock_face_enable(Clock_Face *face); */
 static void    _clock_face_disable(Clock_Face *face);
@@ -24,6 +24,8 @@ static void    _clock_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj,
 static void    _clock_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
 static void    _clock_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
 
+static void    _clock_face_cb_update_policy(void *data);
+
 static int _clock_count;
 
 static E_Config_DD *conf_edd;
@@ -137,13 +139,16 @@ _clock_new()
 #undef D
 #define T Config
 #define D conf_edd
+   E_CONFIG_VAL(D, T, allow_overlap, INT);
    E_CONFIG_LIST(D, T, faces, conf_face_edd);
 
    clock->conf = e_config_domain_load("module.clock", conf_edd);
    if (!clock->conf)
      {
        clock->conf = E_NEW(Config, 1);
+       clock->conf->allow_overlap = 0;
      }
+   E_CONFIG_LIMIT(clock->conf->allow_overlap, 0, 1);
 
    _clock_config_menu_new(clock);
 
@@ -160,9 +165,10 @@ _clock_new()
             Clock_Face *face;
 
             con = l2->data;
-            face = _clock_face_new(con);
+            face = _clock_face_new(clock, con);
             if (face)
               {
+                 face->clock = clock;
                  clock->faces = evas_list_append(clock->faces, face);
                  /* Config */
                  if (!cl)
@@ -228,11 +234,12 @@ _clock_config_menu_new(Clock *clock)
 }
 
 static Clock_Face *
-_clock_face_new(E_Container *con)
+_clock_face_new(Clock *clock, E_Container *con)
 {
    Clock_Face *face;
    Evas_Object *o;
    Evas_Coord x, y, w, h;
+   E_Gadman_Policy  policy;
 
    face = E_NEW(Clock_Face, 1);
    if (!face) return NULL;
@@ -266,12 +273,19 @@ _clock_face_new(E_Container *con)
 
    face->gmc = e_gadman_client_new(con->gadman);
    e_gadman_client_domain_set(face->gmc, "module.clock", _clock_count++);
-   e_gadman_client_policy_set(face->gmc,
-                             E_GADMAN_POLICY_ANYWHERE |
-                             E_GADMAN_POLICY_HMOVE |
-                             E_GADMAN_POLICY_VMOVE |
-                             E_GADMAN_POLICY_HSIZE |
-                             E_GADMAN_POLICY_VSIZE);
+
+   policy = E_GADMAN_POLICY_ANYWHERE |
+           E_GADMAN_POLICY_HMOVE |
+           E_GADMAN_POLICY_VMOVE |
+           E_GADMAN_POLICY_HSIZE |
+           E_GADMAN_POLICY_VSIZE;
+
+   if (clock->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+   e_gadman_client_policy_set(face->gmc, policy);
    e_gadman_client_min_size_set(face->gmc, 4, 4);
    e_gadman_client_max_size_set(face->gmc, 512, 512);
    e_gadman_client_auto_size_set(face->gmc,
@@ -437,4 +451,28 @@ _clock_face_cb_config_updated(void *data)
    memset(buf, 0, sizeof(buf));
    snprintf(buf, sizeof(buf), "%i", face->conf->digitalStyle);
    edje_object_part_text_set(face->clock_object, "digitalStyle", buf);
+
+   _clock_face_cb_update_policy(face->clock);
+}
+
+static void _clock_face_cb_update_policy(void *data)
+{
+  Clock               *clock;
+  Clock_Face   *cf;
+  Evas_List   *l;
+  E_Gadman_Policy policy;
+
+  clock = data;
+  for (l = clock->faces; l; l = l->next)
+    {
+      cf = l->data;
+      policy = cf->gmc->policy;
+
+      if (clock->conf->allow_overlap ==0)
+        policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+      else
+        policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+      e_gadman_client_policy_set(cf->gmc , policy);
+    }
 }
index f625bef..64ac4db 100644 (file)
@@ -11,6 +11,7 @@ typedef struct _Clock_Face  Clock_Face;
 
 struct _Config
 {
+   int       allow_overlap;
    Evas_List *faces;
 };
 
@@ -33,6 +34,7 @@ struct _Clock_Face
    E_Container *con;
    E_Menu      *menu;
    Config_Face *conf;
+   Clock       *clock;
    
    struct {
        Evas_Coord l, r, t, b;
index ae2285a..ce6dfe5 100644 (file)
@@ -25,6 +25,7 @@ static void     _cpufreq_menu_medium(void *data, E_Menu *m, E_Menu_Item *mi);
 static void     _cpufreq_menu_normal(void *data, E_Menu *m, E_Menu_Item *mi);
 static void     _cpufreq_menu_slow(void *data, E_Menu *m, E_Menu_Item *mi);
 static void     _cpufreq_menu_very_slow(void *data, E_Menu *m, E_Menu_Item *mi);
+static void    _cpufreq_menu_cb_allow_overlap(void *data, E_Menu *m, E_Menu_Item *mi);
 static void     _cpufreq_menu_restore_governor(void *data, E_Menu *m, E_Menu_Item *mi);
 static void     _cpufreq_menu_governor(void *data, E_Menu *m, E_Menu_Item *mi);
 static void     _cpufreq_menu_frequency(void *data, E_Menu *m, E_Menu_Item *mi);
@@ -50,6 +51,8 @@ static void          _cpufreq_face_update_current(Cpufreq_Face *face);
 static void          _cpufreq_face_cb_set_frequency(void *data, Evas_Object *o, const char *emission, const char *source);
 static void          _cpufreq_face_cb_set_governor(void *data, Evas_Object *o, const char *emission, const char *source);
 
+static void    _cpufreq_cb_update_policy(Cpufreq *e);
+
 static E_Config_DD *conf_edd;
 static E_Config_DD *conf_face_edd;
 
@@ -141,6 +144,7 @@ _cpufreq_new(E_Module *module)
 #define T Config
 #define D conf_edd
    E_CONFIG_VAL(D, T, poll_time, DOUBLE);
+   E_CONFIG_VAL(D, T, allow_overlap, INT);
    E_CONFIG_LIST(D, T, faces, conf_face_edd);
    E_CONFIG_VAL(D, T, restore_governor, INT);
    E_CONFIG_VAL(D, T, governor, STR);
@@ -152,8 +156,10 @@ _cpufreq_new(E_Module *module)
        e->conf->poll_time = 2.0;
        e->conf->restore_governor = 0;
        e->conf->governor = NULL;
+       e->conf->allow_overlap = 0;
      }
    E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 60.0);
+   E_CONFIG_LIMIT(e->conf->allow_overlap, 0, 1);
 #ifdef __FreeBSD__     
    /* does e_module_dir_get(module) work correctly in linux???  - yes it does... what's wrong in bsd? */
    snprintf(buf, sizeof(buf), "%s/%s/cpufreq/freqset", e_module_dir_get(module), MODULE_ARCH);
@@ -209,6 +215,13 @@ _cpufreq_new(E_Module *module)
 
                  _cpufreq_face_menu_new(ef);
 
+                 /* Add 'Allow Overlap' option */
+                 mi = e_menu_item_new(ef->menu);
+                 e_menu_item_label_set(mi, _("Allow Overlap"));
+                 e_menu_item_check_set(mi, 1);
+                 e_menu_item_toggle_set(mi, e->conf->allow_overlap);
+                 e_menu_item_callback_set(mi, _cpufreq_menu_cb_allow_overlap, e);
+
                  /* Add poll time menu to this face */
                  mi = e_menu_item_new(ef->menu);
                  e_menu_item_label_set(mi, _("Set Poll Time"));
@@ -396,6 +409,38 @@ _cpufreq_menu_very_slow(void *data, E_Menu *m, E_Menu_Item *mi)
    e_config_save_queue();
 }
 
+static void _cpufreq_cb_update_policy(Cpufreq *e)
+{
+  Cpufreq_Face     *cf;
+  Evas_List        *l;
+  E_Gadman_Policy   policy;
+
+  for (l = e->faces; l; l = l->next)
+    {
+      cf = l->data;
+      policy = cf->gmc->policy;
+
+      if (e->conf->allow_overlap == 0)
+       policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+      else
+       policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+      e_gadman_client_policy_set(cf->gmc, policy);
+    }
+}
+
+static void _cpufreq_menu_cb_allow_overlap(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+  Cpufreq *e;
+
+  e = data;
+  e->conf->allow_overlap = e_menu_item_toggle_get(mi);
+  _cpufreq_cb_update_policy(e);
+  e_config_save_queue();
+}
+
+
+
 static void
 _cpufreq_menu_restore_governor(void *data, E_Menu *m, E_Menu_Item *mi)
 {
@@ -543,6 +588,12 @@ _cpufreq_config_menu_new(Cpufreq *e)
    mn = e_menu_new();
 
    mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, _("Allow Overlap"));
+   e_menu_item_check_set(mi, 1);
+   e_menu_item_toggle_set(mi, e->conf->allow_overlap);
+   e_menu_item_callback_set(mi, _cpufreq_menu_cb_allow_overlap, e);
+   
+   mi = e_menu_item_new(mn);
    e_menu_item_label_set(mi, _("Set Poll Time"));
    e_menu_item_submenu_set(mi, e->config_menu_poll);
 
@@ -861,6 +912,7 @@ _cpufreq_face_new(E_Container *con, Cpufreq *owner)
 {
    Evas_Object *o;
    Cpufreq_Face *ef;
+   E_Gadman_Policy  policy;
 
    ef = E_NEW(Cpufreq_Face, 1);
    if (!ef) return NULL;
@@ -890,9 +942,19 @@ _cpufreq_face_new(E_Container *con, Cpufreq *owner)
 
    ef->gmc = e_gadman_client_new(ef->con->gadman);
    e_gadman_client_domain_set(ef->gmc, "module.cpufreq", cpufreq_count++);
-   e_gadman_client_policy_set(ef->gmc, E_GADMAN_POLICY_ANYWHERE |
-                             E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE |
-                             E_GADMAN_POLICY_HSIZE | E_GADMAN_POLICY_VSIZE);
+
+   policy = E_GADMAN_POLICY_ANYWHERE  |
+           E_GADMAN_POLICY_HMOVE     |
+           E_GADMAN_POLICY_VMOVE     |
+           E_GADMAN_POLICY_HSIZE     |
+           E_GADMAN_POLICY_VSIZE;
+
+   if (owner->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+   e_gadman_client_policy_set(ef->gmc, policy);
    e_gadman_client_min_size_set(ef->gmc, 4, 4);
    e_gadman_client_max_size_set(ef->gmc, 128, 128);
    /* This module needs a slightly higher min size */
index 57baf32..c616d80 100644 (file)
@@ -23,6 +23,7 @@ struct _Status
 struct _Config
 {
    double poll_time;
+   int   allow_overlap;
    Evas_List *faces;
 
    int   restore_governor;
index 6fde85e..10118db 100644 (file)
@@ -10,6 +10,7 @@ struct _E_Config_Dialog_Data
    int autofit;
    int follower;
    int iconsize;
+   int allow_overlap;
    double follow_speed;
    double autoscroll_speed;
 };
@@ -53,6 +54,7 @@ _fill_data(IBar *ib, E_Config_Dialog_Data *cfdata)
    cfdata->autofit = (ib->conf->width == IBAR_WIDTH_AUTO);
    cfdata->follower = ib->conf->follower;
    cfdata->iconsize = ib->conf->iconsize;   
+   cfdata->allow_overlap = ib->conf->allow_overlap;
    cfdata->follow_speed = ib->conf->follow_speed;
    cfdata->autoscroll_speed = ib->conf->autoscroll_speed;
 }
@@ -93,6 +95,9 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
    e_widget_list_object_append(o, ob, 1, 1, 0.5);
    ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->autofit));
    e_widget_list_object_append(o, ob, 1, 1, 0.5);
+
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_list_object_append(o, ob, 1, 1, 0.5);
    return o;
 }
 
@@ -111,7 +116,12 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
      {
        ib->conf->follower = 0;
      }
-   
+
+   if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 0;
    if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED)) 
      {
        ib->conf->width = IBAR_WIDTH_AUTO;
@@ -160,6 +170,12 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
    ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0,  &(cfdata->autoscroll_speed), NULL,200);
    e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+   /* allow overlap checkbox */
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
    return o;
 }
 
@@ -178,6 +194,12 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
      {
        ib->conf->follower = 0;
      }
+
+   /* allow overlap check box */
+   if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 0;
    
    if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED)) 
      {
index 381ab60..90d42b7 100644 (file)
@@ -222,6 +222,7 @@ _ibar_new()
    E_CONFIG_VAL(D, T, autoscroll_speed, DOUBLE);
    E_CONFIG_VAL(D, T, iconsize, INT);
    E_CONFIG_VAL(D, T, width, INT);
+   E_CONFIG_VAL(D, T, allow_overlap, INT);
    E_CONFIG_LIST(D, T, bars, conf_bar_edd);
 
    ib->conf = e_config_domain_load("module.ibar", conf_edd);
@@ -233,12 +234,14 @@ _ibar_new()
        ib->conf->follow_speed = 0.9;
        ib->conf->autoscroll_speed = 0.95;
        ib->conf->iconsize = 24;
+       ib->conf->allow_overlap = 0;
        ib->conf->width = IBAR_WIDTH_AUTO;
      }
    E_CONFIG_LIMIT(ib->conf->follow_speed, 0.01, 1.0);
    E_CONFIG_LIMIT(ib->conf->autoscroll_speed, 0.01, 1.0);
    E_CONFIG_LIMIT(ib->conf->iconsize, 2, 400);
    E_CONFIG_LIMIT(ib->conf->width, -2, -1);
+   E_CONFIG_LIMIT(ib->conf->allow_overlap, 0, 1);
 
    _ibar_config_menu_new(ib);
 
@@ -582,6 +585,12 @@ _ibar_bar_new(IBar *ib, E_Container *con)
    policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
    if (ibb->ibar->conf->width == IBAR_WIDTH_FIXED)
      policy |= E_GADMAN_POLICY_HSIZE;
+
+   if (ibb->ibar->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
    e_gadman_client_policy_set(ibb->gmc, policy);
    e_gadman_client_min_size_set(ibb->gmc, 8, 8);
    e_gadman_client_max_size_set(ibb->gmc, 3200, 3200);
@@ -1007,6 +1016,11 @@ _ibar_bar_edge_change(IBar_Bar *ibb, int edge)
    e_box_align_set(ibb->box_object, 0.5, 0.5);
 
    policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+   if (ibb->ibar->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
    if ((edge == E_GADMAN_EDGE_BOTTOM) ||
        (edge == E_GADMAN_EDGE_TOP))
      {
@@ -1050,6 +1064,12 @@ _ibar_bar_update_policy(IBar_Bar *ibb)
    E_Gadman_Policy policy;
 
    policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+
+   if (ibb->ibar->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
    if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
        (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP))
      {
index b3f765b..2accd4d 100644 (file)
@@ -21,6 +21,7 @@ struct _Config
    double        autoscroll_speed;
    int           iconsize;
    int           width;
+   int          allow_overlap;
    Evas_List    *bars;
 };
 
index 9b2747a..f076a00 100644 (file)
@@ -12,6 +12,7 @@ struct _E_Config_Dialog_Data
    int iconsize;
    double follow_speed;
    double autoscroll_speed;
+   int allow_overlap;
 };
 
 struct _Cfg_File_Data
@@ -55,6 +56,7 @@ _fill_data(IBox *ib, E_Config_Dialog_Data *cfdata)
    cfdata->iconsize = ib->conf->iconsize;
    cfdata->follow_speed = ib->conf->follow_speed;
    cfdata->autoscroll_speed = ib->conf->autoscroll_speed;
+   cfdata->allow_overlap = ib->conf->allow_overlap;
 }
 
 static void *
@@ -93,6 +95,9 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
    e_widget_list_object_append(o, ob, 1, 1, 0.5);
    ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->autofit));
    e_widget_list_object_append(o, ob, 1, 1, 0.5);
+
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_list_object_append(o, ob, 1, 1, 0.5);
    return o;
 }
 
@@ -120,6 +125,12 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
      {
        ib->conf->width = IBOX_WIDTH_FIXED;
      }
+
+   if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 0;
+
    e_border_button_bindings_grab_all();
    e_config_save_queue();
 
@@ -160,6 +171,12 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
    ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0,  &(cfdata->autoscroll_speed), NULL,200);
    e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+
    return o;
 }
 
@@ -200,6 +217,11 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
      {
        ib->conf->autoscroll_speed = cfdata->autoscroll_speed;
      }
+
+   if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 0;
    
    e_border_button_bindings_grab_all();
    e_config_save_queue();
index 04aee02..6214c53 100644 (file)
@@ -203,6 +203,7 @@ _ibox_new()
    E_CONFIG_VAL(D, T, autoscroll_speed, DOUBLE);
    E_CONFIG_VAL(D, T, iconsize, INT);
    E_CONFIG_VAL(D, T, width, INT);
+   E_CONFIG_VAL(D, T, allow_overlap, INT);
    E_CONFIG_LIST(D, T, boxes, conf_box_edd);
 
    ib->conf = e_config_domain_load("module.ibox", conf_edd);
@@ -214,11 +215,13 @@ _ibox_new()
        ib->conf->autoscroll_speed = 0.95;
        ib->conf->iconsize = 24;
        ib->conf->width = IBOX_WIDTH_AUTO;
+       ib->conf->allow_overlap = 0;
      }
    E_CONFIG_LIMIT(ib->conf->follow_speed, 0.01, 1.0);
    E_CONFIG_LIMIT(ib->conf->autoscroll_speed, 0.01, 1.0);
    E_CONFIG_LIMIT(ib->conf->iconsize, 2, 400);
    E_CONFIG_LIMIT(ib->conf->width, -2, -1);
+   E_CONFIG_LIMIT(ib->conf->allow_overlap, 0, 1);
 
    _ibox_config_menu_new(ib);
 
@@ -396,6 +399,12 @@ _ibox_box_new(IBox *ib, E_Container *con)
    policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
    if (ibb->ibox->conf->width == IBOX_WIDTH_FIXED)
      policy |= E_GADMAN_POLICY_VSIZE;
+
+   if (ibb->ibox->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+   
    e_gadman_client_policy_set(ibb->gmc, policy);
    e_gadman_client_min_size_set(ibb->gmc, 8, 8);
    e_gadman_client_max_size_set(ibb->gmc, 3200, 3200);
@@ -710,6 +719,12 @@ _ibox_box_edge_change(IBox_Box *ibb, int edge)
    e_box_align_set(ibb->item_object, 0.5, 0.5);
 
    policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+
+   if (ibb->ibox->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
    if ((edge == E_GADMAN_EDGE_BOTTOM) ||
        (edge == E_GADMAN_EDGE_TOP))
      {
@@ -753,6 +768,12 @@ _ibox_box_update_policy(IBox_Box *ibb)
    E_Gadman_Policy policy;
 
    policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+
+   if (ibb->ibox->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
    if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
        (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP))
      {
index dd3d4f6..81319fe 100644 (file)
@@ -19,6 +19,7 @@ struct _Config
    int           follower;
    double        autoscroll_speed;
    int           iconsize;
+   int          allow_overlap;
    int           width;
    Evas_List    *boxes;
 };
diff --git a/src/modules/itray/Makefile.am b/src/modules/itray/Makefile.am
new file mode 100644 (file)
index 0000000..43b92ed
--- /dev/null
@@ -0,0 +1,28 @@
+MAINTAINERCLEANFILES = Makefile.in
+MODULE = itray
+
+# data files for the module
+filesdir = $(libdir)/enlightenment/modules/$(MODULE)
+files_DATA = \
+module_icon.png
+
+EXTRA_DIST = $(files_DATA)
+
+# the module .so file
+INCLUDES               = -I. \
+                         -I$(top_srcdir) \
+                         -I$(includedir) \
+                         -I$(top_srcdir)/$(MODULE) \
+                         -I$(top_srcdir)/src/bin \
+                         -I$(top_srcdir)/src/lib \
+                         -I$(top_srcdir)/src/modules \
+                         @e_cflags@
+pkgdir                 = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
+pkg_LTLIBRARIES        = module.la
+module_la_SOURCES      = e_mod_main.c \
+                         e_mod_main.h \
+                         e_mod_config.c \
+                         e_mod_config.h
+module_la_LIBADD       = @e_libs@ @dlopen_libs@
+module_la_LDFLAGS      = -module -avoid-version
+module_la_DEPENDENCIES = $(top_builddir)/config.h
diff --git a/src/modules/itray/e_mod_config.c b/src/modules/itray/e_mod_config.c
new file mode 100644 (file)
index 0000000..7647f87
--- /dev/null
@@ -0,0 +1,237 @@
+#include "e.h"
+#include "e_mod_main.h"
+#include "e_mod_config.h"
+#include "config.h"
+
+typedef struct _cfdata CFData;
+typedef struct _Cfg_File_Data Cfg_File_Data;
+
+struct _cfdata
+{
+   int follower;
+   int rowsize;
+   double follow_speed;
+   int allow_overlap;
+/*    double autoscroll_speed;
+ *    int autofit;
+ */
+};
+
+struct _Cfg_File_Data
+{
+   E_Config_Dialog *cfd;
+   char *file;
+};
+
+/* Protos */
+static void *_create_data(E_Config_Dialog *cfd);
+static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
+static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
+static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
+static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
+static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
+
+void 
+_config_itray_module(E_Container *con, ITray *itray)
+{
+   E_Config_Dialog *cfd;
+   E_Config_Dialog_View v;
+
+   /* Dialog Methods */
+   v.create_cfdata = _create_data;
+   v.free_cfdata = _free_data;
+   v.basic.apply_cfdata = _basic_apply_data;
+   v.basic.create_widgets = _basic_create_widgets;
+   v.advanced.apply_cfdata = _advanced_apply_data;
+   v.advanced.create_widgets = _advanced_create_widgets;
+
+   /* Create The Dialog */
+   cfd = e_config_dialog_new(con, _("ITray Configuration"), NULL, 0, &v, itray);
+   itray->config_dialog = cfd;
+}
+
+static void 
+_fill_data(ITray *ib, CFData *cfdata)
+{
+/*    cfdata->autofit = (ib->conf->width == ITRAY_WIDTH_AUTO);
+ *    cfdata->autoscroll_speed = ib->conf->autoscroll_speed;
+ */
+   cfdata->follower = ib->conf->follower;
+   cfdata->rowsize = ib->conf->rowsize;
+   cfdata->follow_speed = ib->conf->follow_speed;
+   cfdata->allow_overlap = ib->conf->allow_overlap;
+}
+
+static void *
+_create_data(E_Config_Dialog *cfd)
+{
+   CFData *cfdata;
+   ITray *ib;
+   
+   ib = cfd->data;
+   cfdata = E_NEW(CFData, 1);
+   _fill_data(ib, cfdata);
+   return cfdata;
+}
+
+static void 
+_free_data(E_Config_Dialog *cfd, CFData *cfdata)
+{
+   ITray *ib;
+   
+   ib = cfd->data;
+   ib->config_dialog = NULL;
+   free(cfdata);
+}
+
+static Evas_Object *
+_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
+{
+   Evas_Object *o, *ob, *of;
+   ITray *ib;
+   
+   ib = cfd->data;
+   _fill_data(ib, cfdata);
+
+   o = e_widget_list_add(evas, 0, 0);
+   ob = e_widget_check_add(evas, _("Show Follower"), &(cfdata->follower));
+   e_widget_list_object_append(o, ob, 1, 1, 0.5);
+/*    ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->autofit));
+ *    e_widget_list_object_append(o, ob, 1, 1, 0.5);
+ */
+   
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+   
+   return o;
+}
+
+static int 
+_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
+{
+   ITray *ib;
+   
+   ib = cfd->data;
+   if ((cfdata->follower) && (!ib->conf->follower)) 
+     ib->conf->follower = 1;
+   else if (!(cfdata->follower) && (ib->conf->follower)) 
+     ib->conf->follower = 0;
+
+   if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 0;
+   
+/*    if ((cfdata->autofit) && (ib->conf->width == ITRAY_WIDTH_FIXED)) 
+ *      {
+ *     ib->conf->width = ITRAY_WIDTH_AUTO;
+ *      }
+ *    else if (!(cfdata->autofit) && (ib->conf->width == ITRAY_WIDTH_AUTO)) 
+ *      {
+ *     ib->conf->width = ITRAY_WIDTH_FIXED;
+ *      }
+ */
+   e_config_save_queue();
+
+   _itray_box_cb_config_updated(ib);
+   return 1;
+}
+
+static Evas_Object *
+_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
+{
+   Evas_Object *o, *of, *ob;
+   ITray *ib;
+   
+   ib = cfd->data;
+   _fill_data(ib, cfdata);
+
+   o = e_widget_list_add(evas, 0, 0);
+   
+   of = e_widget_framelist_add(evas, _("Follower"), 0);
+   ob = e_widget_check_add(evas, _("Visible"), &(cfdata->follower));
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_label_add(evas, _("Follow Speed"));
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0,  &(cfdata->follow_speed), NULL,200);
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+   of = e_widget_framelist_add(evas, _("Number of Rows"), 0);
+   ob = e_widget_slider_add(evas, 1, 0, _("%3.0f"), 1.0, 6.0, 1.0, 0,  NULL, &(cfdata->rowsize), 200);
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+      
+/*    of = e_widget_framelist_add(evas, _("Width"), 0);
+ *    ob = e_widget_check_add(evas, _("Auto Fit"), &(cfdata->autofit));
+ *    e_widget_framelist_object_append(of, ob);
+ *    ob = e_widget_label_add(evas, _("Autoscroll Speed:"));
+ *    e_widget_framelist_object_append(of, ob);
+ *    ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0,  &(cfdata->autoscroll_speed), NULL,200);
+ *    e_widget_framelist_object_append(of, ob);
+ *    e_widget_list_object_append(o, of, 1, 1, 0.5);
+ */
+   
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+   
+   return o;
+}
+
+static int 
+_advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
+{
+   ITray *ib;
+   
+   ib = cfd->data;
+   e_border_button_bindings_ungrab_all();
+   if ((cfdata->follower) && (!ib->conf->follower)) 
+     {
+       ib->conf->follower = 1;
+     }
+   else if (!(cfdata->follower) && (ib->conf->follower)) 
+     {
+       ib->conf->follower = 0;
+     }
+   
+/*    if ((cfdata->autofit) && (ib->conf->width == ITRAY_WIDTH_FIXED)) 
+ *      {
+ *     ib->conf->width = ITRAY_WIDTH_AUTO;
+ *      }
+ *    else if (!(cfdata->autofit) && (ib->conf->width == ITRAY_WIDTH_AUTO)) 
+ *      {
+ *     ib->conf->width = ITRAY_WIDTH_FIXED;
+ *      }
+ */
+
+   if (cfdata->rowsize != ib->conf->rowsize) 
+     {
+       ib->conf->rowsize = cfdata->rowsize;
+     }
+   if (cfdata->follow_speed != ib->conf->follow_speed) 
+     { 
+       ib->conf->follow_speed = cfdata->follow_speed;
+     }
+   
+   if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+     ib->conf->allow_overlap = 0;
+   
+   
+/*    if (cfdata->autoscroll_speed != ib->conf->autoscroll_speed) 
+ *      {
+ *     ib->conf->autoscroll_speed = cfdata->autoscroll_speed;
+ *      }
+ */
+   
+   e_border_button_bindings_grab_all();
+   e_config_save_queue();
+
+   _itray_box_cb_config_updated(ib);
+   return 1;
+}
diff --git a/src/modules/itray/e_mod_config.h b/src/modules/itray/e_mod_config.h
new file mode 100644 (file)
index 0000000..70f441e
--- /dev/null
@@ -0,0 +1,8 @@
+#ifdef E_TYPEDEFS
+#else
+#ifndef E_MOD_CONFIG_H
+#define E_MOD_CONFIG_H
+#include "e_mod_main.h"
+void _config_itray_module(E_Container *con, ITray *itray);
+#endif
+#endif
diff --git a/src/modules/itray/e_mod_main.c b/src/modules/itray/e_mod_main.c
new file mode 100644 (file)
index 0000000..4a0e9aa
--- /dev/null
@@ -0,0 +1,1196 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#include "e.h"
+#include "e_mod_main.h"
+#include "e_mod_config.h"
+#include <math.h>
+
+#include "Ecore_X.h"
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+
+/* Currently unused */
+#define SYSTEM_TRAY_REQUEST_DOCK    0
+#define SYSTEM_TRAY_BEGIN_MESSAGE   1
+#define SYSTEM_TRAY_CANCEL_MESSAGE  2
+#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
+#define _NET_SYSTEM_TRAY_ORIENTATION_VERT 1
+/* ---------------- */
+
+#define XEMBED_EMBEDDED_NOTIFY      0
+
+#define TRAY_ICON_SIZE             24
+
+/* Bug List:
+ *
+ * Changing the number of rows breaks the layout.
+ *     It's magically fixed when the module is moved.
+ * Remove the follower code, or make it work on top of the tray icons.
+ *
+ * TODO List:
+ * 
+ * Make sure only one tray exists.
+ * Use the abovestated defines.
+ * Change the size of the tray icons.
+ * Use the shape extension for the ecore_x_window so that the "gray"
+ *     itself is not visible, but the tray icons are.
+ *
+ * The Big Picture:
+ *
+ * Get rid of the ecore_x_window stuff. 
+ * Make the tray survive an E restart.
+ *
+ */
+
+static int box_count;
+static E_Config_DD *conf_edd;
+static E_Config_DD *conf_box_edd;
+
+/* const strings */
+static const char *_itray_main_orientation[] =
+{"left", "right", "top", "bottom"};
+
+/* module private routines */
+static ITray   *_itray_new();
+static void    _itray_free(ITray *it);
+static void    _itray_config_menu_new(ITray *it);
+
+static ITray_Box *_itray_box_new(ITray *it, E_Container *con);
+static void    _itray_box_free(ITray_Box *itb);
+static void    _itray_box_menu_new(ITray_Box *itb);
+static void    _itray_box_disable(ITray_Box *itb);
+static void    _itray_box_frame_resize(ITray_Box *itb);
+static void    _itray_box_edge_change(ITray_Box *itb, int edge);
+static void    _itray_box_update_policy(ITray_Box *itb);
+static void    _itray_box_motion_handle(ITray_Box *itb, Evas_Coord mx, Evas_Coord my);
+static void    _itray_box_timer_handle(ITray_Box *itb);
+static void    _itray_box_follower_reset(ITray_Box *itb);
+
+static void    _itray_box_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change);
+static void    _itray_box_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void    _itray_box_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void    _itray_box_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void    _itray_box_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void    _itray_box_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+/* Follower */
+static int     _itray_box_cb_timer(void *data);
+static int     _itray_box_cb_animator(void *data);
+
+static void    _itray_box_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
+static void    _itray_box_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
+
+/* Config Updated Function Protos */
+static void    _itray_box_cb_width_auto(void *data);
+static void    _itray_box_cb_follower(void *data);
+
+/* Tray */
+static void    _itray_tray_init(ITray_Box *itb);
+static void    _itray_tray_shutdown(ITray_Box *itb);
+static int     _itray_tray_cb_msg(void *data, int type, void *event);
+static void    _itray_tray_active_set();
+
+static void    _itray_tray_cb_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y);
+static void    _itray_tray_cb_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
+
+static void    _itray_tray_layout(ITray_Box *itb);
+
+/* public module routines. all modules must have these */
+EAPI E_Module_Api e_modapi =
+{
+   E_MODULE_API_VERSION,
+     "ITray"
+};
+
+EAPI void *
+e_modapi_init(E_Module *m)
+{
+   ITray *it;
+
+   /* actually init ibox */
+   it = _itray_new();
+   m->config_menu = it->config_menu;
+   return it;
+}
+
+EAPI int
+e_modapi_shutdown(E_Module *m)
+{
+   ITray *it;
+
+   if (m->config_menu)
+     m->config_menu = NULL;
+
+   it = m->data;
+   if (it) 
+     {
+       if (it->config_dialog) 
+         {
+            e_object_del(E_OBJECT(it->config_dialog));
+            it->config_dialog = NULL;
+         }
+       _itray_free(it);        
+     }  
+   return 1;
+}
+
+EAPI int
+e_modapi_save(E_Module *m)
+{
+   ITray *it;
+
+   it = m->data;
+   e_config_domain_save("module.itray", conf_edd, it->conf);
+   return 1;
+}
+
+EAPI int
+e_modapi_info(E_Module *m)
+{
+   char buf[4096];
+
+   snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m));
+   m->icon_file = strdup(buf);
+   return 1;
+}
+
+EAPI int
+e_modapi_about(E_Module *m)
+{
+   e_module_dialog_show(_("Enlightenment ITray Module"),
+                       _("This is the ITray system tray module for Enlightenment.<br>"
+                         "It will hold system tray icons."));
+   return 1;
+}
+
+EAPI int
+e_modapi_config(E_Module *m)
+{
+   ITray *e;
+   Evas_List *l;
+   
+   e = m->data;
+   if (!e) return 0;
+   if (!e->boxes) return 0;
+   
+   for (l = e->boxes; l; l = l->next) 
+     {
+       ITray_Box *face;
+       face = l->data;
+       if (!face) return 0;
+       if (face->con == e_container_current_get(e_manager_current_get())) 
+         {
+            _config_itray_module(face->con, face->itray);
+            break;
+         }     
+     }
+   return 1;
+}
+
+/* module private routines */
+static ITray *
+_itray_new()
+{
+   ITray *it;
+   Evas_List *managers, *l, *l2, *cl;
+
+   box_count = 0;
+   it = E_NEW(ITray, 1);
+   if (!it) return NULL;
+
+   conf_box_edd = E_CONFIG_DD_NEW("ITray_Config_Box", Config_Box);
+#undef T
+#undef D
+#define T Config_Box
+#define D conf_box_edd
+   E_CONFIG_VAL(D, T, enabled, UCHAR);
+
+   conf_edd = E_CONFIG_DD_NEW("ITray_Config", Config);
+#undef T
+#undef D
+#define T Config
+#define D conf_edd
+   E_CONFIG_VAL(D, T, follower, INT);
+   E_CONFIG_VAL(D, T, follow_speed, DOUBLE);
+   E_CONFIG_VAL(D, T, autoscroll_speed, DOUBLE);
+   E_CONFIG_VAL(D, T, rowsize, INT);
+   E_CONFIG_VAL(D, T, width, INT);
+   E_CONFIG_LIST(D, T, boxes, conf_box_edd);
+
+   it->conf = e_config_domain_load("module.itray", conf_edd);
+   if (!it->conf)
+     {
+       it->conf = E_NEW(Config, 1);
+       it->conf->follower = 1;
+       it->conf->follow_speed = 0.9;
+       it->conf->autoscroll_speed = 0.95;
+       it->conf->rowsize = 1;
+       it->conf->width = ITRAY_WIDTH_AUTO;
+     }
+   E_CONFIG_LIMIT(it->conf->follow_speed, 0.01, 1.0);
+   E_CONFIG_LIMIT(it->conf->autoscroll_speed, 0.01, 1.0);
+   E_CONFIG_LIMIT(it->conf->rowsize, 1, 6);
+   E_CONFIG_LIMIT(it->conf->width, -2, -1);
+
+   _itray_config_menu_new(it);
+
+   managers = e_manager_list();
+   cl = it->conf->boxes;
+   for (l = managers; l; l = l->next)
+     {
+       E_Manager *man;
+
+       man = l->data;
+       for (l2 = man->containers; l2; l2 = l2->next)
+         {
+            E_Container *con;
+            ITray_Box *itb;
+            /* Config */
+            con = l2->data;
+            itb = _itray_box_new(it, con);
+            if (itb)
+              {
+                 E_Menu_Item *mi;
+
+                 if (!cl)
+                   {
+                      itb->conf = E_NEW(Config_Box, 1);
+                      itb->conf->enabled = 1;
+                      it->conf->boxes = evas_list_append(it->conf->boxes, itb->conf);
+                   }
+                 else
+                   {
+                      itb->conf = cl->data;
+                      cl = cl->next;
+                   }
+
+                 /* Menu */
+                 _itray_box_menu_new(itb);
+
+                 /* Add main menu to box menu */
+                 mi = e_menu_item_new(it->config_menu);
+                 e_menu_item_label_set(mi, con->name);
+                 e_menu_item_submenu_set(mi, itb->menu);
+
+                 /* Setup */
+                 if (!itb->conf->enabled)
+                   _itray_box_disable(itb);
+              }
+         }
+     }
+   return it;
+}
+
+static void
+_itray_free(ITray *it)
+{
+   E_CONFIG_DD_FREE(conf_edd);
+   E_CONFIG_DD_FREE(conf_box_edd);
+
+   while (it->boxes)
+     _itray_box_free(it->boxes->data);
+
+   e_object_del(E_OBJECT(it->config_menu));
+   evas_list_free(it->conf->boxes);
+   free(it->conf);
+   free(it);
+}
+
+static ITray_Box *
+_itray_box_new(ITray *it, E_Container *con)
+{
+   ITray_Box *itb;
+   Evas_Object *o;
+   E_Gadman_Policy policy;
+   Evas_Coord x, y, w, h;
+
+   itb = E_NEW(ITray_Box, 1);
+   if (!itb) return NULL;
+   itb->itray = it;
+   it->boxes = evas_list_append(it->boxes, itb);
+
+   itb->con = con;
+   e_object_ref(E_OBJECT(con));
+   itb->evas = con->bg_evas;
+
+   itb->tray = NULL;
+
+   itb->x = itb->y = itb->w = itb->h = -1;
+
+   evas_event_freeze(itb->evas);
+   o = edje_object_add(itb->evas);
+   itb->box_object = o;
+   e_theme_edje_object_set(o, "base/theme/modules/itray",
+                          "modules/itray/main");
+   evas_object_show(o);
+
+   if (itb->itray->conf->follower)
+     {
+       o = edje_object_add(itb->evas);
+       itb->overlay_object = o;
+       evas_object_layer_set(o, 1);
+       e_theme_edje_object_set(o, "base/theme/modules/itray",
+                               "modules/itray/follower");
+       evas_object_show(o);
+     }
+
+   o = evas_object_rectangle_add(itb->evas);
+   itb->event_object = o;
+   evas_object_layer_set(o, 2);
+   evas_object_repeat_events_set(o, 1);
+   evas_object_color_set(o, 0, 0, 0, 0);
+   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN,  _itray_box_cb_mouse_in,  itb);
+   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _itray_box_cb_mouse_out, itb);
+   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _itray_box_cb_mouse_down, itb);
+   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _itray_box_cb_mouse_up, itb);
+   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _itray_box_cb_mouse_move, itb);
+   evas_object_show(o);
+
+   o = e_box_add(itb->evas);
+   itb->item_object = o;
+   _itray_tray_init(itb);
+   e_box_freeze(o);
+   edje_object_part_swallow(itb->box_object, "tray", o);
+   evas_object_show(o);
+
+   itb->align_req = 0.5;
+   itb->align = 0.5;
+   e_box_align_set(itb->item_object, 0.5, 0.5);
+
+   evas_object_resize(itb->box_object, 1000, 1000);
+   edje_object_calc_force(itb->box_object);
+   edje_object_part_geometry_get(itb->box_object, "tray", &x, &y, &w, &h);
+   itb->box_inset.l = x;
+   itb->box_inset.r = 1000 - (x + w);
+   itb->box_inset.t = y;
+   itb->box_inset.b = 1000 - (y + h);
+
+   e_box_thaw(itb->item_object);
+
+   itb->gmc = e_gadman_client_new(itb->con->gadman);
+   e_gadman_client_domain_set(itb->gmc, "module.itray", box_count++);
+   policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+   if (itb->itray->conf->width == ITRAY_WIDTH_FIXED)
+     policy |= E_GADMAN_POLICY_VSIZE;
+   e_gadman_client_policy_set(itb->gmc, policy);
+   e_gadman_client_min_size_set(itb->gmc, 8, 8);
+   e_gadman_client_max_size_set(itb->gmc, 3200, 3200);
+   e_gadman_client_auto_size_set(itb->gmc, -1, -1);
+   e_gadman_client_align_set(itb->gmc, 0.0, 0.5);
+   e_gadman_client_resize(itb->gmc, 400, 32);
+   e_gadman_client_change_func_set(itb->gmc, _itray_box_cb_gmc_change, itb);
+   e_gadman_client_edge_set(itb->gmc, E_GADMAN_EDGE_LEFT);
+   e_gadman_client_load(itb->gmc);
+
+   evas_event_thaw(itb->evas);
+
+   /* We need to resize, if the width is auto and the number
+    * of apps has changed since last startup */
+   _itray_box_frame_resize(itb);
+
+   /*
+   edje_object_signal_emit(itb->box_object, "passive", "");
+   edje_object_signal_emit(itb->overlay_object, "passive", "");
+   */
+
+   return itb;
+}
+
+static void
+_itray_box_free(ITray_Box *itb)
+{
+   e_object_unref(E_OBJECT(itb->con));
+   e_object_del(E_OBJECT(itb->menu));
+
+   if (itb->timer) ecore_timer_del(itb->timer);
+   if (itb->animator) ecore_animator_del(itb->animator);
+   evas_object_del(itb->box_object);
+   if (itb->overlay_object) evas_object_del(itb->overlay_object);
+   evas_object_del(itb->item_object);
+   evas_object_del(itb->event_object);
+
+   if (itb->tray)
+     {
+       _itray_tray_shutdown(itb);
+       itb->tray = NULL;
+     }
+
+   e_gadman_client_save(itb->gmc);
+   e_object_del(E_OBJECT(itb->gmc));
+
+   itb->itray->boxes = evas_list_remove(itb->itray->boxes, itb);
+
+   free(itb->conf);
+   free(itb);
+   box_count--;
+}
+
+static void
+_itray_box_menu_new(ITray_Box *itb)
+{
+   E_Menu *mn;
+   E_Menu_Item *mi;
+
+   mn = e_menu_new();
+   itb->menu = mn;
+
+   /* Config */
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, _("Configuration"));
+   e_menu_item_callback_set(mi, _itray_box_cb_menu_configure, itb);
+
+   /* Edit */
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, _("Edit Mode"));
+   e_menu_item_callback_set(mi, _itray_box_cb_menu_edit, itb);
+}
+
+static void
+_itray_box_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   ITray_Box *itb;
+
+   itb = (ITray_Box *)data;
+   if (!itb) return;
+   _config_itray_module(itb->con, itb->itray);
+}
+
+static void
+_itray_box_disable(ITray_Box *itb)
+{
+   itb->conf->enabled = 0;
+   evas_object_hide(itb->box_object);
+   if (itb->overlay_object) evas_object_hide(itb->overlay_object);
+   evas_object_hide(itb->item_object);
+   evas_object_hide(itb->event_object);
+   e_config_save_queue();
+}
+
+void
+_itray_config_menu_new(ITray *it)
+{
+   E_Menu *mn;
+
+   mn = e_menu_new();
+   it->config_menu = mn;
+}
+
+static void
+_itray_box_frame_resize(ITray_Box *itb)
+{
+   Evas_Coord w, h, bw, bh;
+   int icons_per_row;
+   /* Not finished loading config yet! */
+   if ((itb->x == -1) ||
+       (itb->y == -1) ||
+       (itb->w == -1) ||
+       (itb->h == -1))
+     return;
+
+   evas_event_freeze(itb->evas);
+   e_box_freeze(itb->item_object);
+
+   if (e_box_pack_count_get(itb->item_object))
+     e_box_min_size_get(itb->item_object, &w, &h);
+   else
+     {
+       if (!itb->tray)
+         w = h = TRAY_ICON_SIZE + itb->box_inset.l + itb->box_inset.r;
+       else if (!itb->tray->icons)
+         w = h = TRAY_ICON_SIZE + itb->box_inset.l + itb->box_inset.r;
+       else 
+         {
+            icons_per_row = (itb->tray->icons + 
+                  (itb->tray->icons % itb->tray->rows)) / itb->tray->rows;
+            w = (icons_per_row * TRAY_ICON_SIZE)
+               + itb->box_inset.l + itb->box_inset.r;
+            h = (itb->tray->rows * TRAY_ICON_SIZE)
+               + itb->box_inset.t + itb->box_inset.b;
+         }
+     }
+   edje_object_part_unswallow(itb->box_object, itb->item_object);
+/*   edje_extern_object_min_size_set(itb->item_object, w, h);*/
+/*   edje_object_part_swallow(itb->box_object, "tray", itb->item_object);*/
+/*   edje_object_size_min_calc(itb->box_object, &bw, &bh);*/
+   edje_extern_object_min_size_set(itb->item_object, 0, 0);
+   edje_object_part_swallow(itb->box_object, "tray", itb->item_object);
+
+   e_box_thaw(itb->item_object);
+   evas_event_thaw(itb->evas);
+
+   if (itb->itray->conf->width == ITRAY_WIDTH_AUTO)
+     {
+       if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+           (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+         {
+            e_gadman_client_resize(itb->gmc, h, w);
+         }
+       else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP) ||
+                (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM))
+         {
+            e_gadman_client_resize(itb->gmc, w, h);
+         }
+     }
+   else
+     {
+       if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+           (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+         {
+            /* h is the width of the box */
+            e_gadman_client_resize(itb->gmc, bw, itb->h);
+         }
+       else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP) ||
+                (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM))
+         {
+            /* w is the width of the box */
+            e_gadman_client_resize(itb->gmc, itb->w, bh);
+         }
+     }
+}
+
+static void
+_itray_box_edge_change(ITray_Box *itb, int edge)
+{
+   Evas_Coord bw, bh, tmp;
+   Evas_Object *o;
+   E_Gadman_Policy policy;
+   int changed;
+
+   evas_event_freeze(itb->evas);
+   o = itb->box_object;
+   edje_object_signal_emit(o, "set_orientation", _itray_main_orientation[edge]);
+   edje_object_message_signal_process(o);
+
+   if (itb->overlay_object)
+     {
+       o = itb->overlay_object;
+       edje_object_signal_emit(o, "set_orientation", _itray_main_orientation[edge]);
+       edje_object_message_signal_process(o);
+     }
+
+   e_box_freeze(itb->item_object);
+
+   itb->align_req = 0.5;
+   itb->align = 0.5;
+   e_box_align_set(itb->item_object, 0.5, 0.5);
+
+   policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+   if ((edge == E_GADMAN_EDGE_BOTTOM) ||
+       (edge == E_GADMAN_EDGE_TOP))
+     {
+       changed = (e_box_orientation_get(itb->item_object) != 1);
+       if (changed)
+         {
+            e_box_orientation_set(itb->item_object, 1);
+            if (itb->itray->conf->width == ITRAY_WIDTH_FIXED)
+              policy |= E_GADMAN_POLICY_HSIZE;
+            e_gadman_client_policy_set(itb->gmc, policy);
+            tmp = itb->w;
+            itb->w = itb->h;
+            itb->h = tmp;
+         }
+     }
+   else if ((edge == E_GADMAN_EDGE_LEFT) ||
+           (edge == E_GADMAN_EDGE_RIGHT))
+     {
+       changed = (e_box_orientation_get(itb->item_object) != 0);
+       if (changed)
+         {
+            e_box_orientation_set(itb->item_object, 0);
+            if (itb->itray->conf->width == ITRAY_WIDTH_FIXED)
+              policy |= E_GADMAN_POLICY_VSIZE;
+            e_gadman_client_policy_set(itb->gmc, policy);
+            tmp = itb->w;
+            itb->w = itb->h;
+            itb->h = tmp;
+         }
+     }
+
+   e_box_thaw(itb->item_object);
+   evas_event_thaw(itb->evas);
+
+   _itray_box_frame_resize(itb);
+}
+
+static void
+_itray_box_update_policy(ITray_Box *itb)
+{
+   E_Gadman_Policy policy;
+
+   policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+   if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
+       (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP))
+     {
+       if (itb->itray->conf->width == ITRAY_WIDTH_FIXED)
+         policy |= E_GADMAN_POLICY_HSIZE;
+       e_gadman_client_policy_set(itb->gmc, policy);
+     }
+   else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+           (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+     {
+       if (itb->itray->conf->width == ITRAY_WIDTH_FIXED)
+         policy |= E_GADMAN_POLICY_VSIZE;
+       e_gadman_client_policy_set(itb->gmc, policy);
+     }
+}
+
+static void
+_itray_box_motion_handle(ITray_Box *itb, Evas_Coord mx, Evas_Coord my)
+{
+   Evas_Coord x, y, w, h;
+   double relx, rely;
+
+   evas_object_geometry_get(itb->item_object, &x, &y, &w, &h);
+   if (w > 0) relx = (double)(mx - x) / (double)w;
+   else relx = 0.0;
+   if (h > 0) rely = (double)(my - y) / (double)h;
+   else rely = 0.0;
+   if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
+       (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP))
+     {
+       itb->align_req = 1.0 - relx;
+       itb->follow_req = relx;
+     }
+   else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+           (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+     {
+       itb->align_req = 1.0 - rely;
+       itb->follow_req = rely;
+     }
+}
+
+static void
+_itray_box_timer_handle(ITray_Box *itb)
+{
+   if (!itb->timer)
+     itb->timer = ecore_timer_add(0.01, _itray_box_cb_timer, itb);
+   if (!itb->animator)
+     itb->animator = ecore_animator_add(_itray_box_cb_animator, itb);
+}
+
+static void
+_itray_box_follower_reset(ITray_Box *itb)
+{
+   Evas_Coord ww, hh, bx, by, bw, bh, d1, d2, mw, mh;
+
+   if (!itb->overlay_object) return;
+
+   evas_output_viewport_get(itb->evas, NULL, NULL, &ww, &hh);
+   evas_object_geometry_get(itb->item_object, &bx, &by, &bw, &bh);
+   edje_object_size_min_get(itb->overlay_object, &mw, &mh);
+   if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
+       (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP))
+     {
+       d1 = bx;
+       d2 = ww - (bx + bw);
+       if (bw > 0)
+         {
+            if (d1 < d2)
+              itb->follow_req = -((double)(d1 + (mw * 4)) / (double)bw);
+            else
+              itb->follow_req = 1.0 + ((double)(d2 + (mw * 4)) / (double)bw);
+         }
+     }
+   else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+           (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+     {
+       d1 = by;
+       d2 = hh - (by + bh);
+       if (bh > 0)
+         {
+            if (d1 < d2)
+              itb->follow_req = -((double)(d1 + (mh * 4)) / (double)bh);
+            else
+              itb->follow_req = 1.0 + ((double)(d2 + (mh * 4)) / (double)bh);
+         }
+     }
+}
+
+static void
+_itray_box_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Mouse_In *ev;
+   ITray_Box *itb;
+
+   ev = event_info;
+   itb = data;
+   if (itb->overlay_object)
+     edje_object_signal_emit(itb->overlay_object, "active", "");
+   _itray_box_motion_handle(itb, ev->canvas.x, ev->canvas.y);
+   _itray_box_timer_handle(itb);
+}
+
+static void
+_itray_box_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Mouse_Out *ev;
+   ITray_Box *itb;
+
+   ev = event_info;
+   itb = data;
+   if (itb->overlay_object)
+     edje_object_signal_emit(itb->overlay_object, "passive", "");
+   _itray_box_follower_reset(itb);
+   _itray_box_timer_handle(itb);
+}
+
+static void
+_itray_box_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Mouse_Down *ev;
+   ITray_Box *itb;
+
+   ev = event_info;
+   itb = data;
+   if (ev->button == 3)
+     {
+       e_menu_activate_mouse(itb->menu, e_zone_current_get(itb->con),
+                             ev->output.x, ev->output.y, 1, 1,
+                             E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
+       e_util_container_fake_mouse_up_later(itb->con, 3);
+     }
+}
+
+static void
+_itray_box_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Mouse_Up *ev;
+   ITray_Box *itb;
+
+   ev = event_info;
+   itb = data;
+}
+
+static void
+_itray_box_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Mouse_Move *ev;
+   ITray_Box *itb;
+
+   ev = event_info;
+   itb = data;
+   _itray_box_motion_handle(itb, ev->cur.canvas.x, ev->cur.canvas.y);
+   _itray_box_timer_handle(itb);
+}
+
+static int
+_itray_box_cb_timer(void *data)
+{
+   ITray_Box *itb;
+   double dif, dif2;
+   double v;
+
+   itb = data;
+   v = itb->itray->conf->autoscroll_speed;
+   itb->align = (itb->align_req * (1.0 - v)) + (itb->align * v);
+   v = itb->itray->conf->follow_speed;
+   itb->follow = (itb->follow_req * (1.0 - v)) + (itb->follow * v);
+
+   dif = itb->align - itb->align_req;
+   if (dif < 0) dif = -dif;
+   if (dif < 0.001) itb->align = itb->align_req;
+
+   dif2 = itb->follow - itb->follow_req;
+   if (dif2 < 0) dif2 = -dif2;
+   if (dif2 < 0.001) itb->follow = itb->follow_req;
+
+   if ((dif < 0.001) && (dif2 < 0.001))
+     {
+       itb->timer = NULL;
+       return 0;
+     }
+   return 1;
+}
+
+static int
+_itray_box_cb_animator(void *data)
+{
+   ITray_Box *itb;
+   Evas_Coord x, y, w, h, mw, mh;
+
+   itb = data;
+
+   if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
+       (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP))
+     {
+        e_box_min_size_get(itb->item_object, &mw, &mh);
+       evas_object_geometry_get(itb->item_object, NULL, NULL, &w, &h);
+       if (mw > w)
+         e_box_align_set(itb->item_object, itb->align, 0.5);
+       else
+         e_box_align_set(itb->item_object, 0.5, 0.5);
+
+       if (itb->overlay_object)
+         {
+            evas_object_geometry_get(itb->item_object, &x, &y, &w, &h);
+            edje_object_size_min_get(itb->overlay_object, &mw, &mh);
+            evas_object_resize(itb->overlay_object, mw, h);
+            evas_object_move(itb->overlay_object, x + (w * itb->follow) - (mw / 2), y);
+         }
+     }
+   else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+           (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+     {
+        e_box_min_size_get(itb->item_object, &mw, &mh);
+       evas_object_geometry_get(itb->item_object, NULL, NULL, &w, &h);
+       if (mh > h)
+         e_box_align_set(itb->item_object, 0.5, itb->align);
+       else
+         e_box_align_set(itb->item_object, 0.5, 0.5);
+
+       if (itb->overlay_object)
+         {
+            evas_object_geometry_get(itb->item_object, &x, &y, &w, &h);
+            edje_object_size_min_get(itb->overlay_object, &mw, &mh);
+            evas_object_resize(itb->overlay_object, w, mh);
+            evas_object_move(itb->overlay_object, x, y + (h * itb->follow) - (mh / 2));
+         }
+     }
+   if (itb->timer) return 1;
+   itb->animator = NULL;
+   return 0;
+}
+
+static void
+_itray_box_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change)
+{
+   ITray_Box *itb;
+
+   itb = data;
+   switch (change)
+     {
+      case E_GADMAN_CHANGE_MOVE_RESIZE:
+       e_gadman_client_geometry_get(itb->gmc, &itb->x, &itb->y, &itb->w, &itb->h);
+
+       edje_extern_object_min_size_set(itb->item_object, 0, 0);
+       edje_object_part_swallow(itb->box_object, "tray", itb->item_object);
+
+       evas_object_move(itb->box_object, itb->x, itb->y);
+       evas_object_resize(itb->box_object, itb->w, itb->h);
+
+       _itray_box_follower_reset(itb);
+       _itray_box_timer_handle(itb);
+
+       break;
+      case E_GADMAN_CHANGE_EDGE:
+       _itray_box_edge_change(itb, e_gadman_client_edge_get(itb->gmc));
+       break;
+      case E_GADMAN_CHANGE_RAISE:
+      case E_GADMAN_CHANGE_ZONE:
+        /* Ignore */
+       break;
+     }
+}
+
+static void
+_itray_box_cb_width_auto(void *data)
+{
+   ITray          *it;
+   ITray_Box      *itb;
+   Evas_List     *l;
+
+   it = (ITray *)data;
+   for (l = it->boxes; l; l = l->next)
+     {
+       itb = l->data;
+       _itray_box_update_policy(itb);
+       _itray_box_frame_resize(itb);
+     }
+}
+
+static void
+_itray_box_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   ITray_Box *itb;
+
+   itb = data;
+   e_gadman_mode_set(itb->gmc->gadman, E_GADMAN_MODE_EDIT);
+}
+
+static void
+_itray_box_cb_follower(void *data)
+{
+   ITray          *it;
+   ITray_Box      *itb;
+   unsigned char  enabled;
+   Evas_List     *l;
+
+   it = (ITray *)data;
+   enabled = it->conf->follower;
+   if (enabled)
+     {
+       for (l = it->boxes; l; l = l->next)
+         {
+            Evas_Object *o;
+
+            itb = l->data;
+            if (itb->overlay_object) continue;
+            o = edje_object_add(itb->evas);
+            itb->overlay_object = o;
+            evas_object_layer_set(o, 1);
+            e_theme_edje_object_set(o, "base/theme/modules/itray",
+                                    "modules/itray/follower");
+            edje_object_signal_emit(o, "set_orientation", _itray_main_orientation[e_gadman_client_edge_get(itb->gmc)]);
+            edje_object_message_signal_process(o);
+            evas_object_show(o);
+         }
+     }
+   else if (!enabled)
+     {
+       for (l = it->boxes; l; l = l->next)
+         {
+            itb = l->data;
+            if (!itb->overlay_object) continue;
+            evas_object_del(itb->overlay_object);
+            itb->overlay_object = NULL;
+         }
+     }
+}
+
+void
+_itray_box_cb_config_updated(void *data)
+{
+   /* Call Any Needed Funcs To Let Module Handle Config Changes */
+   _itray_box_cb_follower(data);
+   _itray_box_cb_width_auto(data);
+}
+
+void
+_itray_tray_init(ITray_Box *itb)
+{
+   Evas_Coord x, y, w, h;
+
+   /* FIXME - temp */
+   itb->tray = malloc(sizeof(ITray_Tray));
+   itb->tray->icons = 0;
+   itb->tray->w = 1;
+   itb->tray->h = 1;
+   itb->tray->wins = NULL;
+
+   evas_object_resize(itb->item_object, itb->tray->w, itb->tray->h);
+   evas_object_color_set(itb->item_object, 180, 0, 0, 0);
+   evas_object_intercept_move_callback_add(itb->item_object, _itray_tray_cb_move, itb);
+   evas_object_intercept_resize_callback_add(itb->item_object, _itray_tray_cb_resize, itb);
+
+   _itray_tray_active_set(itb, 1);
+
+   evas_object_geometry_get(itb->item_object, &x, &y, &w, &h);
+   itb->tray->win = ecore_x_window_new(itb->con->bg_win, x, y, w, h);
+   ecore_x_window_container_manage(itb->tray->win);
+   ecore_x_window_background_color_set(itb->tray->win, 255, 255, 255);
+
+   itb->tray->msg_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _itray_tray_cb_msg, itb);
+   itb->tray->dst_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _itray_tray_cb_msg, itb);
+}
+
+void
+_itray_tray_shutdown(ITray_Box *itb)
+{
+   _itray_tray_active_set(itb, 0);
+
+   evas_list_free(itb->tray->wins);
+   evas_object_del(itb->item_object);
+
+   ecore_event_handler_del(itb->tray->msg_handler);
+   ecore_event_handler_del(itb->tray->dst_handler);
+   ecore_x_window_del(itb->tray->win);
+}
+
+static void
+_itray_tray_active_set(ITray_Box *itb, int active)
+{
+   Ecore_X_Window win;
+   Display *display;
+   Window root;
+   char buf[32];
+   Atom selection_atom;
+
+   win = 0;
+   if (active)
+     win = itb->con->bg_win;
+
+   display = ecore_x_display_get();
+   root = RootWindow (display, DefaultScreen(display));
+
+   snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", DefaultScreen(display));
+   selection_atom = ecore_x_atom_get(buf);
+   XSetSelectionOwner (display, selection_atom, win, CurrentTime);
+
+   if (active &&
+        XGetSelectionOwner (display, selection_atom) == itb->con->bg_win)
+     {
+       ecore_x_client_message32_send(root, ecore_x_atom_get("MANAGER"),
+             ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+             CurrentTime, selection_atom, win, 0, 0);
+     }
+}
+
+static void
+_itray_tray_add(ITray_Box *itb, Ecore_X_Window win) 
+{
+   if (evas_list_find(itb->tray->wins, (void *)win))
+     return;
+   ecore_x_window_show(itb->tray->win);
+   evas_object_show(itb->item_object);
+
+   /* FIXME: need a way to register managed windows so the
+    * managers default configure request handler doesnt do anything
+    */
+   /* we want to insert at the end, so as not to move all icons on each add */
+   itb->tray->wins = evas_list_append(itb->tray->wins, (void *)win);
+   itb->tray->icons++;
+   ecore_x_window_client_manage(win);
+   ecore_x_window_resize(win, TRAY_ICON_SIZE, TRAY_ICON_SIZE);
+
+   ecore_x_window_reparent(win, itb->tray->win, 0, 0);
+   _itray_tray_layout(itb);
+   _itray_box_frame_resize(itb);
+
+   ecore_x_window_show(win);
+
+}
+
+static void
+_itray_tray_remove(ITray_Box *itb, Ecore_X_Window win)
+{
+
+   if (!win)
+     return;
+   if (!evas_list_find(itb->tray->wins, (void *)win)) /* if was not found */
+     return;
+
+   itb->tray->wins = evas_list_remove(itb->tray->wins, (void *)win);
+   itb->tray->icons--;
+   _itray_tray_layout(itb);
+   _itray_box_frame_resize(itb);
+   if (itb->tray->icons == 0) 
+     {
+       ecore_x_window_hide(itb->tray->win);
+       evas_object_show(itb->item_object);
+     }
+}
+
+static int
+_itray_tray_cb_msg(void *data, int type, void *event)
+{
+   Ecore_X_Event_Client_Message *ev;
+   Ecore_X_Event_Window_Destroy *dst;
+   ITray_Box *itb;
+
+   itb = data;
+   if (type == ECORE_X_EVENT_CLIENT_MESSAGE) {
+       ev = event;
+       if (ev->message_type == ecore_x_atom_get("_NET_SYSTEM_TRAY_OPCODE")) {
+            _itray_tray_add(itb, (Ecore_X_Window) ev->data.l[2]);
+
+            /* Should proto be set according to clients _XEMBED_INFO? */
+            ecore_x_client_message32_send(
+                  ev->data.l[2], 
+                  ecore_x_atom_get("_XEMBED"),
+                  ECORE_X_EVENT_MASK_NONE, CurrentTime,
+                  XEMBED_EMBEDDED_NOTIFY, 0, itb->con->bg_win, /*proto*/1);
+
+       } else if (ev->message_type == ecore_x_atom_get("_NET_SYSTEM_TRAY_MESSAGE_DATA")) {
+            printf("got message\n");
+       } 
+   } else if (type == ECORE_X_EVENT_WINDOW_DESTROY) {
+       dst = event;
+       _itray_tray_remove(itb, (Ecore_X_Window) dst->win);
+   } 
+
+   return 1;
+
+}
+
+static void
+_itray_tray_cb_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y)
+{
+   ITray_Box *itb;
+
+   itb = data;
+   evas_object_move(o, x, y);
+   evas_object_move(itb->event_object, x, y);
+   ecore_x_window_move(itb->tray->win, (int) x, (int) y);
+}
+
+static void
+_itray_tray_cb_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h)
+{
+   ITray_Box *itb;
+
+   itb = data;
+   evas_object_resize(o, w, h);
+   evas_object_resize(itb->event_object, w, h);
+
+   _itray_tray_layout(itb);
+   _itray_box_frame_resize(itb);
+}
+
+static void
+_itray_tray_layout(ITray_Box *itb)
+{
+   Evas_Coord w, h, c, d;
+   int x, y;
+   Evas_List *wins;
+   E_Gadman_Edge edge;
+
+   if (!itb->gmc) return;
+   edge = e_gadman_client_edge_get(itb->gmc); 
+   h = itb->itray->conf->rowsize * TRAY_ICON_SIZE;
+   if (h < TRAY_ICON_SIZE)
+     h = TRAY_ICON_SIZE;
+   c = (h - (h % TRAY_ICON_SIZE)) / TRAY_ICON_SIZE;
+   if (itb->tray->icons > 0 && itb->tray->icons < c + 1)
+     {
+       c = itb->tray->icons;
+       h = c * TRAY_ICON_SIZE;
+     }
+   w = ((itb->tray->icons + (itb->tray->icons % c)) / c) * TRAY_ICON_SIZE;
+
+   if (edge == E_GADMAN_EDGE_BOTTOM || edge == E_GADMAN_EDGE_TOP) {
+       edje_object_part_unswallow(itb->box_object, itb->item_object);
+       evas_object_resize(itb->item_object, w, h);
+       ecore_x_window_resize(itb->tray->win, (int) w, (int) h);
+
+       edje_extern_object_min_size_set(itb->item_object, w, h);
+       edje_extern_object_max_size_set(itb->item_object, w, h);
+       edje_object_part_swallow(itb->box_object, "tray", itb->item_object);
+   } else {
+       edje_object_part_unswallow(itb->box_object, itb->item_object);
+       evas_object_resize(itb->item_object, h, w);
+       ecore_x_window_resize(itb->tray->win, (int) h, (int) w);
+
+       edje_extern_object_min_size_set(itb->item_object, w, h);
+       edje_extern_object_max_size_set(itb->item_object, w, h);
+       edje_object_part_swallow(itb->box_object, "tray", itb->item_object);
+   }
+
+   x = 0;
+   if (edge == E_GADMAN_EDGE_BOTTOM || edge == E_GADMAN_EDGE_RIGHT)
+     y = h - TRAY_ICON_SIZE;
+   else
+     y = 0;
+   d = 0;
+   for (wins = itb->tray->wins; wins; wins = wins->next) {
+       if (edge == E_GADMAN_EDGE_BOTTOM || edge == E_GADMAN_EDGE_TOP)
+         ecore_x_window_move((Ecore_X_Window) wins->data, x, y);
+       else
+         ecore_x_window_move((Ecore_X_Window) wins->data, y, x);
+
+       d++;
+       if (d % c == 0) {
+            x += TRAY_ICON_SIZE;
+            if (edge == E_GADMAN_EDGE_BOTTOM || edge == E_GADMAN_EDGE_RIGHT)
+              y = h - TRAY_ICON_SIZE;
+            else
+              y = 0;
+       } else
+         if (edge == E_GADMAN_EDGE_BOTTOM || edge == E_GADMAN_EDGE_RIGHT)
+           y -= TRAY_ICON_SIZE;
+         else
+           y += TRAY_ICON_SIZE;
+   }
+   itb->tray->rows = c;
+}
diff --git a/src/modules/itray/e_mod_main.h b/src/modules/itray/e_mod_main.h
new file mode 100644 (file)
index 0000000..0055872
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#ifndef E_MOD_MAIN_H
+#define E_MOD_MAIN_H
+
+typedef struct _Config      Config;
+typedef struct _Config_Box  Config_Box;
+typedef struct _ITray        ITray;
+typedef struct _ITray_Box    ITray_Box;
+typedef struct _ITray_Tray   ITray_Tray;
+
+#define ITRAY_WIDTH_AUTO -1
+#define ITRAY_WIDTH_FIXED -2
+
+struct _Config
+{
+   double        follow_speed;
+   int           follower;
+   double        autoscroll_speed;
+   int           rowsize;
+   int           width;
+   Evas_List    *boxes;
+   int           allow_overlap;
+};
+
+struct _Config_Box
+{
+   unsigned char enabled;
+};
+
+struct _ITray
+{
+   Evas_List   *boxes;
+   E_Menu      *config_menu;
+   
+   Config      *conf;
+   E_Config_Dialog *config_dialog;
+};
+
+struct _ITray_Box
+{
+   ITray        *itray;
+   E_Container *con;
+   Evas        *evas;
+   E_Menu      *menu;
+   
+   Evas_Object *box_object;
+   Evas_Object *overlay_object;
+   Evas_Object *item_object;
+   Evas_Object *event_object;
+   
+   double          align, align_req;
+   double          follow, follow_req;
+   Ecore_Timer    *timer;
+   Ecore_Animator *animator;
+   
+   Evas_Coord      x, y, w, h;
+   struct {
+       Evas_Coord l, r, t, b;
+   } box_inset;
+
+   E_Gadman_Client *gmc;
+
+   ITray_Tray    *tray;
+   Config_Box     *conf;
+};
+
+struct _ITray_Tray
+{
+   int                 w, h;
+   int                 icons, rows;
+   Evas_List           *wins;
+   Ecore_X_Window      win;
+
+   Ecore_Event_Handler *msg_handler;
+   Ecore_Event_Handler *dst_handler;
+};
+
+EAPI extern E_Module_Api e_modapi;
+
+EAPI void *e_modapi_init     (E_Module *m);
+EAPI int   e_modapi_shutdown (E_Module *m);
+EAPI int   e_modapi_save     (E_Module *m);
+EAPI int   e_modapi_info     (E_Module *m);
+EAPI int   e_modapi_about    (E_Module *m);
+EAPI int   e_modapi_config   (E_Module *m);
+
+void _itray_box_cb_config_updated(void *data);
+
+#endif
diff --git a/src/modules/itray/module_icon.png b/src/modules/itray/module_icon.png
new file mode 100644 (file)
index 0000000..7365900
Binary files /dev/null and b/src/modules/itray/module_icon.png differ
index 99b5625..6879ae8 100644 (file)
@@ -11,6 +11,7 @@ struct _E_Config_Dialog_Data
    int name_pos;
    int show_popup;
    double popup_speed;
+   int allow_overlap;
 };
 
 struct _Cfg_File_Data 
@@ -61,6 +62,7 @@ _fill_data(Pager *p, E_Config_Dialog_Data *cfdata)
    
    cfdata->show_popup = p->conf->popup;
    cfdata->popup_speed = p->conf->popup_speed;
+   cfdata->allow_overlap = p->conf->allow_overlap;
 }
 
 static void *
@@ -108,6 +110,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
    e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
 
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+
    /* Not Supported Yet ??
    ob = e_widget_radio_add(evas, _("Left"), PAGER_DESKNAME_LEFT, rg);
    e_widget_framelist_object_append(of, ob);
@@ -130,6 +137,11 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
    p->conf->deskname_pos = cfdata->name_pos;
    if (!cfdata->show_name) p->conf->deskname_pos = PAGER_DESKNAME_NONE;
    
+   if (cfdata->allow_overlap && !p->conf->allow_overlap)
+     p->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && p->conf->allow_overlap)
+     p->conf->allow_overlap = 0;
+
    e_border_button_bindings_grab_all();
    e_config_save_queue();
    
@@ -176,6 +188,12 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
    ob = e_widget_slider_add(evas, 1, 0, _("%1.1f seconds"), 0.1, 10.0, 0.1, 0, &(cfdata->popup_speed), NULL, 200);
    e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);   
+
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+
    return o;
 }
 
@@ -192,6 +210,11 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
    if (!cfdata->show_name) p->conf->deskname_pos = PAGER_DESKNAME_NONE;
    p->conf->popup_speed = cfdata->popup_speed;
    
+   if (cfdata->allow_overlap && !p->conf->allow_overlap)
+     p->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && p->conf->allow_overlap)
+     p->conf->allow_overlap = 0;
+
    e_border_button_bindings_grab_all();
    e_config_save_queue();
 
index a1021d0..731453c 100644 (file)
@@ -85,6 +85,8 @@ static void        _pager_menu_cb_aspect_keep_height(void *data, E_Menu *m, E_Me
 static void        _pager_menu_cb_aspect_keep_width(void *data, E_Menu *m, E_Menu_Item *mi);
 static void        _pager_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi);
 
+static void       _pager_cb_update_policy(void *data);
+
 static int         _pager_count;
 
 static E_Config_DD *_conf_edd;
@@ -223,6 +225,7 @@ _pager_new(void)
    E_CONFIG_VAL(D, T, deskname_pos, UINT);
    E_CONFIG_VAL(D, T, popup_speed, DOUBLE);
    E_CONFIG_VAL(D, T, popup, UINT);
+   E_CONFIG_VAL(D, T, allow_overlap, INT);
 
    pager->conf = e_config_domain_load("module.pager", _conf_edd);
 
@@ -232,10 +235,12 @@ _pager_new(void)
        pager->conf->deskname_pos = PAGER_DESKNAME_NONE;
        pager->conf->popup_speed = 1.0;
        pager->conf->popup = 1;
+       pager->conf->allow_overlap = 0;
      }
    E_CONFIG_LIMIT(pager->conf->deskname_pos, PAGER_DESKNAME_NONE, PAGER_DESKNAME_RIGHT);
    E_CONFIG_LIMIT(pager->conf->popup_speed, 0.1, 10.0);
    E_CONFIG_LIMIT(pager->conf->popup, 0, 1);
+   E_CONFIG_LIMIT(pager->conf->allow_overlap, 0, 1);
 
    _pager_config_menu_new(pager);
 
@@ -424,6 +429,7 @@ _pager_face_new(Pager *pager, E_Zone *zone, Evas *evas, int use_gmc)
    Evas_Coord   x, y, w, h;
    double       aspect;
    const char  *drop[] = { "enlightenment/border", "enlightenment/pager_win" };
+   E_Gadman_Policy  policy;
 
    face = E_NEW(Pager_Face, 1);
    if (!face) return NULL;
@@ -471,13 +477,21 @@ _pager_face_new(Pager *pager, E_Zone *zone, Evas *evas, int use_gmc)
 
    e_gadman_client_domain_set(face->gmc, "module.pager", _pager_count++);
    e_gadman_client_zone_set(face->gmc, face->zone);
-   e_gadman_client_policy_set(face->gmc,
-//                           E_GADMAN_POLICY_FIXED_ZONE |
-                             E_GADMAN_POLICY_ANYWHERE |
-                             E_GADMAN_POLICY_HMOVE |
-                             E_GADMAN_POLICY_VMOVE |
-                             E_GADMAN_POLICY_HSIZE |
-                             E_GADMAN_POLICY_VSIZE);
+
+   policy = E_GADMAN_POLICY_ANYWHERE |
+           E_GADMAN_POLICY_HMOVE |
+           E_GADMAN_POLICY_VMOVE |
+           E_GADMAN_POLICY_HSIZE |
+  //                         E_GADMAN_POLICY_FIXED_ZONE |
+           E_GADMAN_POLICY_VSIZE;
+
+   if (pager->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+   e_gadman_client_policy_set(face->gmc, policy);
+
    e_gadman_client_min_size_set(face->gmc, 8, 8);
    e_gadman_client_max_size_set(face->gmc, 600, 600);
    e_gadman_client_auto_size_set(face->gmc,
@@ -2139,6 +2153,7 @@ _pager_cb_config_updated(void *data)
 
    /* Handle Desktop Name Position Change */
    pager = data;
+   _pager_cb_update_policy(pager);
    for (l = pager->faces; l; l = l->next)
      {
        Pager_Face *face;
@@ -2147,3 +2162,24 @@ _pager_cb_config_updated(void *data)
        _pager_face_deskname_position_change(face);
      }   
 }
+static void _pager_cb_update_policy(void *data)
+{
+  Pager     *pg;
+  Pager_Face *pf;
+  Evas_List   *l;
+  E_Gadman_Policy policy;
+
+  pg = data;
+  for (l = pg->faces; l; l = l->next)
+    {
+      pf = l->data;
+      policy = pf->gmc->policy;
+
+      if (pg->conf->allow_overlap == 0)
+       policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+      else
+       policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+      e_gadman_client_policy_set(pf->gmc , policy);
+    }
+}
+
index a2fae8e..57b80b6 100644 (file)
@@ -32,6 +32,8 @@ struct _Config
    double popup_speed;
    /* Show popup? */
    unsigned int popup;
+
+   int allow_overlap;
 };
 
 struct _Config_Face
index fc4a7f5..bf2df50 100644 (file)
@@ -20,7 +20,9 @@ INCLUDES               = -I. \
 pkgdir                 = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
 pkg_LTLIBRARIES        = module.la
 module_la_SOURCES      = e_mod_main.c \
-                         e_mod_main.h
+                         e_mod_main.h \
+                        e_mod_config.c \
+                        e_mod_config.h
 module_la_LIBADD       = @e_libs@ @dlopen_libs@
 module_la_LDFLAGS      = -module -avoid-version
 module_la_DEPENDENCIES = $(top_builddir)/config.h
diff --git a/src/modules/start/e_mod_config.c b/src/modules/start/e_mod_config.c
new file mode 100644 (file)
index 0000000..50d8f87
--- /dev/null
@@ -0,0 +1,102 @@
+#include "e.h"
+#include "e_mod_main.h"
+#include "config.h"
+
+typedef struct _cfdata CFData;
+typedef struct _Cfg_File_Data Cfg_File_Data;
+
+struct _cfdata 
+{
+   int allow_overlap;
+};
+
+struct _Cfg_File_Data 
+{
+   E_Config_Dialog *cfd;
+   char *file;
+};
+
+/* Protos */
+static Evas_Object *_create_widgets(E_Config_Dialog *cfd, Evas *evas, Config *cfdata);
+static void *_create_data(E_Config_Dialog *cfd);
+static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
+static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
+static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
+
+void 
+_config_start_module(E_Container *con, Start *start)
+{
+   E_Config_Dialog *cfd;
+   E_Config_Dialog_View v;
+   
+   v.create_cfdata = _create_data;
+   v.free_cfdata = _free_data;
+   v.basic.apply_cfdata = _basic_apply_data;
+   v.basic.create_widgets = _basic_create_widgets;
+   v.advanced.apply_cfdata = NULL;
+   v.advanced.create_widgets = NULL;
+   
+   cfd = e_config_dialog_new(con, _("Start Module Configuration"), NULL, 0, &v, start);
+}
+
+static void 
+_fill_data(Start *s, CFData *cfdata) 
+{
+   cfdata->allow_overlap = s->conf->allow_overlap;
+}
+
+static void 
+*_create_data(E_Config_Dialog *cfd) 
+{
+   CFData *cfdata;
+   Start  *s;
+   
+   s = cfd->data;
+   cfdata = E_NEW(CFData, 1);
+   _fill_data(s, cfdata);
+   return cfdata;
+}
+
+static void 
+_free_data(E_Config_Dialog *cfd, CFData *cfdata) 
+{
+   free(cfdata);
+}
+
+static Evas_Object 
+*_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
+{
+   Evas_Object *o, *of, *ob;
+   Start *s;
+   
+   s = cfd->data;
+   _fill_data(s, cfdata);
+   
+   o = e_widget_list_add(evas, 0, 0);
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+   
+   return o;
+}
+
+static int 
+_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
+{
+   Start *s;
+   
+   s = cfd->data;
+   e_border_button_bindings_ungrab_all();
+
+   if (cfdata->allow_overlap && !s->conf->allow_overlap)
+     s->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && s->conf->allow_overlap)
+     s->conf->allow_overlap = 0;
+   
+   e_border_button_bindings_grab_all();
+   e_config_save_queue();
+   
+   _start_cb_config_updated(s);
+   return 1;
+}
diff --git a/src/modules/start/e_mod_config.h b/src/modules/start/e_mod_config.h
new file mode 100644 (file)
index 0000000..7106d7c
--- /dev/null
@@ -0,0 +1,8 @@
+#ifdef E_TYPEDEFS
+#else
+#ifndef E_MOD_CONFIG_H
+#define E_MOD_CONFIG_H
+#include "e_mod_main.h"
+EAPI void _config_start_module(E_Container *con, Start *start);
+#endif
+#endif
index b2af0af..476ccc1 100644 (file)
@@ -6,7 +6,7 @@
 #include "e_int_menus.h"
 
 static Start *_start_new(void);
-static Start_Face *_start_face_new(E_Container *con);
+static Start_Face *_start_face_new(Start *s, E_Container *con);
 static void _start_free(Start *e);
 static void _start_face_free(Start_Face *face);
 static void _start_face_disable(Start_Face *e);
@@ -17,6 +17,9 @@ static void _start_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman
 static void _start_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _start_menu_cb_post_deactivate(void *data, E_Menu *m);
 
+static void _start_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _start_cb_update_policy(void *data);
+
 static int button_count;
 static E_Config_DD *conf_edd;
 static E_Config_DD *conf_face_edd;
@@ -79,6 +82,21 @@ e_modapi_about(E_Module *m)
    return 1;
 }
 
+int
+e_modapi_config(E_Module *m)
+{
+  Start *s;
+  Start_Face *face;
+
+  s = m->data;
+  if (s == NULL) return 0;
+  if (s->faces == NULL) return 0;
+  face = s->faces->data;
+  if (face == NULL) return 0;
+  _config_start_module(e_container_current_get(e_manager_current_get()), s);
+  return 1;
+}
+
 static Start *
 _start_new(void)
 {
@@ -103,9 +121,15 @@ _start_new(void)
 #define T Config
 #define D conf_edd
    E_CONFIG_LIST(D, T, faces, conf_face_edd);
+   E_CONFIG_VAL(D, T, allow_overlap, INT);
    
    e->conf = e_config_domain_load("module.start", conf_edd);
-   if (!e->conf) e->conf = E_NEW(Config, 1);
+   if (!e->conf)
+     {
+       e->conf = E_NEW(Config, 1);
+       e->conf->allow_overlap = 0;
+     }
+   E_CONFIG_LIMIT(e->conf->allow_overlap, 0, 1);
    
    _start_config_menu_new(e);
    
@@ -122,9 +146,10 @@ _start_new(void)
             Start_Face *face;
             
             con = l2->data;
-            face = _start_face_new(con);
+            face = _start_face_new(e, con);
             if (face)
               {
+                 face->start = e;
                  e->faces = evas_list_append(e->faces, face);
                  /* Config */
                  if (!cl)
@@ -142,6 +167,10 @@ _start_new(void)
                  /* Menu */
                  /* This menu must be initialized after conf */
                  _start_face_menu_new(face);
+
+                 mi = e_menu_item_new(e->config_menu);
+                 e_menu_item_label_set(mi, _("Configuration"));
+                 e_menu_item_callback_set(mi, _start_face_cb_menu_configure, face);
                  
                  mi = e_menu_item_new(e->config_menu);
                  e_menu_item_label_set(mi, con->name);
@@ -157,10 +186,11 @@ _start_new(void)
 }
 
 static Start_Face *
-_start_face_new(E_Container *con)
+_start_face_new(Start *s, E_Container *con)
 {
    Start_Face *face;
    Evas_Object *o;
+   E_Gadman_Policy policy;
    
    face = E_NEW(Start_Face, 1);
    if (!face) return NULL;
@@ -186,12 +216,20 @@ _start_face_new(E_Container *con)
    
    face->gmc = e_gadman_client_new(con->gadman);
    e_gadman_client_domain_set(face->gmc, "module.start", button_count++);
-   e_gadman_client_policy_set(face->gmc,
-                             E_GADMAN_POLICY_ANYWHERE |
-                             E_GADMAN_POLICY_HMOVE |
-                             E_GADMAN_POLICY_VMOVE |
-                             E_GADMAN_POLICY_HSIZE |
-                             E_GADMAN_POLICY_VSIZE);
+
+   policy = E_GADMAN_POLICY_ANYWHERE |
+           E_GADMAN_POLICY_HMOVE |
+           E_GADMAN_POLICY_VMOVE |
+           E_GADMAN_POLICY_HSIZE |
+           E_GADMAN_POLICY_VSIZE;
+
+   if (s->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+   e_gadman_client_policy_set(face->gmc, policy);
+
    e_gadman_client_min_size_set(face->gmc, 4, 4);
    e_gadman_client_max_size_set(face->gmc, 512, 512);
    e_gadman_client_auto_size_set(face->gmc, 40, 40);
@@ -226,6 +264,10 @@ _start_face_menu_new(Start_Face *face)
    
    /* Edit */
    mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, _("Configuration"));
+   e_menu_item_callback_set(mi, _start_face_cb_menu_configure, face);
+
+   mi = e_menu_item_new(mn);
    e_menu_item_label_set(mi, _("Edit Mode"));
    e_menu_item_callback_set(mi, _start_face_cb_menu_edit, face);
    
@@ -358,3 +400,39 @@ _start_menu_cb_post_deactivate(void *data, E_Menu *m)
    e_object_del(E_OBJECT(face->main_menu));
    face->main_menu = NULL;
 }
+void _start_cb_config_updated( void *data )
+{
+  _start_cb_update_policy(data);
+}
+
+void
+_start_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   Start_Face *face;
+
+   face = (Start_Face*)data;
+   if (!face) return;
+   _config_start_module(face->con, face->start);
+}
+
+static void _start_cb_update_policy(void *data)
+{
+  Start     *s;
+  Start_Face *sf;
+  Evas_List   *l;
+  E_Gadman_Policy policy;
+
+  s = data;
+  for (l = s->faces; l; l = l->next)
+    {
+      sf = l->data;
+      policy = sf->gmc->policy;
+
+      if (s->conf->allow_overlap == 0)
+        policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+      else
+        policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+      e_gadman_client_policy_set(sf->gmc , policy);
+    }
+}
+
index b4acd80..0fa75d9 100644 (file)
@@ -9,6 +9,7 @@ typedef struct _Start_Face  Start_Face;
 struct _Config
 {
    Evas_List *faces;
+   int      allow_overlap;
 };
 
 struct _Config_Face
@@ -29,6 +30,7 @@ struct _Start_Face
    E_Container *con;
    E_Menu      *menu;
    E_Menu      *main_menu;
+   Start       *start;
    
    Config_Face *conf;
    
@@ -47,4 +49,6 @@ EAPI int   e_modapi_info     (E_Module *m);
 EAPI int   e_modapi_about    (E_Module *m);
 /* EAPI int   e_modapi_config   (E_Module *module); */
 
+EAPI void  _start_cb_config_updated(void *data);
+
 #endif
index d371298..4c17d4f 100644 (file)
@@ -32,6 +32,8 @@ struct _E_Config_Dialog_Data
    int high_method;
    int high_temp;
 
+   int allow_overlap;
+
    int sensor;
 };
 
@@ -146,6 +148,8 @@ _fill_data(Temperature *t, E_Config_Dialog_Data *cfdata)
      {
        cfdata->sensor = 2;
      }
+
+   cfdata->allow_overlap = t->conf->allow_overlap;
 }
 
 static void *
@@ -248,6 +252,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
        e_widget_list_object_append(o, of, 1, 1, 0.5);
      }
 
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+
    return o;
 }
 
@@ -280,6 +289,11 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
        t->conf->high = cfdata->high_method;
      }
 
+   if (cfdata->allow_overlap && !t->conf->allow_overlap)
+     t->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && t->conf->allow_overlap)
+     t->conf->allow_overlap = 0;
+
    e_border_button_bindings_grab_all();
    e_config_save_queue();
    
@@ -392,6 +406,12 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
        e_widget_framelist_object_append(of, ob);
        e_widget_list_object_append(o, of, 1, 1, 0.5);
      }  
+
+   of = e_widget_framelist_add(evas, _("Extras"), 0);
+   ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+
    return o;
 }
 
@@ -446,6 +466,11 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
        break;
      }
    
+   if (cfdata->allow_overlap && !t->conf->allow_overlap)
+     t->conf->allow_overlap = 1;
+   else if (!cfdata->allow_overlap && t->conf->allow_overlap)
+     t->conf->allow_overlap = 0;
+
    e_border_button_bindings_grab_all();
    e_config_save_queue();
    
index 0d3e01a..0cc4214 100644 (file)
@@ -22,7 +22,7 @@ static void     _temperature_free(Temperature *e);
 static void     _temperature_config_menu_new(Temperature *e);
 static int      _temperature_cb_check(void *data);
 
-static Temperature_Face *_temperature_face_new(E_Container *con);
+static Temperature_Face *_temperature_face_new(Temperature *t, E_Container *con);
 static void     _temperature_face_free(Temperature_Face *ef);
 static void     _temperature_face_enable(Temperature_Face *face);
 static void     _temperature_face_disable(Temperature_Face *face);
@@ -33,6 +33,8 @@ static void     _temperature_face_level_set(Temperature_Face *ef, double level);
 static void     _temperature_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
 static void     _temperature_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
 
+static void    _temperature_cb_update_policy(void *data);
+
 static E_Config_DD *conf_edd;
 static E_Config_DD *conf_face_edd;
 
@@ -160,6 +162,7 @@ _temperature_new()
    E_CONFIG_LIST(D, T, faces, conf_face_edd);
    E_CONFIG_VAL(D, T, sensor_name, STR);
    E_CONFIG_VAL(D, T, units, INT);
+   E_CONFIG_VAL(D, T, allow_overlap, INT);
 
    e->conf = e_config_domain_load("module.temperature", conf_edd);
    if (!e->conf)
@@ -170,11 +173,13 @@ _temperature_new()
        e->conf->high = 80;
        e->conf->sensor_name = "temp1";
        e->conf->units = CELCIUS;
+       e->conf->allow_overlap = 0;
      }
    E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 1000.0);
    E_CONFIG_LIMIT(e->conf->low, 0, 100);
    E_CONFIG_LIMIT(e->conf->high, 0, 220);
    E_CONFIG_LIMIT(e->conf->units, CELCIUS, FAHRENHEIT);
+   E_CONFIG_LIMIT(e->conf->allow_overlap, 0, 1);
 
    _temperature_config_menu_new(e);
    e->have_temp = -1;
@@ -193,7 +198,7 @@ _temperature_new()
             Temperature_Face *ef;
 
             con = l2->data;
-            ef = _temperature_face_new(con);
+            ef = _temperature_face_new(e, con);
             if (ef)
               {
                  ef->temp = e;
@@ -270,10 +275,11 @@ _temperature_config_menu_new(Temperature *e)
 }
 
 static Temperature_Face *
-_temperature_face_new(E_Container *con)
+_temperature_face_new(Temperature *t, E_Container *con)
 {
    Evas_Object *o;
    Temperature_Face *ef;
+   E_Gadman_Policy  policy;
 
    ef = E_NEW(Temperature_Face, 1);
    if (!ef) return NULL;
@@ -299,12 +305,19 @@ _temperature_face_new(E_Container *con)
 
    ef->gmc = e_gadman_client_new(ef->con->gadman);
    e_gadman_client_domain_set(ef->gmc, "module.temperature", temperature_count++);
-   e_gadman_client_policy_set(ef->gmc,
-                             E_GADMAN_POLICY_ANYWHERE |
-                             E_GADMAN_POLICY_HMOVE |
-                             E_GADMAN_POLICY_VMOVE |
-                             E_GADMAN_POLICY_HSIZE |
-                             E_GADMAN_POLICY_VSIZE);
+
+   policy = E_GADMAN_POLICY_ANYWHERE |
+           E_GADMAN_POLICY_HMOVE |
+           E_GADMAN_POLICY_VMOVE |
+           E_GADMAN_POLICY_HSIZE |
+           E_GADMAN_POLICY_VSIZE;
+
+   if (t->conf->allow_overlap == 0)
+     policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+   else
+     policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+   e_gadman_client_policy_set(ef->gmc, policy);
    e_gadman_client_min_size_set(ef->gmc, 4, 4);
    e_gadman_client_max_size_set(ef->gmc, 128, 128);
    e_gadman_client_auto_size_set(ef->gmc, 40, 40);
@@ -623,5 +636,28 @@ _temperature_face_cb_config_updated(Temperature *temp)
    /* Call all funcs needed to handle update */
    ecore_timer_del(temp->temperature_check_timer);
    temp->temperature_check_timer = ecore_timer_add(temp->conf->poll_time, _temperature_cb_check, temp);
+   _temperature_cb_update_policy(temp);
 }
 
+void
+_temperature_cb_update_policy(void *data)
+{
+  Temperature *temp;
+  Temperature_Face *tf;
+  Evas_List *l;
+  E_Gadman_Policy policy;
+
+  temp = data;
+  for (l = temp->faces; l; l = l->next)
+    {
+      tf = l->data;
+      policy = tf->gmc->policy;
+
+      if (temp->conf->allow_overlap == 0)
+       policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+      else
+       policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+      e_gadman_client_policy_set(tf->gmc, policy);
+    }
+}
index 70d7804..f2c45f5 100644 (file)
@@ -22,6 +22,7 @@ struct _Config
    Evas_List *faces;
    char *sensor_name;
    Unit units;
+   int allow_overlap;
 };
 
 struct _Config_Face