Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h arrange.c mod-misc.c settings.c 


Log Message:
Add option to center new windows when desk is full (suggested by George L. 
Yermulnik).

===================================================================
RCS file: /cvs/e/e16/e/src/E.h,v
retrieving revision 1.606
retrieving revision 1.607
diff -u -3 -r1.606 -r1.607
--- E.h 1 Mar 2008 15:25:41 -0000       1.606
+++ E.h 11 Mar 2008 22:03:57 -0000      1.607
@@ -344,13 +344,14 @@
    {
       char                manual;
       char                manual_mouse_pointer;
+      char                center_if_desk_full;
+      char                ignore_struts;
+      char                raise_fullscreen;
       char                slidein;
       char                cleanupslide;
       int                 slidemode;
       int                 slidespeedmap;
       int                 slidespeedcleanup;
-      char                ignore_struts;
-      char                raise_fullscreen;
 #ifdef HAVE_XINERAMA
       char                extra_head;  /* Not used */
 #endif
===================================================================
RCS file: /cvs/e/e16/e/src/arrange.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -3 -r1.103 -r1.104
--- arrange.c   11 Mar 2008 22:00:03 -0000      1.103
+++ arrange.c   11 Mar 2008 22:03:57 -0000      1.104
@@ -39,7 +39,7 @@
 typedef struct
 {
    int                 x, y;
-   int                 p;
+   int                 p, q;
 } RectInfo;
 
 static int
@@ -173,7 +173,7 @@
                 int wx, int wy, int ww, int wh)
 {
    int                 i, j, w, h, fw, fh, z1, z2;
-   int                 cost;
+   int                 cost, desk;
    int                 num_spaces = *ns;
 
    if (wx < xarray[0] || (wx != xarray[0] && wx + ww > xarray[xsize - 1]))
@@ -181,7 +181,7 @@
    if (wy < yarray[0] || (wy != yarray[0] && wy + wh > yarray[ysize - 1]))
       return;
 
-   cost = 0;
+   cost = desk = 0;
    fh = wh;
 #if DEBUG_ARRANGE > 1
    Eprintf("Check-A %d,%d %dx%d\n", wx, wy, ww, wh);
@@ -208,7 +208,10 @@
 #if DEBUG_ARRANGE > 1
             Eprintf("Add [%d,%d] %3dx%3d: %2d\n", i, j, w, h, Filled(i, j));
 #endif
-            cost += w * h * Filled(i, j);
+            if (Filled(i, j) == 0)
+               desk += w * h;
+            else
+               cost += w * h * Filled(i, j);
             fw -= w;
             if (fw <= 0)
                break;
@@ -219,11 +222,13 @@
      }
 
 #if DEBUG_ARRANGE
-   Eprintf("Check %4d,%4d %3dx%3d cost=%d\n", wx, wy, ww, wh, cost);
+   Eprintf("Check %4d,%4d %3dx%3d cost=%d desk=%d\n", wx, wy, ww, wh,
+          cost, desk);
 #endif
    spaces[num_spaces].x = wx;
    spaces[num_spaces].y = wy;
    spaces[num_spaces].p = cost;
+   spaces[num_spaces].q = desk;
    num_spaces++;
    *ns = num_spaces;
 }
@@ -393,17 +398,26 @@
        /* find the first space that fits */
        k = 0;
        sort = 0x7fffffff;      /* NB! Break at 0 == free space */
-       for (j = 0; j < num_spaces && sort; j++)
+       for (j = 0; j < num_spaces; j++)
          {
-            if (spaces[j].p >= sort)
+            a1 = spaces[j].p - spaces[j].q * 4;
+            if (a1 >= sort)
                continue;
-            sort = spaces[j].p;
+            sort = a1;
             k = j;
             if (sort == 0)
                break;
          }
-       sorted[num_sorted].x = spaces[k].x;
-       sorted[num_sorted].y = spaces[k].y;
+       if (spaces[k].q == 0 && Conf.place.center_if_desk_full)
+         {
+            sorted[num_sorted].x = (tx1 + tx2 - floating[i].w) / 2;
+            sorted[num_sorted].y = (ty1 + ty2 - floating[i].h) / 2;
+         }
+       else
+         {
+            sorted[num_sorted].x = spaces[k].x;
+            sorted[num_sorted].y = spaces[k].y;
+         }
        sorted[num_sorted].data = floating[i].data;
        sorted[num_sorted].w = floating[i].w;
        sorted[num_sorted].h = floating[i].h;
===================================================================
RCS file: /cvs/e/e16/e/src/mod-misc.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -3 -r1.65 -r1.66
--- mod-misc.c  13 Feb 2008 21:31:29 -0000      1.65
+++ mod-misc.c  11 Mar 2008 22:03:57 -0000      1.66
@@ -167,13 +167,14 @@
 
    CFG_ITEM_BOOL(Conf, place.manual, 0),
    CFG_ITEM_BOOL(Conf, place.manual_mouse_pointer, 0),
+   CFG_ITEM_BOOL(Conf, place.center_if_desk_full, 0),
+   CFG_ITEM_BOOL(Conf, place.ignore_struts, 0),
+   CFG_ITEM_BOOL(Conf, place.raise_fullscreen, 0),
    CFG_ITEM_BOOL(Conf, place.slidein, 0),
    CFG_ITEM_BOOL(Conf, place.cleanupslide, 1),
    CFG_ITEM_INT(Conf, place.slidemode, 0),
    CFG_ITEM_INT(Conf, place.slidespeedmap, 6000),
    CFG_ITEM_INT(Conf, place.slidespeedcleanup, 8000),
-   CFG_ITEM_BOOL(Conf, place.ignore_struts, 0),
-   CFG_ITEM_BOOL(Conf, place.raise_fullscreen, 0),
 
    CFG_ITEM_BOOL(Conf, session.enable_script, 0),
    CFG_ITEM_STR(Conf, session.script),
===================================================================
RCS file: /cvs/e/e16/e/src/settings.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -3 -r1.171 -r1.172
--- settings.c  10 Feb 2008 20:21:53 -0000      1.171
+++ settings.c  11 Mar 2008 22:03:57 -0000      1.172
@@ -223,6 +223,7 @@
 static char         tmp_switch_popup;
 static char         tmp_manual_placement;
 static char         tmp_manual_placement_mouse_pointer;
+static char         tmp_center_if_desk_full;
 static char         tmp_map_slide;
 static char         tmp_cleanup_slide;
 static int          tmp_slide_mode;
@@ -247,6 +248,7 @@
 
        Conf.place.manual = tmp_manual_placement;
        Conf.place.manual_mouse_pointer = tmp_manual_placement_mouse_pointer;
+       Conf.place.center_if_desk_full = tmp_center_if_desk_full;
 
        Conf.place.slidein = tmp_map_slide;
        Conf.place.cleanupslide = tmp_cleanup_slide;
@@ -277,6 +279,7 @@
 
    tmp_manual_placement = Conf.place.manual;
    tmp_manual_placement_mouse_pointer = Conf.place.manual_mouse_pointer;
+   tmp_center_if_desk_full = Conf.place.center_if_desk_full;
 
    tmp_map_slide = Conf.place.slidein;
    tmp_cleanup_slide = Conf.place.cleanupslide;
@@ -318,6 +321,11 @@
    DialogItemSetColSpan(di, 2);
    DialogItemSetText(di, _("Place windows under mouse"));
    DialogItemCheckButtonSetPtr(di, &tmp_manual_placement_mouse_pointer);
+
+   di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   DialogItemSetColSpan(di, 2);
+   DialogItemSetText(di, _("Center windows when desk is full"));
+   DialogItemCheckButtonSetPtr(di, &tmp_center_if_desk_full);
 
    di = DialogAddItem(table, DITEM_CHECKBUTTON);
    DialogItemSetColSpan(di, 2);



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to