Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h buttons.c desktops.c eobj.c ewin-ops.c ewins.c 
        moveresize.c stacking.c 


Log Message:
Desktop and stacking fixes.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.377
retrieving revision 1.378
diff -u -3 -r1.377 -r1.378
--- E.h 26 Feb 2005 16:40:36 -0000      1.377
+++ E.h 27 Feb 2005 01:11:49 -0000      1.378
@@ -523,7 +523,7 @@
 #define EoGetH(eo)              ((eo)->o.h)
 #define EoIsSticky(eo)          ((eo)->o.sticky)
 #define EoIsFloating(eo)        ((eo)->o.floating)
-#define EoGetDesk(eo)           EobjGetDesk(&((eo)->o))
+#define EoGetDesk(eo)           ((eo)->o.desk)
 #define EoGetLayer(eo)          ((eo)->o.layer)
 #define EoGetPixmap(eo)         EobjGetPixmap(&((eo)->o))
 
@@ -674,11 +674,12 @@
 struct _ewin
 {
    EObj                o;
-   int                 shape_x, shape_y;
-   int                 req_x, req_y;
-   int                 lx, ly, lw, lh, ll;
    char                type;
    char                state;
+   int                 ld;     /* Last desk */
+   int                 lx, ly; /* Last pos */
+   int                 lw, lh; /* Last size */
+   int                 ll;     /* Last layer */
    char                toggle;
    Window              win_container;
    WinClient           client;
@@ -686,9 +687,8 @@
    const Border       *normal_border;
    const Border       *previous_border;
    EWinBit            *bits;
-   int                 flags;
-   Group             **groups;
    int                 num_groups;
+   Group             **groups;
    char                visibility;
    char                docked;
    char                shown;
@@ -752,6 +752,8 @@
       char               *wm_name;
       char               *wm_icon_name;
    } ewmh;
+   int                 shape_x, shape_y;
+   int                 req_x, req_y;
    void                (*MoveResize) (EWin * ewin, int resize);
    void                (*Refresh) (EWin * ewin);
    void                (*Close) (EWin * ewin);
@@ -1354,6 +1356,7 @@
 void                DeskSetArea(int desk, int ax, int ay);
 int                 DeskIsViewable(int desk);
 void                DeskSetViewable(int desk, int on);
+void                DeskSetDirtyStack(int desk);
 void                DeskGetCurrentArea(int *ax, int *ay);
 Window              DeskGetCurrentRoot(void);
 void                DeskSetCurrentArea(int ax, int ay);
@@ -1369,8 +1372,6 @@
 void                DeskSetBg(int desk, Background * bg, int refresh);
 int                 DesktopAt(int x, int y);
 void                DeskGoto(int num);
-void                DeskRaise(int num);
-void                DeskLower(int num);
 void                DeskMove(int num, int x, int y);
 void                DeskHide(int num);
 void                DeskShow(int num);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- buttons.c   26 Feb 2005 16:40:36 -0000      1.47
+++ buttons.c   27 Feb 2005 01:11:50 -0000      1.48
@@ -150,7 +150,6 @@
    EoSetShadow(b, 0);
 
    EobjListStackAdd(&b->o, 0);
-   EwinListStackRaise(b);
 
    AddItem(b, b->name, id, LIST_TYPE_BUTTON);
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -3 -r1.125 -r1.126
--- desktops.c  26 Feb 2005 16:40:36 -0000      1.125
+++ desktops.c  27 Feb 2005 01:11:50 -0000      1.126
@@ -34,6 +34,7 @@
    EObj                o;
    int                 num;
    char                viewable;
+   char                dirty_stack;
    Background         *bg;
    Button             *tag;
    int                 current_area_x;
@@ -46,11 +47,14 @@
 typedef struct _desktops
 {
    int                 current;
+   int                 previous;
    Desk               *desk[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
    int                 order[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
 }
 Desktops;
 
+static void         DeskRaise(int num);
+static void         DeskLower(int num);
 static void         DesktopHandleEvents(XEvent * ev, void *prm);
 
 /* The desktops */
@@ -308,6 +312,9 @@
      }
 #endif
 
+   /* Restack buttons - Hmmm. */
+   StackDesktop(d->num);
+
    d->tag = b;
 }
 
@@ -550,6 +557,17 @@
    _DeskGet(desk)->viewable = on;
 }
 
+void
+DeskSetDirtyStack(int desk)
+{
+   Desk               *d = _DeskGet(desk);
+
+   if (!d)
+      return;
+
+   d->dirty_stack++;
+}
+
 Window
 DeskGetCurrentRoot(void)
 {
@@ -591,6 +609,8 @@
 {
    int                 i;
 
+   desks.previous = -1;
+
    for (i = 0; i < Conf.desks.num; i++)
       DeskCreate(i, 0);
 }
@@ -603,9 +623,6 @@
    for (i = 0; i < Conf.desks.num; i++)
       DeskResize(i, w, h);
 
-   /* Restack buttons - Hmmm. */
-   StackDesktops();
-
    ModulesSignal(ESIGNAL_DESK_RESIZE, NULL);
 }
 
@@ -631,8 +648,10 @@
       return;
 
    pnum = Conf.desks.num;
+
    for (i = quantity; i < Conf.desks.num; i++)
       DeskLower(i);
+
    Conf.desks.num = quantity;
 
    if (Conf.desks.num > pnum)
@@ -708,9 +727,6 @@
    DesksControlsCreate();
    DesksControlsShow();
 
-   /* Restack buttons - Hmmm. */
-   StackDesktops();
-
    autosave();
 }
 
@@ -972,7 +988,6 @@
 void
 DeskGoto(int desk)
 {
-   static int          pdesk = -1;
    Desk               *d;
    int                 x, y;
 
@@ -983,7 +998,7 @@
        else if (desk < 0)
           desk = Conf.desks.num - 1;
      }
-   if (desk < 0 || desk >= Conf.desks.num || desk == pdesk)
+   if (desk < 0 || desk >= Conf.desks.num || desk == desks.previous)
       return;
 
    if (EventDebug(EDBUG_TYPE_DESKS))
@@ -1066,7 +1081,6 @@
    ModulesSignal(ESIGNAL_DESK_SWITCH_DONE, NULL);
 
    HandleDrawQueue();
-   pdesk = DesksGetCurrent();
 }
 
 void
@@ -1182,7 +1196,7 @@
       EMapWindow(EoGetWin(d));
 }
 
-void
+static void
 DeskRaise(int desk)
 {
    Desk               *d;
@@ -1193,38 +1207,41 @@
 
    d = _DeskGet(desk);
 
-   if (EventDebug(EDBUG_TYPE_DESKS))
-      Eprintf("DeskRaise %d\n", desk);
-
    FocusNewDeskBegin();
    d->viewable = 1;
    DeskRefresh(desk);
    MoveToDeskTop(desk);
 
+   if (EventDebug(EDBUG_TYPE_DESKS))
+      Eprintf("DeskRaise(%d) current=%d\n", desk, desks.current);
+
+   desks.previous = desks.current = desk;
+
    if (desk == 0)
      {
        for (i = Conf.desks.num - 1; i > 0; i--)
-         {
-            DeskHide(desks.order[i]);
-         }
+          DeskHide(desks.order[i]);
      }
+   else
+     {
+       EMapWindow(EoGetWin(d));
+     }
+
    StackDesktops();
-   desks.current = desk;
    MoveStickyWindowsToCurrentDesk();
    MoveStickyButtonsToCurrentDesk();
    StackDesktop(DesksGetCurrent());
    FocusNewDesk();
-#if 0                          /* FIXME - TBD */
-   ModulesSignal(ESIGNAL_DESK_SWITCH_DONE, NULL);
-#endif
    if (Mode.mode == MODE_NONE)
-      HandleDrawQueue();
+     {
+       ModulesSignal(ESIGNAL_DESK_SWITCH_DONE, NULL);
+       HandleDrawQueue();
+     }
    HintsSetCurrentDesktop();
-   EMapWindow(EoGetWin(d));
    ecore_x_sync();
 }
 
-void
+static void
 DeskLower(int desk)
 {
    if ((desk <= 0) || (desk >= Conf.desks.num))
@@ -1232,19 +1249,25 @@
 
    FocusNewDeskBegin();
    MoveToDeskBottom(desk);
+
+   if (EventDebug(EDBUG_TYPE_DESKS))
+      Eprintf("DeskLower(%d) %d -> %d\n", desk, desks.current, desks.order[0]);
+
+   desks.previous = desks.current = desks.order[0];
+
    UncoverDesktop(desks.order[0]);
    DeskHide(desk);
+
    StackDesktops();
-   desks.current = desks.order[0];
    MoveStickyWindowsToCurrentDesk();
    MoveStickyButtonsToCurrentDesk();
    StackDesktop(DesksGetCurrent());
    FocusNewDesk();
-#if 0                          /* FIXME - TBD */
-   ModulesSignal(ESIGNAL_DESK_SWITCH_DONE, NULL);
-#endif
    if (Mode.mode == MODE_NONE)
-      HandleDrawQueue();
+     {
+       ModulesSignal(ESIGNAL_DESK_SWITCH_DONE, NULL);
+       HandleDrawQueue();
+     }
    HintsSetCurrentDesktop();
    ecore_x_sync();
 }
@@ -1388,11 +1411,11 @@
 void
 DeskGotoByEwin(EWin * ewin)
 {
-   if (!EoIsSticky(ewin))
-     {
-       DeskGoto(EoGetDesk(ewin));
-       SetCurrentArea(ewin->area_x, ewin->area_y);
-     }
+   if (EoIsSticky(ewin) || EoIsFloating(ewin))
+      return;
+
+   DeskGoto(EoGetDesk(ewin));
+   SetCurrentArea(ewin->area_x, ewin->area_y);
 }
 
 static char         sentpress = 0;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/eobj.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- eobj.c      20 Feb 2005 23:08:43 -0000      1.11
+++ eobj.c      27 Feb 2005 01:11:51 -0000      1.12
@@ -54,7 +54,9 @@
        eo->desk = desk;
        break;
      case EOBJ_TYPE_EWIN:
-       if (eo->sticky || eo->floating || eo->desk < 0)
+       if (eo->floating)
+          eo->desk = 0;
+       else if (eo->sticky || eo->desk < 0)
           eo->desk = DesksGetCurrent();
        else
           eo->desk = desk % Conf.desks.num;
@@ -128,6 +130,7 @@
       return;
 
    eo->floating = floating;
+   eo->desk = 0;
    EobjSetLayer(eo, eo->layer);
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewin-ops.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ewin-ops.c  26 Feb 2005 16:40:36 -0000      1.14
+++ ewin-ops.c  27 Feb 2005 01:11:51 -0000      1.15
@@ -1285,18 +1285,15 @@
           EoGetDesk(ewin), desk);
 #endif
 
-   pdesk = EoGetDesk(ewin);
+   pdesk = ewin->ld;
    desk = desk % Conf.desks.num;
+   EoSetDesk(ewin, desk);
+
    if (desk != pdesk && !EoIsSticky(ewin))
      {
-#if 0                          /* Not necessary when the the _XROOT... atoms 
are initially set on each desk */
-       /* Refresh bg before apps are planted so they can pick it up */
-       DeskSetViewable(desk, 1);
-       DeskRefresh(desk);
-#endif
-       EoSetDesk(ewin, desk);
        SnapshotEwinUpdate(ewin, SNAP_USE_DESK);
-       ModulesSignal(ESIGNAL_DESK_CHANGE, (void *)pdesk);
+       if (pdesk >= 0)
+          ModulesSignal(ESIGNAL_DESK_CHANGE, (void *)pdesk);
      }
 
    dx = x - EoGetX(ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewins.c     26 Feb 2005 16:40:36 -0000      1.19
+++ ewins.c     27 Feb 2005 01:11:51 -0000      1.20
@@ -67,6 +67,7 @@
 
    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;
@@ -837,10 +838,12 @@
        unsigned int        mask;
        Window              junk, root_return;
 
+#if 0                          /* FIXME: Disable for now */
        /* if the loser has manual placement on and the app asks to be on */
        /*  a desktop, then send E to that desktop so the user can place */
        /* the window there */
        DeskGoto(desk);
+#endif
 
        XQueryPointer(disp, VRoot.win, &root_return, &junk, &rx, &ry, &wx, &wy,
                      &mask);
@@ -1410,9 +1413,14 @@
       return;
 
    if (EoIsFloating(ewin))
-      EoSetFloating(ewin, 2);
+     {
+       EoSetFloating(ewin, 2);
+     }
    else
-      EoSetFloating(ewin, 1);
+     {
+       ewin->ld = EoGetDesk(ewin);
+       EoSetFloating(ewin, 1);
+     }
 
    dx = x - EoGetX(ewin);
    dy = y - EoGetY(ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/moveresize.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- moveresize.c        20 Feb 2005 23:08:45 -0000      1.30
+++ moveresize.c        27 Feb 2005 01:11:51 -0000      1.31
@@ -104,8 +104,6 @@
        return 0;
      }
 
-   d = DesktopAt(Mode.x, Mode.y);
-
    gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_MOVE, Mode.nogroup
                                      || Mode.move.swap, &num);
 
@@ -124,6 +122,8 @@
      }
    Mode.mode = MODE_NONE;
 
+   d = DesktopAt(Mode.x, Mode.y);
+
    for (i = 0; i < num; i++)
      {
        if ((EoIsFloating(gwins[i])) || (Conf.movres.mode_move > 0))
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/stacking.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- stacking.c  20 Feb 2005 23:08:45 -0000      1.16
+++ stacking.c  27 Feb 2005 01:11:51 -0000      1.17
@@ -35,8 +35,12 @@
    int                 nalloc;
    int                 nwins;
    EObj              **list;
+   char                layered;
 };
 
+static int          EobjListRaise(EobjList * ewl, EObj * eo);
+static int          EobjListLower(EobjList * ewl, EObj * eo);
+
 #if ENABLE_DEBUG_STACKING
 static void
 EobjListShow(const char *txt, EobjList * ewl)
@@ -52,8 +56,7 @@
      {
        eo = ewl->list[i];
        Eprintf(" %2d: %#10lx %#10lx %d %d %s\n", i, eo->win,
-               EobjGetCwin(eo), eo->desk,
-               (eo->floating) ? 999 : eo->ilayer, EobjGetName(eo));
+               EobjGetCwin(eo), eo->desk, eo->ilayer, EobjGetName(eo));
      }
 }
 #else
@@ -88,14 +91,34 @@
        ewl->list = (EObj **) Erealloc(ewl->list, ewl->nalloc * sizeof(EObj *));
      }
 
-   if (ontop)
+   if (ewl->layered)
      {
-       memmove(ewl->list + 1, ewl->list, ewl->nwins * sizeof(EObj *));
-       ewl->list[0] = eo;
+       /* The simple way for now (add, raise/lower) */
+       if (ontop)
+         {
+            ewl->list[ewl->nwins] = eo;
+            EobjListRaise(ewl, eo);
+         }
+       else
+         {
+            memmove(ewl->list + 1, ewl->list, ewl->nwins * sizeof(EObj *));
+            ewl->list[0] = eo;
+            EobjListLower(ewl, eo);
+         }
+
+       DeskSetDirtyStack(eo->desk);
      }
    else
      {
-       ewl->list[ewl->nwins] = eo;
+       if (ontop)
+         {
+            memmove(ewl->list + 1, ewl->list, ewl->nwins * sizeof(EObj *));
+            ewl->list[0] = eo;
+         }
+       else
+         {
+            ewl->list[ewl->nwins] = eo;
+         }
      }
    ewl->nwins++;
 
@@ -130,7 +153,7 @@
 }
 
 static int
-EobjListLower(EobjList * ewl, EObj * eo, int mode)
+EobjListLower(EobjList * ewl, EObj * eo)
 {
    int                 i, j, n;
 
@@ -140,7 +163,7 @@
       return 0;
 
    j = ewl->nwins - 1;
-   if (mode)
+   if (ewl->layered)
      {
        /* Take the layer into account */
        for (; j >= 0; j--)
@@ -155,11 +178,15 @@
      {
        memmove(ewl->list + i, ewl->list + i + 1, n * sizeof(EObj *));
        ewl->list[j] = eo;
+       if (ewl->layered)
+          DeskSetDirtyStack(eo->desk);
      }
    else if (n < 0)
      {
        memmove(ewl->list + j + 1, ewl->list + j, -n * sizeof(EObj *));
        ewl->list[j] = eo;
+       if (ewl->layered)
+          DeskSetDirtyStack(eo->desk);
      }
 
    EobjListShow("EobjListLower", ewl);
@@ -167,7 +194,7 @@
 }
 
 static int
-EobjListRaise(EobjList * ewl, EObj * eo, int mode)
+EobjListRaise(EobjList * ewl, EObj * eo)
 {
    int                 i, j, n;
 
@@ -177,7 +204,7 @@
       return 0;
 
    j = 0;
-   if (mode)
+   if (ewl->layered)
      {
        /* Take the layer into account */
        for (; j < ewl->nwins; j++)
@@ -192,11 +219,15 @@
      {
        memmove(ewl->list + i, ewl->list + i + 1, n * sizeof(EObj *));
        ewl->list[j] = eo;
+       if (ewl->layered)
+          DeskSetDirtyStack(eo->desk);
      }
    else if (n < 0)
      {
        memmove(ewl->list + j + 1, ewl->list + j, -n * sizeof(EObj *));
        ewl->list[j] = eo;
+       if (ewl->layered)
+          DeskSetDirtyStack(eo->desk);
      }
 
    EobjListShow("EobjListRaise", ewl);
@@ -230,8 +261,8 @@
 /*
  * The global stacking and focus lists
  */
-EobjList            EwinListStack = { "Stack", 0, 0, NULL };
-EobjList            EwinListFocus = { "Focus", 0, 0, NULL };
+EobjList            EwinListStack = { "Stack", 0, 0, NULL, 1 };
+EobjList            EwinListFocus = { "Focus", 0, 0, NULL, 0 };
 
 static EObj        *const *
 EobjListGet(EobjList * ewl, int *num)
@@ -279,19 +310,19 @@
 int
 EobjListStackRaise(EObj * eo)
 {
-   return EobjListRaise(&EwinListStack, eo, 1);
+   return EobjListRaise(&EwinListStack, eo);
 }
 
 int
 EobjListStackLower(EObj * eo)
 {
-   return EobjListLower(&EwinListStack, eo, 1);
+   return EobjListLower(&EwinListStack, eo);
 }
 
 int
 EobjListFocusRaise(EObj * eo)
 {
-   return EobjListRaise(&EwinListFocus, eo, 0);
+   return EobjListRaise(&EwinListFocus, eo);
 }
 
 EWin               *const *
@@ -382,7 +413,7 @@
    for (i = j = 0; i < ewl->nwins; i++)
      {
        eo = ewl->list[i];
-       if (eo->desk != desk && !eo->sticky && !eo->floating)
+       if (eo->desk != desk)
           continue;
 
        lst[j++] = eo;




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to