Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h buttons.c config.c desktops.c ipc.c 


Log Message:
Fix button stacking.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.330
retrieving revision 1.331
diff -u -3 -r1.330 -r1.331
--- E.h 12 Nov 2004 17:02:27 -0000      1.330
+++ E.h 17 Nov 2004 19:31:08 -0000      1.331
@@ -1748,7 +1748,7 @@
 void                ButtonToggle(Button * b);
 void                ButtonDraw(Button * b);
 void                ButtonDrawWithState(Button * b, int state);
-void                ButtonMoveToDesktop(Button * b, int num);
+void                ButtonMoveToDesktop(Button * b, int desk);
 void                ButtonMoveToCoord(Button * b, int x, int y);
 void                ButtonMoveRelative(Button * b, int dx, int dy);
 void                ButtonIncRefcount(Button * b);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- buttons.c   31 Aug 2004 17:24:40 -0000      1.38
+++ buttons.c   17 Nov 2004 19:31:09 -0000      1.39
@@ -65,6 +65,8 @@
    b->ontop = ontop;
    b->flags = flags;
    b->sticky = sticky;
+   if (sticky && ontop == 1)
+      desk = 0;
    b->desktop = desk;
    b->visible = 0;
    b->geom.width.min = minw;
@@ -251,22 +253,17 @@
 }
 
 void
-ButtonMoveToDesktop(Button * b, int num)
+ButtonMoveToDesktop(Button * b, int desk)
 {
    EDBUG(3, "ButtonMoveToDesktop");
 
-   if (b->sticky)
-     {
-       b->desktop = 0;
-       EReparentWindow(disp, b->win, desks.desk[0].win, b->x, b->y);
-       XRaiseWindow(disp, b->win);
-     }
-   else
-     {
-       b->desktop = num;
-       EReparentWindow(disp, b->win, desks.desk[DESKTOPS_WRAP_NUM(num)].win,
-                       b->x, b->y);
-     }
+   if (b->sticky && b->ontop == 1)
+      desk = 0;
+   if (b->desktop == desk)
+      EDBUG_RETURN_;
+
+   b->desktop = desk;
+   EReparentWindow(disp, b->win, desks.desk[desk].win, b->x, b->y);
 
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -3 -r1.117 -r1.118
--- config.c    30 Oct 2004 12:58:55 -0000      1.117
+++ config.c    17 Nov 2004 19:31:09 -0000      1.118
@@ -1778,8 +1778,9 @@
             break;
          case BUTTON_DESK:
             desk = atoi(s2);
+            desk = ((unsigned int)desk) % ENLIGHTENMENT_CONF_NUM_DESKTOPS;
             if (pbt)
-               pbt->desktop = desk;
+               ButtonMoveToDesktop(pbt, desk);
             break;
          case BUTTON_STICKY:
             sticky = atoi(s2);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -3 -r1.102 -r1.103
--- desktops.c  30 Oct 2004 12:59:03 -0000      1.102
+++ desktops.c  17 Nov 2004 19:31:11 -0000      1.103
@@ -672,11 +672,10 @@
 static void
 MoveStickyWindowsToCurrentDesk(void)
 {
-   EWin               *const *lst, *ewin, *last_ewin;
+   EWin               *const *lst, *ewin;
    int                 i, num;
 
    lst = EwinListGetStacking(&num);
-   last_ewin = NULL;
    for (i = 0; i < num; i++)
      {
        ewin = lst[i];
@@ -690,7 +689,23 @@
        EMoveWindow(disp, ewin->win, ewin->x, ewin->y);
        HintsSetWindowArea(ewin);
        HintsSetWindowDesktop(ewin);
-       last_ewin = ewin;
+     }
+}
+
+static void
+MoveStickyButtonsToCurrentDesk(void)
+{
+   Button            **lst, *btn;
+   int                 i, num;
+
+   lst = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
+   for (i = 0; i < num; i++)
+     {
+       btn = lst[i];
+       if (!btn->sticky || btn->internal)
+          continue;
+
+       ButtonMoveToDesktop(btn, desks.current);
      }
 }
 
@@ -940,6 +955,7 @@
    StackDesktops();
    desks.current = desk;
    MoveStickyWindowsToCurrentDesk();
+   MoveStickyButtonsToCurrentDesk();
    StackDesktop(desks.current);
    FocusNewDesk();
    FX_DeskChange();
@@ -970,6 +986,7 @@
    StackDesktops();
    desks.current = desks.order[0];
    MoveStickyWindowsToCurrentDesk();
+   MoveStickyButtonsToCurrentDesk();
    StackDesktop(desks.current);
    FocusNewDesk();
    FX_DeskChange();
@@ -1062,69 +1079,58 @@
     * Build the window stack, top to bottom
     */
 
-   wl2 = ListProgressWindows(&wnum);
-   if (wl2)
-     {
-       for (i = 0; i < wnum; i++)
-          _APPEND_TO_WIN_LIST(wl2[i]);
-       Efree(wl2);
-     }
-   if (init_win_ext)
-     {
-       _APPEND_TO_WIN_LIST(init_win_ext);
-     }
-   if (init_win1)
+   if (desk == 0)
      {
-       _APPEND_TO_WIN_LIST(init_win1);
-       _APPEND_TO_WIN_LIST(init_win2);
+       wl2 = ListProgressWindows(&wnum);
+       if (wl2)
+         {
+            for (i = 0; i < wnum; i++)
+               _APPEND_TO_WIN_LIST(wl2[i]);
+            Efree(wl2);
+         }
+       if (init_win_ext)
+         {
+            _APPEND_TO_WIN_LIST(init_win_ext);
+         }
+       if (init_win1)
+         {
+            _APPEND_TO_WIN_LIST(init_win1);
+            _APPEND_TO_WIN_LIST(init_win2);
+         }
      }
 
    lst = EwinListGetStacking(&wnum);
    blst = (Button **) ListItemType(&bnum, LIST_TYPE_BUTTON);
 
-   /* Sticky buttons */
-   if (blst)
-     {
-       for (i = 0; i < bnum; i++)
-         {
-            if (!blst[i]->sticky || blst[i]->internal)
-               continue;
-
-            _APPEND_TO_WIN_LIST(blst[i]->win);
-         }
-     }
-
    /* Floating EWins */
-   if (lst)
+   for (i = 0; i < wnum; i++)
      {
-       for (i = 0; i < wnum; i++)
-         {
-            if (!lst[i]->floating)
-               continue;
+       ewin = lst[i];
+       if (!ewin->floating || EwinGetDesk(ewin) != desk)
+          continue;
 
-            _APPEND_TO_WIN_LIST(lst[i]->win);
-         }
+       _APPEND_TO_WIN_LIST(ewin->win);
      }
 
-   /* The virtual desktop windows */
-   for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
+   /* "Above" buttons */
+   for (i = 0; i < bnum; i++)
      {
-       if (desks.order[i] == 0)
-          break;
+       if (blst[i]->internal || blst[i]->desktop != desk ||
+           blst[i]->ontop != 1)
+          continue;
 
-       _APPEND_TO_WIN_LIST(desks.desk[desks.order[i]].win);
+       _APPEND_TO_WIN_LIST(blst[i]->win);
      }
 
-   /* Non-sticky, "above" buttons */
-   if (blst)
+   if (desk == 0)
      {
-       for (i = 0; i < bnum; i++)
+       /* The virtual desktop windows */
+       for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
          {
-            if (blst[i]->desktop != desk || blst[i]->ontop != 1 ||
-                blst[i]->sticky || blst[i]->internal)
-               continue;
+            if (desks.order[i] == 0)
+               break;
 
-            _APPEND_TO_WIN_LIST(blst[i]->win);
+            _APPEND_TO_WIN_LIST(desks.desk[desks.order[i]].win);
          }
      }
 
@@ -1132,7 +1138,7 @@
    for (i = 0; i < wnum; i++)
      {
        ewin = lst[i];
-       if (EwinGetDesk(ewin) != desk || ewin->floating)
+       if (ewin->floating || EwinGetDesk(ewin) != desk)
           continue;
 
        _APPEND_TO_WIN_LIST(ewin->win);
@@ -1140,21 +1146,25 @@
           _APPEND_TO_WIN_LIST(Mode.menus.cover_win);
      }
 
-   /* Non-sticky, "below" buttons */
-   if (blst)
+   /* "Normal" buttons */
+   for (i = 0; i < bnum; i++)
      {
-       for (i = 0; i < bnum; i++)
-         {
-            if (blst[i]->desktop != desk || blst[i]->ontop != -1 ||
-                blst[i]->sticky || blst[i]->internal)
-               continue;
+       if (blst[i]->internal || blst[i]->desktop != desk ||
+           blst[i]->ontop != 0)
+          continue;
 
-            _APPEND_TO_WIN_LIST(blst[i]->win);
-         }
+       _APPEND_TO_WIN_LIST(blst[i]->win);
      }
 
-   /* The current (virtual) root window */
-   _APPEND_TO_WIN_LIST(desks.desk[desk].win);
+   /* "Below" buttons */
+   for (i = 0; i < bnum; i++)
+     {
+       if (blst[i]->internal || blst[i]->desktop != desk ||
+           blst[i]->ontop != -1)
+          continue;
+
+       _APPEND_TO_WIN_LIST(blst[i]->win);
+     }
 
    if (EventDebug(EDBUG_TYPE_STACKING))
      {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -3 -r1.184 -r1.185
--- ipc.c       12 Nov 2004 17:10:59 -0000      1.184
+++ ipc.c       17 Nov 2004 19:31:11 -0000      1.185
@@ -21,6 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #define DECLARE_STRUCT_BACKGROUND
+#define DECLARE_STRUCT_BUTTON
 #include "E.h"
 #include "timestamp.h"
 #include <ctype.h>
@@ -1621,13 +1622,17 @@
          }
        else if (!strcmp(params, "buttons"))
          {
-            Button            **lst;
+            Button            **lst, *b;
 
             lst = (Button **) ListItemType(&num, LIST_TYPE_BUTTON);
             for (i = 0; i < num; i++)
               {
+                 b = lst[i];
                  buf2[0] = 0;
-                 Esnprintf(buf2, sizeof(buf2), "%s\n", ButtonGetName(lst[i]));
+                 Esnprintf(buf2, sizeof(buf2),
+                           "%#lx %2d %2d %2d %5d+%5d %5dx%5d %s\n", b->win,
+                           b->desktop, b->sticky, b->ontop, b->x, b->y, b->w,
+                           b->h, ButtonGetName(b));
                  if (buf)
                     buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
                  else




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to