Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h borders.c dialog.c draw.c ecompmgr.c ecompmgr.h eobj.c 
        events.c ewin-ops.c ewins.c menus.c moveresize.c 


Log Message:
More composite manager and geometry handling stuff.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.416
retrieving revision 1.417
diff -u -3 -r1.416 -r1.417
--- E.h 29 Apr 2005 18:24:50 -0000      1.416
+++ E.h 1 May 2005 11:27:34 -0000       1.417
@@ -538,10 +538,6 @@
 #define EoGetPixmap(eo)         EobjGetPixmap(&((eo)->o))
 
 #define EoSetName(eo, _x)       (eo)->o.name = (_x)
-#define EoSetX(eo, _x)          (eo)->o.x = (_x)
-#define EoSetY(eo, _y)          (eo)->o.y = (_y)
-#define EoSetW(eo, _w)          (eo)->o.w = (_w)
-#define EoSetH(eo, _h)          (eo)->o.h = (_h)
 #define EoSetSticky(eo, _x)     (eo)->o.sticky = ((_x)?1:0)
 #define EoSetFloating(eo, _f)   EobjSetFloating(&((eo)->o), (_f))
 #define EoSetDesk(eo, _d)       EobjSetDesk(&((eo)->o), (_d))
@@ -564,6 +560,7 @@
 #define EoMove(eo, x, y)                EobjMove(&((eo)->o), x, y)
 #define EoResize(eo, w, h)              EobjResize(&((eo)->o), w, h)
 #define EoMoveResize(eo, x, y, w, h)    EobjMoveResize(&((eo)->o), x, y, w, h)
+#define EoReparent(eo, d, x, y)         EobjReparent(&((eo)->o), d, x, y)
 
 typedef struct
 {
@@ -709,7 +706,6 @@
    EObj                o;
    char                type;
    char                state;
-   int                 ld;     /* Last desk */
    int                 lx, ly; /* Last pos */
    int                 lw, lh; /* Last size */
    int                 ll;     /* Last layer */
@@ -785,7 +781,7 @@
       char               *wm_icon_name;
       unsigned int        opacity;
    } ewmh;
-   int                 shape_x, shape_y;
+   int                 shape_x, shape_y, shape_w, shape_h;
    int                 req_x, req_y;
    void                (*MoveResize) (EWin * ewin, int resize);
    void                (*Refresh) (EWin * ewin);
@@ -1545,6 +1541,7 @@
 void                EobjMove(EObj * eo, int x, int y);
 void                EobjResize(EObj * eo, int w, int h);
 void                EobjMoveResize(EObj * eo, int x, int y, int w, int h);
+void                EobjReparent(EObj * eo, int desk, int x, int y);
 
 #if USE_COMPOSITE
 Pixmap              EobjGetPixmap(const EObj * eo);
@@ -1626,7 +1623,6 @@
 EWin               *AddInternalToFamily(Window win, const char *bname, int 
type,
                                        void *ptr,
                                        void (*init) (EWin * ewin, void *ptr));
-void                EwinConformToDesktop(EWin * ewin);
 void                EwinReparent(EWin * ewin, Window parent);
 void                SyncBorderToEwin(EWin * ewin);
 Window              EwinGetClientWin(const EWin * ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.256
retrieving revision 1.257
diff -u -3 -r1.256 -r1.257
--- borders.c   15 Apr 2005 21:07:42 -0000      1.256
+++ borders.c   1 May 2005 11:27:34 -0000       1.257
@@ -192,7 +192,7 @@
 }
 
 static void
-BorderWinpartCalc(EWin * ewin, int i)
+BorderWinpartCalc(EWin * ewin, int i, int ww, int hh)
 {
    int                 x, y, w, h, ox, oy, max, min;
    int                 topleft, bottomright;
@@ -200,18 +200,16 @@
    topleft = ewin->border->part[i].geom.topleft.originbox;
    bottomright = ewin->border->part[i].geom.bottomright.originbox;
    if (topleft >= 0)
-      BorderWinpartCalc(ewin, topleft);
+      BorderWinpartCalc(ewin, topleft, ww, hh);
    if (bottomright >= 0)
-      BorderWinpartCalc(ewin, bottomright);
+      BorderWinpartCalc(ewin, bottomright, ww, hh);
    x = y = 0;
    if (topleft == -1)
      {
        x = ((ewin->border->part[i].geom.topleft.x.percent *
-             EoGetW(ewin)) >> 10) +
-          ewin->border->part[i].geom.topleft.x.absolute;
+             ww) >> 10) + ewin->border->part[i].geom.topleft.x.absolute;
        y = ((ewin->border->part[i].geom.topleft.y.percent *
-             EoGetH(ewin)) >> 10) +
-          ewin->border->part[i].geom.topleft.y.absolute;
+             hh) >> 10) + ewin->border->part[i].geom.topleft.y.absolute;
      }
    else if (topleft >= 0)
      {
@@ -228,10 +226,10 @@
    if (bottomright == -1)
      {
        ox = ((ewin->border->
-              part[i].geom.bottomright.x.percent * EoGetW(ewin)) >> 10) +
+              part[i].geom.bottomright.x.percent * ww) >> 10) +
           ewin->border->part[i].geom.bottomright.x.absolute;
        oy = ((ewin->border->
-              part[i].geom.bottomright.y.percent * EoGetH(ewin)) >> 10) +
+              part[i].geom.bottomright.y.percent * hh) >> 10) +
           ewin->border->part[i].geom.bottomright.y.absolute;
      }
    else if (bottomright >= 0)
@@ -373,7 +371,7 @@
 void
 EwinBorderCalcSizes(EWin * ewin)
 {
-   int                 i;
+   int                 i, ww, hh;
    char                reshape;
 
    if (!ewin)
@@ -381,11 +379,14 @@
    if (!ewin->border)
       return;
 
+   ww = EoGetW(ewin);
+   hh = EoGetH(ewin);
+
    for (i = 0; i < ewin->border->num_winparts; i++)
       ewin->bits[i].w = -2;
    for (i = 0; i < ewin->border->num_winparts; i++)
       if (ewin->bits[i].w == -2)
-        BorderWinpartCalc(ewin, i);
+        BorderWinpartCalc(ewin, i, ww, hh);
    for (i = 0; i < ewin->border->num_winparts; i++)
       BorderWinpartRealise(ewin, i);
 
@@ -749,7 +750,7 @@
       ewin->bits[i].w = -2;
    for (i = 0; i < ewin->border->num_winparts; i++)
       if (ewin->bits[i].w == -2)
-        BorderWinpartCalc(ewin, i);
+        BorderWinpartCalc(ewin, i, pw, ph);
 
    switch (ewin->border->shadedir)
      {
@@ -772,7 +773,7 @@
             if (rightborderwidth < w)
                rightborderwidth = w;
          }
-       EoSetW(ewin, rightborderwidth + leftborderwidth);
+       pw = rightborderwidth + leftborderwidth;
        break;
      case 2:
      case 3:
@@ -791,7 +792,7 @@
             if (bottomborderwidth < h)
                bottomborderwidth = h;
          }
-       EoSetH(ewin, bottomborderwidth + topborderwidth);
+       ph = bottomborderwidth + topborderwidth;
        break;
      default:
        break;
@@ -801,7 +802,7 @@
       ewin->bits[i].w = -2;
    for (i = 0; i < ewin->border->num_winparts; i++)
       if (ewin->bits[i].w == -2)
-        BorderWinpartCalc(ewin, i);
+        BorderWinpartCalc(ewin, i, pw, ph);
 
    min_w = 0;
    min_h = 0;
@@ -819,9 +820,6 @@
           min_h = h;
      }
 
-   EoSetW(ewin, pw);
-   EoSetH(ewin, ph);
-
  done:
    *mw = min_w;
    *mh = min_h;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/dialog.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -3 -r1.106 -r1.107
--- dialog.c    25 Apr 2005 16:02:52 -0000      1.106
+++ dialog.c    1 May 2005 11:27:34 -0000       1.107
@@ -636,6 +636,7 @@
          }
        else
          {
+            ResizeEwin(ewin, w, h);
             if (FindADialog() > 1)
                ArrangeEwin(ewin);
             else
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/draw.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -3 -r1.61 -r1.62
--- draw.c      23 Apr 2005 08:28:02 -0000      1.61
+++ draw.c      1 May 2005 11:27:35 -0000       1.62
@@ -938,8 +938,6 @@
      {
      case 0:
        MoveResizeEwin(ewin, x, y, w, h);
-       ewin->shape_x = x;
-       ewin->shape_y = y;
        if (Mode.mode != MODE_NONE)
           CoordsShow(ewin);
        break;
@@ -963,10 +961,8 @@
        x1 = ewin->shape_x + dx;
        y1 = ewin->shape_y + dy;
 
-       w1 = EoGetW(ewin) - (ewin->border->border.left +
-                            ewin->border->border.right);
-       h1 = EoGetH(ewin) - (ewin->border->border.top +
-                            ewin->border->border.bottom);
+       w1 = ewin->shape_w;
+       h1 = ewin->shape_h;
 
        ewin->shape_x = x;
        ewin->shape_y = y;
@@ -978,15 +974,15 @@
             ewin->client.w = w;
             ewin->client.h = h;
             ICCCM_MatchSize(ewin);
-            EoSetW(ewin, ewin->client.w + ewin->border->border.left +
-                   ewin->border->border.right);
-            EoSetH(ewin, ewin->client.h + ewin->border->border.top +
-                   ewin->border->border.bottom);
+            if (!ewin->shaded)
+              {
+                 ewin->shape_w = ewin->client.w;
+                 ewin->shape_h = ewin->client.h;
+              }
          }
-       w = EoGetW(ewin) - (ewin->border->border.left +
-                           ewin->border->border.right);
-       h = EoGetH(ewin) - (ewin->border->border.top +
-                           ewin->border->border.bottom);
+       w = ewin->shape_w;
+       h = ewin->shape_h;
+
        if (!gc)
          {
             gcv.function = GXxor;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecompmgr.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ecompmgr.c  25 Apr 2005 22:07:37 -0000      1.23
+++ ecompmgr.c  1 May 2005 11:27:35 -0000       1.24
@@ -1204,6 +1204,35 @@
    ECompMgrWinMoveResize(eo, x, y, w, h, bw);
 }
 
+void
+ECompMgrWinReparent(EObj * eo, int desk, int x, int y)
+{
+   ECmWinInfo         *cw = eo->cmhook;
+
+   D1printf("ECompMgrWinReparent %#lx %#lx d=%d x,y=%d,%d\n",
+           eo->win, cw->extents, desk, x, y);
+
+   /* Invalidate old window region */
+   if (eo->shown)
+     {
+       if (EventDebug(EDBUG_TYPE_COMPMGR3))
+          ERegionShow("old-extents:", cw->extents);
+       ECompMgrDamageMerge(eo->desk, cw->extents, 0);
+     }
+
+   if (cw->a.x != x || cw->a.y != y)
+     {
+       ECompMgrWinInvalidate(eo, INV_POS);
+
+       cw->a.x = x;
+       cw->a.y = y;
+
+       /* Find new window region */
+       if (eo->shown)          /* FIXME - ??? */
+          cw->extents = win_extents(disp, eo);
+     }
+}
+
 static void
 ECompMgrWinCirculate(EObj * eo, XEvent * ev)
 {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecompmgr.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ecompmgr.h  22 Apr 2005 07:02:11 -0000      1.7
+++ ecompmgr.h  1 May 2005 11:27:42 -0000       1.8
@@ -39,6 +39,8 @@
 void                ECompMgrWinUnmap(EObj * eo);
 void                ECompMgrWinMoveResize(EObj * eo, int x, int y, int w, int 
h,
                                          int bw);
+void                ECompMgrWinReparent(EObj * eo, int desk, int x, int y);
+
 void                ECompMgrWinChangeOpacity(EObj * eo, unsigned int opacity);
 Pixmap              ECompMgrWinGetPixmap(const EObj * eo);
 void                ECompMgrConfigGet(cfg_composite * cfg);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/eobj.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- eobj.c      23 Apr 2005 08:07:26 -0000      1.22
+++ eobj.c      1 May 2005 11:27:42 -0000       1.23
@@ -26,26 +26,27 @@
 void
 EobjSetDesk(EObj * eo, int desk)
 {
-   int                 pdesk = eo->desk;
-
    switch (eo->type)
      {
      default:
-       eo->desk = desk;
        break;
 
      case EOBJ_TYPE_EWIN:
-       if (eo->floating)
-          eo->desk = 0;
+       if (eo->floating > 1)
+          desk = 0;
        else if (eo->sticky || eo->desk < 0)
-          eo->desk = DesksGetCurrent();
+          desk = DesksGetCurrent();
        else
-          eo->desk = desk % Conf.desks.num;
+          desk = desk % Conf.desks.num;
        break;
      }
 
-   if (eo->desk != pdesk && eo->stacked > 0)
-      DeskSetDirtyStack(eo->desk);
+   if (desk != eo->desk)
+     {
+       if (eo->stacked > 0)
+          DeskSetDirtyStack(desk);
+       eo->desk = desk;
+     }
 }
 
 void
@@ -354,6 +355,26 @@
    EobjMoveResize(eo, eo->x, eo->y, w, h);
 }
 
+void
+EobjReparent(EObj * eo, int desk, int x, int y)
+{
+   Desk               *d;
+
+   d = DeskGet(desk);
+   if (!d)
+      return;
+
+   eo->x = x;
+   eo->y = y;
+
+   EReparentWindow(eo->win, EoGetWin(d), x, y);
+#if USE_COMPOSITE
+   if (eo->cmhook)
+      ECompMgrWinReparent(eo, desk, x, y);
+#endif
+   EobjSetDesk(eo, desk);
+}
+
 #if USE_COMPOSITE
 Pixmap
 EobjGetPixmap(const EObj * eo)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -3 -r1.84 -r1.85
--- events.c    25 Apr 2005 22:07:37 -0000      1.84
+++ events.c    1 May 2005 11:27:42 -0000       1.85
@@ -178,8 +178,11 @@
      case KeyPress:
        Mode.last_keycode = ev->xkey.keycode;
      case KeyRelease:
+       ModeGetXY(ev->xbutton.root, ev->xkey.x_root, ev->xkey.y_root);
+       goto do_stuff;
      case ButtonPress:
      case ButtonRelease:
+       ModeGetXY(ev->xbutton.root, ev->xbutton.x_root, ev->xbutton.y_root);
        goto do_stuff;
      case EnterNotify:
        Mode.context_win = ev->xany.window;
@@ -231,7 +234,6 @@
      {
      case KeyPress:            /*  2 */
      case KeyRelease:          /*  3 */
-       ModeGetXY(ev->xbutton.root, ev->xkey.x_root, ev->xkey.y_root);
        /* Unfreeze keyboard in case we got here by keygrab */
        XAllowEvents(disp, AsyncKeyboard, CurrentTime);
        break;
@@ -248,13 +250,10 @@
 
        if (Mode.double_click)
           ev->xbutton.time = 0;
-       ModeGetXY(ev->xbutton.root, ev->xbutton.x_root, ev->xbutton.y_root);
        break;
      case ButtonRelease:       /*  5 */
        SoundPlay("SOUND_BUTTON_RAISE");
 
-       ModeGetXY(ev->xbutton.root, ev->xbutton.x_root, ev->xbutton.y_root);
-
 #if 0                          /* FIXME - TBD */
        /* DON'T handle clicks whilst moving/resizing things */
        if ((Mode.mode != MODE_NONE) &&
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewin-ops.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewin-ops.c  28 Apr 2005 22:11:19 -0000      1.26
+++ ewin-ops.c  1 May 2005 11:27:42 -0000       1.27
@@ -296,6 +296,8 @@
           move = 1;
        ewin->client.x = x + ewin->border->border.left;
        ewin->client.y = y + ewin->border->border.top;
+       ewin->shape_x = x;
+       ewin->shape_y = y;
      }
    else
      {
@@ -317,6 +319,10 @@
          {
             w = EoGetW(ewin);
             h = EoGetH(ewin);
+            ewin->shape_w = w -
+               (ewin->border->border.left + ewin->border->border.right);
+            ewin->shape_h = h -
+               (ewin->border->border.top + ewin->border->border.bottom);
          }
        else
          {
@@ -324,6 +330,8 @@
                ewin->border->border.right;
             h = ewin->client.h + ewin->border->border.top +
                ewin->border->border.bottom;
+            ewin->shape_w = ewin->client.w;
+            ewin->shape_h = ewin->client.h;
          }
      }
    else
@@ -362,11 +370,7 @@
      }
 
    if ((Mode.mode == MODE_NONE) /* && (move || resize) */ )
-     {
-       ewin->shape_x = x;
-       ewin->shape_y = y;
-       EwinUpdateAfterMoveResize(ewin, resize);
-     }
+      EwinUpdateAfterMoveResize(ewin, resize);
 
    call_depth--;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- ewins.c     29 Apr 2005 18:24:52 -0000      1.51
+++ ewins.c     1 May 2005 11:27:42 -0000       1.52
@@ -82,7 +82,6 @@
 
    ewin->type = type;
    ewin->state = (Mode.wm.startup) ? EWIN_STATE_STARTUP : EWIN_STATE_NEW;
-   ewin->ld = -1;
    ewin->lx = -1;
    ewin->ly = -1;
    ewin->lw = -1;
@@ -759,6 +758,7 @@
        ewin->st.fullscreen = 0;
        EwinSetFullscreen(ewin, 1);
        ewin->client.already_placed = 1;
+       MoveEwinToDesktopAt(ewin, desk, EoGetX(ewin), EoGetY(ewin));
        ShowEwin(ewin);
        goto done;
      }
@@ -927,7 +927,7 @@
           EoIsFloating(ewin));
 #endif
 
-   EwinConformToDesktop(ewin);
+   MoveEwinToDesktopAt(ewin, EoGetDesk(ewin), EoGetX(ewin), EoGetY(ewin));
 
  done:
    ecore_x_ungrab();
@@ -964,101 +964,6 @@
       EwinDestroy(ewin);
 }
 
-void
-EwinConformToDesktop(EWin * ewin)
-{
-   Window              dwin;
-
-   dwin = DeskGetWin(EoGetDesk(ewin));
-   if ((ewin->iconified) && (ewin->parent != dwin))
-     {
-       ewin->parent = dwin;
-       EReparentWindow(EoGetWin(ewin), dwin, EoGetX(ewin), EoGetY(ewin));
-       RaiseEwin(ewin);
-       ICCCM_Configure(ewin);
-     }
-   else if (EoIsFloating(ewin))
-     {
-       if ((ewin->parent != VRoot.win) && (EoIsFloating(ewin) == 2))
-         {
-            ewin->parent = VRoot.win;
-            EReparentWindow(EoGetWin(ewin), VRoot.win, EoGetX(ewin),
-                            EoGetY(ewin));
-            EoSetDesk(ewin, 0);
-         }
-       RaiseEwin(ewin);
-       ICCCM_Configure(ewin);
-     }
-   else if (ewin->parent != dwin)
-     {
-       ewin->parent = dwin;
-       EReparentWindow(EoGetWin(ewin), dwin, EoGetX(ewin), EoGetY(ewin));
-       RaiseEwin(ewin);
-       MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
-     }
-   else
-     {
-       RaiseEwin(ewin);
-       MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
-     }
-
-   EwinDetermineArea(ewin);
-   HintsSetWindowDesktop(ewin);
-}
-
-void
-MoveEwinToDesktop(EWin * ewin, int desk)
-{
-   MoveEwinToDesktopAt(ewin, desk, EoGetX(ewin), EoGetY(ewin));
-}
-
-void
-MoveEwinToDesktopAt(EWin * ewin, int desk, int x, int y)
-{
-   EWin              **lst;
-   int                 i, num;
-   int                 pdesk, dx, dy;
-
-   EoSetFloating(ewin, 0);
-
-#if 0
-   Eprintf("MoveEwinToDesktopAt: %#lx %d->%d\n", ewin->client.win,
-          EoGetDesk(ewin), desk);
-#endif
-
-   pdesk = ewin->ld;
-   desk = desk % Conf.desks.num;
-   EoSetDesk(ewin, desk);
-
-   if (desk != pdesk && !EoIsSticky(ewin))
-     {
-       SnapshotEwinUpdate(ewin, SNAP_USE_DESK);
-       if (pdesk >= 0)
-          ModulesSignal(ESIGNAL_DESK_CHANGE, (void *)pdesk);
-     }
-
-   dx = x - EoGetX(ewin);
-   dy = y - EoGetY(ewin);
-   EoSetX(ewin, x);
-   EoSetY(ewin, y);
-   EwinConformToDesktop(ewin);
-
-   lst = EwinListTransients(ewin, &num, 0);
-   for (i = 0; i < num; i++)
-      MoveEwinToDesktopAt(lst[i], desk, EoGetX(lst[i]) + dx,
-                         EoGetY(lst[i]) + dy);
-   if (lst)
-      Efree(lst);
-
-   ModulesSignal(ESIGNAL_DESK_CHANGE, (void *)desk);
-}
-
-void
-EwinReparent(EWin * ewin, Window parent)
-{
-   EReparentWindow(ewin->client.win, parent, 0, 0);
-}
-
 static void
 EwinEventMapRequest(EWin * ewin, Window win)
 {
@@ -1395,32 +1300,114 @@
    ModulesSignal(ESIGNAL_EWIN_CHANGE, ewin);
 }
 
-#if 0                          /* Unused */
+#if 0                          /* FIXME - Remove */
 void
-FloatEwin(EWin * ewin)
+EwinConformToDesktop(EWin * ewin)
+{
+   Window              dwin;
+
+   dwin = DeskGetWin(EoGetDesk(ewin));
+   if ((ewin->iconified) && (ewin->parent != dwin))
+     {
+       ewin->parent = dwin;
+       EReparentWindow(EoGetWin(ewin), dwin, EoGetX(ewin), EoGetY(ewin));
+       RaiseEwin(ewin);
+       ICCCM_Configure(ewin);
+     }
+   else if (EoIsFloating(ewin))
+     {
+       if ((ewin->parent != VRoot.win) && (EoIsFloating(ewin) == 2))
+         {
+            ewin->parent = VRoot.win;
+            EReparentWindow(EoGetWin(ewin), VRoot.win, EoGetX(ewin),
+                            EoGetY(ewin));
+            EoSetDesk(ewin, 0);
+         }
+       RaiseEwin(ewin);
+       ICCCM_Configure(ewin);
+     }
+   else if (ewin->parent != dwin)
+     {
+       ewin->parent = dwin;
+       EReparentWindow(EoGetWin(ewin), dwin, EoGetX(ewin), EoGetY(ewin));
+       RaiseEwin(ewin);
+       MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
+     }
+   else
+     {
+       RaiseEwin(ewin);
+       MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
+     }
+
+   EwinDetermineArea(ewin);
+   HintsSetWindowDesktop(ewin);
+}
+#endif
+
+void
+MoveEwinToDesktop(EWin * ewin, int desk)
+{
+   MoveEwinToDesktopAt(ewin, desk, EoGetX(ewin), EoGetY(ewin));
+}
+
+void
+MoveEwinToDesktopAt(EWin * ewin, int desk, int x, int y)
 {
-   static int          call_depth = 0;
    EWin              **lst;
    int                 i, num;
+   int                 pdesk, dx, dy;
 
-   call_depth++;
-   if (call_depth > 256)
-      return;
+#if 0
+   Eprintf("MoveEwinToDesktopAt: %#lx %d->%d\n", ewin->client.win,
+          EoGetDesk(ewin), desk);
+#endif
+
+   pdesk = (ewin->o.stacked >= 0) ? EoGetDesk(ewin) : 0;
+   desk = desk % Conf.desks.num;
+
+   if (desk != pdesk && !EoIsSticky(ewin))
+     {
+       SnapshotEwinUpdate(ewin, SNAP_USE_DESK);
+       if (EoIsShown(ewin))
+          ModulesSignal(ESIGNAL_DESK_CHANGE, (void *)pdesk);
+     }
+
+   dx = x - EoGetX(ewin);
+   dy = y - EoGetY(ewin);
+   if (desk != pdesk)
+     {
+       EoReparent(ewin, desk, x, y);
+       RaiseEwin(ewin);
+       if (ewin->iconified)
+          ICCCM_Configure(ewin);
+       else
+          MoveEwin(ewin, x, y);
+     }
+   else
+     {
+       RaiseEwin(ewin);
+       MoveEwin(ewin, x, y);
+     }
 
-   EoSetFloating(ewin, 1);
-   EoSetDesk(ewin, 0);
-   EwinConformToDesktop(ewin);
-   RaiseEwin(ewin);
+   EwinDetermineArea(ewin);
+   HintsSetWindowDesktop(ewin);
 
    lst = EwinListTransients(ewin, &num, 0);
    for (i = 0; i < num; i++)
-      FloatEwin(lst[i]);
+      MoveEwinToDesktopAt(lst[i], desk, EoGetX(lst[i]) + dx,
+                         EoGetY(lst[i]) + dy);
    if (lst)
       Efree(lst);
 
-   call_depth--;
+   if (EoIsShown(ewin))
+      ModulesSignal(ESIGNAL_DESK_CHANGE, (void *)desk);
+}
+
+void
+EwinReparent(EWin * ewin, Window parent)
+{
+   EReparentWindow(ewin->client.win, parent, 0, 0);
 }
-#endif
 
 void
 FloatEwinAt(EWin * ewin, int x, int y)
@@ -1428,12 +1415,14 @@
    static int          call_depth = 0;
    int                 dx, dy;
    EWin              **lst;
-   int                 i, num;
+   int                 i, num, desk, pdesk;
 
    call_depth++;
    if (call_depth > 256)
       return;
 
+   pdesk = EoGetDesk(ewin);
+
    if (EoIsFloating(ewin))
      {
        /* Reparenting to root moves the desktop-relative coordinates */
@@ -1444,18 +1433,31 @@
        ewin->req_x += dx;
        ewin->req_y += dy;
        EoSetFloating(ewin, 2);
+       desk = 0;
      }
    else
      {
-       ewin->ld = EoGetDesk(ewin);
        EoSetFloating(ewin, 1);
+       desk = pdesk;
      }
 
    dx = x - EoGetX(ewin);
    dy = y - EoGetY(ewin);
-   EoSetX(ewin, x);
-   EoSetY(ewin, y);
-   EwinConformToDesktop(ewin);
+
+   if (desk != pdesk)
+     {
+       ewin->o.desk = pdesk;   /* FIXME */
+       EoReparent(ewin, desk, x, y);
+       ICCCM_Configure(ewin);
+       HintsSetWindowDesktop(ewin);
+     }
+   else
+     {
+       RaiseEwin(ewin);
+       MoveEwin(ewin, x, y);
+     }
+
+   EwinDetermineArea(ewin);
 
    lst = EwinListTransients(ewin, &num, 0);
    for (i = 0; i < num; i++)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -3 -r1.186 -r1.187
--- menus.c     27 Apr 2005 16:11:05 -0000      1.186
+++ menus.c     1 May 2005 11:27:42 -0000       1.187
@@ -349,7 +349,6 @@
        if (!noshow)
          {
             ICCCM_Cmap(NULL);
-            MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
             FloatEwinAt(ewin, EoGetX(ewin), EoGetY(ewin));
             ShowEwin(ewin);
             if (Conf.menus.animate)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/moveresize.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- moveresize.c        23 Apr 2005 07:31:16 -0000      1.35
+++ moveresize.c        1 May 2005 11:27:43 -0000       1.36
@@ -130,16 +130,21 @@
        if ((EoIsFloating(gwins[i])) || (Conf.movres.mode_move > 0))
          {
             if (EoIsFloating(gwins[i]))
-               MoveEwinToDesktopAt(gwins[i], d,
-                                   gwins[i]->shape_x -
-                                   (DeskGetX(d) -
-                                    DeskGetX(EoGetDesk(gwins[i]))),
-                                   gwins[i]->shape_y -
-                                   (DeskGetY(d) -
-                                    DeskGetY(EoGetDesk(gwins[i]))));
+              {
+                 EoSetFloating(gwins[i], 0);
+                 MoveEwinToDesktopAt(gwins[i], d,
+                                     gwins[i]->shape_x -
+                                     (DeskGetX(d) -
+                                      DeskGetX(EoGetDesk(gwins[i]))),
+                                     gwins[i]->shape_y -
+                                     (DeskGetY(d) -
+                                      DeskGetY(EoGetDesk(gwins[i]))));
+              }
             else
-               MoveEwinToDesktopAt(gwins[i], d, gwins[i]->shape_x,
-                                   gwins[i]->shape_y);
+              {
+                 MoveEwinToDesktopAt(gwins[i], d, gwins[i]->shape_x,
+                                     gwins[i]->shape_y);
+              }
          }
 
        EoChangeOpacity(ewin, ewin->ewmh.opacity);




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to