Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
      Tag: branch-exp
        E.h desktops.c ewins.c ewmh.c focus.c stacking.c warp.c 


Log Message:
Start of global object stacks.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.314.2.61
retrieving revision 1.314.2.62
diff -u -3 -r1.314.2.61 -r1.314.2.62
--- E.h 20 Nov 2004 20:48:55 -0000      1.314.2.61
+++ E.h 21 Nov 2004 22:15:19 -0000      1.314.2.62
@@ -2127,23 +2127,28 @@
 void                SoundPlay(const char *name);
 
 /* stacking.c */
-typedef struct _ewinlist EWinList;
-extern EWinList     EwinListFocus;
-extern EWinList     EwinListStack;
-int                 EwinListGetIndex(EWinList * ewl, EWin * ewin);
-void                EwinListAdd(EWinList * ewl, EWin * ewin, int ontop);
-void                EwinListDelete(EWinList * ewl, EWin * ewin);
-int                 EwinListRaise(EWinList * ewl, EWin * ewin, int mode);
-int                 EwinListLower(EWinList * ewl, EWin * ewin, int mode);
-EWin               *const *EwinListGet(EWinList * ewl, int *num);
+#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);
+void                EobjListFocusDel(EObj * eo);
+int                 EobjListStackRaise(EObj * eo);
+int                 EobjListFocusRaise(EObj * eo);
+int                 EobjListStackLower(EObj * eo);
+int                 EobjListFocusLower(EObj * eo);
+EObj               *const *EobjListStackGet(int *num);
+EWin               *const *EwinListStackGet(int *num);
+EWin               *const *EwinListFocusGet(int *num);
 EWin               *const *EwinListGetForDesktop(int desk, int *num);
 
-#define EwinListGetFocus(pnum) EwinListGet(&EwinListFocus, pnum)
-#define EwinListGetStacking(pnum) EwinListGet(&EwinListStack, pnum)
-#define EwinListGetAll EwinListGetStacking
-int                 EwinListStackingRaise(EWin * ewin);
-int                 EwinListStackingLower(EWin * ewin);
-int                 EwinListFocusRaise(EWin * ewin);
+#define EwinListGetAll EwinListStackGet
+#define EwinListStackRaise(ewin) EobjListStackRaise(&(ewin->o))
+#define EwinListStackLower(ewin) EobjListStackLower(&(ewin->o))
+#define EwinListFocusRaise(ewin) EobjListFocusRaise(&(ewin->o))
+#define EwinListFocusLower(ewin) EobjListFocusLower(&(ewin->o))
 
 /* startup.c */
 void                CreateStartupDisplay(char start);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.95.2.28
retrieving revision 1.95.2.29
diff -u -3 -r1.95.2.28 -r1.95.2.29
--- desktops.c  20 Nov 2004 20:48:56 -0000      1.95.2.28
+++ desktops.c  21 Nov 2004 22:15:20 -0000      1.95.2.29
@@ -702,7 +702,7 @@
    if ((ewin->iconified) && (ewin->parent != dt->win))
      {
        ewin->parent = dt->win;
-       EwinListStackingRaise(ewin);
+       EwinListStackRaise(ewin);
        EReparentWindow(disp, EoGetWin(ewin), dt->win, EoGetX(ewin),
                        EoGetY(ewin));
        ICCCM_Configure(ewin);
@@ -726,7 +726,7 @@
    else if (ewin->parent != dt->win)
      {
        ewin->parent = dt->win;
-       EwinListStackingRaise(ewin);
+       EwinListStackRaise(ewin);
        EReparentWindow(disp, EoGetWin(ewin), dt->win, EoGetX(ewin),
                        EoGetY(ewin));
        StackDesktop(EoGetDesk(ewin));
@@ -766,7 +766,7 @@
    EWin               *const *lst, *ewin;
    int                 i, num;
 
-   lst = EwinListGetStacking(&num);
+   lst = EwinListStackGet(&num);
    for (i = 0; i < num; i++)
      {
        ewin = lst[i];
@@ -1171,7 +1171,7 @@
      }
 #endif
 
-   lst = EwinListGetStacking(&wnum);
+   lst = EwinListStackGet(&wnum);
    blst = (Button **) ListItemType(&bnum, LIST_TYPE_BUTTON);
 
    /* Floating EWins */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewins.c,v
retrieving revision 1.1.2.28
retrieving revision 1.1.2.29
diff -u -3 -r1.1.2.28 -r1.1.2.29
--- ewins.c     20 Nov 2004 20:48:56 -0000      1.1.2.28
+++ ewins.c     21 Nov 2004 22:15:20 -0000      1.1.2.29
@@ -120,8 +120,8 @@
    ewin->client.win = win;
    FocusEwinSetGrabs(ewin);
    GrabButtonGrabs(ewin);
-   EwinListAdd(&EwinListStack, ewin, 0);
-   EwinListAdd(&EwinListFocus, ewin, 0);
+   EobjListStackAdd(&ewin->o, 0);
+   EobjListFocusAdd(&ewin->o, 0);
 
    ewin->client.event_mask = EWIN_CLIENT_EVENT_MASK;
    AddItem(ewin, "EWIN", win, LIST_TYPE_EWIN);
@@ -157,8 +157,8 @@
 
    RemoveItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    EUnregisterWindow(disp, ewin->client.win);
-   EwinListDelete(&EwinListStack, ewin);
-   EwinListDelete(&EwinListFocus, ewin);
+   EobjListStackDel(&ewin->o);
+   EobjListFocusDel(&ewin->o);
 
    XSelectInput(disp, ewin->client.win, 0);
 
@@ -1415,7 +1415,7 @@
             goto done;
          }
 
-       num = EwinListStackingRaise(ewin);
+       num = EwinListStackRaise(ewin);
        if (num == 0)           /* Quit if stacking is unchanged */
           goto done;
 
@@ -1457,7 +1457,7 @@
 
    if ((EoGetWin(ewin)) && (!EoIsFloating(ewin)))
      {
-       num = EwinListStackingLower(ewin);
+       num = EwinListStackLower(ewin);
        if (num == 0)           /* Quit if stacking is unchanged */
           goto done;
 
@@ -1731,7 +1731,7 @@
    if (EventDebug(EDBUG_TYPE_SESSION))
       Eprintf("EwinsSetFree\n");
 
-   lst = EwinListGetStacking(&num);
+   lst = EwinListStackGet(&num);
    for (i = num - 1; i >= 0; i--)
      {
        ewin = lst[i];
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewmh.c,v
retrieving revision 1.55.2.15
retrieving revision 1.55.2.16
diff -u -3 -r1.55.2.15 -r1.55.2.16
--- ewmh.c      13 Nov 2004 10:41:56 -0000      1.55.2.15
+++ ewmh.c      21 Nov 2004 22:15:20 -0000      1.55.2.16
@@ -422,7 +422,7 @@
    EWin               *const *lst;
 
    /* Stacking order */
-   lst = EwinListGetStacking(&num);
+   lst = EwinListStackGet(&num);
    if (num > 0)
      {
        wl = Emalloc(num * sizeof(Ecore_X_Window));
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/focus.c,v
retrieving revision 1.81.2.10
retrieving revision 1.81.2.11
diff -u -3 -r1.81.2.10 -r1.81.2.11
--- focus.c     20 Nov 2004 20:48:57 -0000      1.81.2.10
+++ focus.c     21 Nov 2004 22:15:21 -0000      1.81.2.11
@@ -67,7 +67,7 @@
           break;
        /* If pointer not in window -  fall thru and select other */
      case MODE_FOCUS_CLICK:
-       lst = EwinListGetFocus(&num);
+       lst = EwinListFocusGet(&num);
        for (i = 0; i < num; i++)
          {
             if (!FocusEwinValid(lst[i], 1) || lst[i]->skipfocus)
@@ -101,7 +101,7 @@
 
    ewin = FindItem("", val, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    if (ewin)
-      EwinListRaise(&EwinListFocus, ewin, 0);
+      EwinListFocusRaise(ewin);
 }
 
 void
@@ -111,7 +111,7 @@
    EWin               *ewin;
    int                 i, num;
 
-   lst = EwinListGetFocus(&num);
+   lst = EwinListFocusGet(&num);
    if (num <= 1)
       return;
 
@@ -135,7 +135,7 @@
    EWin               *ewin;
    int                 i, num;
 
-   lst = EwinListGetFocus(&num);
+   lst = EwinListFocusGet(&num);
    if (num <= 1)
       return;
 
@@ -341,7 +341,7 @@
      case FOCUS_DESK_ENTER:
        break;
      case FOCUS_NEXT:
-       EwinListRaise(&EwinListFocus, ewin, 0);
+       EwinListFocusRaise(ewin);
        break;
      }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/stacking.c,v
retrieving revision 1.12.2.2
retrieving revision 1.12.2.3
diff -u -3 -r1.12.2.2 -r1.12.2.3
--- stacking.c  17 Oct 2004 08:47:26 -0000      1.12.2.2
+++ stacking.c  21 Nov 2004 22:15:21 -0000      1.12.2.3
@@ -24,20 +24,27 @@
 
 #define ENABLE_DEBUG_STACKING 1
 
-struct _ewinlist
+#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;
+
+struct _eobjlist
 {
    const char         *name;
    int                 nalloc;
    int                 nwins;
-   EWin              **list;
+   EObj              **list;
 };
 
 #if ENABLE_DEBUG_STACKING
 static void
-EwinListShow(const char *txt, EWinList * ewl)
+EobjListShow(const char *txt, EobjList * ewl)
 {
    int                 i;
-   EWin               *ewin;
+   EObj               *eo;
 
    if (!EventDebug(EDBUG_TYPE_STACKING))
       return;
@@ -45,66 +52,65 @@
    Eprintf("%s-%s:\n", ewl->name, txt);
    for (i = 0; i < ewl->nwins; i++)
      {
-       ewin = ewl->list[i];
-       Eprintf(" %2d: %#10lx %#10lx %d %d %s\n", i, EoGetWin(ewin),
-               ewin->client.win, EoGetDesk(ewin),
-               (EoIsFloating(ewin)) ? 999 : EoGetLayer(ewin),
-               EwinGetTitle(ewin));
+       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));
      }
 }
 #else
-#define EwinListShow(txt, ewl)
+#define EobjListShow(txt, ewl)
 #endif
 
-int
-EwinListGetIndex(EWinList * ewl, EWin * ewin)
+static int
+EobjListGetIndex(EobjList * ewl, EObj * eo)
 {
    int                 i;
 
    for (i = 0; i < ewl->nwins; i++)
-      if (ewl->list[i] == ewin)
+      if (ewl->list[i] == eo)
         return i;
 
    return -1;
 }
 
-void
-EwinListAdd(EWinList * ewl, EWin * ewin, int ontop)
+static void
+EobjListAdd(EobjList * ewl, EObj * eo, int ontop)
 {
    int                 i;
 
    /* Quit if already in list */
-   i = EwinListGetIndex(ewl, ewin);
+   i = EobjListGetIndex(ewl, eo);
    if (i >= 0)
       return;
 
    if (ewl->nwins >= ewl->nalloc)
      {
        ewl->nalloc += 16;
-       ewl->list = (EWin **) Erealloc(ewl->list, ewl->nalloc * sizeof(EWin *));
+       ewl->list = (EObj **) Erealloc(ewl->list, ewl->nalloc * sizeof(EObj *));
      }
 
    if (ontop)
      {
-       memmove(ewl->list + 1, ewl->list, ewl->nwins * sizeof(EWin *));
-       ewl->list[0] = ewin;
+       memmove(ewl->list + 1, ewl->list, ewl->nwins * sizeof(EObj *));
+       ewl->list[0] = eo;
      }
    else
      {
-       ewl->list[ewl->nwins] = ewin;
+       ewl->list[ewl->nwins] = eo;
      }
    ewl->nwins++;
 
-   EwinListShow("EwinListAdd", ewl);
+   EobjListShow("EobjListAdd", ewl);
 }
 
-void
-EwinListDelete(EWinList * ewl, EWin * ewin)
+static void
+EobjListDel(EobjList * ewl, EObj * eo)
 {
    int                 i, n;
 
    /* Quit if not in list */
-   i = EwinListGetIndex(ewl, ewin);
+   i = EobjListGetIndex(ewl, eo);
    if (i < 0)
       return;
 
@@ -112,7 +118,7 @@
    n = ewl->nwins - i;
    if (n > 0)
      {
-       memmove(ewl->list + i, ewl->list + i + 1, n * sizeof(EWin *));
+       memmove(ewl->list + i, ewl->list + i + 1, n * sizeof(EObj *));
      }
    else if (ewl->nwins <= 0)
      {
@@ -122,16 +128,16 @@
        ewl->nalloc = 0;
      }
 
-   EwinListShow("EwinListDelete", ewl);
+   EobjListShow("EobjListDel", ewl);
 }
 
-int
-EwinListLower(EWinList * ewl, EWin * ewin, int mode)
+static int
+EobjListLower(EobjList * ewl, EObj * eo, int mode)
 {
    int                 i, j, n;
 
    /* Quit if not in list */
-   i = EwinListGetIndex(ewl, ewin);
+   i = EobjListGetIndex(ewl, eo);
    if (i < 0)
       return 0;
 
@@ -140,7 +146,7 @@
      {
        /* Take the layer into account */
        for (; j >= 0; j--)
-          if (i != j && EoGetLayer(ewin) <= EoGetLayer(ewl->list[j]))
+          if (i != j && eo->layer <= ewl->list[j]->layer)
              break;
        if (j < i)
           j++;
@@ -149,26 +155,26 @@
    n = j - i;
    if (n > 0)
      {
-       memmove(ewl->list + i, ewl->list + i + 1, n * sizeof(EWin *));
-       ewl->list[j] = ewin;
+       memmove(ewl->list + i, ewl->list + i + 1, n * sizeof(EObj *));
+       ewl->list[j] = eo;
      }
    else if (n < 0)
      {
-       memmove(ewl->list + j + 1, ewl->list + j, -n * sizeof(EWin *));
-       ewl->list[j] = ewin;
+       memmove(ewl->list + j + 1, ewl->list + j, -n * sizeof(EObj *));
+       ewl->list[j] = eo;
      }
 
-   EwinListShow("EwinListLower", ewl);
+   EobjListShow("EobjListLower", ewl);
    return n;
 }
 
-int
-EwinListRaise(EWinList * ewl, EWin * ewin, int mode)
+static int
+EobjListRaise(EobjList * ewl, EObj * eo, int mode)
 {
    int                 i, j, n;
 
    /* Quit if not in list */
-   i = EwinListGetIndex(ewl, ewin);
+   i = EobjListGetIndex(ewl, eo);
    if (i < 0)
       return 0;
 
@@ -177,7 +183,7 @@
      {
        /* Take the layer into account */
        for (; j < ewl->nwins; j++)
-          if (j != i && EoGetLayer(ewin) >= EoGetLayer(ewl->list[j]))
+          if (j != i && eo->layer >= ewl->list[j]->layer)
              break;
        if (j > i)
           j--;
@@ -186,74 +192,155 @@
    n = j - i;
    if (n > 0)
      {
-       memmove(ewl->list + i, ewl->list + i + 1, n * sizeof(EWin *));
-       ewl->list[j] = ewin;
+       memmove(ewl->list + i, ewl->list + i + 1, n * sizeof(EObj *));
+       ewl->list[j] = eo;
      }
    else if (n < 0)
      {
-       memmove(ewl->list + j + 1, ewl->list + j, -n * sizeof(EWin *));
-       ewl->list[j] = ewin;
+       memmove(ewl->list + j + 1, ewl->list + j, -n * sizeof(EObj *));
+       ewl->list[j] = eo;
      }
 
-   EwinListShow("EwinListRaise", ewl);
+   EobjListShow("EobjListRaise", ewl);
+   return n;
+}
+
+static int
+EobjListTypeCount(const EobjList * ewl, int type)
+{
+   int                 i, n;
+
+   for (i = n = 0; i < ewl->nwins; i++)
+      if (ewl->list[i]->type == type)
+        n++;
+
    return n;
 }
 
 /*
  * The global stacking and focus lists
  */
-EWinList            EwinListFocus = { "Focus", 0, 0, NULL };
-EWinList            EwinListStack = { "Stack", 0, 0, NULL };
+EobjList            EwinListStack = { "Stack", 0, 0, NULL };
+EobjList            EwinListFocus = { "Focus", 0, 0, NULL };
 
-EWin               *const *
-EwinListGet(EWinList * ewl, int *num)
+static EObj        *const *
+EobjListGet(EobjList * ewl, int *num)
 {
    *num = ewl->nwins;
    return ewl->list;
 }
 
+EObj               *const *
+EobjListStackGet(int *num)
+{
+   return EobjListGet(&EwinListStack, num);
+}
+
+void
+EobjListStackAdd(EObj * eo, int ontop)
+{
+   EobjListAdd(&EwinListStack, eo, ontop);
+}
+
+void
+EobjListFocusAdd(EObj * eo, int ontop)
+{
+   EobjListAdd(&EwinListFocus, eo, ontop);
+}
+
+void
+EobjListStackDel(EObj * eo)
+{
+   EobjListDel(&EwinListStack, eo);
+}
+
+void
+EobjListFocusDel(EObj * eo)
+{
+   EobjListDel(&EwinListFocus, eo);
+}
+
+int
+EobjListStackRaise(EObj * ewin)
+{
+   return EobjListRaise(&EwinListStack, ewin, 1);
+}
+
+int
+EobjListStackLower(EObj * ewin)
+{
+   return EobjListLower(&EwinListStack, ewin, 1);
+}
+
+int
+EobjListFocusRaise(EObj * ewin)
+{
+   return EobjListRaise(&EwinListFocus, ewin, 0);
+}
+
 EWin               *const *
-EwinListGetForDesktop(int desk, int *num)
+EwinListStackGet(int *num)
 {
    static EWin       **lst = NULL;
    static int          nalloc = 0;
-   int                 i, n, nwins;
-   EWin               *ewin;
-
-   /* TBD: Maintain per desktop lists? Not sure it's worth while */
-   nwins = EwinListStack.nwins;
-   if (nalloc < nwins)
+   const EobjList     *ewl;
+   int                 i, j, newins;
+   EObj               *eo;
+
+   ewl = &EwinListStack;
+   newins = EobjListTypeCount(ewl, EOBJ_TYPE_EWIN);
+   if (nalloc < newins)
      {
-       nalloc = (nwins + 16) & ~0xf;   /* 16 at the time */
+       nalloc = (newins + 16) & ~0xf;  /* 16 at the time */
        lst = Erealloc(lst, nalloc * sizeof(EWin *));
      }
 
-   n = 0;
-   for (i = 0; i < nwins; i++)
+   for (i = j = 0; i < ewl->nwins; i++)
      {
-       ewin = EwinListStack.list[i];
-       if (EoGetDesk(ewin) == desk)
-          lst[n++] = ewin;
+       eo = ewl->list[i];
+       if (eo->type != EOBJ_TYPE_EWIN)
+          continue;
+
+       lst[j++] = (EWin *) eo;
      }
-   *num = n;
 
+   *num = j;
    return lst;
 }
 
-int
-EwinListStackingRaise(EWin * ewin)
+EWin               *const *
+EwinListFocusGet(int *num)
 {
-   return EwinListRaise(&EwinListStack, ewin, 1);
+   return (EWin * const *)EobjListGet(&EwinListFocus, num);
 }
 
-int
-EwinListStackingLower(EWin * ewin)
+EWin               *const *
+EwinListGetForDesktop(int desk, int *num)
 {
-   return EwinListLower(&EwinListStack, ewin, 1);
-}
+   static EWin       **lst = NULL;
+   static int          nalloc = 0;
+   const EobjList     *ewl;
+   int                 i, j, newins;
+   EObj               *eo;
+
+   ewl = &EwinListStack;
+   newins = EobjListTypeCount(ewl, EOBJ_TYPE_EWIN);
+   /* Too many - who cares. */
+   if (nalloc < newins)
+     {
+       nalloc = (newins + 16) & ~0xf;  /* 16 at the time */
+       lst = Erealloc(lst, nalloc * sizeof(EWin *));
+     }
 
-int
-EwinListFocusRaise(EWin * ewin)
-{
-   return EwinListRaise(&EwinListFocus, ewin, 0);
+   for (i = j = 0; i < ewl->nwins; i++)
+     {
+       eo = ewl->list[i];
+       if (eo->type != EOBJ_TYPE_EWIN || eo->desk != desk)
+          continue;
+
+       lst[j++] = (EWin *) eo;
+     }
+
+   *num = j;
+   return lst;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/warp.c,v
retrieving revision 1.49.2.9
retrieving revision 1.49.2.10
diff -u -3 -r1.49.2.9 -r1.49.2.10
--- warp.c      27 Oct 2004 23:32:55 -0000      1.49.2.9
+++ warp.c      21 Nov 2004 22:15:21 -0000      1.49.2.10
@@ -208,7 +208,7 @@
    lst = (EWin **) ListItemType(&num, LIST_TYPE_WARP_RING);
    if (!lst)
      {
-       lst0 = EwinListGetFocus(&num0);
+       lst0 = EwinListFocusGet(&num0);
        num = 0;
        lst = NULL;
        for (i = num0 - 1; i >= 0; --i)




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