Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        areas.c borders.c 


Log Message:
Try to put and end to windows getting lost (off desktop).
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/areas.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -3 -r1.61 -r1.62
--- areas.c     8 Feb 2004 22:51:50 -0000       1.61
+++ areas.c     21 Feb 2004 19:48:32 -0000      1.62
@@ -197,18 +197,19 @@
    struct _xy
    {
       int                 x, y;
-   }
-                      *xy;
+   }                  *xy;
 
    EDBUG(5, "SlideWindowsBy");
-   spd = 16;
-   min = 2;
    if (num < 1)
       EDBUG_RETURN_;
+
+   spd = 16;
+   min = 2;
    xy = Emalloc(sizeof(struct _xy) * num);
 
    for (i = 0; i < num; i++)
       GetWinXY(win[i], &(xy[i].x), &(xy[i].y));
+
    for (k = 0; k <= 1024; k += spd)
      {
        gettimeofday(&timev1, NULL);
@@ -232,10 +233,13 @@
        if (spd < min)
           spd = min;
      }
+
    for (i = 0; i < num; i++)
       EMoveWindow(disp, win[i], xy[i].x + dx, xy[i].y + dy);
+
    if (xy)
       Efree(xy);
+
    EDBUG_RETURN_;
 }
 
@@ -260,8 +264,9 @@
    tt = FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_TOOLTIP);
    HideToolTip(tt);
 
-   dx = ax - desks.desk[desks.current].current_area_x;
-   dy = ay - desks.desk[desks.current].current_area_y;
+   dx = root.w * (ax - desks.desk[desks.current].current_area_x);
+   dy = root.h * (ay - desks.desk[desks.current].current_area_y);
+
    if (dx < 0)
       SoundPlay("SOUND_MOVE_AREA_LEFT");
    else if (dx > 0)
@@ -277,6 +282,10 @@
    /* handling events as a result of our playing wiht windows */
    FocusNewDeskBegin();
 
+   /* set the current area up in out data structs */
+   desks.desk[desks.current].current_area_x = ax;
+   desks.desk[desks.current].current_area_y = ay;
+
    /* move all the windows around */
    lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
    if (lst)
@@ -306,19 +315,14 @@
                         }
                    }
               }
+
             /* slide them */
             if (wl)
               {
-                 SlideWindowsBy(wl, wnum,
-                                -(root.w *
-                                  (ax -
-                                   desks.desk[desks.current].current_area_x)),
-                                -(root.h *
-                                  (ay -
-                                   desks.desk[desks.current].current_area_y)),
-                                conf.desks.slidespeed);
+                 SlideWindowsBy(wl, wnum, -dx, -dy, conf.desks.slidespeed);
                  Efree(wl);
               }
+
             /* move the windows to their final positions */
             for (i = 0; i < num; i++)
               {
@@ -336,17 +340,7 @@
                                 setflip = 1;
                                 mode.flipp = 1;
                              }
-                           MoveEwin(lst[i],
-                                    lst[i]->x -
-                                    (root.w *
-                                     (ax -
-                                      desks.desk[desks.
-                                                 current].current_area_x)),
-                                    lst[i]->y -
-                                    (root.h *
-                                     (ay -
-                                      desks.desk[desks.
-                                                 current].current_area_y)));
+                           MoveEwin(lst[i], lst[i]->x - dx, lst[i]->y - dy);
                            if (setflip)
                               mode.flipp = 0;
                            lst[i]->area_x = a1;
@@ -358,32 +352,21 @@
          }
        else
          {
-            /* move all widnwos across.... */
+            /* move all windows across.... */
             for (i = 0; i < num; i++)
               {
                  if ((lst[i]->desktop == desks.current) && (!lst[i]->sticky)
                      && (!lst[i]->fixedpos))
                    {
                       /* if we're moving this window and its not opaque move */
-                      /* warp it across withotu remebering the xy stuff */
+                      /* warp it across without remebering the xy stuff */
                       /* well work out the xy stuff later when the move finishes */
                       if (lst[i]->floating)
                         {
                            if (conf.movemode > 0)
                              {
                                 GetWinXY(lst[i]->win, &x, &y);
-                                EMoveWindow(disp, lst[i]->win,
-                                            x -
-                                            (root.w *
-                                             (ax -
-                                              desks.desk[desks.
-                                                         current].
-                                              current_area_x)),
-                                            y -
-                                            (root.h *
-                                             (ay -
-                                              desks.desk[desks.current].
-                                              current_area_y)));
+                                EMoveWindow(disp, lst[i]->win, x - dx, y - dy);
                              }
                         }
                       /* if we're not moving it... move it across */
@@ -398,17 +381,7 @@
                                 setflip = 1;
                                 mode.flipp = 1;
                              }
-                           MoveEwin(lst[i],
-                                    lst[i]->x -
-                                    (root.w *
-                                     (ax -
-                                      desks.desk[desks.
-                                                 current].current_area_x)),
-                                    lst[i]->y -
-                                    (root.h *
-                                     (ay -
-                                      desks.desk[desks.
-                                                 current].current_area_y)));
+                           MoveEwin(lst[i], lst[i]->x - dx, lst[i]->y - dy);
                            if (setflip)
                               mode.flipp = 0;
                            lst[i]->area_x = a1;
@@ -421,10 +394,6 @@
        Efree(lst);
      }
 
-   /* set the current area up in out data structs */
-   desks.desk[desks.current].current_area_x = ax;
-   desks.desk[desks.current].current_area_y = ay;
-
    /* set hints up for it */
    HintsSetDesktopViewport();
    XSync(disp, False);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -3 -r1.137 -r1.138
--- borders.c   21 Feb 2004 13:47:56 -0000      1.137
+++ borders.c   21 Feb 2004 19:48:32 -0000      1.138
@@ -1854,7 +1854,7 @@
 doMoveResizeEwin(EWin * ewin, int x, int y, int w, int h, int flags)
 {
    static int          call_depth = 0;
-   int                 dx = 0, dy = 0;
+   int                 dx = 0, dy = 0, sw, sh, x0, y0;
    char                move = 0, resize = 0;
 
    EDBUG(3, "MoveResizeEwin");
@@ -1862,6 +1862,43 @@
       EDBUG_RETURN_;
    call_depth++;
 
+   if (mode.mode == MODE_NONE)
+     {
+       /* Don't throw windows offscreen */
+       sw = root.w;
+       sh = root.h;
+       if (ewin->sticky)
+         {
+            x0 = y0 = 0;
+         }
+       else
+         {
+            int                 ax, ay;
+
+            ax = desks.desk[ewin->desktop].current_area_x;
+            ay = desks.desk[ewin->desktop].current_area_y;
+            x0 = -ax * sw;
+            y0 = -ay * sh;
+            sw *= conf.areas.nx;
+            sh *= conf.areas.ny;
+         }
+       dx = ewin->w / 4;
+       if (dx > 8)
+          dx = 8;
+       dy = ewin->h / 4;
+       if (dy > 8)
+          dy = 8;
+
+       if (x < x0 - ewin->w + dx)
+          x = x0 - ewin->w + dx;
+       else if (x > x0 + sw - dx)
+          x = x0 + sw - dx;
+       if (y < y0 - ewin->h + dy)
+          y = y0 - ewin->h + dy;
+       else if (y > y0 + sh - dy)
+          y = y0 + sh - dy;
+     }
+
    if (flags & MR_FLAGS_MOVE)
      {
        dx = x - ewin->x;




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to