Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h borders.c buttons.c dock.c evhandlers.c iconify.c 


Log Message:
Improve dockapp handling.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.324
retrieving revision 1.325
diff -u -3 -r1.324 -r1.325
--- E.h 25 Aug 2004 16:03:12 -0000      1.324
+++ E.h 31 Aug 2004 17:24:39 -0000      1.325
@@ -1718,6 +1718,7 @@
 int                 EwinIsOnScreen(EWin * ewin);
 int                 BorderWinpartIndex(EWin * ewin, Window win);
 
+void                EwinPropagateShapes(EWin * ewin);
 void                EwinChange(EWin * ewin, unsigned int flag);
 void                EwinChangesStart(EWin * ewin);
 void                EwinChangesProcess(EWin * ewin);
@@ -1761,8 +1762,6 @@
 int                 ButtonIsFixed(Button * b);
 int                 ButtonEmbedWindow(Button * ButtonToUse,
                                      Window WindowToEmbed);
-void                ButtonFindEmptySpotFor(Button * bt, const char *listname,
-                                          char dirtomove);
 int                 ButtonsEventExpose(XEvent * ev);
 int                 ButtonsEventMouseDown(XEvent * ev);
 int                 ButtonsEventMouseUp(XEvent * ev);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -3 -r1.226 -r1.227
--- borders.c   15 Aug 2004 05:02:14 -0000      1.226
+++ borders.c   31 Aug 2004 17:24:39 -0000      1.227
@@ -389,10 +389,7 @@
 
    /* if is an afterstep/windowmaker dock app - dock it */
    if (Conf.dockapp_support && ewin->docked)
-     {
-       DockIt(ewin);
-       EDBUG_RETURN_;
-     }
+      DockIt(ewin);
 
    /* if set for borderless then dont slide it in */
    if ((!ewin->client.mwm_decor_title) && (!ewin->client.mwm_decor_border))
@@ -809,7 +806,7 @@
    BorderWinpartITclassApply(ewin, i, force);
 
    if (!ewin->shapedone || ewin->border->changes_shape)
-      PropagateShapes(ewin->win);
+      EwinPropagateShapes(ewin);
    ewin->shapedone = 1;
 
    EDBUG_RETURN_;
@@ -833,7 +830,7 @@
       BorderWinpartITclassApply(ewin, i, do_shape);
 
    if (do_shape || !ewin->shapedone || ewin->border->changes_shape)
-      PropagateShapes(ewin->win);
+      EwinPropagateShapes(ewin);
    ewin->shapedone = 1;
 
    if (queue_off)
@@ -1068,11 +1065,11 @@
 
             pq = Mode.queue_up;
             Mode.queue_up = 0;
-            PropagateShapes(ewin->win);
+            EwinPropagateShapes(ewin);
             Mode.queue_up = pq;
          }
        else
-          PropagateShapes(ewin->win);
+          EwinPropagateShapes(ewin);
        ewin->shapedone = 1;
      }
 
@@ -1105,12 +1102,12 @@
                  ewin->shapedone = 0;
                  if (!ewin->shapedone)
                    {
-                      PropagateShapes(ewin->win);
+                      EwinPropagateShapes(ewin);
                    }
                  else
                    {
                       if (ewin->border->changes_shape)
-                         PropagateShapes(ewin->win);
+                         EwinPropagateShapes(ewin);
                    }
                  ewin->shapedone = 1;
               }
@@ -1599,9 +1596,6 @@
    if (ewin->pager)
       PagerEventUnmap(ewin->pager);
 
-   if (Conf.dockapp_support && ewin->docked)
-      DockDestroy(ewin);
-
    if (ewin == GetContextEwin())
       SlideoutsHide();
 
@@ -1769,7 +1763,7 @@
       EMoveWindow(disp, ewin->win_container, b->border.left, b->border.top);
 
    CalcEwinSizes(ewin);
-   PropagateShapes(ewin->win);
+   EwinPropagateShapes(ewin);
 
    EDBUG_RETURN_;
 }
@@ -2609,7 +2603,7 @@
      default:
        break;
      }
-   PropagateShapes(ewin->win);
+   EwinPropagateShapes(ewin);
    Mode.queue_up = pq;
    HintsSetWindowState(ewin);
    if (Mode.mode == MODE_NONE)
@@ -2685,7 +2679,7 @@
      default:
        break;
      }
-   PropagateShapes(ewin->win);
+   EwinPropagateShapes(ewin);
    Mode.queue_up = pq;
    HintsSetWindowState(ewin);
    if (Mode.mode == MODE_NONE)
@@ -2759,7 +2753,7 @@
                                      ShapeBounding, -(ewin->client.w - ww),
                                      0, ewin->client.win, ShapeBounding,
                                      ShapeSet);
-               PropagateShapes(ewin->win);
+               EwinPropagateShapes(ewin);
                gettimeofday(&timev2, NULL);
                dsec = timev2.tv_sec - timev1.tv_sec;
                dusec = timev2.tv_usec - timev1.tv_usec;
@@ -2812,7 +2806,7 @@
                   EShapeCombineShape(disp, ewin->win_container,
                                      ShapeBounding, 0, 0, ewin->client.win,
                                      ShapeBounding, ShapeSet);
-               PropagateShapes(ewin->win);
+               EwinPropagateShapes(ewin);
                gettimeofday(&timev2, NULL);
                dsec = timev2.tv_sec - timev1.tv_sec;
                dusec = timev2.tv_usec - timev1.tv_usec;
@@ -2865,7 +2859,7 @@
                                      -(ewin->client.h - hh),
                                      ewin->client.win, ShapeBounding,
                                      ShapeSet);
-               PropagateShapes(ewin->win);
+               EwinPropagateShapes(ewin);
                gettimeofday(&timev2, NULL);
                dsec = timev2.tv_sec - timev1.tv_sec;
                dusec = timev2.tv_usec - timev1.tv_usec;
@@ -2919,7 +2913,7 @@
                   EShapeCombineShape(disp, ewin->win_container,
                                      ShapeBounding, 0, 0, ewin->client.win,
                                      ShapeBounding, ShapeSet);
-               PropagateShapes(ewin->win);
+               EwinPropagateShapes(ewin);
                gettimeofday(&timev2, NULL);
                dsec = timev2.tv_sec - timev1.tv_sec;
                dusec = timev2.tv_usec - timev1.tv_usec;
@@ -2950,7 +2944,7 @@
    if (ewin->client.shaped)
       EShapeCombineShape(disp, ewin->win_container, ShapeBounding, 0, 0,
                         ewin->client.win, ShapeBounding, ShapeSet);
-   PropagateShapes(ewin->win);
+   EwinPropagateShapes(ewin);
 
    Mode.queue_up = pq;
 
@@ -3029,7 +3023,7 @@
                                         ewin->border->border.right)), 0,
                                      ewin->client.win, ShapeBounding,
                                      ShapeSet);
-               PropagateShapes(ewin->win);
+               EwinPropagateShapes(ewin);
                gettimeofday(&timev2, NULL);
                dsec = timev2.tv_sec - timev1.tv_sec;
                dusec = timev2.tv_usec - timev1.tv_usec;
@@ -3084,7 +3078,7 @@
                   EShapeCombineShape(disp, ewin->win_container,
                                      ShapeBounding, 0, 0, ewin->client.win,
                                      ShapeBounding, ShapeSet);
-               PropagateShapes(ewin->win);
+               EwinPropagateShapes(ewin);
                gettimeofday(&timev2, NULL);
                dsec = timev2.tv_sec - timev1.tv_sec;
                dusec = timev2.tv_usec - timev1.tv_usec;
@@ -3139,7 +3133,7 @@
                                         ewin->border->border.bottom)),
                                      ewin->client.win, ShapeBounding,
                                      ShapeSet);
-               PropagateShapes(ewin->win);
+               EwinPropagateShapes(ewin);
                gettimeofday(&timev2, NULL);
                dsec = timev2.tv_sec - timev1.tv_sec;
                dusec = timev2.tv_usec - timev1.tv_usec;
@@ -3194,7 +3188,7 @@
                   EShapeCombineShape(disp, ewin->win_container,
                                      ShapeBounding, 0, 0, ewin->client.win,
                                      ShapeBounding, ShapeSet);
-               PropagateShapes(ewin->win);
+               EwinPropagateShapes(ewin);
                gettimeofday(&timev2, NULL);
                dsec = timev2.tv_sec - timev1.tv_sec;
                dusec = timev2.tv_usec - timev1.tv_usec;
@@ -3222,7 +3216,7 @@
    if (ewin->client.shaped)
       EShapeCombineShape(disp, ewin->win_container, ShapeBounding, 0, 0,
                         ewin->client.win, ShapeBounding, ShapeSet);
-   PropagateShapes(ewin->win);
+   EwinPropagateShapes(ewin);
 
    Mode.queue_up = pq;
 
@@ -3367,6 +3361,13 @@
    return -1;                  /* Not found */
 }
 
+void
+EwinPropagateShapes(EWin * ewin)
+{
+   if (!ewin->docked)
+      PropagateShapes(ewin->win);
+}
+
 /*
  * Change requests
  */
@@ -3517,7 +3518,7 @@
    ewin->bits[j].no_expose = 0;
    ewin->bits[j].expose = 1;
    if (BorderWinpartDraw(ewin, j) && IsPropagateEwinOnQueue(ewin))
-      PropagateShapes(ewin->win);
+      EwinPropagateShapes(ewin);
    return;
    ev = NULL;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- buttons.c   14 Aug 2004 15:06:26 -0000      1.37
+++ buttons.c   31 Aug 2004 17:24:40 -0000      1.38
@@ -483,53 +483,6 @@
    EDBUG_RETURN(0);
 }
 
-void
-ButtonFindEmptySpotFor(Button * bt, const char *listname, char dirtomove)
-{
-
-   Button            **blst;
-   int                 num = 0, i = 0, j = 0, done = 0;
-
-   blst = (Button **) ListItemTypeName(&num, LIST_TYPE_BUTTON, listname);
-   if (blst)
-     {
-       for (i = 0; i < num; i++)
-         {
-            for (j = 0; j < num; j++)
-              {
-                 if ((bt->x + bt->w) <= blst[j]->x
-                     || bt->x >= (blst[j]->x + blst[j]->w))
-                   {
-                      done = 1;
-                   }
-                 else
-                   {
-                      if ((bt->y + bt->h) <= blst[j]->y
-                          || bt->y > (blst[j]->y + blst[j]->h))
-                         done = 1;
-                      else
-                         done = 0;
-                   }
-                 if (!done)
-                   {
-                      if (dirtomove == ICON_RIGHT)
-                         bt->x = blst[j]->w + blst[j]->x;
-                      else if (dirtomove == ICON_LEFT)
-                         bt->x = blst[j]->x - bt->w;
-                      else if (dirtomove == ICON_DOWN)
-                         bt->y = blst[j]->h + blst[j]->y;
-                      else if (dirtomove == ICON_UP)
-                         bt->y = blst[j]->y - bt->h;
-                   }
-              }
-         }
-       Efree(blst);
-     }
-   ButtonMoveToCoord(bt, bt->x, bt->y);
-
-   EDBUG_RETURN_;
-}
-
 /*
  * Functions operating on all buttons
  */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/dock.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- dock.c      26 May 2004 22:24:42 -0000      1.18
+++ dock.c      31 Aug 2004 17:24:40 -0000      1.19
@@ -22,59 +22,121 @@
  */
 #include "E.h"
 
-void
-DockIt(EWin * ewin)
+static void
+DockappFindEmptySpotFor(EWin * eapp)
 {
-   ActionClass        *ac;
-   ImageClass         *ic;
-   Button             *bt;
-   char                id[32];
-
-   EDBUG(3, "DockIt");
-   Esnprintf(id, sizeof(id), "%i", (unsigned)ewin->client.win);
-   ac = 0;
-   ic = FindItem("DEFAULT_DOCK_BUTTON", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
-   if (Conf.dock.startx >= 0)
-     {
-       bt = ButtonCreate(id, ic, ac, NULL, NULL, 1, 0,
-                         ewin->w, ewin->w, ewin->h, ewin->h,
-                         0, 0, Conf.dock.startx, 0, Conf.dock.starty, 0,
-                         0, 0, 0, 0, 1, 0, 1);
-     }
-   else
+   EWin              **lst, *ewin;
+   int                 num, i, j, x, y, w, h, done;
+   int                 step_right, step_down;
+
+   x = eapp->x;
+   y = eapp->y;
+   w = eapp->client.w;
+   h = eapp->client.h;
+   if (!eapp->client.already_placed)
      {
-       bt = ButtonCreate(id, ic, ac, NULL, NULL, 1, 0,
-                         ewin->w, ewin->w, ewin->h, ewin->h,
-                         0, 2046, 0, 0, 0, 1023, 0, 0, 0, 0, 1, 0, 1);
+       x = Conf.dock.startx;
+       if (x < 0)
+          x = 0;
+       else if (x > VRoot.w - eapp->w)
+          x = VRoot.w - eapp->w;
+
+       y = Conf.dock.starty;
+       if (y < 0)
+          y = 0;
+       else if (y > VRoot.h - eapp->h)
+          y = VRoot.h - eapp->h;
      }
-   UngrabX();
-
-   if (!bt)
-      EDBUG_RETURN_;
 
-   ButtonShow(bt);
-   ButtonFindEmptySpotFor(bt, "DOCK_APP_BUTTON", Conf.dock.dirmode);
+   step_right = Conf.dock.startx < VRoot.w;
+   step_down = Conf.dock.starty < VRoot.h;
 
-   AddItem(bt, "DOCK_APP_BUTTON", ewin->client.win, LIST_TYPE_BUTTON);
+   lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
+   for (j = 0; j < num; j++)
+      for (i = 0; i < num; i++)
+       {
+          ewin = lst[i];
+
+          /* Skip self and non-dockapps */
+          if (ewin == eapp || !ewin->docked)
+             continue;
+
+          if ((x + w) <= ewin->x || x >= (ewin->x + ewin->w))
+             done = 1;
+          else if ((y + h) <= ewin->y || y > (ewin->y + ewin->h))
+             done = 1;
+          else
+             done = 0;
+
+          if (!done)
+            {
+               switch (Conf.dock.dirmode)
+                 {
+                 case DOCK_RIGHT:
+                    x = ewin->x + ewin->w;
+                    if (x + w >= VRoot.w)
+                      {
+                         x = Conf.dock.startx;
+                         y += (step_down) ? h : -h;
+                      }
+                    break;
+                 case DOCK_LEFT:
+                    x = ewin->x - w;
+                    if (x < 0)
+                      {
+                         x = Conf.dock.startx - w;
+                         y += (step_down) ? h : -h;
+                      }
+                    break;
+                 case DOCK_DOWN:
+                    y = ewin->y + ewin->h;
+                    if (y + h >= VRoot.h)
+                      {
+                         y = Conf.dock.starty;
+                         x += (step_right) ? w : -w;
+                      }
+                    break;
+                 case DOCK_UP:
+                    y = ewin->y - h;
+                    if (y < 0)
+                      {
+                         y = VRoot.h - h;
+                         x += (step_right) ? w : -w;
+                      }
+                    break;
+                 }
+            }
+       }
+   if (lst)
+      Efree(lst);
 
-   ButtonEmbedWindow(bt, ewin->win);
-   EMoveResizeWindow(disp, ewin->win, 0, 0, ewin->w, ewin->h);
-   ewin->fixedpos = 1;
-   ShowEwin(ewin);
+   if (x < 0 || y < 0 || x + w >= VRoot.w || y + h >= VRoot.h)
+     {
+       x = VRoot.w - w / 2;
+       y = VRoot.h - h / 2;
+     }
 
-   EDBUG_RETURN_;
+   eapp->x = x;
+   eapp->y = y;
 }
 
 void
-DockDestroy(EWin * ewin)
+DockIt(EWin * ewin)
 {
+   ImageClass         *ic;
+   char                id[32];
+
+   Esnprintf(id, sizeof(id), "%i", (unsigned)ewin->client.win);
+   ic = FindItem("DEFAULT_DOCK_BUTTON", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
+
+   UngrabX();
+
+   DockappFindEmptySpotFor(ewin);
+   ewin->client.already_placed = 1;
 
-   Button             *bt;
+   if (ewin->client.icon_win)
+      EMapWindow(disp, ewin->client.icon_win);
 
-   EDBUG(3, "DockDestroy");
-   bt = FindItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_BUTTON);
-   if (bt)
-      ButtonDestroy(RemoveItem
-                   (NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_BUTTON));
-   EDBUG_RETURN_;
+   IclassApply(ic, ewin->win, ewin->client.w, ewin->client.h,
+              0, 0, STATE_NORMAL, 0, ST_BUTTON);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -3 -r1.175 -r1.176
--- evhandlers.c        14 Aug 2004 15:06:26 -0000      1.175
+++ evhandlers.c        31 Aug 2004 17:24:40 -0000      1.176
@@ -891,7 +891,7 @@
           if (pshaped != ewin->client.shaped)
             {
                SyncBorderToEwin(ewin);
-               PropagateShapes(ewin->win);
+               EwinPropagateShapes(ewin);
             }
        }
        ReZoom(ewin);
@@ -933,7 +933,7 @@
           if (pshaped != ewin->client.shaped)
             {
                SyncBorderToEwin(ewin);
-               PropagateShapes(ewin->win);
+               EwinPropagateShapes(ewin);
             }
        }
        ReZoom(ewin);
@@ -1021,7 +1021,7 @@
        b = ewin->border;
        SyncBorderToEwin(ewin);
        if (ewin->border == b)
-          PropagateShapes(ewin->win);
+          EwinPropagateShapes(ewin);
      }
 
    EDBUG_RETURN_;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -3 -r1.117 -r1.118
--- iconify.c   3 Aug 2004 20:31:04 -0000       1.117
+++ iconify.c   31 Aug 2004 17:24:40 -0000      1.118
@@ -1936,7 +1936,7 @@
        b = ib->ewin->border;
        SyncBorderToEwin(ib->ewin);
        if (ib->ewin->border == b)
-          PropagateShapes(ib->ewin->win);
+          EwinPropagateShapes(ib->ewin);
      }
 }
 
@@ -2229,7 +2229,7 @@
 
    PropagateShapes(ib->win);
    ICCCM_GetShapeInfo(ib->ewin);
-   PropagateShapes(ib->ewin->win);
+   EwinPropagateShapes(ib->ewin);
 
    Mode.queue_up = pq;
 }




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to