Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h coords.c dialog.c draw.c ewins.c ewins.h finders.c 
        groups.c moveresize.c snaps.c 


Log Message:
Fix several window group bugs.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.507
retrieving revision 1.508
diff -u -3 -r1.507 -r1.508
--- E.h 2 Nov 2005 18:03:08 -0000       1.507
+++ E.h 5 Nov 2005 17:12:53 -0000       1.508
@@ -271,15 +271,6 @@
 #define GROUP_SELECT_EWIN_ONLY       1
 #define GROUP_SELECT_ALL_EXCEPT_EWIN 2
 
-#define GROUP_FEATURE_BORDER  1
-#define GROUP_FEATURE_KILL    2
-#define GROUP_FEATURE_MOVE    4
-#define GROUP_FEATURE_RAISE   8
-#define GROUP_FEATURE_ICONIFY 16
-#define GROUP_FEATURE_STICK   32
-#define GROUP_FEATURE_SHADE   64
-#define GROUP_FEATURE_MIRROR  128
-
 /* For window group listing */
 #define GROUP_ACTION_ANY                     0
 #define GROUP_ACTION_MOVE                    1
@@ -292,10 +283,6 @@
 #define GROUP_ACTION_SET_WINDOW_BORDER       8
 #define GROUP_ACTION_RAISE_LOWER             9
 
-#define SET_OFF    0
-#define SET_ON     1
-#define SET_TOGGLE 2
-
 /*
  * Types
  */
@@ -1025,7 +1012,7 @@
 
 /* groups.c */
 void                BuildWindowGroup(EWin ** ewins, int num);
-Group              *EwinsInGroup(EWin * ewin1, EWin * ewin2);
+Group              *EwinsInGroup(const EWin * ewin1, const EWin * ewin2);
 void                AddEwinToGroup(EWin * ewin, Group * g);
 void                GroupsEwinRemove(EWin * ewin);
 void                SaveGroups(void);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/coords.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- coords.c    27 Oct 2005 23:18:35 -0000      1.37
+++ coords.c    5 Nov 2005 17:12:53 -0000       1.38
@@ -46,7 +46,7 @@
 
    if (!Conf.movres.mode_info)
       return;
-   if (ewin == NULL)
+   if (ewin == NULL || !ewin->state.show_coords)
       return;
 
    tc = TextclassFind("COORDS", 1);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/dialog.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -3 -r1.136 -r1.137
--- dialog.c    31 Oct 2005 20:46:08 -0000      1.136
+++ dialog.c    5 Nov 2005 17:12:53 -0000       1.137
@@ -206,6 +206,8 @@
 static void         DialogItemsRealize(Dialog * d);
 static void         DialogFreeItem(DItem * di);
 
+static int          DialogItemCheckButtonGetState(DItem * di);
+
 static void         DialogUpdate(Dialog * d);
 static char         dialog_update_pending = 0;
 
@@ -561,7 +563,6 @@
    ewin = FindEwinByDialog(d);
    if (ewin)
      {
-       // FIXME
 #if 0                          /* Make dialogs sticky? */
        if (EoGetDesk(ewin) != DesksGetCurrent())
           EwinMoveToDesktop(ewin, DesksGetCurrent());
@@ -718,7 +719,7 @@
      case DITEM_CHECKBUTTON:
        di->item.check_button.check_win = 0;
        di->item.check_button.onoff = 0;
-       di->item.check_button.onoff_ptr = NULL;
+       di->item.check_button.onoff_ptr = &(di->item.check_button.onoff);
        di->item.check_button.check_orig_w = 10;
        di->item.check_button.check_orig_h = 10;
        break;
@@ -1653,7 +1654,7 @@
           state = STATE_HILITED;
        else if (!(di->hilited) && (di->clicked))
           state = STATE_CLICKED;
-       if (di->item.check_button.onoff)
+       if (DialogItemCheckButtonGetState(di))
           ImageclassApply(di->iclass, di->item.check_button.check_win,
                           di->item.check_button.check_orig_w,
                           di->item.check_button.check_orig_h, 1, 0, state,
@@ -1800,7 +1801,7 @@
      {
        di->item.radio_button.val_ptr = val_ptr;
        if (*val_ptr == di->item.radio_button.val)
-          di->item.check_button.onoff = 1;
+          di->item.radio_button.onoff = 1;
        di = di->item.radio_button.next;
      }
 }
@@ -1814,14 +1815,19 @@
 void
 DialogItemCheckButtonSetState(DItem * di, char onoff)
 {
-   di->item.check_button.onoff = onoff;
+   *(di->item.check_button.onoff_ptr) = onoff;
 }
 
 void
 DialogItemCheckButtonSetPtr(DItem * di, char *onoff_ptr)
 {
    di->item.check_button.onoff_ptr = onoff_ptr;
-   DialogItemCheckButtonSetState(di, *onoff_ptr);
+}
+
+static int
+DialogItemCheckButtonGetState(DItem * di)
+{
+   return *(di->item.check_button.onoff_ptr);
 }
 
 void
@@ -2325,12 +2331,7 @@
        break;
 
      case DITEM_CHECKBUTTON:
-       if (di->item.check_button.onoff)
-          di->item.check_button.onoff = 0;
-       else
-          di->item.check_button.onoff = 1;
-       if (di->item.check_button.onoff_ptr)
-          *di->item.check_button.onoff_ptr = di->item.check_button.onoff;
+       DialogItemCheckButtonSetState(di, !DialogItemCheckButtonGetState(di));
        break;
 
      case DITEM_RADIOBUTTON:
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/draw.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -3 -r1.85 -r1.86
--- draw.c      30 Oct 2005 19:40:49 -0000      1.85
+++ draw.c      5 Nov 2005 17:12:53 -0000       1.86
@@ -648,8 +648,7 @@
      case 0:
        EwinMoveResize(ewin, x, y, w, h);
        EwinShapeSet(ewin);
-       if (Mode.mode != MODE_NONE)
-          CoordsShow(ewin);
+       CoordsShow(ewin);
        break;
      case 1:
      case 2:
@@ -834,9 +833,7 @@
               {
                  DO_DRAW_MODE_1(x1, y1, w1, h1);
               }
-            if ((Mode.mode != MODE_NONE)
-                && (!ewin->groups || (ewin->groups && !check_move)))
-               CoordsShow(ewin);
+            CoordsShow(ewin);
             if (firstlast < 2)
               {
                  DO_DRAW_MODE_1(x, y, w, h);
@@ -848,9 +845,7 @@
               {
                  DO_DRAW_MODE_2(x1, y1, w1, h1);
               }
-            if ((Mode.mode != MODE_NONE)
-                && (!ewin->groups || (ewin->groups && !check_move)))
-               CoordsShow(ewin);
+            CoordsShow(ewin);
             if (firstlast < 2)
               {
                  DO_DRAW_MODE_2(x, y, w, h);
@@ -862,9 +857,7 @@
               {
                  DO_DRAW_MODE_3(x1, y1, w1, h1);
               }
-            if ((Mode.mode != MODE_NONE)
-                && (!ewin->groups || (ewin->groups && !check_move)))
-               CoordsShow(ewin);
+            CoordsShow(ewin);
             if (firstlast < 2)
               {
                  DO_DRAW_MODE_3(x, y, w, h);
@@ -876,9 +869,7 @@
               {
                  DO_DRAW_MODE_4(x1, y1, w1, h1);
               }
-            if ((Mode.mode != MODE_NONE)
-                && (!ewin->groups || (ewin->groups && !check_move)))
-               CoordsShow(ewin);
+            CoordsShow(ewin);
             if (firstlast < 2)
               {
                  DO_DRAW_MODE_4(x, y, w, h);
@@ -1022,8 +1013,7 @@
                     EDestroyPixImg(root_pi);
                  root_pi->pmap = 0;
               }
-            if (Mode.mode != MODE_NONE)
-               CoordsShow(ewin);
+            CoordsShow(ewin);
          }
        if (firstlast == 2)
          {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -3 -r1.124 -r1.125
--- ewins.c     2 Nov 2005 23:03:03 -0000       1.124
+++ ewins.c     5 Nov 2005 17:12:53 -0000       1.125
@@ -289,8 +289,7 @@
    if (!EwinIsInternal(ewin) && Mode.wm.startup)
       EHintsGetInfo(ewin);     /* E restart hints */
    SnapshotsEwinMatch(ewin);   /* Find a saved settings match */
-   if (!ewin->state.identified)
-      SnapshotEwinApply(ewin); /* Apply saved settings */
+   SnapshotEwinApply(ewin);    /* Apply saved settings */
 
    EwinStateUpdate(ewin);      /* Update after snaps etc. */
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewins.h     2 Nov 2005 23:03:03 -0000       1.26
+++ ewins.h     5 Nov 2005 17:12:53 -0000       1.27
@@ -78,6 +78,7 @@
 
       unsigned            showingdesk:1;       /* Iconified by show desktop */
       unsigned            animated:1;
+      unsigned            show_coords:1;
 
       /* Derived state flags. Change only in EwinStateUpdate() */
       unsigned            no_border:1;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/finders.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- finders.c   30 Oct 2005 19:40:49 -0000      1.42
+++ finders.c   5 Nov 2005 17:12:53 -0000       1.43
@@ -194,107 +194,97 @@
 
 EWin              **
 ListWinGroupMembersForEwin(const EWin * ewin, int action, char nogroup,
-                          int *num)
+                          int *pnum)
 {
 
-   EWin              **gwins = NULL;
-   int                 i, j, k, daddy_says_no_no;
-   char                inlist;
+   EWin              **gwins, *ew;
+   EWin               *const *ewins;
+   Group              *grp;
+   int                 i, num, gwcnt;
 
-   if (ewin)
+   if (!ewin)
      {
-       if (nogroup)
-         {
-            gwins = Emalloc(sizeof(EWin *));
-            gwins[0] = (EWin *) ewin;
-            *num = 1;
-            return gwins;
-         }
+       *pnum = 0;
+       return NULL;
+     }
 
-       (*num) = 0;
+   gwcnt = 0;
+   gwins = NULL;
 
-       for (i = 0; i < ewin->num_groups; i++)
-         {
-            daddy_says_no_no = 0;
+   if (nogroup || ewin->num_groups <= 0)
+      goto done;
 
-            switch (action)
-              {
-              case GROUP_ACTION_SET_WINDOW_BORDER:
-                 if (!ewin->groups[i]->cfg.set_border)
-                    daddy_says_no_no = 1;
-                 break;
-              case GROUP_ACTION_ICONIFY:
-                 if (!ewin->groups[i]->cfg.iconify)
-                    daddy_says_no_no = 1;
-                 break;
-              case GROUP_ACTION_MOVE:
-                 if (!ewin->groups[i]->cfg.move)
-                    daddy_says_no_no = 1;
-                 break;
-              case GROUP_ACTION_RAISE:
-              case GROUP_ACTION_LOWER:
-              case GROUP_ACTION_RAISE_LOWER:
-                 if (!ewin->groups[i]->cfg.raise)
-                    daddy_says_no_no = 1;
-                 break;
-              case GROUP_ACTION_STICK:
-                 if (!ewin->groups[i]->cfg.stick)
-                    daddy_says_no_no = 1;
-                 break;
-              case GROUP_ACTION_SHADE:
-                 if (!ewin->groups[i]->cfg.shade)
-                    daddy_says_no_no = 1;
-                 break;
-              case GROUP_ACTION_KILL:
-                 if (!ewin->groups[i]->cfg.kill)
-                    daddy_says_no_no = 1;
-                 break;
-              default:
-                 break;
-              }
-
-            if (!daddy_says_no_no)
-              {
-                 gwins =
-                    Erealloc(gwins,
-                             sizeof(EWin *) * (*num +
-                                               ewin->groups[i]->num_members));
-                 /* Check if a window is not already in the group */
-                 for (k = 0; k < ewin->groups[i]->num_members; k++)
-                   {
-                      /* To get consistent behaviour, limit groups to a single 
desktop for now: */
-                      if (EoGetDesk(ewin->groups[i]->members[k]) ==
-                          EoGetDesk(ewin))
-                        {
-                           inlist = 0;
-                           for (j = 0; j < (*num); j++)
-                             {
-                                if (gwins[j] == ewin->groups[i]->members[k])
-                                   inlist = 1;
-                             }
-                           /* If we do not have this one yet, add it to the 
result */
-                           if (!inlist)
-                              gwins[(*num)++] = ewin->groups[i]->members[k];
-                        }
-                   }
-                 /* and shrink the result to the correct size. */
-                 gwins = Erealloc(gwins, sizeof(EWin *) * (*num));
-              }
-         }
+   ewins = EwinListGetAll(&num);
+   if (ewins == NULL)          /* Should not be possible */
+      goto done;
+
+   /* Loop through window stack, bottom up */
+   for (i = num - 1; i >= 0; i--)
+     {
+       ew = ewins[i];
 
-       if (gwins == NULL)
+       if (ew == ewin)
+          goto do_add;
+
+       /* To get consistent behaviour, limit groups to a single desktop for 
now: */
+       if (EoGetDesk(ew) != EoGetDesk(ewin))
+          continue;
+
+       grp = EwinsInGroup(ewin, ew);
+       if (!grp)
+          continue;
+
+       switch (action)
          {
-            gwins = Emalloc(sizeof(EWin *));
-            gwins[0] = (EWin *) ewin;
-            *num = 1;
-         }
-       return gwins;
+         case GROUP_ACTION_SET_WINDOW_BORDER:
+            if (!grp->cfg.set_border)
+               continue;
+            break;
+         case GROUP_ACTION_ICONIFY:
+            if (!grp->cfg.iconify)
+               continue;
+            break;
+         case GROUP_ACTION_MOVE:
+            if (!grp->cfg.move)
+               continue;
+            break;
+         case GROUP_ACTION_RAISE:
+         case GROUP_ACTION_LOWER:
+         case GROUP_ACTION_RAISE_LOWER:
+            if (!grp->cfg.raise)
+               continue;
+            break;
+         case GROUP_ACTION_STICK:
+            if (!grp->cfg.stick)
+               continue;
+            break;
+         case GROUP_ACTION_SHADE:
+            if (!grp->cfg.shade)
+               continue;
+            break;
+         case GROUP_ACTION_KILL:
+            if (!grp->cfg.kill)
+               continue;
+            break;
+         default:
+            break;
+         }
+
+      do_add:
+       gwins = Erealloc(gwins, (gwcnt + 1) * sizeof(EWin *));
+       gwins[gwcnt] = ew;
+       gwcnt++;
      }
-   else
+
+ done:
+   if (gwins == NULL)
      {
-       *num = 0;
-       return NULL;
+       gwins = Emalloc(sizeof(EWin *));
+       gwins[0] = (EWin *) ewin;
+       gwcnt = 1;
      }
+   *pnum = gwcnt;
+   return gwins;
 }
 
 EWin              **
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/groups.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- groups.c    30 Oct 2005 19:40:49 -0000      1.72
+++ groups.c    5 Nov 2005 17:12:53 -0000       1.73
@@ -28,6 +28,10 @@
 #include "snaps.h"
 #include <math.h>
 
+#define SET_OFF    0
+#define SET_ON     1
+#define SET_TOGGLE 2
+
 #define DISABLE_PAGER_ICONBOX_GROUPING 0
 
 static void         RemoveEwinFromGroup(EWin * ewin, Group * g);
@@ -167,7 +171,7 @@
 }
 
 static int
-EwinInGroup(EWin * ewin, Group * g)
+EwinInGroup(const EWin * ewin, const Group * g)
 {
    int                 i;
 
@@ -183,7 +187,7 @@
 }
 
 Group              *
-EwinsInGroup(EWin * ewin1, EWin * ewin2)
+EwinsInGroup(const EWin * ewin1, const EWin * ewin2)
 {
    int                 i;
 
@@ -289,21 +293,24 @@
 }
 
 static void
-ShowHideWinGroups(EWin * ewin, Group * g, char onoff)
+ShowHideWinGroups(EWin * ewin, int group_index, char onoff)
 {
    EWin              **gwins;
    int                 i, num;
    const Border       *b = NULL;
    const Border       *previous_border;
 
-   if (g)
+   if (!ewin || group_index >= ewin->num_groups)
+      return;
+
+   if (group_index < 0)
      {
-       gwins = g->members;
-       num = g->num_members;
+       gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_ANY, 0, &num);
      }
    else
      {
-       gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_ANY, 0, &num);
+       gwins = ewin->groups[group_index]->members;
+       num = ewin->groups[group_index]->num_members;
      }
 
    previous_border = ewin->previous_border;
@@ -359,7 +366,7 @@
             SnapshotEwinUpdate(gwins[i], SNAP_USE_GROUPS);
          }
      }
-   if (!g)
+   if (group_index < 0)
       Efree(gwins);
    SaveGroups();
 }
@@ -509,7 +516,7 @@
 {
    if (((val == 0) || (val == 2)) && tmp_groups)
      {
-       ShowHideWinGroups(tmp_ewin, tmp_groups[tmp_index], SET_OFF);
+       ShowHideWinGroups(tmp_ewin, tmp_index, SET_OFF);
      }
    if (val == 0)
      {
@@ -541,8 +548,8 @@
 static void
 GroupCallback(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
 {
-   ShowHideWinGroups(tmp_ewin, tmp_groups[tmp_index], SET_OFF);
-   ShowHideWinGroups(tmp_ewin, tmp_groups[val], SET_ON);
+   ShowHideWinGroups(tmp_ewin, tmp_index, SET_OFF);
+   ShowHideWinGroups(tmp_ewin, val, SET_ON);
    tmp_index = val;
 }
 
@@ -589,8 +596,7 @@
        return;
      }
 
-   group_member_strings = GetWinGroupMemberNames(tmp_groups, num_groups);
-   ShowHideWinGroups(ewin, tmp_groups[0], SET_ON);
+   ShowHideWinGroups(ewin, 0, SET_ON);
 
    d = FindItem("GROUP_SELECTION", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG);
    if (d)
@@ -615,6 +621,8 @@
    DialogItemSetAlign(di, 0, 512);
    DialogItemSetText(di, message);
 
+   group_member_strings = GetWinGroupMemberNames(tmp_groups, num_groups);
+
    radio = di = DialogAddItem(table, DITEM_RADIOBUTTON);
    DialogItemSetColSpan(di, 2);
    DialogItemSetCallback(di, GroupCallback, 0, (void *)d);
@@ -633,49 +641,49 @@
      }
    DialogItemRadioButtonGroupSetValPtr(radio, &tmp_group_index);
 
-   DialogAddFooter(d, DLG_OC, ChooseGroup);
+   StrlistFree(group_member_strings, num_groups);
 
-   for (i = 0; i < num_groups; i++)
-      Efree(group_member_strings[i]);
-   Efree(group_member_strings);
+   DialogAddFooter(d, DLG_OC, ChooseGroup);
 
    ShowDialog(d);
 }
 
-static GroupConfig *tmp_cfgs = NULL;
-static int          tmp_current_group;
-
-#if 0                          /* FIXME - Should these be separate variables? 
*/
-static int          tmp_index;
-static EWin        *tmp_ewin;
-static Group      **tmp_groups;
-#endif
-static GroupConfig  tmp_cfg;
-
-static DItem       *di_border;
-static DItem       *di_iconify;
-static DItem       *di_kill;
-static DItem       *di_move;
-static DItem       *di_raise;
-static DItem       *di_stick;
-static DItem       *di_shade;
-static DItem       *di_mirror;
+typedef struct
+{
+   EWin               *ewin;
+   GroupConfig         cfg;    /* Dialog data for current group */
+   GroupConfig        *cfgs;   /* Work copy of ewin group cfgs */
+   int                 ngrp;
+   unsigned int        current;
+} EwinGroupDlgData;
 
 static void
-CB_ConfigureGroup(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+CB_ConfigureGroup(Dialog * d, int val, void *data __UNUSED__)
 {
+   EwinGroupDlgData   *dd = DialogGetData(d);
+   EWin               *ewin;
    int                 i;
 
-   if (val < 2)
+   if (!dd)
+      return;
+
+   /* Check ewin */
+   ewin = EwinFindByPtr(dd->ewin);
+   if (ewin && ewin->num_groups != dd->ngrp)
+      ewin = NULL;
+
+   if (val < 2 && ewin)
      {
-       for (i = 0; i < tmp_ewin->num_groups; i++)
-          CopyGroupConfig(&(tmp_cfgs[i]), &(tmp_ewin->groups[i]->cfg));
+       CopyGroupConfig(&(dd->cfg), &(dd->cfgs[dd->current]));
+       for (i = 0; i < ewin->num_groups; i++)
+          CopyGroupConfig(dd->cfgs + i, &(ewin->groups[i]->cfg));
      }
-   if (((val == 0) || (val == 2)) && tmp_cfgs)
+   if ((val == 0) || (val == 2))
      {
-       ShowHideWinGroups(tmp_ewin, tmp_groups[tmp_current_group], SET_OFF);
-       Efree(tmp_cfgs);
-       tmp_cfgs = NULL;
+       ShowHideWinGroups(ewin, dd->current, SET_OFF);
+       Efree(dd->cfgs);
+       Efree(dd);
+       DialogSetData(d, NULL);
      }
    autosave();
 }
@@ -683,52 +691,14 @@
 static void
 GroupSelectCallback(Dialog * d, int val, void *data __UNUSED__)
 {
-   DialogItemCheckButtonSetState(di_border, tmp_cfgs[val].set_border);
-   DialogItemCheckButtonSetState(di_kill, tmp_cfgs[val].kill);
-   DialogItemCheckButtonSetState(di_move, tmp_cfgs[val].move);
-   DialogItemCheckButtonSetState(di_raise, tmp_cfgs[val].raise);
-   DialogItemCheckButtonSetState(di_iconify, tmp_cfgs[val].iconify);
-   DialogItemCheckButtonSetState(di_stick, tmp_cfgs[val].stick);
-   DialogItemCheckButtonSetState(di_shade, tmp_cfgs[val].shade);
-   DialogItemCheckButtonSetState(di_mirror, tmp_cfgs[val].mirror);
-   DialogRedraw(d);
-   ShowHideWinGroups(tmp_ewin, tmp_groups[tmp_current_group], SET_OFF);
-   ShowHideWinGroups(tmp_ewin, tmp_groups[val], SET_ON);
-   tmp_current_group = val;
-}
+   EwinGroupDlgData   *dd = DialogGetData(d);
 
-static void
-GroupFeatureChangeCallback(Dialog * d __UNUSED__, int val, void *data)
-{
-   switch (val)
-     {
-     case GROUP_FEATURE_BORDER:
-       tmp_cfgs[tmp_current_group].set_border = *((char *)data);
-       break;
-     case GROUP_FEATURE_KILL:
-       tmp_cfgs[tmp_current_group].kill = *((char *)data);
-       break;
-     case GROUP_FEATURE_MOVE:
-       tmp_cfgs[tmp_current_group].move = *((char *)data);
-       break;
-     case GROUP_FEATURE_RAISE:
-       tmp_cfgs[tmp_current_group].raise = *((char *)data);
-       break;
-     case GROUP_FEATURE_ICONIFY:
-       tmp_cfgs[tmp_current_group].iconify = *((char *)data);
-       break;
-     case GROUP_FEATURE_STICK:
-       tmp_cfgs[tmp_current_group].stick = *((char *)data);
-       break;
-     case GROUP_FEATURE_SHADE:
-       tmp_cfgs[tmp_current_group].shade = *((char *)data);
-       break;
-     case GROUP_FEATURE_MIRROR:
-       tmp_cfgs[tmp_current_group].mirror = *((char *)data);
-       break;
-     default:
-       break;
-     }
+   CopyGroupConfig(&(dd->cfg), &(dd->cfgs[dd->current]));
+   CopyGroupConfig(&(dd->cfgs[val]), &(dd->cfg));
+   DialogRedraw(d);
+   ShowHideWinGroups(dd->ewin, dd->current, SET_OFF);
+   ShowHideWinGroups(dd->ewin, val, SET_ON);
+   dd->current = val;
 }
 
 static void
@@ -738,9 +708,11 @@
    DItem              *table, *radio, *di;
    int                 i;
    char              **group_member_strings;
+   EwinGroupDlgData   *dd;
 
    if (!ewin)
       return;
+
    if (ewin->num_groups == 0)
      {
        DialogOK(_("Window Group Error"),
@@ -756,21 +728,28 @@
        ShowDialog(d);
        return;
      }
+
    SoundPlay("SOUND_SETTINGS_GROUP");
 
-   tmp_ewin = ewin;
-   tmp_groups = ewin->groups;
-   tmp_cfgs = (GroupConfig *) Emalloc(ewin->num_groups * sizeof(GroupConfig));
-   tmp_current_group = 0;
-   group_member_strings =
-      GetWinGroupMemberNames(ewin->groups, ewin->num_groups);
-   ShowHideWinGroups(ewin, ewin->groups[0], SET_ON);
+   d = DialogCreate("CONFIGURE_GROUP");
+   if (!d)
+      return;
+   DialogSetTitle(d, _("Window Group Settings"));
+
+   dd = Ecalloc(1, sizeof(EwinGroupDlgData));
+   if (!dd)
+      return;
 
+   dd->ewin = ewin;
+   dd->cfgs = Emalloc(ewin->num_groups * sizeof(GroupConfig));
+   dd->ngrp = ewin->num_groups;
+   dd->current = 0;
    for (i = 0; i < ewin->num_groups; i++)
-      CopyGroupConfig(&(ewin->groups[i]->cfg), &(tmp_cfgs[i]));
+      CopyGroupConfig(&(ewin->groups[i]->cfg), dd->cfgs + i);
+   CopyGroupConfig(dd->cfgs, &(dd->cfg));
+   DialogSetData(d, dd);
 
-   d = DialogCreate("CONFIGURE_GROUP");
-   DialogSetTitle(d, _("Window Group Settings"));
+   ShowHideWinGroups(ewin, 0, SET_ON);
 
    table = DialogInitItem(d);
    DialogItemTableSetOptions(table, 2, 0, 0, 0);
@@ -784,9 +763,12 @@
    DialogItemSetAlign(di, 0, 512);
    DialogItemSetText(di, _("   Pick the group to configure:   "));
 
+   group_member_strings =
+      GetWinGroupMemberNames(ewin->groups, ewin->num_groups);
+
    radio = di = DialogAddItem(table, DITEM_RADIOBUTTON);
    DialogItemSetColSpan(di, 2);
-   DialogItemSetCallback(di, GroupSelectCallback, 0, (void *)d);
+   DialogItemSetCallback(di, GroupSelectCallback, 0, d);
    DialogItemSetText(di, group_member_strings[0]);
    DialogItemRadioButtonSetFirst(di, radio);
    DialogItemRadioButtonGroupSetVal(di, 0);
@@ -795,93 +777,66 @@
      {
        di = DialogAddItem(table, DITEM_RADIOBUTTON);
        DialogItemSetColSpan(di, 2);
-       DialogItemSetCallback(di, GroupSelectCallback, i, (void *)d);
+       DialogItemSetCallback(di, GroupSelectCallback, i, d);
        DialogItemSetText(di, group_member_strings[i]);
        DialogItemRadioButtonSetFirst(di, radio);
        DialogItemRadioButtonGroupSetVal(di, i);
      }
    DialogItemRadioButtonGroupSetValPtr(radio, &tmp_index);
 
+   StrlistFree(group_member_strings, ewin->num_groups);
+
    di = DialogAddItem(table, DITEM_SEPARATOR);
    DialogItemSetColSpan(di, 2);
 
    di = DialogAddItem(table, DITEM_TEXT);
    DialogItemSetColSpan(di, 2);
    DialogItemSetAlign(di, 0, 512);
-   DialogItemSetText(di,
-                    _("  The following actions are  \n"
-                      "  applied to all group members:  "));
+   DialogItemSetText(di, _("  The following actions are  \n"
+                          "  applied to all group members:  "));
 
-   di_border = di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   di = DialogAddItem(table, DITEM_CHECKBUTTON);
    DialogItemSetColSpan(di, 2);
-   DialogItemSetCallback(di, GroupFeatureChangeCallback, GROUP_FEATURE_BORDER,
-                        &(tmp_cfg.set_border));
    DialogItemSetText(di, _("Changing Border Style"));
-   DialogItemCheckButtonSetState(di, tmp_cfgs[0].set_border);
-   DialogItemCheckButtonSetPtr(di, &(tmp_cfg.set_border));
+   DialogItemCheckButtonSetPtr(di, &(dd->cfg.set_border));
 
-   di_iconify = di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   di = DialogAddItem(table, DITEM_CHECKBUTTON);
    DialogItemSetColSpan(di, 2);
-   DialogItemSetCallback(di, GroupFeatureChangeCallback,
-                        GROUP_FEATURE_ICONIFY, &(tmp_cfg.iconify));
    DialogItemSetText(di, _("Iconifying"));
-   DialogItemCheckButtonSetState(di, tmp_cfgs[0].iconify);
-   DialogItemCheckButtonSetPtr(di, &(tmp_cfg.iconify));
+   DialogItemCheckButtonSetPtr(di, &(dd->cfg.iconify));
 
-   di_kill = di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   di = DialogAddItem(table, DITEM_CHECKBUTTON);
    DialogItemSetColSpan(di, 2);
-   DialogItemSetCallback(di, GroupFeatureChangeCallback, GROUP_FEATURE_KILL,
-                        &(tmp_cfg.kill));
    DialogItemSetText(di, _("Killing"));
-   DialogItemCheckButtonSetState(di, tmp_cfgs[0].kill);
-   DialogItemCheckButtonSetPtr(di, &(tmp_cfg.kill));
+   DialogItemCheckButtonSetPtr(di, &(dd->cfg.kill));
 
-   di_move = di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   di = DialogAddItem(table, DITEM_CHECKBUTTON);
    DialogItemSetColSpan(di, 2);
-   DialogItemSetCallback(di, GroupFeatureChangeCallback, GROUP_FEATURE_MOVE,
-                        &(tmp_cfg.move));
    DialogItemSetText(di, _("Moving"));
-   DialogItemCheckButtonSetState(di, tmp_cfgs[0].move);
-   DialogItemCheckButtonSetPtr(di, &(tmp_cfg.move));
+   DialogItemCheckButtonSetPtr(di, &(dd->cfg.move));
 
-   di_raise = di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   di = DialogAddItem(table, DITEM_CHECKBUTTON);
    DialogItemSetColSpan(di, 2);
-   DialogItemSetCallback(di, GroupFeatureChangeCallback, GROUP_FEATURE_RAISE,
-                        &(tmp_cfg.raise));
    DialogItemSetText(di, _("Raising/Lowering"));
-   DialogItemCheckButtonSetState(di, tmp_cfgs[0].raise);
-   DialogItemCheckButtonSetPtr(di, &(tmp_cfg.raise));
+   DialogItemCheckButtonSetPtr(di, &(dd->cfg.raise));
 
-   di_stick = di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   di = DialogAddItem(table, DITEM_CHECKBUTTON);
    DialogItemSetColSpan(di, 2);
-   DialogItemSetCallback(di, GroupFeatureChangeCallback, GROUP_FEATURE_STICK,
-                        &(tmp_cfg.stick));
    DialogItemSetText(di, _("Sticking"));
-   DialogItemCheckButtonSetState(di, tmp_cfgs[0].stick);
-   DialogItemCheckButtonSetPtr(di, &(tmp_cfg.stick));
+   DialogItemCheckButtonSetPtr(di, &(dd->cfg.stick));
 
-   di_shade = di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   di = DialogAddItem(table, DITEM_CHECKBUTTON);
    DialogItemSetColSpan(di, 2);
-   DialogItemSetCallback(di, GroupFeatureChangeCallback, GROUP_FEATURE_SHADE,
-                        &(tmp_cfg.shade));
    DialogItemSetText(di, _("Shading"));
-   DialogItemCheckButtonSetState(di, tmp_cfgs[0].shade);
-   DialogItemCheckButtonSetPtr(di, &(tmp_cfg.shade));
+   DialogItemCheckButtonSetPtr(di, &(dd->cfg.shade));
 
-   di_mirror = di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   di = DialogAddItem(table, DITEM_CHECKBUTTON);
    DialogItemSetColSpan(di, 2);
-   DialogItemSetCallback(di, GroupFeatureChangeCallback, GROUP_FEATURE_MIRROR,
-                        &(tmp_cfg.mirror));
    DialogItemSetText(di, _("Mirror Shade/Iconify/Stick"));
-   DialogItemCheckButtonSetState(di, tmp_cfgs[0].mirror);
-   DialogItemCheckButtonSetPtr(di, &(tmp_cfg.mirror));
+   DialogItemCheckButtonSetPtr(di, &(dd->cfg.mirror));
 
    DialogAddFooter(d, DLG_OAC, CB_ConfigureGroup);
 
-   for (i = 0; i < ewin->num_groups; i++)
-      Efree(group_member_strings[i]);
-   Efree(group_member_strings);
-
    ShowDialog(d);
 }
 
@@ -1049,7 +1004,7 @@
 static int
 doShowHideGroup(EWin * ewin, const char *params __UNUSED__)
 {
-   ShowHideWinGroups(ewin, NULL, SET_TOGGLE);
+   ShowHideWinGroups(ewin, -1, SET_TOGGLE);
    return 0;
 }
 
@@ -1247,7 +1202,7 @@
      }
    else if (!strcmp(operation, "showhide"))
      {
-       ShowHideWinGroups(ewin, NULL, SET_TOGGLE);
+       ShowHideWinGroups(ewin, -1, SET_TOGGLE);
        IpcPrintf("showhide %8x", win);
      }
    else
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/moveresize.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -3 -r1.54 -r1.55
--- moveresize.c        27 Oct 2005 23:18:35 -0000      1.54
+++ moveresize.c        5 Nov 2005 17:12:53 -0000       1.55
@@ -87,16 +87,15 @@
    Mode_mr.win_w = ewin->client.w;
    Mode_mr.win_h = ewin->client.h;
 
+   RaiseEwin(ewin);
    gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_MOVE, nogroup
                                      || Mode.move.swap, &num);
    for (i = 0; i < num; i++)
      {
-       EwinShapeSet(ewin);
+       EwinShapeSet(gwins[i]);
        EwinFloatAt(gwins[i], EoGetX(gwins[i]), EoGetY(gwins[i]));
        if (Conf.movres.mode_move == 0)
-         {
-            EoChangeOpacity(ewin, OpacityExt(Conf.movres.opacity));
-         }
+          EoChangeOpacity(gwins[i], OpacityExt(Conf.movres.opacity));
      }
    Efree(gwins);
    Mode_mr.swapcoord_x = EoGetX(ewin);
@@ -123,6 +122,8 @@
    if (!ewin)
       goto done;
 
+   ewin->state.show_coords = 0;
+
    gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_MOVE, Mode.nogroup
                                      || Mode.move.swap, &num);
 
@@ -137,11 +138,6 @@
 
    d2 = DesktopAt(Mode.events.x, Mode.events.y);
 
-   if (Conf.movres.mode_move == 0)
-     {
-       EoChangeOpacity(ewin, ewin->ewmh.opacity);
-     }
-
    for (i = 0; i < num; i++)
      {
        ewin = gwins[i];
@@ -152,6 +148,8 @@
           EwinUnfloatAt(ewin, d2,
                         ewin->shape_x - (EoGetX(d2) - EoGetX(d1)),
                         ewin->shape_y - (EoGetY(d2) - EoGetY(d1)));
+       if (Conf.movres.mode_move == 0)
+          EoChangeOpacity(ewin, ewin->ewmh.opacity);
      }
 
    Efree(gwins);
@@ -359,6 +357,7 @@
    Mode_mr.win_w = ewin->client.w;
    Mode_mr.win_h = ewin->client.h;
    EwinShapeSet(ewin);
+   ewin->state.show_coords = 1;
    DrawEwinShape(ewin, Conf.movres.mode_resize, EoGetX(ewin), EoGetY(ewin),
                 ewin->client.w, ewin->client.h, 0);
 
@@ -381,6 +380,7 @@
    if (!ewin)
       goto done;
 
+   ewin->state.show_coords = 0;
    DrawEwinShape(ewin, Conf.movres.mode_resize, ewin->shape_x, ewin->shape_y,
                 ewin->client.w, ewin->client.h, 2);
 
@@ -429,6 +429,9 @@
             ModulesSignal(ESIGNAL_ANIMATION_SUSPEND, NULL);
          }
 
+       if (Conf.movres.mode_move == 0 || num == 1)
+          ewin->state.show_coords = 1;
+
        for (i = 0; i < num; i++)
          {
             ewin1 = gwins[i];
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/snaps.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -3 -r1.108 -r1.109
--- snaps.c     30 Oct 2005 22:55:45 -0000      1.108
+++ snaps.c     5 Nov 2005 17:12:53 -0000       1.109
@@ -1419,11 +1419,11 @@
 {
    Snapshot           *sn;
    int                 i, ax, ay;
+   unsigned int        use_flags;
 
    sn = ewin->snap;
    if (!sn)
      {
-
        if (ewin->props.autosave)
           SnapshotEwinSet(ewin, SNAP_MATCH_DEFAULT, SNAP_USE_ALL | SNAP_AUTO);
        return;
@@ -1432,19 +1432,25 @@
    if (ewin->props.autosave)
       sn->track_changes = 1;
 
-   if (sn->use_flags & SNAP_USE_STICKY)
+   use_flags = sn->use_flags;
+   /* If restarting don't override stuff set in attributes/properties */
+   if (ewin->state.identified)
+      use_flags &= SNAP_USE_LAYER | SNAP_USE_FOCUS_NEVER | SNAP_USE_SHADOW |
+        SNAP_USE_GROUPS;
+
+   if (use_flags & SNAP_USE_STICKY)
       EoSetSticky(ewin, sn->sticky);
 
-   if (sn->use_flags & SNAP_USE_DESK)
+   if (use_flags & SNAP_USE_DESK)
       EoSetDesk(ewin, DeskGet(sn->desktop));
 
-   if (sn->use_flags & SNAP_USE_SIZE)
+   if (use_flags & SNAP_USE_SIZE)
      {
        ewin->client.w = sn->w;
        ewin->client.h = sn->h;
      }
 
-   if (sn->use_flags & SNAP_USE_POS)
+   if (use_flags & SNAP_USE_POS)
      {
        ewin->state.placed = 1;
        ewin->client.x = sn->x;
@@ -1464,23 +1470,23 @@
                          ewin->client.y, ewin->client.w, ewin->client.h);
      }
 
-   if (sn->use_flags & SNAP_USE_LAYER)
+   if (use_flags & SNAP_USE_LAYER)
       EoSetLayer(ewin, sn->layer);
 
-   if (sn->use_flags & SNAP_USE_SKIP_LISTS)
+   if (use_flags & SNAP_USE_SKIP_LISTS)
      {
        ewin->props.skip_focuslist = sn->skipfocus;
        ewin->props.skip_ext_task = sn->skiptask;
        ewin->props.skip_winlist = sn->skipwinlist;
      }
 
-   if (sn->use_flags & SNAP_USE_FOCUS_NEVER)
+   if (use_flags & SNAP_USE_FOCUS_NEVER)
       ewin->props.never_focus = sn->neverfocus;
 
-   if (sn->use_flags & SNAP_USE_SHADED)
+   if (use_flags & SNAP_USE_SHADED)
       ewin->state.shaded = sn->shaded;
 
-   if (sn->use_flags & SNAP_USE_BORDER)
+   if (use_flags & SNAP_USE_BORDER)
       EwinSetBorderByName(ewin, sn->border_name);
 
    if (sn->groups)
@@ -1504,10 +1510,10 @@
      }
 
 #if USE_COMPOSITE
-   if (sn->use_flags & SNAP_USE_OPACITY)
+   if (use_flags & SNAP_USE_OPACITY)
       ewin->ewmh.opacity = OpacityExt(sn->opacity);
 
-   if (sn->use_flags & SNAP_USE_SHADOW)
+   if (use_flags & SNAP_USE_SHADOW)
       EoSetShadow(ewin, sn->shadow);
 #endif
 




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to