Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
      Tag: branch-exp
        E.h Makefile.am buttons.c desktops.c ewin-ops.c ewins.c 
        pager.c stacking.c 
Added Files:
      Tag: branch-exp
        eobj.c 


Log Message:
Add buttons to global object stack.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.314.2.64
retrieving revision 1.314.2.65
diff -u -3 -r1.314.2.64 -r1.314.2.65
--- E.h 28 Nov 2004 17:51:33 -0000      1.314.2.64
+++ E.h 30 Nov 2004 23:31:50 -0000      1.314.2.65
@@ -546,6 +546,7 @@
 {
    Window              win;    /* The top level window */
    short               type;   /* Ewin, button, other, ... */
+   short               ilayer; /* Internal tacking layer */
    short               layer;  /* Stacking layer */
    short               desk;   /* Belongs on desk */
    char                sticky:1;
@@ -554,7 +555,12 @@
    int                 w, h;
 };
 
+#define EOBJ_TYPE_EWIN      0
+#define EOBJ_TYPE_BUTTON    1
+#define EOBJ_TYPE_OTHER     2
+
 #define EoGetWin(eo)            ((eo)->o.win)
+#define EoGetType(eo)           ((eo)->o.type)
 #define EoGetX(eo)              ((eo)->o.x)
 #define EoGetY(eo)              ((eo)->o.y)
 #define EoGetW(eo)              ((eo)->o.w)
@@ -565,6 +571,7 @@
 #define EoGetLayer(eo)          ((eo)->o.layer)
 
 #define EoSetWin(eo, _x)        (eo)->o.win = (_x)
+#define EoSetType(eo, _x)       (eo)->o.type = (_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)
@@ -572,7 +579,7 @@
 #define EoSetSticky(eo, _x)     (eo)->o.sticky = ((_x)?1:0)
 #define EoSetFloating(eo, _x)   (eo)->o.floating = (_x)
 #define EoSetDesk(eo, _d)       EobjSetDesk(&((eo)->o), (_d))
-#define EoSetLayer(eo, _l)      (eo)->o.layer = (_l)
+#define EoSetLayer(eo, _l)      EobjSetLayer(&((eo)->o), (_l))
 
 typedef struct _constraints
 {
@@ -1559,6 +1566,12 @@
 void                EdgeWindowsShow(void);
 void                EdgeWindowsHide(void);
 
+/* eobj.c */
+const char         *EobjGetName(const EObj * eo);
+int                 EobjGetDesk(const EObj * eo);
+int                 EobjSetDesk(EObj * eo, int desk);
+void                EobjSetLayer(EObj * eo, int layer);
+
 /* events.c */
 /* Re-mapped X-events */
 #define EX_EVENT_SHAPE_NOTIFY            64
@@ -1599,9 +1612,6 @@
 #define EWIN_CHANGE_DESKTOP     (1<<3)
 #define EWIN_CHANGE_LAYER       (1<<4)
 
-int                 EobjGetDesk(const EObj * eo);
-int                 EobjSetDesk(EObj * eo, int desk);
-
 void                EwinGetPosition(const EWin * ewin, int *px, int *py);
 void                EwinRefresh(EWin * ewin);
 void                EwinUpdateAfterMoveResize(EWin * ewin, int resize);
@@ -2126,10 +2136,6 @@
 void                SoundPlay(const char *name);
 
 /* stacking.c */
-#define EOBJ_TYPE_EWIN      0
-#define EOBJ_TYPE_BUTTON    1
-#define EOBJ_TYPE_OTHER     2
-
 void                EobjListStackAdd(EObj * eo, int ontop);
 void                EobjListFocusAdd(EObj * eo, int ontop);
 void                EobjListStackDel(EObj * eo);
@@ -2139,9 +2145,10 @@
 int                 EobjListStackLower(EObj * eo);
 int                 EobjListFocusLower(EObj * eo);
 EObj               *const *EobjListStackGet(int *num);
+EObj               *const *EobjListStackGetForDesk(int *num, int desk);
 EWin               *const *EwinListStackGet(int *num);
 EWin               *const *EwinListFocusGet(int *num);
-EWin               *const *EwinListGetForDesktop(int desk, int *num);
+EWin               *const *EwinListGetForDesk(int *num, int desk);
 
 #define EwinListGetAll EwinListStackGet
 #define EwinListStackRaise(ewin) EobjListStackRaise(&(ewin->o))
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Makefile.am,v
retrieving revision 1.43.2.23
retrieving revision 1.43.2.24
diff -u -3 -r1.43.2.23 -r1.43.2.24
--- Makefile.am 21 Oct 2004 17:52:44 -0000      1.43.2.23
+++ Makefile.am 30 Nov 2004 23:31:51 -0000      1.43.2.24
@@ -45,6 +45,7 @@
        ecore-e16.c             \
        edge.c                  \
        emodule.c               \
+       eobj.c          \
        events.c                \
        ewins.c                 \
        ewin-ops.c              \
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v
retrieving revision 1.36.2.17
retrieving revision 1.36.2.18
diff -u -3 -r1.36.2.17 -r1.36.2.18
--- buttons.c   20 Nov 2004 20:48:56 -0000      1.36.2.17
+++ buttons.c   30 Nov 2004 23:31:51 -0000      1.36.2.18
@@ -85,7 +85,8 @@
    if (desk < 0 || desk >= DesksGetNumber())
       return NULL;
 
-   b = Emalloc(sizeof(Button));
+   b = Ecalloc(1, sizeof(Button));
+   EoSetType(b, EOBJ_TYPE_BUTTON);
 
    b->name = Estrdup(name);
    b->label = Estrdup(label);
@@ -108,12 +109,12 @@
 
    b->label = label;
 
-   EoSetLayer(b, ontop);
    b->flags = flags;
    EoSetSticky(b, sticky);
    if (sticky && ontop == 1)
       desk = 0;
-   b->o.desk = desk;
+   EoSetDesk(b, desk);
+   EoSetLayer(b, ontop);
    b->visible = 0;
    b->geom.width.min = minw;
    b->geom.width.max = maxw;
@@ -152,6 +153,8 @@
    b->expose = 0;
    b->ref_count = 0;
 
+   EobjListStackAdd(&b->o, 0);
+   EwinListStackRaise(b);
    AddItem(b, b->name, id, LIST_TYPE_BUTTON);
 
    EDBUG_RETURN(b);
@@ -172,6 +175,7 @@
      }
 
    while (RemoveItemByPtr(b, LIST_TYPE_BUTTON));
+   EobjListStackDel(&b->o);
 
    if (b->name)
       Efree(b->name);
@@ -305,7 +309,7 @@
    if (EoIsSticky(b) && EoGetLayer(b) == 1)
       desk = 0;
    pdesk = EoGetDesk(b);
-   desk = EoSetDesk(b, desk);
+   EoSetDesk(b, desk);
 
    if (desk != pdesk)
       EReparentWindow(disp, EoGetWin(b), DeskGetWin(desk), EoGetX(b),
@@ -450,6 +454,7 @@
    b->flags |= FLAG_FIXED;
    b->used = 1;
    b->ref_count++;
+   EobjListStackDel(&b->o);
 }
 
 const char         *
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.95.2.31
retrieving revision 1.95.2.32
diff -u -3 -r1.95.2.31 -r1.95.2.32
--- desktops.c  28 Nov 2004 17:51:34 -0000      1.95.2.31
+++ desktops.c  30 Nov 2004 23:31:51 -0000      1.95.2.32
@@ -1137,9 +1137,8 @@
 #if 1                          /* FIXME - Somehow */
    Window             *wl2;
 #endif
-   int                 i, wnum, tot, bnum;
-   EWin               *const *lst, *ewin;
-   Button            **blst;
+   int                 i, num, tot;
+   EObj               *const *lst, *eo;
 
    EDBUG(2, "StackDesktop");
    tot = 0;
@@ -1152,10 +1151,10 @@
 #if 1                          /* FIXME - Somehow */
    if (desk == 0)
      {
-       wl2 = ProgressbarsListWindows(&wnum);
+       wl2 = ProgressbarsListWindows(&num);
        if (wl2)
          {
-            for (i = 0; i < wnum; i++)
+            for (i = 0; i < num; i++)
                _APPEND_TO_WIN_LIST(wl2[i]);
             Efree(wl2);
          }
@@ -1171,24 +1170,18 @@
      }
 #endif
 
-   lst = EwinListStackGet(&wnum);
-   blst = (Button **) ListItemType(&bnum, LIST_TYPE_BUTTON);
+   lst = EobjListStackGetForDesk(&num, desk);
 
-   /* Floating EWins */
-   for (i = 0; i < wnum; i++)
+   /* Make the X window list */
+
+   /* Floating objects */
+   for (i = 0; i < num; i++)
      {
-       ewin = lst[i];
-       if (!EoIsFloating(lst[i]) || EoGetDesk(ewin) != desk)
+       eo = lst[i];
+       if (!eo->floating)
           continue;
 
-       _APPEND_TO_WIN_LIST(EoGetWin(lst[i]));
-     }
-
-   /* "Above" buttons */
-   for (i = 0; i < bnum; i++)
-     {
-       if (ButtonIsAbove(blst[i], desk))
-          _APPEND_TO_WIN_LIST(ButtonGetWindow(blst[i]));
+       _APPEND_TO_WIN_LIST(eo->win);
      }
 
    if (desk == 0)
@@ -1203,34 +1196,20 @@
          }
      }
 
-   /* Normal EWins on this desk */
-   for (i = 0; i < wnum; i++)
+   /* Normal objects */
+   for (i = 0; i < num; i++)
      {
-       ewin = lst[i];
-       if (EoIsFloating(ewin) || EoGetDesk(ewin) != desk)
+       eo = lst[i];
+       if (eo->floating)
           continue;
 
-       _APPEND_TO_WIN_LIST(EoGetWin(ewin));
+       _APPEND_TO_WIN_LIST(eo->win);
 #if 0                          /* FIXME */
        if (EoGetWin(ewin) == Mode.menus.win_covered)
           _APPEND_TO_WIN_LIST(Mode.menus.cover_win);
 #endif
      }
 
-   /* "Normal" buttons */
-   for (i = 0; i < bnum; i++)
-     {
-       if (ButtonIsNormal(blst[i], desk))
-          _APPEND_TO_WIN_LIST(ButtonGetWindow(blst[i]));
-     }
-
-   /* "Below" buttons */
-   for (i = 0; i < bnum; i++)
-     {
-       if (ButtonIsBelow(blst[i], desk))
-          _APPEND_TO_WIN_LIST(ButtonGetWindow(blst[i]));
-     }
-
    if (EventDebug(EDBUG_TYPE_STACKING))
      {
        Eprintf("StackDesktop %d:\n", desk);
@@ -1247,8 +1226,6 @@
 
    if (wl)
       Efree(wl);
-   if (blst)
-      Efree(blst);
 
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewin-ops.c,v
retrieving revision 1.1.2.18
retrieving revision 1.1.2.19
diff -u -3 -r1.1.2.18 -r1.1.2.19
--- ewin-ops.c  23 Nov 2004 23:46:26 -0000      1.1.2.18
+++ ewin-ops.c  30 Nov 2004 23:31:52 -0000      1.1.2.19
@@ -1214,7 +1214,7 @@
    EWin               *const *lst, *ewin;
    int                 i, num;
 
-   lst = EwinListGetForDesktop(DesksGetCurrent(), &num);
+   lst = EwinListGetForDesk(&num, DesksGetCurrent());
 
    for (i = 0; i < num; i++)
      {
@@ -1365,7 +1365,7 @@
    int                 gnum, j, raise = 0;
    int                 i, num;
 
-   lst = EwinListGetForDesktop(EoGetDesk(ewin), &num);
+   lst = EwinListGetForDesk(&num, EoGetDesk(ewin));
    gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_RAISE_LOWER,
                                      Mode.nogroup, &gnum);
    for (j = 0; j < gnum; j++)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewins.c,v
retrieving revision 1.1.2.31
retrieving revision 1.1.2.32
diff -u -3 -r1.1.2.31 -r1.1.2.32
--- ewins.c     28 Nov 2004 17:51:34 -0000      1.1.2.31
+++ ewins.c     30 Nov 2004 23:31:52 -0000      1.1.2.32
@@ -66,6 +66,7 @@
    ewin = Ecalloc(1, sizeof(EWin));
 
    ewin->state = (Mode.wm.startup) ? EWIN_STATE_STARTUP : EWIN_STATE_NEW;
+   EoSetType(ewin, EOBJ_TYPE_EWIN);
    EoSetX(ewin, -1);
    EoSetY(ewin, -1);
    EoSetW(ewin, -1);
@@ -304,7 +305,7 @@
    px -= DeskGetX(desk);
    py -= DeskGetY(desk);
 
-   lst = EwinListGetForDesktop(desk, &num);
+   lst = EwinListGetForDesk(&num, desk);
    for (i = 0; i < num; i++)
      {
        int                 x, y, w, h;
@@ -629,6 +630,7 @@
    /* it's already managed */
    if (ewin)
      {
+#if 0
        /* if its iconified - de-iconify */
        if (ewin->iconified)
          {
@@ -645,6 +647,8 @@
             ewin->iconified = 0;
          }
        EDBUG_RETURN_;
+#endif
+       Eprintf("AddToFamily already added %#lx\n", ewin->client.win);
      }
 
    /* grab that server */
@@ -1364,7 +1368,7 @@
        goto done;
      }
 
-   lst = EwinListGetForDesktop(EoGetDesk(ewin), &num);
+   lst = EwinListGetForDesk(&num, EoGetDesk(ewin));
    if (num < 2)
       goto done;
 
@@ -1529,23 +1533,6 @@
    return (ewin) ? ewin->client.win : None;
 }
 
-int
-EobjGetDesk(const EObj * eo)
-{
-   return (eo->sticky) ? DesksGetCurrent() : eo->desk;
-}
-
-int
-EobjSetDesk(EObj * eo, int desk)
-{
-   if (eo->sticky || eo->desk < 0)
-      eo->desk = DesksGetCurrent();
-   else
-      eo->desk = desk % Conf.desks.num;
-
-   return eo->desk;
-}
-
 const char         *
 EwinGetTitle(const EWin * ewin)
 {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.103.2.22
retrieving revision 1.103.2.23
diff -u -3 -r1.103.2.22 -r1.103.2.23
--- pager.c     13 Nov 2004 10:41:56 -0000      1.103.2.22
+++ pager.c     30 Nov 2004 23:31:53 -0000      1.103.2.23
@@ -189,7 +189,7 @@
        int                 i, num;
        EWin               *const *lst;
 
-       lst = EwinListGetForDesktop(p->desktop, &num);
+       lst = EwinListGetForDesk(&num, p->desktop);
        for (i = 0; i < num; i++)
           PagerEwinUpdateFromPager(p, lst[i]);
 
@@ -385,7 +385,7 @@
                          p->h / ay, x * (p->w / ax), y * (p->h / ay));
          }
 
-       lst = EwinListGetForDesktop(p->desktop, &num);
+       lst = EwinListGetForDesk(&num, p->desktop);
        for (i = num - 1; i >= 0; i--)
          {
             EWin               *ewin;
@@ -473,7 +473,7 @@
    ScaleRect(p->pmap, VRoot.win, 0, 0, xx, yy, VRoot.w, VRoot.h, ww, hh);
    XClearWindow(disp, p->win);
 
-   lst = EwinListGetForDesktop(p->desktop, &num);
+   lst = EwinListGetForDesk(&num, p->desktop);
    for (i = 0; i < num; i++)
       PagerEwinUpdateFromPager(p, lst[i]);
 }
@@ -544,7 +544,7 @@
      }
    Mode.queue_up = pq;
 
-   lst = EwinListGetForDesktop(p->desktop, &num);
+   lst = EwinListGetForDesk(&num, p->desktop);
    for (i = 0; i < num; i++)
       PagerEwinUpdateMini(p, lst[i]);
 
@@ -831,7 +831,7 @@
    GetAreaSize(&ax, &ay);
    DeskGetArea(p->desktop, &cx, &cy);
 
-   lst = EwinListGetForDesktop(p->desktop, &num);
+   lst = EwinListGetForDesk(&num, p->desktop);
    for (i = 0; i < num; i++)
      {
        EWin               *ewin;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/stacking.c,v
retrieving revision 1.12.2.3
retrieving revision 1.12.2.4
diff -u -3 -r1.12.2.3 -r1.12.2.4
--- stacking.c  21 Nov 2004 22:15:21 -0000      1.12.2.3
+++ stacking.c  30 Nov 2004 23:31:53 -0000      1.12.2.4
@@ -26,8 +26,6 @@
 
 #define EobjGetCwin(p) \
     ((p->type == EOBJ_TYPE_EWIN) ? EwinGetClientWin((EWin*)(p)) : None)
-#define EobjGetName(p) \
-    ((p->type == EOBJ_TYPE_EWIN) ? EwinGetTitle((EWin*)(p)) : "")
 
 typedef struct _eobjlist EobjList;
 
@@ -55,7 +53,7 @@
        eo = ewl->list[i];
        Eprintf(" %2d: %#10lx %#10lx %d %d %s\n", i, eo->win,
                EobjGetCwin(eo), eo->desk,
-               (eo->floating) ? 999 : eo->layer, EobjGetName(eo));
+               (eo->floating) ? 999 : eo->ilayer, EobjGetName(eo));
      }
 }
 #else
@@ -146,7 +144,7 @@
      {
        /* Take the layer into account */
        for (; j >= 0; j--)
-          if (i != j && eo->layer <= ewl->list[j]->layer)
+          if (i != j && eo->ilayer <= ewl->list[j]->ilayer)
              break;
        if (j < i)
           j++;
@@ -183,7 +181,7 @@
      {
        /* Take the layer into account */
        for (; j < ewl->nwins; j++)
-          if (j != i && eo->layer >= ewl->list[j]->layer)
+          if (j != i && eo->ilayer >= ewl->list[j]->ilayer)
              break;
        if (j > i)
           j--;
@@ -315,7 +313,7 @@
 }
 
 EWin               *const *
-EwinListGetForDesktop(int desk, int *num)
+EwinListGetForDesk(int *num, int desk)
 {
    static EWin       **lst = NULL;
    static int          nalloc = 0;
@@ -344,3 +342,34 @@
    *num = j;
    return lst;
 }
+
+EObj               *const *
+EobjListStackGetForDesk(int *num, int desk)
+{
+   static EObj       **lst = NULL;
+   static int          nalloc = 0;
+   const EobjList     *ewl;
+   int                 i, j;
+   EObj               *eo;
+
+   ewl = &EwinListStack;
+
+   /* Too many - who cares. */
+   if (nalloc < ewl->nwins)
+     {
+       nalloc = (ewl->nwins + 16) & ~0xf;      /* 16 at the time */
+       lst = Erealloc(lst, nalloc * sizeof(EWin *));
+     }
+
+   for (i = j = 0; i < ewl->nwins; i++)
+     {
+       eo = ewl->list[i];
+       if (eo->desk != desk)
+          continue;
+
+       lst[j++] = eo;
+     }
+
+   *num = j;
+   return lst;
+}




-------------------------------------------------------
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://productguide.itmanagersjournal.com/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to