Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_int_menus.c e_place.c e_place.h 


Log Message:
Window cleanup function and menu entry.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_menus.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- e_int_menus.c       12 May 2005 13:13:53 -0000      1.58
+++ e_int_menus.c       13 May 2005 04:05:42 -0000      1.59
@@ -29,6 +29,7 @@
 static void _e_int_menus_clients_pre_cb      (void *data, E_Menu *m);
 static void _e_int_menus_clients_free_hook   (void *obj);
 static void _e_int_menus_clients_item_cb     (void *data, E_Menu *m, 
E_Menu_Item *mi);
+static void _e_int_menus_clients_cleanup_cb  (void *data, E_Menu *m, 
E_Menu_Item *mi);
 static void _e_int_menus_desktops_pre_cb     (void *data, E_Menu *m);
 static void _e_int_menus_desktops_item_cb    (void *data, E_Menu *m, 
E_Menu_Item *mi);
 static void _e_int_menus_desktops_row_add_cb (void *data, E_Menu *m, 
E_Menu_Item *mi);
@@ -491,6 +492,12 @@
                                         bd->client.icccm.class);
        if (a) e_menu_item_icon_edje_set(mi, a->path, "icon");
      }
+   mi = e_menu_item_new(m);
+   e_menu_item_label_set(mi, _("Cleanup Windows"));
+   e_menu_item_icon_edje_set(mi,
+                            e_path_find(path_icons, "default.edj"),
+                            "windows");
+   e_menu_item_callback_set(mi, _e_int_menus_clients_cleanup_cb, zone);
    e_object_free_attach_func_set(E_OBJECT(m), _e_int_menus_clients_free_hook);
    e_object_data_set(E_OBJECT(m), borders);
 }
@@ -526,6 +533,14 @@
    e_border_focus_set(bd, 1, 1);
 }
 
+static void 
+_e_int_menus_clients_cleanup_cb(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   E_Zone *zone = data;
+
+   e_place_zone_region_smart_cleanup(zone);
+}
+
 static void
 _e_int_menus_gadgets_pre_cb(void *data, E_Menu *m)
 {
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_place.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- e_place.c   7 Feb 2005 13:51:09 -0000       1.3
+++ e_place.c   13 May 2005 04:05:43 -0000      1.4
@@ -3,6 +3,59 @@
  */
 #include "e.h"
 
+void
+e_place_zone_region_smart_cleanup(E_Zone *zone)
+{
+   E_Desk *desk;
+   Evas_List *l, *borders = NULL;
+
+   E_OBJECT_CHECK(zone);
+   desk = e_desk_current_get(zone);
+   for (l = e_border_clients_get(); l; l = l->next)
+     {
+       E_Border *border;
+
+       border = l->data;
+       /* Build a list of windows on this desktop and not iconified. */
+       if ((border->desk == desk) && !(border->iconic))
+         {
+            int area;
+            Evas_List *ll;
+
+            /* Ordering windows largest to smallest gives better results */
+            area = border->w * border->h;
+            for (ll = borders; ll; ll = ll->next)
+              {
+                 int testarea;
+                 E_Border *bd = ll->data;
+
+                 testarea = bd->w * bd->h;
+                 /* Insert the border if larger than the current border */
+                 if (area >= testarea)
+                   {
+                      borders = evas_list_prepend_relative(borders, border, 
bd);
+                      break;
+                   }
+              }
+            /* Looped over all borders without placing, so place at end */
+            if (!ll) borders = evas_list_append(borders, border);
+         }
+     }
+
+   /* Loop over the borders moving each one using the smart placement */
+   while (borders)
+     {
+       int new_x, new_y;
+       E_Border *border;
+
+       border = borders->data;
+       e_place_zone_region_smart(zone, borders, border->x, border->y,
+                                 border->w, border->h, &new_x, &new_y);
+       e_border_move(border, new_x, new_y);
+       borders = evas_list_remove(borders, border);
+     }
+}
+
 int
 e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int 
w, int h, int *rx, int *ry)
 {
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_place.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_place.h   7 Feb 2005 13:51:09 -0000       1.5
+++ e_place.h   13 May 2005 04:05:43 -0000      1.6
@@ -6,6 +6,7 @@
 #ifndef E_PLACE_H
 #define E_PLACE_H
 
+EAPI void e_place_zone_region_smart_cleanup(E_Zone *zone);
 EAPI int e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, 
int y, int w, int h, int *rx, int *ry);
     
 #endif




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

Reply via email to