Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        borders.c desktops.c pager.c 


Log Message:
Fix various problems with pager dragging and focus.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -3 -r1.136 -r1.137
--- borders.c   17 Feb 2004 23:43:04 -0000      1.136
+++ borders.c   21 Feb 2004 13:47:56 -0000      1.137
@@ -398,7 +398,6 @@
      }
    x = 0;
    y = 0;
-   DetermineEwinArea(ewin);
    ResizeEwin(ewin, ewin->client.w, ewin->client.h);
 
    if (ewin->client.transient)
@@ -1641,6 +1640,11 @@
 void
 EwinUpdateAfterMoveResize(EWin * ewin, int resize)
 {
+   if (!ewin)
+      return;
+
+   DetermineEwinArea(ewin);
+
    if (ewin->dialog)
       DialogMove(ewin->dialog);
    else if (ewin->menu)
@@ -1889,9 +1893,6 @@
 
    EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
 
-   if (move)
-      DetermineEwinArea(ewin);
-
    if ((mode.mode != MODE_MOVE_PENDING && mode.mode != MODE_MOVE)
        || (mode.have_place_grab))
       ICCCM_Configure(ewin);
@@ -3142,16 +3143,21 @@
 int
 EwinIsOnScreen(EWin * ewin)
 {
-   int                 desk;
+   int                 x, y, w, h;
 
    if (ewin->sticky)
       return 1;
-   desk = ewin->desktop;
-   if (desk != desks.current)
+   if (ewin->desktop != desks.current)
       return 0;
-   if (ewin->area_x != desks.desk[desk].current_area_x ||
-       ewin->area_y != desks.desk[desk].current_area_y)
+
+   x = ewin->x;
+   y = ewin->y;
+   w = ewin->w;
+   h = ewin->h;
+
+   if (x + w <= 0 || x >= root.w || y + h <= 0 || y >= root.h)
       return 0;
+
    return 1;
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- desktops.c  18 Feb 2004 22:18:40 -0000      1.64
+++ desktops.c  21 Feb 2004 13:47:58 -0000      1.65
@@ -1141,11 +1141,8 @@
        DesktopAddEwinToTop(ewin);
        EReparentWindow(disp, ewin->win, desks.desk[ewin->desktop].win, ewin->x,
                        ewin->y);
-       RaiseEwin(ewin);
-/*      ShowEwin(ewin); */
-       ICCCM_Configure(ewin);
        StackDesktops();
-       SetEwinToCurrentArea(ewin);
+       MoveEwin(ewin, ewin->x, ewin->y);
      }
    else
      {
@@ -1846,7 +1843,7 @@
    EDBUG(3, "MoveEwinToDesktopAt");
 /*   ewin->sticky = 0; */
    ewin->floating = 0;
-   if (num != ewin->desktop)
+   if (num != ewin->desktop && !ewin->sticky)
      {
        DesktopRemoveEwin(ewin);
        ForceUpdatePagersForDesktop(ewin->desktop);
@@ -1874,7 +1871,7 @@
             Efree(lst);
          }
      }
-   ForceUpdatePagersForDesktop(ewin->desktop);
+   ForceUpdatePagersForDesktop(num);
    EDBUG_RETURN_;
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -3 -r1.66 -r1.67
--- pager.c     16 Feb 2004 22:03:44 -0000      1.66
+++ pager.c     21 Feb 2004 13:47:58 -0000      1.67
@@ -1738,12 +1738,16 @@
    int                 i, num;
    Pager              *p;
    EWin               *ewin, **gwins;
-   int                 pax, pay;
+   int                 x, y, pax, pay;
+   int                 mode_was;
 
    p = FindPager(win);
    if (p == NULL)
       goto exit;
 
+   mode_was = mode.mode;
+   mode.mode = MODE_NONE;
+
    if (((int)ev->xbutton.button == conf.pagers.sel_button))
      {
        if (win != mode.last_bpress)
@@ -1771,41 +1775,19 @@
                      LIST_FINDBY_POINTER, LIST_TYPE_EWIN))
           p->hi_ewin = NULL;
 
-       switch (mode.mode)
+       switch (mode_was)
          {
          case MODE_PAGER_DRAG:
             if (!p->hi_ewin)
                break;
 
-            ewin = NULL;
-            for (i = 0; i < desks.desk[desks.current].num; i++)
-              {
-                 EWin               *ew;
-
-                 ew = desks.desk[desks.current].list[i];
-                 if (((ew->pager) || (ew->ibox))
-                     && ((ew->desktop == desks.current) || (ew->sticky)))
-                   {
-                      if ((ev->xbutton.x_root >=
-                           (ew->x + ew->border->border.left))
-                          && (ev->xbutton.x_root <
-                              (ew->x + ew->w - ew->border->border.right))
-                          && (ev->xbutton.y_root >=
-                              (ew->y + ew->border->border.top))
-                          && (ev->xbutton.y_root <
-                              (ew->y + ew->h - ew->border->border.bottom)))
-                        {
-                           ewin = ew;
-                           i = desks.desk[desks.current].num;
-                        }
-                   }
-              }
-
+            /* Find which pager or iconbox we are in (if any) */
             ewin = GetEwinPointerInClient();
             if ((ewin) && (ewin->pager))
               {
+                 /* Pointer is in pager */
                  Pager              *pp;
-                 int                 w, h, x, y, ax, ay, cx, cy, px, py;
+                 int                 w, h, ax, ay, cx, cy, px, py;
                  int                 wx, wy, base_x = 0, base_y = 0;
                  Window              dw;
 
@@ -1824,18 +1806,16 @@
                  if (((x + w) <= px) || ((y + h) <= py)
                      || (x >= (px + pp->w)) || (y >= (py + pp->h)))
                    {
-                      int                 ndesk, nx, ny;
+                      int                 nx, ny;
 
-                      ndesk = desks.current;
                       nx = (int)ev->xbutton.x_root -
                          desks.desk[desks.current].x -
                          ((int)p->hi_ewin->w / 2);
                       ny = (int)ev->xbutton.y_root -
                          desks.desk[desks.current].y -
                          ((int)p->hi_ewin->h / 2);
-                      MoveEwin(p->hi_ewin, nx, ny);
-                      if (!p->hi_ewin->sticky)
-                         MoveEwinToDesktop(p->hi_ewin, ndesk);
+
+                      MoveEwinToDesktopAt(p->hi_ewin, desks.current, nx, ny);
                    }
                  else
                    {
@@ -1853,29 +1833,25 @@
                            }
                       for (i = 0; i < num; i++)
                         {
-                           if (!gwins[i]->sticky)
-                              MoveEwinToDesktopAt(gwins[i], pp->desktop,
-                                                  wx + (gwin_px[i] -
-                                                        base_x),
-                                                  wy + (gwin_py[i] - base_y));
-                           else
-                              MoveEwin(gwins[i],
-                                       ((root.w * ax) + wx +
-                                        (gwin_px[i] - base_x)) % root.w,
-                                       ((root.h * ay) + wy +
-                                        (gwin_py[i] - base_y)) % root.h);
+                           x = wx + gwin_px[i] - base_x;
+                           y = wy + gwin_py[i] - base_y;
+                           MoveEwinToDesktopAt(gwins[i], pp->desktop, x, y);
                         }
                       if (gwins)
                          Efree(gwins);
                    }
               }
-            else if ((ewin) && (ewin->ibox) && (!((p->hi_ewin->ibox)
-                                                  /* || ((ewin->client.need_input) && 
((ewin->skiptask) || (ewin->skipwinlist))) */
-                                                )))
+            else if ((ewin) && (ewin->ibox))
               {
-                 gwins =
-                    ListWinGroupMembersForEwin(p->hi_ewin, ACTION_MOVE,
-                                               mode.nogroup, &num);
+                 /* Pointer is in iconbox */
+
+                 /* Don't iconify an iconbox by dragging */
+                 if (p->hi_ewin->ibox)
+                    break;
+
+                 /* Iconify after moving back to pre-drag position */
+                 gwins = ListWinGroupMembersForEwin(p->hi_ewin, ACTION_MOVE,
+                                                    mode.nogroup, &num);
                  for (i = 0; i < num; i++)
                    {
                       if (!gwins[i]->pager)
@@ -1889,19 +1865,18 @@
               }
             else
               {
-                 int                 ndesk, nx, ny, base_x = 0, base_y =
-                    0, ax, ay;
+                 /* Pointer is not in pager or iconbox */
+                 int                 nx, ny, base_x = 0, base_y = 0, ax, ay;
 
-                 ndesk = desks.current;
+                 /* Move window(s) to pointer location */
                  nx = (int)ev->xbutton.x_root -
                     desks.desk[desks.current].x - ((int)p->hi_ewin->w / 2);
                  ny = (int)ev->xbutton.y_root -
                     desks.desk[desks.current].y - ((int)p->hi_ewin->h / 2);
                  GetAreaSize(&ax, &ay);
 
-                 gwins =
-                    ListWinGroupMembersForEwin(p->hi_ewin, ACTION_MOVE,
-                                               mode.nogroup, &num);
+                 gwins = ListWinGroupMembersForEwin(p->hi_ewin, ACTION_MOVE,
+                                                    mode.nogroup, &num);
                  for (i = 0; i < num; i++)
                     if (gwins[i] == p->hi_ewin)
                       {
@@ -1910,17 +1885,9 @@
                       }
                  for (i = 0; i < num; i++)
                    {
-                      if (!gwins[i]->sticky)
-                         MoveEwin(gwins[i], nx + (gwin_px[i] - base_x),
-                                  ny + (gwin_py[i] - base_y));
-                      else
-                         MoveEwin(gwins[i],
-                                  ((root.w * ax) + nx +
-                                   (gwin_px[i] - base_x)) % root.w,
-                                  ((root.h * ay) + ny +
-                                   (gwin_py[i] - base_y)) % root.h);
-                      if (!gwins[i]->sticky)
-                         MoveEwinToDesktop(gwins[i], ndesk);
+                      x = nx + gwin_px[i] - base_x;
+                      y = ny + gwin_py[i] - base_y;
+                      MoveEwinToDesktopAt(gwins[i], desks.current, x, y);
                    }
                  if (gwins)
                     Efree(gwins);
@@ -1951,8 +1918,8 @@
             PagerHideHi(p);
          }
 
-       mode.mode = MODE_NONE;
        mode.context_pager = NULL;
+       UnGrabTheButtons();
      }
 
  exit:




-------------------------------------------------------
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