Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h arrange.c borders.c coords.c draw.c icccm.c moveresize.c 


Log Message:
Fix floating window movement (finally, I hope).
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.264
retrieving revision 1.265
diff -u -3 -r1.264 -r1.265
--- E.h 15 May 2004 22:42:20 -0000      1.264
+++ E.h 18 May 2004 23:31:00 -0000      1.265
@@ -892,7 +892,9 @@
 struct _ewin
 {
    Window              win;
-   int                 x, y, w, h, reqx, reqy;
+   int                 x, y, w, h;
+   int                 shape_x, shape_y;
+   int                 req_x, req_y;
    int                 lx, ly, lw, lh;
    char                type;
    char                state;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/arrange.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -3 -r1.68 -r1.69
--- arrange.c   4 May 2004 19:04:22 -0000       1.68
+++ arrange.c   18 May 2004 23:31:07 -0000      1.69
@@ -597,7 +597,8 @@
        EDBUG_RETURN_;
      }
 
-   ScreenGetGeometry(ewin->x, ewin->y, &left_bound, &top_bound, &w, &h);
+   ScreenGetGeometry(ewin->shape_x, ewin->shape_y, &left_bound, &top_bound, &w,
+                    &h);
    right_bound = left_bound + w;
    bottom_bound = top_bound + h;
    screen_snap_dist = Mode.constrained ? (w + h) : Conf.snap.screen_snap_dist;
@@ -617,150 +618,150 @@
          }
        Efree(gwins);
      }
+
    odx = dx;
    ody = dy;
    if (dx < 0)
      {
-       if (IN_BELOW(ewin->x + dx, left_bound, screen_snap_dist)
-           && (ewin->x >= left_bound))
+       if (IN_BELOW(ewin->shape_x + dx, left_bound, screen_snap_dist)
+           && (ewin->shape_x >= left_bound))
          {
-            dx = left_bound - ewin->x;
+            dx = left_bound - ewin->shape_x;
          }
        else if (lst)
          {
             for (i = 0; i < num; i++)
               {
-                 if (lst[i])
+                 if (lst[i] == NULL)
+                    continue;
+
+                 if (((ewin->desktop == lst[i]->desktop) ||
+                      (lst[i]->sticky)) && (!(lst[i]->floating)) &&
+                     (!(lst[i]->iconified)) && (!(lst[i]->ignorearrange)))
                    {
-                      if (((ewin->desktop == lst[i]->desktop)
-                           || (lst[i]->sticky)) && (!(lst[i]->floating))
-                          && (!(lst[i]->iconified))
-                          && (!(lst[i]->ignorearrange)))
+                      if (IN_BELOW
+                          (ewin->shape_x + dx, lst[i]->x + lst[i]->w - 1,
+                           Conf.snap.edge_snap_dist)
+                          && SPANS_COMMON(ewin->shape_y, ewin->h, lst[i]->y,
+                                          lst[i]->h)
+                          && (ewin->shape_x >= (lst[i]->x + lst[i]->w)))
                         {
-                           if (IN_BELOW
-                               (ewin->x + dx, lst[i]->x + lst[i]->w - 1,
-                                Conf.snap.edge_snap_dist)
-                               && SPANS_COMMON(ewin->y, ewin->h, lst[i]->y,
-                                               lst[i]->h)
-                               && (ewin->x >= (lst[i]->x + lst[i]->w)))
-                             {
-                                dx = (lst[i]->x + lst[i]->w) - ewin->x;
-                                break;
-                             }
+                           dx = (lst[i]->x + lst[i]->w) - ewin->shape_x;
+                           break;
                         }
                    }
               }
          }
-       if ((ewin->reqx - ewin->x) > 0)
+       if ((ewin->req_x - ewin->shape_x) > 0)
           dx = 0;
      }
    else if (dx > 0)
      {
-       if (IN_ABOVE(ewin->x + ewin->w + dx, right_bound, screen_snap_dist)
-           && ((ewin->x + ewin->w) <= right_bound))
+       if (IN_ABOVE
+           (ewin->shape_x + ewin->w + dx, right_bound, screen_snap_dist)
+           && ((ewin->shape_x + ewin->w) <= right_bound))
          {
-            dx = right_bound - (ewin->x + ewin->w);
+            dx = right_bound - (ewin->shape_x + ewin->w);
          }
        else if (lst)
          {
             for (i = 0; i < num; i++)
               {
-                 if (lst[i])
+                 if (lst[i] == NULL)
+                    continue;
+
+                 if (((ewin->desktop == lst[i]->desktop) ||
+                      (lst[i]->sticky)) && (!(lst[i]->floating)) &&
+                     (!(lst[i]->iconified)) && (!(lst[i]->ignorearrange)))
                    {
-                      if (((ewin->desktop == lst[i]->desktop)
-                           || (lst[i]->sticky)) && (!(lst[i]->floating))
-                          && (!(lst[i]->iconified))
-                          && (!(lst[i]->ignorearrange)))
+                      if (IN_ABOVE(ewin->shape_x + ewin->w + dx - 1, lst[i]->x,
+                                   Conf.snap.edge_snap_dist) &&
+                          SPANS_COMMON(ewin->shape_y, ewin->h, lst[i]->y,
+                                       lst[i]->h) &&
+                          ((ewin->shape_x + ewin->w) <= lst[i]->x))
                         {
-                           if (IN_ABOVE
-                               (ewin->x + ewin->w + dx - 1, lst[i]->x,
-                                Conf.snap.edge_snap_dist)
-                               && SPANS_COMMON(ewin->y, ewin->h, lst[i]->y,
-                                               lst[i]->h)
-                               && ((ewin->x + ewin->w) <= lst[i]->x))
-                             {
-                                dx = lst[i]->x - (ewin->x + ewin->w);
-                                break;
-                             }
+                           dx = lst[i]->x - (ewin->shape_x + ewin->w);
+                           break;
                         }
                    }
               }
          }
-       if ((ewin->reqx - ewin->x) < 0)
+       if ((ewin->req_x - ewin->shape_x) < 0)
           dx = 0;
      }
+
    if (dy < 0)
      {
-       if (IN_BELOW(ewin->y + dy, top_bound, screen_snap_dist)
-           && (ewin->y >= top_bound))
+       if (IN_BELOW(ewin->shape_y + dy, top_bound, screen_snap_dist)
+           && (ewin->shape_y >= top_bound))
          {
-            dy = top_bound - ewin->y;
+            dy = top_bound - ewin->shape_y;
          }
        else if (lst)
          {
             for (i = 0; i < num; i++)
               {
-                 if (lst[i])
+                 if (lst[i] == NULL)
+                    continue;
+
+                 if (((ewin->desktop == lst[i]->desktop) ||
+                      (lst[i]->sticky)) && (!(lst[i]->floating)) &&
+                     (!(lst[i]->iconified)) && (!(lst[i]->ignorearrange)))
                    {
-                      if (((ewin->desktop == lst[i]->desktop)
-                           || (lst[i]->sticky)) && (!(lst[i]->floating))
-                          && (!(lst[i]->iconified))
-                          && (!(lst[i]->ignorearrange)))
+                      if (IN_BELOW
+                          (ewin->shape_y + dy, lst[i]->y + lst[i]->h - 1,
+                           Conf.snap.edge_snap_dist)
+                          && SPANS_COMMON(ewin->shape_x, ewin->w, lst[i]->x,
+                                          lst[i]->w)
+                          && (ewin->shape_y >= (lst[i]->y + lst[i]->h)))
                         {
-                           if (IN_BELOW
-                               (ewin->y + dy, lst[i]->y + lst[i]->h - 1,
-                                Conf.snap.edge_snap_dist)
-                               && SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
-                                               lst[i]->w)
-                               && (ewin->y >= (lst[i]->y + lst[i]->h)))
-                             {
-                                dy = (lst[i]->y + lst[i]->h) - ewin->y;
-                                break;
-                             }
+                           dy = (lst[i]->y + lst[i]->h) - ewin->shape_y;
+                           break;
                         }
                    }
               }
          }
-       if ((ewin->reqy - ewin->y) > 0)
+       if ((ewin->req_y - ewin->shape_y) > 0)
           dy = 0;
      }
    else if (dy > 0)
      {
-       if (IN_ABOVE(ewin->y + ewin->h + dy, bottom_bound, screen_snap_dist)
-           && ((ewin->y + ewin->h) <= bottom_bound))
+       if (IN_ABOVE
+           (ewin->shape_y + ewin->h + dy, bottom_bound, screen_snap_dist)
+           && ((ewin->shape_y + ewin->h) <= bottom_bound))
          {
-            dy = bottom_bound - (ewin->y + ewin->h);
+            dy = bottom_bound - (ewin->shape_y + ewin->h);
          }
        else if (lst)
          {
             for (i = 0; i < num; i++)
               {
-                 if (lst[i])
+                 if (lst[i] == NULL)
+                    continue;
+
+                 if (((ewin->desktop == lst[i]->desktop) ||
+                      (lst[i]->sticky)) && (!(lst[i]->floating)) &&
+                     (!(lst[i]->iconified)) && (!(lst[i]->ignorearrange)))
                    {
-                      if (((ewin->desktop == lst[i]->desktop)
-                           || (lst[i]->sticky)) && (!(lst[i]->floating))
-                          && (!(lst[i]->iconified))
-                          && (!(lst[i]->ignorearrange)))
+                      if (IN_ABOVE(ewin->shape_y + ewin->h + dy - 1, lst[i]->y,
+                                   Conf.snap.edge_snap_dist) &&
+                          SPANS_COMMON(ewin->shape_x, ewin->w, lst[i]->x,
+                                       lst[i]->w) &&
+                          ((ewin->shape_y + ewin->h) <= lst[i]->y))
                         {
-                           if (IN_ABOVE
-                               (ewin->y + ewin->h + dy - 1, lst[i]->y,
-                                Conf.snap.edge_snap_dist)
-                               && SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
-                                               lst[i]->w)
-                               && ((ewin->y + ewin->h) <= lst[i]->y))
-                             {
-                                dy = lst[i]->y - (ewin->y + ewin->h);
-                                break;
-                             }
+                           dy = lst[i]->y - (ewin->shape_y + ewin->h);
+                           break;
                         }
                    }
               }
          }
-       if ((ewin->reqy - ewin->y) < 0)
+       if ((ewin->req_y - ewin->shape_y) < 0)
           dy = 0;
      }
+
    if (lst)
       Efree(lst);
+
    if ((odx != dx) || (ody != dy))
      {
        if (!last_res)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -3 -r1.178 -r1.179
--- borders.c   18 May 2004 16:25:48 -0000      1.178
+++ borders.c   18 May 2004 23:31:07 -0000      1.179
@@ -1233,8 +1233,6 @@
    ewin->y = -1;
    ewin->w = -1;
    ewin->h = -1;
-   ewin->reqx = -1;
-   ewin->reqy = -1;
    ewin->lx = -1;
    ewin->ly = -1;
    ewin->lw = -1;
@@ -1466,7 +1464,7 @@
 
    if (Mode.doingslide)
      {
-       DrawEwinShape(ewin, Conf.slidemode, ewin->x, ewin->y,
+       DrawEwinShape(ewin, Conf.slidemode, ewin->shape_x, ewin->shape_y,
                      ewin->client.w, ewin->client.h, 2);
        Mode.doingslide = 0;
      }
@@ -1773,8 +1771,6 @@
           move = 1;
        ewin->x = x;
        ewin->y = y;
-       ewin->reqx = x;
-       ewin->reqy = y;
      }
 
    if (flags & MR_FLAGS_RESIZE)
@@ -1826,7 +1822,11 @@
      }
 
    if ((Mode.mode == MODE_NONE) /* && (move || resize) */ )
-      EwinUpdateAfterMoveResize(ewin, resize);
+     {
+       ewin->shape_x = x;
+       ewin->shape_y = y;
+       EwinUpdateAfterMoveResize(ewin, resize);
+     }
 
    call_depth--;
    EDBUG_RETURN_;
@@ -1900,8 +1900,6 @@
    dy = y - ewin->y;
    ewin->x = x;
    ewin->y = y;
-   ewin->reqx = x;
-   ewin->reqy = y;
    ConformEwinToDesktop(ewin);
    if (ewin->has_transients)
      {
@@ -2396,7 +2394,6 @@
        ewin->shaded = 2;
        ewin->w = b;
        ewin->x = d;
-       ewin->reqx = d;
        EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
        EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
        CalcEwinSizes(ewin);
@@ -2423,7 +2420,6 @@
        ewin->shaded = 2;
        ewin->h = b;
        ewin->y = d;
-       ewin->reqy = d;
        EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
        EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
        CalcEwinSizes(ewin);
@@ -2479,7 +2475,6 @@
        ewin->shaded = 0;
        ewin->w = b;
        ewin->x = d;
-       ewin->reqx = d;
        MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
        XSync(disp, False);
        break;
@@ -2503,7 +2498,6 @@
        ewin->shaded = 0;
        ewin->h = b;
        ewin->y = d;
-       ewin->reqy = d;
        MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
        XSync(disp, False);
        break;
@@ -2616,7 +2610,6 @@
                j = ((c * (1024 - k)) + (d * k)) >> 10;
                ewin->w = i;
                ewin->x = j;
-               ewin->reqx = j;
                if (ewin->w < 1)
                   ewin->w = 1;
                ww = ewin->w - ewin->border->border.left -
@@ -2651,7 +2644,6 @@
        ewin->shaded = 2;
        ewin->w = b;
        ewin->x = d;
-       ewin->reqx = d;
        EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
        EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
        CalcEwinSizes(ewin);
@@ -2725,7 +2717,6 @@
                j = ((c * (1024 - k)) + (d * k)) >> 10;
                ewin->h = i;
                ewin->y = j;
-               ewin->reqy = j;
                if (ewin->h < 1)
                   ewin->h = 1;
                hh = ewin->h - ewin->border->border.top -
@@ -2760,7 +2751,6 @@
        ewin->shaded = 2;
        ewin->h = b;
        ewin->y = d;
-       ewin->reqy = d;
        EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
        EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
        CalcEwinSizes(ewin);
@@ -2887,7 +2877,6 @@
                j = ((c * (1024 - k)) + (d * k)) >> 10;
                ewin->w = i;
                ewin->x = j;
-               ewin->reqx = j;
                EMoveResizeWindow(disp, ewin->win_container,
                                  ewin->border->border.left,
                                  ewin->border->border.top,
@@ -2916,7 +2905,6 @@
             }
        ewin->w = b;
        ewin->x = d;
-       ewin->reqx = d;
        MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
        XSync(disp, False);
        break;
@@ -2999,7 +2987,6 @@
                j = ((c * (1024 - k)) + (d * k)) >> 10;
                ewin->h = i;
                ewin->y = j;
-               ewin->reqy = j;
                EMoveResizeWindow(disp, ewin->win_container,
                                  ewin->border->border.left,
                                  ewin->border->border.top, ewin->client.w,
@@ -3028,7 +3015,6 @@
             }
        ewin->h = b;
        ewin->y = d;
-       ewin->reqy = d;
        MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
        XSync(disp, False);
        break;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/coords.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- coords.c    4 May 2004 19:04:26 -0000       1.18
+++ coords.c    18 May 2004 23:31:07 -0000      1.19
@@ -47,8 +47,8 @@
    if ((!ic) || (!tc))
       return;
 
-   x = ewin->x;
-   y = ewin->y;
+   x = ewin->shape_x;
+   y = ewin->shape_y;
    w = (ewin->client.w - ewin->client.base_w) / ewin->client.w_inc;
    h = (ewin->client.h - ewin->client.base_h) / ewin->client.h_inc;
 
@@ -79,9 +79,9 @@
                    case 0:
                    case 1:
                    case 2:
-                      cx = ewin->x + ((ewin->w - cw) / 2) +
+                      cx = x + ((ewin->w - cw) / 2) +
                          desks.desk[ewin->desktop].x;
-                      cy = ewin->y + ((ewin->h - ch) / 2) +
+                      cy = y + ((ewin->h - ch) / 2) +
                          desks.desk[ewin->desktop].y;
                       break;
                    }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/draw.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- draw.c      15 May 2004 22:42:21 -0000      1.47
+++ draw.c      18 May 2004 23:31:07 -0000      1.48
@@ -1317,10 +1317,10 @@
        ewin->client.w = w;
        ewin->client.h = h;
        ICCCM_MatchSize(ewin);
-       i = (x - ewin->x) / ewin->client.w_inc;
-       j = (y - ewin->y) / ewin->client.h_inc;
-       x = ewin->x + (i * ewin->client.w_inc);
-       y = ewin->y + (j * ewin->client.h_inc);
+       i = (x - ewin->shape_x) / ewin->client.w_inc;
+       j = (y - ewin->shape_y) / ewin->client.h_inc;
+       x = ewin->shape_x + (i * ewin->client.w_inc);
+       y = ewin->shape_y + (j * ewin->client.h_inc);
        ewin->client.w = w1;
        ewin->client.h = h1;
      }
@@ -1358,6 +1358,8 @@
      {
      case 0:
        MoveResizeEwin(ewin, x, y, w, h);
+       ewin->shape_x = x;
+       ewin->shape_y = y;
        if (Mode.mode != MODE_NONE)
           SetCoords(ewin);
        break;
@@ -1375,16 +1377,12 @@
        if (!b3)
           b3 = XCreateBitmapFromData(disp, VRoot.win, gray3_bits, gray3_width,
                                      gray3_height);
-       x1 = ewin->x + desks.desk[ewin->desktop].x;
-       y1 = ewin->y + desks.desk[ewin->desktop].y;
+       x1 = ewin->shape_x;
+       y1 = ewin->shape_y;
        w1 = ewin->w - (ewin->border->border.left + ewin->border->border.right);
        h1 = ewin->h - (ewin->border->border.top + ewin->border->border.bottom);
-       ewin->x = x;
-       ewin->y = y;
-       ewin->reqx = x;
-       ewin->reqy = y;
-       x = ewin->x + desks.desk[ewin->desktop].x;
-       y = ewin->y + desks.desk[ewin->desktop].y;
+       ewin->shape_x = x;
+       ewin->shape_y = y;
        if ((w != ewin->client.w) || (h != ewin->client.h))
          {
             ewin->client.w = w;
@@ -1732,9 +1730,9 @@
                 || (ewin->groups && !check_move))
               {
                  if (ewin->shaded)
-                    MoveEwin(ewin, ewin->x, ewin->y);
+                    MoveEwin(ewin, ewin->shape_x, ewin->shape_y);
                  else
-                    MoveResizeEwin(ewin, ewin->x, ewin->y, pw, ph);
+                    MoveResizeEwin(ewin, ewin->shape_x, ewin->shape_y, pw, ph);
               }
             XFreeGC(disp, gc);
             gc = 0;
@@ -1744,6 +1742,12 @@
        break;
      }
 
+   if (firstlast == 0 || firstlast == 2 || firstlast == 4)
+     {
+       ewin->req_x = ewin->shape_x;
+       ewin->req_y = ewin->shape_y;
+     }
+
  done:
    Mode.queue_up = pq;
    EDBUG_RETURN_;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -3 -r1.62 -r1.63
--- icccm.c     7 May 2004 15:18:06 -0000       1.62
+++ icccm.c     18 May 2004 23:31:07 -0000      1.63
@@ -395,12 +395,10 @@
                   (unsigned char *)c, 2);
    ewin->x = ewin->client.x;
    ewin->y = ewin->client.y;
-   ewin->reqx = ewin->client.x;
-   ewin->reqy = ewin->client.y;
-   ewin->w =
-      ewin->client.w + ewin->border->border.left + ewin->border->border.right;
-   ewin->h =
-      ewin->client.h + ewin->border->border.top + ewin->border->border.bottom;
+   ewin->w = ewin->client.w +
+      ewin->border->border.left + ewin->border->border.right;
+   ewin->h = ewin->client.h +
+      ewin->border->border.top + ewin->border->border.bottom;
 
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/moveresize.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- moveresize.c        16 May 2004 16:02:58 -0000      1.14
+++ moveresize.c        18 May 2004 23:31:07 -0000      1.15
@@ -128,11 +128,9 @@
      {
        wasresize = 1;
        for (i = 0; i < num; i++)
-          DrawEwinShape(gwins[i], Conf.movemode, gwins[i]->x, gwins[i]->y,
-                        gwins[i]->client.w, gwins[i]->client.h,
-                        Mode.firstlast);
-       for (i = 0; i < num; i++)
-          MoveEwin(gwins[i], gwins[i]->x, gwins[i]->y);
+          DrawEwinShape(gwins[i], Conf.movemode, gwins[i]->shape_x,
+                        gwins[i]->shape_y, gwins[i]->client.w,
+                        gwins[i]->client.h, Mode.firstlast);
      }
    Mode.mode = MODE_NONE;
 
@@ -142,16 +140,19 @@
          {
             if (gwins[i]->floating)
                MoveEwinToDesktopAt(gwins[i], d,
-                                   gwins[i]->x - (desks.desk[d].x -
-                                                  desks.
-                                                  desk[gwins[i]->desktop].x),
-                                   gwins[i]->y - (desks.desk[d].y -
-                                                  desks.
-                                                  desk[gwins[i]->desktop].y));
+                                   gwins[i]->shape_x - (desks.desk[d].x -
+                                                        desks.desk[gwins[i]->
+                                                                   desktop].x),
+                                   gwins[i]->shape_y - (desks.desk[d].y -
+                                                        desks.desk[gwins[i]->
+                                                                   desktop].
+                                                        y));
             else
-               MoveEwinToDesktopAt(gwins[i], d, gwins[i]->x, gwins[i]->y);
+               MoveEwinToDesktopAt(gwins[i], d, gwins[i]->shape_x,
+                                   gwins[i]->shape_y);
             gwins[i]->floating = 0;
          }
+
        if ((Conf.movemode > 0) && (gwins[i]->has_transients))
          {
             EWin              **lst;
@@ -201,8 +202,6 @@
    EDBUG_RETURN(0);
 }
 
-static int          area_x, area_y;
-
 int
 ActionMoveSuspend(void)
 {
@@ -213,8 +212,6 @@
    if (!ewin)
       return 0;
 
-   GetCurrentArea(&area_x, &area_y);
-
    if (Mode.mode == MODE_MOVE_PENDING)
       return 0;
 
@@ -225,7 +222,7 @@
        for (i = 0; i < num; i++)
          {
             ewin = lst[i];
-            DrawEwinShape(ewin, Conf.movemode, ewin->x, ewin->y,
+            DrawEwinShape(ewin, Conf.movemode, ewin->shape_x, ewin->shape_y,
                           ewin->client.w, ewin->client.h, 3);
          }
        if (lst)
@@ -240,7 +237,7 @@
 {
    EWin               *ewin, **lst;
    int                 i, num;
-   int                 x, y, ax, ay, dx, dy, fl;
+   int                 x, y, ax, ay, fl;
 
    ewin = mode_moveresize_ewin;
    if (!ewin)
@@ -264,32 +261,12 @@
        if (!ewin->floating)
           continue;
 
-       x = ewin->x;
-       y = ewin->y;
+       x = ewin->shape_x;
+       y = ewin->shape_y;
        if (Mode.flipp)
          {
-            dx = Mode.x - Mode.px;
-            dy = Mode.y - Mode.py;
-            if (Conf.movemode == 0)
-              {
-                 x += dx;
-                 y += dy;
-              }
-            else
-              {
-                 x += dx + (ax - area_x) * VRoot.w;
-                 y += dy + (ay - area_y) * VRoot.h;
-              }
-         }
-       else
-         {
-            dx = (ax - area_x) * VRoot.w;
-            dy = (ay - area_y) * VRoot.h;
-            if (Conf.movemode != 0)
-              {
-                 x += dx;
-                 y += dy;
-              }
+            x += Mode.x - Mode.px;
+            y += Mode.y - Mode.py;
          }
        DrawEwinShape(ewin, Conf.movemode, x, y,
                      ewin->client.w, ewin->client.h, fl);
@@ -395,8 +372,8 @@
    Mode.queue_up = DRAW_QUEUE_ENABLE;
    Mode.mode = MODE_NONE;
    Mode.firstlast = 2;
-   DrawEwinShape(ewin, Conf.resizemode, ewin->x, ewin->y, ewin->client.w,
-                ewin->client.h, Mode.firstlast);
+   DrawEwinShape(ewin, Conf.resizemode, ewin->shape_x, ewin->shape_y,
+                ewin->client.w, ewin->client.h, Mode.firstlast);
    for (i = 0; i < ewin->border->num_winparts; i++)
       ewin->bits[i].no_expose = 1;
    ICCCM_Configure(ewin);
@@ -419,13 +396,10 @@
 void
 ActionMoveHandleMotion(void)
 {
-   int                 dx, dy;
-   EWin               *ewin;
-
-   EWin              **gwins;
-   int                 i, j, num;
+   int                 dx, dy, dd;
+   EWin               *ewin, **gwins, *ewin1;
+   int                 i, num;
    int                 ndx, ndy;
-   int                 prx, pry;
    int                 screen_snap_dist;
    char                jumpx, jumpy;
    int                 min_dx, max_dx, min_dy, max_dy;
@@ -440,9 +414,11 @@
    if (Mode.mode == MODE_MOVE_PENDING)
      {
        for (i = 0; i < num; i++)
-          DrawEwinShape(gwins[i], Conf.movemode, gwins[i]->x,
-                        gwins[i]->y, gwins[i]->client.w,
-                        gwins[i]->client.h, 0);
+         {
+            ewin1 = gwins[i];
+            DrawEwinShape(ewin1, Conf.movemode, ewin1->x,
+                          ewin1->y, ewin1->client.w, ewin1->client.h, 0);
+         }
        Mode.mode = MODE_MOVE;
      }
 
@@ -505,93 +481,103 @@
 
    for (i = 0; i < num; i++)
      {
+       ewin1 = gwins[i];
+
        /* jump out of snap horizontally */
+       dd = ewin1->req_x - ewin1->shape_x;
+       if (dd < 0)
+          dd = -dd;
        if ((ndx != dx) &&
-           (((gwins[i]->x == 0) &&
-             (!(IN_RANGE(gwins[i]->reqx, gwins[i]->x, screen_snap_dist)))) ||
-            ((gwins[i]->x == (VRoot.w - gwins[i]->w)) &&
-             (!(IN_RANGE(gwins[i]->reqx, gwins[i]->x, screen_snap_dist)))) ||
-            ((gwins[i]->x != 0) &&
-             (gwins[i]->x != (VRoot.w - gwins[i]->w) &&
-              (!(IN_RANGE(gwins[i]->reqx, gwins[i]->x,
-                          Conf.snap.edge_snap_dist)))))))
+           (((ewin1->shape_x == 0) &&
+             (dd > screen_snap_dist)) ||
+            ((ewin1->shape_x == (VRoot.w - ewin1->w)) &&
+             (dd > screen_snap_dist)) ||
+            ((ewin1->shape_x != 0) &&
+             (ewin1->shape_x != (VRoot.w - ewin1->w) &&
+              (dd > Conf.snap.edge_snap_dist)))))
          {
             jumpx = 1;
-            ndx = gwins[i]->reqx - gwins[i]->x + dx;
+            ndx = ewin1->req_x - ewin1->shape_x + dx;
          }
 
        /* jump out of snap vertically */
+       dd = ewin1->req_y - ewin1->shape_y;
+       if (dd < 0)
+          dd = -dd;
        if ((ndy != dy) &&
-           (((gwins[i]->y == 0) &&
-             (!(IN_RANGE(gwins[i]->reqy, gwins[i]->y, screen_snap_dist)))) ||
-            ((gwins[i]->y == (VRoot.h - gwins[i]->h)) &&
-             (!(IN_RANGE(gwins[i]->reqy, gwins[i]->y, screen_snap_dist)))) ||
-            ((gwins[i]->y != 0) &&
-             (gwins[i]->y != (VRoot.h - gwins[i]->h) &&
-              (!(IN_RANGE(gwins[i]->reqy, gwins[i]->y,
-                          Conf.snap.edge_snap_dist)))))))
+           (((ewin1->shape_y == 0) &&
+             (dd > screen_snap_dist)) ||
+            ((ewin1->shape_y == (VRoot.h - ewin1->h)) &&
+             (dd > screen_snap_dist)) ||
+            ((ewin1->shape_y != 0) &&
+             (ewin1->shape_y != (VRoot.h - ewin1->h) &&
+              (dd > Conf.snap.edge_snap_dist)))))
          {
             jumpy = 1;
-            ndy = gwins[i]->reqy - gwins[i]->y + dy;
+            ndy = ewin1->req_y - ewin1->shape_y + dy;
          }
      }
 
    for (i = 0; i < num; i++)
      {
+       ewin1 = gwins[i];
+
        /* if its opaque move mode check to see if we have to float */
        /* the window aboe all desktops (reparent to root) */
        if (Conf.movemode == 0)
-          DetermineEwinFloat(gwins[i], ndx, ndy);
+          DetermineEwinFloat(ewin1, ndx, ndy);
+
        /* draw the new position of the window */
-       prx = gwins[i]->reqx;
-       pry = gwins[i]->reqy;
-       DrawEwinShape(gwins[i], Conf.movemode, gwins[i]->x + ndx,
-                     gwins[i]->y + ndy, gwins[i]->client.w,
-                     gwins[i]->client.h, Mode.firstlast);
-       /* if we didnt jump the winow after a resist at the edge */
+       DrawEwinShape(ewin1, Conf.movemode, ewin1->shape_x + ndx,
+                     ewin1->shape_y + ndy, ewin1->client.w,
+                     ewin1->client.h, Mode.firstlast);
+
+       /* if we didnt jump the window after a resist at the edge */
        /* reset the requested x to be the prev. requested + delta */
-       if (!(jumpx))
-          gwins[i]->reqx = prx + dx;
-       if (!(jumpy))
-          gwins[i]->reqy = pry + dy;
+       /* if we did jump set requested to current shape position */
+       ewin1->req_x = (jumpx) ? ewin1->shape_x : ewin1->req_x + dx;
+       ewin1->req_y = (jumpy) ? ewin1->shape_y : ewin1->req_y + dy;
 
        /* swapping of group member locations: */
        if (Mode.swapmovemode && Conf.group_swapmove)
          {
-            EWin              **all_gwins;
-            int                 all_gwins_num;
+            EWin              **all_gwins, *ewin2;
+            int                 j, all_gwins_num;
 
-            all_gwins =
-               ListWinGroupMembersForEwin(ewin, ACTION_NONE, 0,
-                                          &all_gwins_num);
+            all_gwins = ListWinGroupMembersForEwin(ewin, ACTION_NONE, 0,
+                                                   &all_gwins_num);
 
             for (j = 0; j < all_gwins_num; j++)
               {
-                 if (gwins[i] == all_gwins[j])
+                 ewin2 = all_gwins[j];
+
+                 if (ewin1 == ewin2)
                     continue;
 
                  /* check for sufficient overlap and avoid flickering */
-                 if (((gwins[i]->x >= all_gwins[j]->x &&
-                       gwins[i]->x <= all_gwins[j]->x + all_gwins[j]->w / 2 &&
-                       Mode.x <= Mode.px) ||
-                      (gwins[i]->x <= all_gwins[j]->x &&
-                       gwins[i]->x + gwins[i]->w / 2 >= all_gwins[j]->x &&
+                 if (((ewin1->shape_x >= ewin2->shape_x &&
+                       ewin1->shape_x <= ewin2->shape_x +
+                       ewin2->w / 2 && Mode.x <= Mode.px) ||
+                      (ewin1->shape_x <= ewin2->shape_x &&
+                       ewin1->shape_x + ewin1->w / 2 >=
+                       ewin2->shape_x &&
                        Mode.x >= Mode.px)) &&
-                     ((gwins[i]->y >= all_gwins[j]->y &&
-                       gwins[i]->y <= all_gwins[j]->y + all_gwins[j]->h / 2 &&
-                       Mode.y <= Mode.py) ||
-                      (gwins[i]->y <= all_gwins[j]->y &&
-                       gwins[i]->y + gwins[i]->h / 2 >= all_gwins[j]->y &&
-                       Mode.y >= Mode.py)))
+                     ((ewin1->shape_y >= ewin2->shape_y
+                       && ewin1->shape_y <=
+                       ewin2->shape_y + ewin2->h / 2
+                       && Mode.y <= Mode.py) || (ewin1->y <= ewin2->y
+                                                 && ewin1->shape_y +
+                                                 ewin1->h / 2 >= ewin2->shape_y
+                                                 && Mode.y >= Mode.py)))
                    {
                       int                 tmp_swapcoord_x;
                       int                 tmp_swapcoord_y;
 
                       tmp_swapcoord_x = Mode.swapcoord_x;
                       tmp_swapcoord_y = Mode.swapcoord_y;
-                      Mode.swapcoord_x = all_gwins[j]->x;
-                      Mode.swapcoord_y = all_gwins[j]->y;
-                      MoveEwin(all_gwins[j], tmp_swapcoord_x, tmp_swapcoord_y);
+                      Mode.swapcoord_x = ewin2->shape_x;
+                      Mode.swapcoord_y = ewin2->shape_y;
+                      MoveEwin(ewin2, tmp_swapcoord_x, tmp_swapcoord_y);
                       break;
                    }
               }
@@ -631,11 +617,11 @@
             w = ewin->client.w;
             h = ewin->client.h;
             if (pw == ewin->client.w)
-               x = ewin->x;
+               x = ewin->shape_x;
             else
                x = Mode.win_x + Mode.win_w - w;
             if (ph == ewin->client.h)
-               y = ewin->y;
+               y = ewin->shape_y;
             else
                y = Mode.win_y + Mode.win_h - h;
             ewin->client.w = pw;
@@ -646,13 +632,13 @@
             ph = ewin->client.h;
             w = Mode.win_w + (Mode.x - Mode.start_x);
             h = Mode.win_h - (Mode.y - Mode.start_y);
-            x = ewin->x;
+            x = ewin->shape_x;
             y = Mode.win_y + (Mode.y - Mode.start_y);
             ewin->client.h = h;
             ICCCM_MatchSize(ewin);
             h = ewin->client.h;
             if (ph == ewin->client.h)
-               y = ewin->y;
+               y = ewin->shape_y;
             else
                y = Mode.win_y + Mode.win_h - h;
             ewin->client.h = ph;
@@ -663,12 +649,12 @@
             w = Mode.win_w - (Mode.x - Mode.start_x);
             h = Mode.win_h + (Mode.y - Mode.start_y);
             x = Mode.win_x + (Mode.x - Mode.start_x);
-            y = ewin->y;
+            y = ewin->shape_y;
             ewin->client.w = w;
             ICCCM_MatchSize(ewin);
             w = ewin->client.w;
             if (pw == ewin->client.w)
-               x = ewin->x;
+               x = ewin->shape_x;
             else
                x = Mode.win_x + Mode.win_w - w;
             ewin->client.w = pw;
@@ -677,8 +663,8 @@
          case 3:
             w = Mode.win_w + (Mode.x - Mode.start_x);
             h = Mode.win_h + (Mode.y - Mode.start_y);
-            x = ewin->x;
-            y = ewin->y;
+            x = ewin->shape_x;
+            y = ewin->shape_y;
             DrawEwinShape(ewin, Conf.resizemode, x, y, w, h, Mode.firstlast);
             break;
          default:
@@ -694,12 +680,12 @@
             w = Mode.win_w - (Mode.x - Mode.start_x);
             h = ewin->client.h;
             x = Mode.win_x + (Mode.x - Mode.start_x);
-            y = ewin->y;
+            y = ewin->shape_y;
             ewin->client.w = w;
             ICCCM_MatchSize(ewin);
             w = ewin->client.w;
             if (pw == ewin->client.w)
-               x = ewin->x;
+               x = ewin->shape_x;
             else
                x = Mode.win_x + Mode.win_w - w;
             ewin->client.w = pw;
@@ -708,8 +694,8 @@
          case 1:
             w = Mode.win_w + (Mode.x - Mode.start_x);
             h = ewin->client.h;
-            x = ewin->x;
-            y = ewin->y;
+            x = ewin->shape_x;
+            y = ewin->shape_y;
             DrawEwinShape(ewin, Conf.resizemode, x, y, w, h, Mode.firstlast);
             break;
          default:
@@ -724,13 +710,13 @@
             ph = ewin->client.h;
             w = ewin->client.w;
             h = Mode.win_h - (Mode.y - Mode.start_y);
-            x = ewin->x;
+            x = ewin->shape_x;
             y = Mode.win_y + (Mode.y - Mode.start_y);
             ewin->client.h = h;
             ICCCM_MatchSize(ewin);
             h = ewin->client.h;
             if (ph == ewin->client.h)
-               y = ewin->y;
+               y = ewin->shape_y;
             else
                y = Mode.win_y + Mode.win_h - h;
             ewin->client.h = ph;
@@ -739,8 +725,8 @@
          case 1:
             w = ewin->client.w;
             h = Mode.win_h + (Mode.y - Mode.start_y);
-            x = ewin->x;
-            y = ewin->y;
+            x = ewin->shape_x;
+            y = ewin->shape_y;
             DrawEwinShape(ewin, Conf.resizemode, x, y, w, h, Mode.firstlast);
             break;
          default:




-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to