Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h actions.c arrange.c buttons.c comms.c config.c 
        containers.c desktops.c dock.c evhandlers.c finders.c ipc.c 
        main.c menus.c settings.c slideout.c 


Log Message:
Button code and namespace shuffle.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -3 -r1.153 -r1.154
--- E.h 4 Dec 2003 16:57:48 -0000       1.153
+++ E.h 7 Dec 2003 09:18:55 -0000       1.154
@@ -664,6 +664,8 @@
 typedef struct _snapshot Snapshot;
 typedef struct _iconbox Iconbox;
 typedef struct _group Group;
+typedef struct _button Button;
+typedef struct _buttoncontainer Container;
 
 typedef struct
 {
@@ -1090,6 +1092,7 @@
 }
 AwaitIclass;
 
+#ifdef DECLARE_STRUCT_BUTTON
 typedef struct _bgeometry
 {
    Constraints         width, height;
@@ -1102,7 +1105,7 @@
 }
 BGeometry;
 
-typedef struct _button
+struct _button
 {
    char               *name;
    BGeometry           geom;
@@ -1129,10 +1132,10 @@
    char                destroy_inside_win;
    char                left;
    unsigned int        ref_count;
-}
-Button;
+};
+#endif /* DECLARE_STRUCT_BUTTON */
 
-typedef struct _buttoncontainer
+struct _buttoncontainer
 {
    char               *name;
    ImageClass         *iclass;
@@ -1144,8 +1147,7 @@
    char                orientation;
    Button            **ButtonList;
    int                 numofbuttonsinlist;
-}
-Container;
+};
 
 typedef struct
 {
@@ -2075,6 +2077,7 @@
 void                ShowDesktopControls(void);
 void                ShowDesktopTabs(void);
 void                HideDesktopTabs(void);
+void                ShowDesktopButtons(void);
 void                MoveToDeskTop(int num);
 void                MoveToDeskBottom(int num);
 void                SlideWindowTo(Window win, int fx, int fy, int tx, int ty,
@@ -2184,25 +2187,42 @@
 void                RemoveContainer(Container * bc);
 
 /* buttons.c functions */
-Button             *CreateButton(char *name, ImageClass * iclass,
+Button             *ButtonCreate(char *name, ImageClass * iclass,
                                 ActionClass * aclass, TextClass * tclass,
                                 char *label, char ontop, int flags, int minw,
                                 int maxw, int minh, int maxh, int xo, int yo,
                                 int xa, int xr, int ya, int yr, int xsr,
                                 int xsa, int ysr, int ysa, char simg, int desk,
                                 char sticky);
-void                DestroyButton(Button * b);
-void                CalcButton(Button * b);
-void                ShowButton(Button * b);
-void                MoveButtonToDesktop(Button * b, int num);
-void                HideButton(Button * b);
-void                ToggleButton(Button * b);
-void                DrawButton(Button * b);
-void                MovebuttonToCoord(Button * b, int x, int y);
-int                 EmbedWindowIntoButton(Button * ButtonToUse,
-                                         Window WindowToEmbed);
-void                FindEmptySpotForButton(Button * bt, char *listname,
+void                ButtonDestroy(Button * b);
+void                ButtonShow(Button * b);
+void                ButtonHide(Button * b);
+void                ButtonToggle(Button * b);
+void                ButtonDraw(Button * b);
+void                ButtonDrawWithState(Button * b, int state);
+void                ButtonMoveToDesktop(Button * b, int num);
+void                ButtonMoveToCoord(Button * b, int x, int y);
+void                ButtonMoveRelative(Button * b, int dx, int dy);
+void                ButtonIncRefcount(Button * b);
+void                ButtonDecRefcount(Button * b);
+const char         *ButtonGetName(Button * b);
+int                 ButtonGetRefcount(Button * b);
+int                 ButtonGetDesktop(Button * b);
+void                ButtonGetGeometry(Button * b, int *x, int *y,
+                                     unsigned int *w, unsigned int *h);
+int                 ButtonGetInfo(Button * b, RectBox * r, int desk);
+ActionClass        *ButtonGetAClass(Button * b);
+int                 ButtonIsFixed(Button * b);
+int                 ButtonEmbedWindow(Button * ButtonToUse,
+                                     Window WindowToEmbed);
+void                ButtonFindEmptySpotFor(Button * bt, char *listname,
                                           char dirtomove);
+int                 ButtonsEventExpose(XEvent * ev);
+int                 ButtonsEventMouseDown(XEvent * ev);
+int                 ButtonsEventMouseUp(XEvent * ev, int wasmovres,
+                                       int wasdrag);
+int                 ButtonsEventMouseIn(XEvent * ev);
+int                 ButtonsEventMouseOut(XEvent * ev);
 
 /* atoms.c functions */
 void               *AtomGet(Window win, Atom to_get, Atom type, int *size);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/actions.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -3 -r1.115 -r1.116
--- actions.c   24 Nov 2003 17:07:23 -0000      1.115
+++ actions.c   7 Dec 2003 09:18:55 -0000       1.116
@@ -1065,7 +1065,7 @@
 {
    EWin              **gwins;
    EWin               *ewin;
-   int                 xo, yo, i, num;
+   int                 i, num;
 
    EDBUG(6, "doMove");
    if (InZoom())
@@ -1102,8 +1102,6 @@
    mode.win_h = ewin->client.h;
    mode.firstlast = 0;
    start_move_desk = ewin->desktop;
-   xo = desks.desk[ewin->desktop].x;
-   yo = desks.desk[ewin->desktop].y;
 
    gwins = ListWinGroupMembersForEwin(ewin, ACTION_MOVE, mode.nogroup
                                      || mode.swapmovemode, &num);
@@ -1439,18 +1437,9 @@
             ret = Erealloc(ret, sizeof(RectBox) * ((num + j) + 1 + k));
             for (i = 0; i < num; i++)
               {
-                 Button             *b = blst[i];
-
-                 if (!b->visible || b->internal)
-                    continue;
-                 if (!b->sticky && (b->desktop != desks.current))
+                 if (ButtonGetInfo(blst[i], &fixed[k], desks.current))
                     continue;
 
-                 fixed[k].data = NULL;
-                 fixed[k].x = blst[i]->x;
-                 fixed[k].y = blst[i]->y;
-                 fixed[k].w = blst[i]->w;
-                 fixed[k].h = blst[i]->h;
                  if (fixed[k].x < 0)
                    {
                       fixed[k].x += fixed[k].w;
@@ -1468,7 +1457,7 @@
                  if ((fixed[k].w <= 0) || (fixed[k].h <= 0))
                     continue;
 
-                 if (blst[i]->sticky)
+                 if (fixed[k].p)       /* Sticky */
                     fixed[k].p = 50;
                  else
                     fixed[k].p = 0;
@@ -1907,8 +1896,7 @@
 int
 doDragButtonStart(void *params)
 {
-   Button             *button;
-   int                 xo, yo;
+   Button             *b;
 
    EDBUG(6, "doDragButtonStart");
 
@@ -1918,26 +1906,23 @@
        || (mode.mode == MODE_RESIZE_V) || (mode.mode == MODE_RESIZE))
       EDBUG_RETURN(0);
 
-   button = mode.button;
-   if (button->flags & FLAG_FIXED)
+   b = mode.button;
+   if (!b)
+      EDBUG_RETURN(0);
+
+   if (ButtonIsFixed(b))
      {
        mode.button = NULL;
        EDBUG_RETURN(0);
      }
-   if (!button)
-      EDBUG_RETURN(0);
 
    GrabThePointer(root.win);
    mode.mode = MODE_BUTTONDRAG;
    mode.button_move_pending = 1;
    mode.start_x = mode.x;
    mode.start_y = mode.y;
-   mode.win_x = button->x;
-   mode.win_y = button->y;
+   ButtonGetGeometry(b, &mode.win_x, &mode.win_y, NULL, NULL);
    mode.firstlast = 0;
-   xo = desks.desk[button->desktop].x;
-   yo = desks.desk[button->desktop].y;
-   params = NULL;
 
    EDBUG_RETURN(0);
 }
@@ -1945,25 +1930,27 @@
 int
 doDragButtonEnd(void *params)
 {
-   Button             *button;
+   Button             *b;
    int                 d;
 
    EDBUG(6, "doDragButtonEnd");
-   button = mode.button;
-   if (!button)
+
+   b = mode.button;
+   if (!b)
       EDBUG_RETURN(0);
+
    mode.mode = MODE_NONE;
    UnGrabTheButtons();
    if (!mode.button_move_pending)
      {
        d = DesktopAt(mode.x, mode.y);
-       MoveButtonToDesktop(button, d);
-       MovebuttonToCoord(button, button->x - desks.desk[button->desktop].x,
-                         button->y - desks.desk[button->desktop].y);
+       ButtonMoveToDesktop(b, d);
+       d = ButtonGetDesktop(b);
+       ButtonMoveRelative(b, -desks.desk[d].x, -desks.desk[d].y);
      }
    else
       mode.button_move_pending = 0;
-   params = NULL;
+
    autosave();
 
    EDBUG_RETURN(0);
@@ -2203,14 +2190,12 @@
        GotoDesktop(desks.current);
        for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
           MoveDesktop(i, 0, 0);
-       while ((b =
-               RemoveItem("_DESKTOP_DRAG_CONTROL", 0, LIST_FINDBY_NAME,
-                          LIST_TYPE_BUTTON)))
-          DestroyButton(b);
-       while ((b =
-               RemoveItem("_DESKTOP_DESKRAY_DRAG_CONTROL", 0, LIST_FINDBY_NAME,
-                          LIST_TYPE_BUTTON)))
-          DestroyButton(b);
+       while ((b = RemoveItem("_DESKTOP_DRAG_CONTROL", 0,
+                              LIST_FINDBY_NAME, LIST_TYPE_BUTTON)))
+          ButtonDestroy(b);
+       while ((b = RemoveItem("_DESKTOP_DESKRAY_DRAG_CONTROL", 0,
+                              LIST_FINDBY_NAME, LIST_TYPE_BUTTON)))
+          ButtonDestroy(b);
        InitDesktopControls();
        ShowDesktopControls();
      }
@@ -2236,10 +2221,9 @@
      }
    if (pd != desks.dragbar_ordering)
      {
-       while ((b =
-               RemoveItem("_DESKTOP_DRAG_CONTROL", 0, LIST_FINDBY_NAME,
-                          LIST_TYPE_BUTTON)))
-          DestroyButton(b);
+       while ((b = RemoveItem("_DESKTOP_DRAG_CONTROL", 0,
+                              LIST_FINDBY_NAME, LIST_TYPE_BUTTON)))
+          ButtonDestroy(b);
        InitDesktopControls();
        ShowDesktopControls();
      }
@@ -2259,10 +2243,9 @@
       desks.dragbar_width = atoi((char *)params);
    if (pd != desks.dragbar_width)
      {
-       while ((b =
-               RemoveItem("_DESKTOP_DRAG_CONTROL", 0, LIST_FINDBY_NAME,
-                          LIST_TYPE_BUTTON)))
-          DestroyButton(b);
+       while ((b = RemoveItem("_DESKTOP_DRAG_CONTROL", 0,
+                              LIST_FINDBY_NAME, LIST_TYPE_BUTTON)))
+          ButtonDestroy(b);
        InitDesktopControls();
        ShowDesktopControls();
      }
@@ -2282,10 +2265,9 @@
       desks.dragbar_length = atoi((char *)params);
    if (pd != desks.dragbar_length)
      {
-       while ((b =
-               RemoveItem("_DESKTOP_DRAG_CONTROL", 0, LIST_FINDBY_NAME,
-                          LIST_TYPE_BUTTON)))
-          DestroyButton(b);
+       while ((b = RemoveItem("_DESKTOP_DRAG_CONTROL", 0,
+                              LIST_FINDBY_NAME, LIST_TYPE_BUTTON)))
+          ButtonDestroy(b);
        InitDesktopControls();
        ShowDesktopControls();
      }
@@ -2448,8 +2430,8 @@
          {
             sscanf((char *)params, "%*s %1000s", s);
             b = (Button *) FindItem(s, 0, LIST_FINDBY_NAME, LIST_TYPE_BUTTON);
-            if ((b) && (!b->used))
-               ToggleButton(b);
+            if (b)
+               ButtonToggle(b);
          }
        else if (!strcmp(s, "buttons"))
          {
@@ -2461,12 +2443,11 @@
                    {
                       for (i = 0; i < num; i++)
                         {
-                           if (matchregexp(ss, lst[i]->name))
+                           if (matchregexp(ss, ButtonGetName(lst[i])))
                              {
-                                if ((strcmp(lst[i]->name,
-                                            "_DESKTOP_DESKRAY_DRAG_CONTROL")
-                                     && (!lst[i]->used)))
-                                   ToggleButton(lst[i]);
+                                if (strcmp(ButtonGetName(lst[i]),
+                                           "_DESKTOP_DESKRAY_DRAG_CONTROL"))
+                                   ButtonToggle(lst[i]);
                              }
                         }
                    }
@@ -2482,12 +2463,11 @@
                    {
                       for (i = 0; i < num; i++)
                         {
-                           if (!matchregexp(ss, lst[i]->name))
+                           if (!matchregexp(ss, ButtonGetName(lst[i])))
                              {
-                                if ((strcmp(lst[i]->name,
-                                            "_DESKTOP_DESKRAY_DRAG_CONTROL")
-                                     && (!lst[i]->used)))
-                                   ToggleButton(lst[i]);
+                                if (strcmp(ButtonGetName(lst[i]),
+                                           "_DESKTOP_DESKRAY_DRAG_CONTROL"))
+                                   ButtonToggle(lst[i]);
                              }
                         }
                    }
@@ -2500,10 +2480,10 @@
               {
                  for (i = 0; i < num; i++)
                    {
-                      if ((strcmp
-                           (lst[i]->name, "_DESKTOP_DESKRAY_DRAG_CONTROL")
-                           && (!lst[i]->used)))
-                         ToggleButton(lst[i]);
+                      if (strcmp
+                          (ButtonGetName(lst[i]),
+                           "_DESKTOP_DESKRAY_DRAG_CONTROL"))
+                         ButtonToggle(lst[i]);
                    }
               }
          }
@@ -2515,8 +2495,7 @@
          {
             for (i = 0; i < num; i++)
               {
-                 if (!lst[i]->used)
-                    ToggleButton(lst[i]);
+                 ButtonToggle(lst[i]);
               }
          }
      }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/arrange.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- arrange.c   8 Nov 2003 10:54:03 -0000       1.57
+++ arrange.c   7 Dec 2003 09:18:55 -0000       1.58
@@ -883,18 +883,9 @@
             fixed = Erealloc(fixed, sizeof(RectBox) * (num + j));
             for (i = 0; i < num; i++)
               {
-                 Button             *b = blst[i];
-
-                 if (!b->visible || b->internal)
-                    continue;
-                 if (!b->sticky && (b->desktop != ewin->desktop))
+                 if (ButtonGetInfo(blst[i], &fixed[j], ewin->desktop))
                     continue;
 
-                 fixed[j].data = NULL;
-                 fixed[j].x = b->x;
-                 fixed[j].y = b->y;
-                 fixed[j].w = b->w;
-                 fixed[j].h = b->h;
                  if (fixed[j].x < 0)
                    {
                       fixed[j].w += fixed[j].x;
@@ -912,7 +903,7 @@
                  if ((fixed[j].w <= 0) || (fixed[j].h <= 0))
                     continue;
 
-                 if (b->sticky)
+                 if (fixed[j].p)       /* Sticky */
                     fixed[j].p = 1;
                  else
                     fixed[j].p = 0;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- buttons.c   15 Nov 2003 22:27:17 -0000      1.22
+++ buttons.c   7 Dec 2003 09:18:55 -0000       1.23
@@ -20,10 +20,11 @@
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#define DECLARE_STRUCT_BUTTON
 #include "E.h"
 
 Button             *
-CreateButton(char *name, ImageClass * iclass, ActionClass * aclass,
+ButtonCreate(char *name, ImageClass * iclass, ActionClass * aclass,
             TextClass * tclass, char *label, char ontop, int flags,
             int minw, int maxw, int minh, int maxh, int xo, int yo,
             int xa, int xr, int ya, int yr, int xsr, int xsa, int ysr,
@@ -31,7 +32,7 @@
 {
    Button             *b;
 
-   EDBUG(5, "CreateButton");
+   EDBUG(5, "ButtonCreate");
 
    b = Emalloc(sizeof(Button));
 
@@ -111,9 +112,9 @@
 }
 
 void
-DestroyButton(Button * b)
+ButtonDestroy(Button * b)
 {
-   EDBUG(5, "DestroyButton");
+   EDBUG(5, "ButtonDestroy");
 
    if (!b)
       EDBUG_RETURN_;
@@ -154,13 +155,13 @@
    EDBUG_RETURN_;
 }
 
-void
-CalcButton(Button * b)
+static void
+ButtonCalc(Button * b)
 {
    int                 w, h, x, y, xo, yo;
    Imlib_Image        *im;
 
-   EDBUG(4, "CalcButton");
+   EDBUG(4, "ButtonCalc");
    x = 0;
    y = 0;
    w = 32;
@@ -219,13 +220,13 @@
 }
 
 void
-ShowButton(Button * b)
+ButtonShow(Button * b)
 {
    char                move, resize;
 
-   EDBUG(4, "ShowButton");
+   EDBUG(4, "ButtonShow");
 
-   CalcButton(b);
+   ButtonCalc(b);
 
    move = 0;
    resize = 0;
@@ -243,7 +244,7 @@
    if (b->sticky)
       XRaiseWindow(disp, b->win);
 
-   DrawButton(b);
+   ButtonDraw(b);
    b->visible = 1;
    EMapWindow(disp, b->win);
    b->cx = b->x;
@@ -255,9 +256,9 @@
 }
 
 void
-MoveButtonToDesktop(Button * b, int num)
+ButtonMoveToDesktop(Button * b, int num)
 {
-   EDBUG(3, "MoveButtonToDesktop");
+   EDBUG(3, "ButtonMoveToDesktop");
 
    if (b->sticky)
      {
@@ -276,9 +277,9 @@
 }
 
 void
-HideButton(Button * b)
+ButtonHide(Button * b)
 {
-   EDBUG(3, "HideButton");
+   EDBUG(3, "ButtonHide");
 
    EUnmapWindow(disp, b->win);
    b->visible = 0;
@@ -287,22 +288,25 @@
 }
 
 void
-ToggleButton(Button * b)
+ButtonToggle(Button * b)
 {
-   EDBUG(3, "ToggleButton");
+   EDBUG(3, "ButtonToggle");
+
+   if (b->used)
+      EDBUG_RETURN_;
 
    if (b->visible)
-      HideButton(b);
+      ButtonHide(b);
    else
-      ShowButton(b);
+      ButtonShow(b);
 
    EDBUG_RETURN_;
 }
 
 void
-DrawButton(Button * b)
+ButtonDraw(Button * b)
 {
-   EDBUG(3, "DrawButton");
+   EDBUG(3, "ButtonDraw");
 
    IclassApply(b->iclass, b->win, b->w, b->h, 0, 0, b->state, 0);
 
@@ -313,12 +317,19 @@
 }
 
 void
-MovebuttonToCoord(Button * b, int x, int y)
+ButtonDrawWithState(Button * b, int state)
+{
+   b->state = state;
+   ButtonDraw(b);
+}
+
+void
+ButtonMoveToCoord(Button * b, int x, int y)
 {
    int                 rx, ry, relx, rely, absx, absy;
    char                move, resize;
 
-   EDBUG(3, "MovebuttonToCoord");
+   EDBUG(3, "ButtonMoveToCoord");
    if (b->flags & FLAG_FIXED)
       EDBUG_RETURN_;
 
@@ -350,7 +361,7 @@
        b->geom.yabs = absy;
        b->geom.yrel = rely;
      }
-   CalcButton(b);
+   ButtonCalc(b);
    move = 0;
    resize = 0;
    if ((b->x != b->cx) || (b->y != b->cy))
@@ -373,13 +384,92 @@
    EDBUG_RETURN_;
 }
 
+void
+ButtonMoveRelative(Button * b, int dx, int dy)
+{
+   ButtonMoveToCoord(b, b->x + dx, b->y + dy);
+}
+
+void
+ButtonIncRefcount(Button * b)
+{
+   b->ref_count++;
+}
+
+void
+ButtonDecRefcount(Button * b)
+{
+   b->ref_count--;
+}
+
+const char         *
+ButtonGetName(Button * b)
+{
+   return b->name;
+}
+
 int
-EmbedWindowIntoButton(Button * ButtonToUse, Window WindowToEmbed)
+ButtonGetRefcount(Button * b)
+{
+   return b->ref_count;
+}
+
+int
+ButtonGetDesktop(Button * b)
+{
+   return b->desktop;
+}
+
+void
+ButtonGetGeometry(Button * b, int *x, int *y, unsigned int *w, unsigned int *h)
+{
+   if (x)
+      *x = b->x;
+   if (y)
+      *y = b->y;
+   if (w)
+      *w = b->w;
+   if (h)
+      *h = b->h;
+}
+
+int
+ButtonGetInfo(Button * b, RectBox * r, int desk)
+{
+   if (!b->visible || b->internal)
+      return -1;
+   if (!b->sticky && (b->desktop != desk))
+      return -1;
+
+   r->data = NULL;
+   r->x = b->x;
+   r->y = b->y;
+   r->w = b->w;
+   r->h = b->h;
+   r->p = b->sticky;
+
+   return 0;
+}
+
+ActionClass        *
+ButtonGetAClass(Button * b)
+{
+   return b->aclass;
+}
+
+int
+ButtonIsFixed(Button * b)
+{
+   return b->flags & FLAG_FIXED;
+}
+
+int
+ButtonEmbedWindow(Button * ButtonToUse, Window WindowToEmbed)
 {
 
    unsigned int        w, h;
 
-   EDBUG(4, "EmbedWindowIntoButton");
+   EDBUG(4, "ButtonEmbedWindow");
    EReparentWindow(disp, WindowToEmbed, ButtonToUse->win, 0, 0);
    ButtonToUse->inside_win = WindowToEmbed;
    GetWinWH(WindowToEmbed, &w, &h);
@@ -399,7 +489,7 @@
 }
 
 void
-FindEmptySpotForButton(Button * bt, char *listname, char dirtomove)
+ButtonFindEmptySpotFor(Button * bt, char *listname, char dirtomove)
 {
 
    Button            **blst;
@@ -440,7 +530,227 @@
          }
        Efree(blst);
      }
-   MovebuttonToCoord(bt, bt->x, bt->y);
+   ButtonMoveToCoord(bt, bt->x, bt->y);
 
    EDBUG_RETURN_;
+}
+
+/*
+ * Functions operating on all buttons
+ */
+
+Button             *
+FindButton(Window win)
+{
+   Button             *b;
+   Button            **buttons;
+   int                 i, num;
+
+   EDBUG(6, "FindButton");
+
+   buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
+   for (i = 0; i < num; i++)
+     {
+       if ((win == buttons[i]->win) || (win == buttons[i]->inside_win)
+           || (win == buttons[i]->event_win))
+         {
+            b = buttons[i];
+            Efree(buttons);
+            EDBUG_RETURN(b);
+         }
+     }
+   if (buttons)
+      Efree(buttons);
+   EDBUG_RETURN(NULL);
+}
+
+/*
+ * Button event handlers
+ */
+
+int
+ButtonsEventExpose(XEvent * ev)
+{
+   int                 used = 0;
+   int                 i, num;
+   Button            **buttons;
+   Window              win = ev->xexpose.window;
+
+   buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
+   if (buttons == NULL)
+      return 0;
+
+   for (i = 0; i < num; i++)
+     {
+       if (win != buttons[i]->win)
+          continue;
+
+       ButtonDraw(buttons[i]);
+       used = 1;
+       break;
+     }
+   Efree(buttons);
+
+   return used;
+}
+
+int
+ButtonsEventMouseDown(XEvent * ev)
+{
+   int                 used = 0;
+   int                 i, num;
+   Button            **buttons;
+   Window              win = ev->xbutton.window;
+   ActionClass        *ac;
+
+   buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
+   if (buttons == NULL)
+      return 0;
+
+   for (i = 0; i < num; i++)
+     {
+       if ((win != buttons[i]->win) && (win != buttons[i]->event_win))
+          continue;
+
+       GrabThePointer(win);
+       if (buttons[i]->inside_win)
+         {
+            Window              id = ev->xany.window;  /* ??? */
+
+            ev->xany.window = buttons[i]->inside_win;
+            XSendEvent(disp, buttons[i]->inside_win, False,
+                       ButtonPressMask, ev);
+            ev->xany.window = id;
+         }
+
+       mode.button = buttons[i];
+       buttons[i]->state = STATE_CLICKED;
+       ButtonDraw(buttons[i]);
+       ac = FindItem("ACTION_BUTTON_DRAG", 0, LIST_FINDBY_NAME,
+                     LIST_TYPE_ACLASS);
+       if (ac)
+          EventAclass(ev, ac);
+       if (buttons[i]->aclass)
+          EventAclass(ev, buttons[i]->aclass);
+       used = 1;
+       break;
+     }
+   Efree(buttons);
+
+   return used;
+}
+
+int
+ButtonsEventMouseUp(XEvent * ev, int wasmovres, int wasdrag)
+{
+   int                 used = 0;
+   int                 i, num;
+   Button            **buttons;
+   Window              win = ev->xbutton.window;
+
+   buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
+   if (buttons == NULL)
+      return 0;
+
+   for (i = 0; i < num; i++)
+     {
+       if ((win != buttons[i]->win) && (win != buttons[i]->event_win))
+          continue;
+
+       if ((buttons[i]->inside_win) && (!wasmovres))
+         {
+            Window              id = ev->xany.window;  /* ??? */
+
+            ev->xany.window = buttons[i]->inside_win;
+            XSendEvent(disp, buttons[i]->inside_win, False,
+                       ButtonReleaseMask, ev);
+            ev->xany.window = id;
+         }
+       mode.button = buttons[i];
+       if ((buttons[i]->state == STATE_CLICKED) && (!buttons[i]->left))
+          buttons[i]->state = STATE_HILITED;
+       else
+          buttons[i]->state = STATE_NORMAL;
+       buttons[i]->left = 0;
+       ButtonDraw(buttons[i]);
+       if ((buttons[i]->aclass) && (!wasdrag) && (!wasmovres))
+          EventAclass(ev, buttons[i]->aclass);
+       mode.destroy = 0;
+       last_bpress = 0;
+       used = 1;
+       break;
+     }
+   Efree(buttons);
+
+   return used;
+}
+
+int
+ButtonsEventMouseIn(XEvent * ev)
+{
+   int                 used = 0;
+   int                 i, num;
+   Button            **buttons;
+   Window              win = ev->xcrossing.window;
+
+   buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
+   if (buttons == NULL)
+      return 0;
+
+   for (i = 0; i < num; i++)
+     {
+       if ((win != buttons[i]->win) && (win != buttons[i]->event_win))
+          continue;
+
+       mode.button = buttons[i];
+       if (buttons[i]->state == STATE_CLICKED)
+          buttons[i]->left = 0;
+       else
+         {
+            buttons[i]->state = STATE_HILITED;
+            ButtonDraw(buttons[i]);
+            if (buttons[i]->aclass)
+               EventAclass(ev, buttons[i]->aclass);
+         }
+       used = 1;
+       break;
+     }
+   Efree(buttons);
+
+   return used;
+}
+
+int
+ButtonsEventMouseOut(XEvent * ev)
+{
+   int                 used = 0;
+   int                 i, num;
+   Button            **buttons;
+   Window              win = ev->xcrossing.window;
+
+   buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
+   if (buttons == NULL)
+      return 0;
+
+   for (i = 0; i < num; i++)
+     {
+       if ((win != buttons[i]->win) && (win != buttons[i]->event_win))
+          continue;
+
+       mode.button = NULL;
+       if (buttons[i]->state == STATE_CLICKED)
+          buttons[i]->left = 1;
+       else
+         {
+            buttons[i]->state = STATE_NORMAL;
+            ButtonDraw(buttons[i]);
+            if (buttons[i]->aclass)
+               EventAclass(ev, buttons[i]->aclass);
+         }
+       used = 1;
+       break;
+     }
+   Efree(buttons);
+
+   return used;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/comms.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- comms.c     22 Nov 2003 00:15:39 -0000      1.34
+++ comms.c     7 Dec 2003 09:18:55 -0000       1.35
@@ -1467,10 +1467,9 @@
          {
             Button             *b;
 
-            while ((b =
-                    RemoveItem("_DESKTOP_DRAG_CONTROL", 0, LIST_FINDBY_NAME,
-                               LIST_TYPE_BUTTON)))
-               DestroyButton(b);
+            while ((b = RemoveItem("_DESKTOP_DRAG_CONTROL", 0,
+                                   LIST_FINDBY_NAME, LIST_TYPE_BUTTON)))
+               ButtonDestroy(b);
             InitDesktopControls();
             ShowDesktopControls();
          }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -3 -r1.74 -r1.75
--- config.c    24 Nov 2003 17:07:23 -0000      1.74
+++ config.c    7 Dec 2003 09:18:55 -0000       1.75
@@ -20,6 +20,7 @@
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#define DECLARE_STRUCT_BUTTON
 #define DECLARE_STRUCT_ICONBOX
 #include "E.h"
 #include "conf.h"
@@ -526,10 +527,7 @@
                b = (Button *) FindItem(s2, 0, LIST_FINDBY_NAME,
                                        LIST_TYPE_BUTTON);
                if (b)
-                 {
-                    AddButtonToSlideout(slideout, b);
-                    b->ref_count++;
-                 }
+                  AddButtonToSlideout(slideout, b);
             }
             break;
          default:
@@ -1496,7 +1494,7 @@
          case CONFIG_CLOSE:
             if ((!pbt) && (!is_autosave))
               {
-                 bt = CreateButton(name, ic, ac, tc, label, ontop, flags,
+                 bt = ButtonCreate(name, ic, ac, tc, label, ontop, flags,
                                    minw, maxw, minh, maxh, xo, yo, xa, xr,
                                    ya, yr, xsr, xsa, ysr, ysa, simg, desk,
                                    sticky);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/containers.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- containers.c        5 Nov 2003 17:24:43 -0000       1.11
+++ containers.c        7 Dec 2003 09:18:55 -0000       1.12
@@ -73,7 +73,7 @@
                    (bc->numofbuttonsinlist + 1) * sizeof(Container *));
      }
    bc->ButtonList[bc->numofbuttonsinlist++] = b;
-   b->ref_count++;
+   ButtonIncRefcount(b);
 
    EDBUG_RETURN_;
 }
@@ -120,7 +120,7 @@
        bc->numofbuttonsinlist = 0;
      }
    Efree(MyButtonList);
-   b->ref_count--;
+   ButtonDecRefcount(b);
    EDBUG_RETURN_;
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- desktops.c  4 Dec 2003 16:57:48 -0000       1.49
+++ desktops.c  7 Dec 2003 09:18:55 -0000       1.50
@@ -20,6 +20,7 @@
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#define DECLARE_STRUCT_BUTTON
 #include "E.h"
 #include <sys/time.h>
 
@@ -170,7 +171,7 @@
    if ((blst) && (num > 0))
      {
        for (i = 0; i < num; i++)
-          ShowButton(blst[i]);
+          ButtonShow(blst[i]);
        Efree(blst);
        StackDesktops();
      }
@@ -186,7 +187,7 @@
    if ((blst) && (num > 0))
      {
        for (i = 0; i < num; i++)
-          ShowButton(blst[i]);
+          ButtonShow(blst[i]);
        Efree(blst);
        StackDesktops();
      }
@@ -195,20 +196,38 @@
 void
 HideDesktopTabs()
 {
-   Button            **lst;
+   Button            **blst;
    int                 num, i;
 
-   lst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 2);
-   if ((lst) && (num > 0))
+   blst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 2);
+   if ((blst) && (num > 0))
      {
        for (i = 0; i < num; i++)
-          HideButton(lst[i]);
-       Efree(lst);
+          ButtonHide(blst[i]);
+       Efree(blst);
        StackDesktops();
      }
 }
 
 void
+ShowDesktopButtons(void)
+{
+   Button            **blst;
+   int                 i, num;
+
+   blst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 0);
+   if (blst)
+     {
+       for (i = 0; i < num; i++)
+         {
+            if ((!blst[i]->internal) && (blst[i]->default_show))
+               ButtonShow(blst[i]);
+         }
+       Efree(blst);
+     }
+}
+
+void
 MoveToDeskTop(int num)
 {
    int                 i, j;
@@ -1002,15 +1021,15 @@
 
        if (desks.dragbar_width > 0)
          {
-            b = CreateButton("_DESKTOP_DRAG_CONTROL", ic2, ac2, NULL, NULL, -1,
+            b = ButtonCreate("_DESKTOP_DRAG_CONTROL", ic2, ac2, NULL, NULL, -1,
                              FLAG_FIXED, 1, 99999, 1, 99999, 0, 0, x[0], 0,
                              y[0], 0, 0, w[0], 0, h[0], 0, i, 0);
             AddItem(b, b->name, 1, LIST_TYPE_BUTTON);
-            b = CreateButton("_DESKTOP_DRAG_CONTROL", ic3, ac3, NULL, NULL, -1,
+            b = ButtonCreate("_DESKTOP_DRAG_CONTROL", ic3, ac3, NULL, NULL, -1,
                              FLAG_FIXED, 1, 99999, 1, 99999, 0, 0, x[1], 0,
                              y[1], 0, 0, w[1], 0, h[1], 0, i, 0);
             AddItem(b, b->name, 1, LIST_TYPE_BUTTON);
-            b = CreateButton("_DESKTOP_DRAG_CONTROL", ic, ac, NULL, NULL, -1,
+            b = ButtonCreate("_DESKTOP_DRAG_CONTROL", ic, ac, NULL, NULL, -1,
                              FLAG_FIXED, 1, 99999, 1, 99999, 0, 0, x[2], 0,
                              y[2], 0, 0, w[2], 0, h[2], 0, i, 0);
             AddItem(b, b->name, 1, LIST_TYPE_BUTTON);
@@ -1019,14 +1038,14 @@
          {
             if (desks.dragdir == 0)
               {
-                 b = CreateButton("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
+                 b = ButtonCreate("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
                                   NULL, NULL, 1, FLAG_FIXED_VERT, 1, 99999, 1,
                                   99999, 0, 0, desks.desk[i].x, 0,
                                   desks.desk[i].y, 0, 0, 0, 0, 0, 1, 0, 1);
               }
             else if (desks.dragdir == 1)
               {
-                 b = CreateButton("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
+                 b = ButtonCreate("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
                                   NULL, NULL, 1, FLAG_FIXED_VERT, 1, 99999, 1,
                                   99999, 0, 0,
                                   desks.desk[i].x + root.w -
@@ -1035,14 +1054,14 @@
               }
             else if (desks.dragdir == 2)
               {
-                 b = CreateButton("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
+                 b = ButtonCreate("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
                                   NULL, NULL, 1, FLAG_FIXED_HORIZ, 1, 99999, 1,
                                   99999, 0, 0, desks.desk[i].x, 0,
                                   desks.desk[i].y, 0, 0, 0, 0, 0, 1, 0, 1);
               }
             else
               {
-                 b = CreateButton("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
+                 b = ButtonCreate("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
                                   NULL, NULL, 1, FLAG_FIXED_HORIZ, 1, 99999, 1,
                                   99999, 0, 0, desks.desk[i].x, 0,
                                   desks.desk[i].y + root.h -
@@ -1453,10 +1472,8 @@
    EMoveWindow(disp, desks.desk[num].win, x, y);
 
    if (desks.desk[num].tag)
-     {
-       MovebuttonToCoord(desks.desk[num].tag, desks.desk[num].tag->x + dx,
-                         desks.desk[num].tag->y + dy);
-     }
+      ButtonMoveRelative(desks.desk[num].tag, dx, dy);
+
    desks.desk[num].x = x;
    desks.desk[num].y = y;
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/dock.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- dock.c      5 Nov 2003 17:24:43 -0000       1.10
+++ dock.c      7 Dec 2003 09:18:55 -0000       1.11
@@ -36,13 +36,13 @@
    ic = FindItem("DEFAULT_DOCK_BUTTON", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
    if (mode.dockstartx >= 0)
      {
-       bt = CreateButton(id, ic, ac, NULL, NULL, 1, 0, 64, 64, 64, 64, 0, 0,
+       bt = ButtonCreate(id, ic, ac, NULL, NULL, 1, 0, 64, 64, 64, 64, 0, 0,
                          mode.dockstartx, 0, mode.dockstarty, 0, 0, 0, 0, 0, 1,
                          0, 1);
      }
    else
      {
-       bt = CreateButton(id, ic, ac, NULL, NULL, 1, 0, 64, 64, 64, 64, 0, 2046,
+       bt = ButtonCreate(id, ic, ac, NULL, NULL, 1, 0, 64, 64, 64, 64, 0, 2046,
                          0, 0, 0, 1023, 0, 0, 0, 0, 1, 0, 1);
      }
    UngrabX();
@@ -50,13 +50,13 @@
    if (!bt)
       EDBUG_RETURN_;
 
-   ShowButton(bt);
-   FindEmptySpotForButton(bt, "DOCK_APP_BUTTON", mode.dockdirmode);
+   ButtonShow(bt);
+   ButtonFindEmptySpotFor(bt, "DOCK_APP_BUTTON", mode.dockdirmode);
 
    AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
    AddItem(bt, "DOCK_APP_BUTTON", ewin->client.win, LIST_TYPE_BUTTON);
 
-   EmbedWindowIntoButton(bt, ewin->client.win);
+   ButtonEmbedWindow(bt, ewin->client.win);
    ShowEwin(ewin);
 
    EDBUG_RETURN_;
@@ -71,7 +71,7 @@
    EDBUG(3, "DockDestroy");
    bt = FindItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_BUTTON);
    if (bt)
-      DestroyButton(RemoveItem
+      ButtonDestroy(RemoveItem
                    (NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_BUTTON));
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -3 -r1.126 -r1.127
--- evhandlers.c        30 Nov 2003 15:35:43 -0000      1.126
+++ evhandlers.c        7 Dec 2003 09:18:55 -0000       1.127
@@ -683,8 +683,7 @@
          {
             if (mode.button)
               {
-                 MovebuttonToCoord(mode.button, mode.button->x + dx,
-                                   mode.button->y + dy);
+                 ButtonMoveRelative(mode.button, dx, dy);
                  if (mode.deskmode == MODE_DESKRAY)
                    {
                       MoveDesktop(mode.deskdrag, desks.desk[mode.deskdrag].x,
@@ -1346,22 +1345,8 @@
    if (ewin)
       Efree(ewin);
 
-   {
-      Button            **button;
-
-      button = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
-      for (i = 0; i < num; i++)
-       {
-          if (win == button[i]->win)
-            {
-               DrawButton(button[i]);
-               Efree(button);
-               EDBUG_RETURN_;
-            }
-       }
-      if (button)
-        Efree(button);
-   }
+   if (ButtonsEventExpose(ev))
+      EDBUG_RETURN_;
 
    DialogEventExpose(ev);
 
@@ -1375,8 +1360,6 @@
    EWin               *ewin;
    EWin              **ewins;
    int                 i, j, num;
-   Button            **buttons;
-   ActionClass        *ac;
    Menu               *m;
    MenuItem           *mi;
    int                 desk_click;
@@ -1458,7 +1441,7 @@
        EDBUG_RETURN_;
      }
 
-   m = FindMenuItem(click_was_in, &mi);
+   m = FindMenuItem(win, &mi);
    if ((!m) && ((mode.clickalways) || (mode.focusmode == FOCUS_CLICK)))
      {
        ewin = FindEwinByChildren(win);
@@ -1550,41 +1533,8 @@
        Efree(ewins);
      }
 
-   if (win)
-     {
-       buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
-       for (i = 0; i < num; i++)
-         {
-            if ((win == buttons[i]->win) || (win == buttons[i]->event_win))
-              {
-                 GrabThePointer(win);
-                 if (buttons[i]->inside_win)
-                   {
-                      Window              id;
-
-                      id = ev->xany.window;
-                      ev->xany.window = buttons[i]->inside_win;
-                      XSendEvent(disp, buttons[i]->inside_win, False,
-                                 ButtonPressMask, ev);
-                      ev->xany.window = id;
-                   }
-
-                 mode.button = buttons[i];
-                 buttons[i]->state = STATE_CLICKED;
-                 DrawButton(buttons[i]);
-                 ac = FindItem("ACTION_BUTTON_DRAG", 0, LIST_FINDBY_NAME,
-                               LIST_TYPE_ACLASS);
-                 if (ac)
-                    EventAclass(ev, ac);
-                 if (buttons[i]->aclass)
-                    EventAclass(ev, buttons[i]->aclass);
-                 Efree(buttons);
-                 EDBUG_RETURN_;
-              }
-         }
-       if (buttons)
-          Efree(buttons);
-     }
+   if (ButtonsEventMouseDown(ev))
+      goto exit;
 
    DialogEventMouseDown(ev);
 
@@ -1611,6 +1561,7 @@
 
    PagersEventMouseDown(ev);
 
+ exit:
    EDBUG_RETURN_;
 }
 
@@ -1621,7 +1572,6 @@
    EWin               *ewin;
    EWin              **ewins;
    int                 i, j, num;
-   Button            **buttons;
    char                wasdrag;
    char                wasmovres;
    char                justclicked = 0;
@@ -1639,6 +1589,7 @@
        if ((int)last_button != (int)ev->xbutton.button)
           EDBUG_RETURN_;
      }
+
    if (ttip)
       HideToolTip(ttip);
    RemoveTimerEvent("TOOLTIP_TIMEOUT");
@@ -1674,9 +1625,6 @@
        mode.place = 0;
        EDBUG_RETURN_;
      }
-   wasdrag = 0;
-   wasmovres = 0;
-   pslideout = mode.slideout;
 
    if ((last_bpress) && (last_bpress != win))
      {
@@ -1700,6 +1648,7 @@
          }
        last_bpress = 0;
      }
+
    wasdrag = 0;
    wasmovres = 0;
    switch (mode.mode)
@@ -1891,45 +1840,9 @@
      }
    if (ewins)
       Efree(ewins);
-   if (click_was_in)
-     {
-       buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
-       for (i = 0; i < num; i++)
-         {
-            if ((click_was_in == buttons[i]->win)
-                || (click_was_in == buttons[i]->event_win))
-              {
-                 if ((buttons[i]->inside_win) && (!wasmovres))
-                   {
-                      Window              id = ev->xany.window;
 
-                      ev->xany.window = buttons[i]->inside_win;
-                      XSendEvent(disp, buttons[i]->inside_win, False,
-                                 ButtonReleaseMask, ev);
-                      ev->xany.window = id;
-                   }
-                 mode.button = buttons[i];
-                 if ((buttons[i]->state == STATE_CLICKED)
-                     && (!buttons[i]->left))
-                    buttons[i]->state = STATE_HILITED;
-                 else
-                    buttons[i]->state = STATE_NORMAL;
-                 buttons[i]->left = 0;
-                 DrawButton(buttons[i]);
-                 if ((buttons[i]->aclass) && (!wasdrag) && (!wasmovres))
-                    EventAclass(ev, buttons[i]->aclass);
-                 mode.destroy = 0;
-                 if ((mode.slideout) && (pslideout))
-                    HideSlideout(mode.slideout, mode.context_win);
-                 Efree(buttons);
-                 click_was_in = 0;
-                 last_bpress = 0;
-                 EDBUG_RETURN_;
-              }
-         }
-       if (buttons)
-          Efree(buttons);
-     }
+   if (ButtonsEventMouseUp(ev, wasmovres, wasdrag))
+      goto exit;
 
    DialogEventMouseUp(ev, click_was_in);
 
@@ -1961,6 +1874,7 @@
 
    mode.destroy = 0;
 
+ exit:
    if ((mode.slideout) && (pslideout))
       HideSlideout(mode.slideout, mode.context_win);
 
@@ -2049,7 +1963,6 @@
    EWin               *ewin;
    EWin              **ewins;
    int                 i, j, num;
-   Button            **buttons;
 
    EDBUG(5, "HandleMouseIn");
 
@@ -2147,33 +2060,12 @@
    if (ewins)
       Efree(ewins);
 
-   if (win)
-     {
-       buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
-       for (i = 0; i < num; i++)
-         {
-            if ((win == buttons[i]->win) || (win == buttons[i]->event_win))
-              {
-                 mode.button = buttons[i];
-                 if (buttons[i]->state == STATE_CLICKED)
-                    buttons[i]->left = 0;
-                 else
-                   {
-                      buttons[i]->state = STATE_HILITED;
-                      DrawButton(buttons[i]);
-                      if (buttons[i]->aclass)
-                         EventAclass(ev, buttons[i]->aclass);
-                   }
-                 Efree(buttons);
-                 EDBUG_RETURN_;
-              }
-         }
-       if (buttons)
-          Efree(buttons);
-     }
+   if (ButtonsEventMouseIn(ev))
+      goto exit;
 
    DialogEventMouseIn(ev);
 
+ exit:
    EDBUG_RETURN_;
 }
 
@@ -2253,34 +2145,11 @@
    if (ewins)
       Efree(ewins);
 
-   if (win)
-     {
-       Button            **buttons;
-
-       buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
-       for (i = 0; i < num; i++)
-         {
-            if ((win == buttons[i]->win) || (win == buttons[i]->event_win))
-              {
-                 mode.button = NULL;
-                 if (buttons[i]->state == STATE_CLICKED)
-                    buttons[i]->left = 1;
-                 else
-                   {
-                      buttons[i]->state = STATE_NORMAL;
-                      DrawButton(buttons[i]);
-                      if (buttons[i]->aclass)
-                         EventAclass(ev, buttons[i]->aclass);
-                   }
-                 Efree(buttons);
-                 EDBUG_RETURN_;
-              }
-         }
-       if (buttons)
-          Efree(buttons);
-     }
+   if (ButtonsEventMouseOut(ev))
+      goto exit;
 
    DialogEventMouseOut(ev);
 
+ exit:
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/finders.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- finders.c   9 Nov 2003 20:28:24 -0000       1.18
+++ finders.c   7 Dec 2003 09:18:55 -0000       1.19
@@ -106,31 +106,6 @@
    EDBUG_RETURN(NULL);
 }
 
-Button             *
-FindButton(Window win)
-{
-   Button             *b;
-   Button            **buttons;
-   int                 i, num;
-
-   EDBUG(6, "FindButton");
-
-   buttons = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
-   for (i = 0; i < num; i++)
-     {
-       if ((win == buttons[i]->win) || (win == buttons[i]->inside_win)
-           || (win == buttons[i]->event_win))
-         {
-            b = buttons[i];
-            Efree(buttons);
-            EDBUG_RETURN(b);
-         }
-     }
-   if (buttons)
-      Efree(buttons);
-   EDBUG_RETURN(NULL);
-}
-
 ActionClass        *
 FindActionClass(Window win)
 {
@@ -139,9 +114,11 @@
    int                 i;
 
    EDBUG(6, "FindActionClass");
+
    b = FindButton(win);
    if (b)
-      EDBUG_RETURN(b->aclass);
+      EDBUG_RETURN(ButtonGetAClass(b));
+
    ewin = FindEwinByDecoration(win);
    if (ewin)
      {
@@ -149,6 +126,7 @@
           if (win == ewin->bits[i].win)
              EDBUG_RETURN(ewin->border->part[i].aclass);
      }
+
    for (i = 0; i < mode.numdesktops; i++)
      {
        ActionClass        *ac;
@@ -160,6 +138,7 @@
             EDBUG_RETURN(ac);
          }
      }
+
    EDBUG_RETURN(NULL);
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -3 -r1.116 -r1.117
--- ipc.c       22 Nov 2003 00:15:40 -0000      1.116
+++ ipc.c       7 Dec 2003 09:18:55 -0000       1.117
@@ -1028,7 +1028,7 @@
                  b = (Button *) FindItem(param1, 0, LIST_FINDBY_NAME,
                                          LIST_TYPE_BUTTON);
                  if (b)
-                    DestroyButton(b);
+                    ButtonDestroy(b);
               }
             else if (!strcmp(param2, "modify"))
               {
@@ -1041,7 +1041,7 @@
                                          LIST_TYPE_BUTTON);
                  if (b)
                     Esnprintf(buf, sizeof(buf), "%u references remain",
-                              b->ref_count);
+                              ButtonGetRefcount(b));
               }
             else
               {
@@ -2159,7 +2159,7 @@
             for (i = 0; i < num; i++)
               {
                  buf2[0] = 0;
-                 Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
+                 Esnprintf(buf2, sizeof(buf2), "%s\n", ButtonGetName(lst[i]));
                  if (buf)
                     buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
                  else
@@ -3345,11 +3345,11 @@
                  while ((b =
                          RemoveItem("_DESKTOP_DRAG_CONTROL", 0,
                                     LIST_FINDBY_NAME, LIST_TYPE_BUTTON)))
-                    DestroyButton(b);
+                    ButtonDestroy(b);
                  while ((b =
                          RemoveItem("_DESKTOP_DESKRAY_DRAG_CONTROL", 0,
                                     LIST_FINDBY_NAME, LIST_TYPE_BUTTON)))
-                    DestroyButton(b);
+                    ButtonDestroy(b);
                  InitDesktopControls();
                  ShowDesktopControls();
               }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- main.c      15 Nov 2003 22:27:17 -0000      1.64
+++ main.c      7 Dec 2003 09:18:55 -0000       1.65
@@ -43,8 +43,7 @@
 int
 main(int argc, char **argv)
 {
-   int                 i, num;
-   Button            **blst;
+   int                 i;
    Background         *bg;
    ECursor            *ec = NULL;
    struct utsname      ubuf;
@@ -264,18 +263,8 @@
      }
    /* toss down the dragbar and related */
    InitDesktopControls();
-
    /* then draw all the buttons that belong on the desktop */
-   blst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 0);
-   if (blst)
-     {
-       for (i = 0; i < num; i++)
-         {
-            if ((!blst[i]->internal) && (blst[i]->default_show))
-               ShowButton(blst[i]);
-         }
-       Efree(blst);
-     }
+   ShowDesktopButtons();
 
    HintsInit();
    SessionInit();
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -3 -r1.88 -r1.89
--- menus.c     15 Nov 2003 22:27:17 -0000      1.88
+++ menus.c     7 Dec 2003 09:18:55 -0000       1.89
@@ -288,8 +288,7 @@
 
        if ((button = FindButton(mode.context_win)))
          {
-            button->state = STATE_NORMAL;
-            DrawButton(button);
+            ButtonDrawWithState(button, STATE_NORMAL);
          }
        else if ((ewin99 = FindEwinByDecoration(mode.context_win)))
          {
@@ -317,8 +316,7 @@
            && FindItem((char *)mode.button, 0, LIST_FINDBY_POINTER,
                        LIST_TYPE_BUTTON))
          {
-            mode.button->state = STATE_NORMAL;
-            DrawButton(mode.button);
+            ButtonDrawWithState(mode.button, STATE_NORMAL);
          }
        RaiseEwin(ewin);
        EDBUG_RETURN_;
@@ -442,8 +440,7 @@
 
       if ((button = FindButton(mode.context_win)))
        {
-          button->state = STATE_NORMAL;
-          DrawButton(button);
+          ButtonDrawWithState(button, STATE_NORMAL);
        }
       else if ((ewin99 = FindEwinByDecoration(mode.context_win)))
        {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/settings.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -3 -r1.81 -r1.82
--- settings.c  24 Nov 2003 17:07:23 -0000      1.81
+++ settings.c  7 Dec 2003 09:18:55 -0000       1.82
@@ -2026,7 +2026,7 @@
             while ((b =
                     RemoveItem("_DESKTOP_DRAG_CONTROL", 0, LIST_FINDBY_NAME,
                                LIST_TYPE_BUTTON)))
-               DestroyButton(b);
+               ButtonDestroy(b);
             InitDesktopControls();
             ShowDesktopControls();
          }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/slideout.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- slideout.c  9 Nov 2003 23:17:15 -0000       1.12
+++ slideout.c  7 Dec 2003 09:18:55 -0000       1.13
@@ -20,6 +20,7 @@
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#define DECLARE_STRUCT_BUTTON
 #include "E.h"
 #include <sys/time.h>
 
@@ -337,7 +338,8 @@
    b->default_show = 0;
    b->flags |= FLAG_FIXED;
    b->used = 1;
-   ShowButton(b);
+   b->ref_count++;
+   ButtonShow(b);
    CalcSlideoutSize(s);
 
    EDBUG_RETURN_;




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to