Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h actions.c borders.c ewmh.c groups.c hints.c icccm.c 
        iconify.c ipc.c menus.c snaps.c 


Log Message:
Fix problem with borders on initially shaded windows.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -3 -r1.166 -r1.167
--- E.h 21 Dec 2003 12:25:58 -0000      1.166
+++ E.h 27 Dec 2003 19:20:15 -0000      1.167
@@ -998,7 +998,6 @@
    WinClient           client;
    Border             *border;
    Border             *previous_border;
-   char                border_new;
    EWinBit            *bits;
    int                 flags;
    int                 desktop;
@@ -1787,8 +1786,6 @@
 void                AddToFamily(Window win);
 EWin               *AddInternalToFamily(Window win, char noshow, char *bname,
                                        int type, void *ptr);
-void                SetEwinBorder(EWin * ewin);
-void                SetEwinToBorder(EWin * ewin, Border * b);
 void                HonorIclass(char *s, int id);
 void                SyncBorderToEwin(EWin * ewin);
 void                UpdateBorderInfo(EWin * ewin);
@@ -1818,7 +1815,6 @@
 void                RemoveWindowMatch(WindowMatch * wm);
 
 /* borders.c functions */
-void                SetFrameProperty(EWin * ewin);
 void                KillEwin(EWin * ewin);
 void                ResizeEwin(EWin * ewin, int w, int h);
 void                DetermineEwinArea(EWin * ewin);
@@ -1842,10 +1838,13 @@
                                  int bxa, int byp, int bya,
                                  char keep_for_shade);
 void                MinShadeSize(EWin * ewin, int *mw, int *mh);
-void                InstantShadeEwin(EWin * ewin);
+void                InstantShadeEwin(EWin * ewin, int force);
 void                InstantUnShadeEwin(EWin * ewin);
 void                ShadeEwin(EWin * ewin);
 void                UnShadeEwin(EWin * ewin);
+void                EwinSetBorder(EWin * ewin, Border * b, int apply);
+void                EwinSetBorderByName(EWin * ewin, const char *name,
+                                       int apply);
 
 /* iclass.c functions */
 ImageClass         *CreateIclass(void);
@@ -2272,6 +2271,7 @@
 void                HintsSetWindowArea(EWin * ewin);
 void                HintsSetWindowState(EWin * ewin);
 void                HintsSetWindowHints(EWin * ewin);
+void                HintsSetWindowBorder(EWin * ewin);
 void                HintsGetWindowHints(EWin * ewin);
 void                HintsDelWindowHints(EWin * ewin);
 void                HintsProcessPropertyChange(EWin * ewin, Atom atom_change);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/actions.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -3 -r1.121 -r1.122
--- actions.c   19 Dec 2003 00:05:36 -0000      1.121
+++ actions.c   27 Dec 2003 19:20:15 -0000      1.122
@@ -3124,7 +3124,6 @@
      {
        if (b != gwins[i]->border)
          {
-            gwins[i]->border_new = 1;
             AUDIO_PLAY("SOUND_WINDOW_BORDER_CHANGE");
             shadechange = 0;
             if (gwins[i]->shaded)
@@ -3132,12 +3131,9 @@
                  shadechange = 1;
                  InstantUnShadeEwin(gwins[i]);
               }
-            SetEwinToBorder(gwins[i], b);
+            EwinSetBorder(gwins[i], b, 1);
             if (shadechange)
-               InstantShadeEwin(gwins[i]);
-            ICCCM_MatchSize(gwins[i]);
-            MoveResizeEwin(gwins[i], gwins[i]->x, gwins[i]->y,
-                           gwins[i]->client.w, gwins[i]->client.h);
+               InstantShadeEwin(gwins[i], 0);
          }
        RememberImportantInfoForEwin(gwins[i]);
      }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -3 -r1.112 -r1.113
--- borders.c   21 Dec 2003 23:15:17 -0000      1.112
+++ borders.c   27 Dec 2003 19:20:15 -0000      1.113
@@ -23,6 +23,9 @@
 #include "E.h"
 #include <sys/time.h>
 
+static void         EwinSetBorderInit(EWin * ewin);
+static void         EwinSetBorderTo(EWin * ewin, Border * b);
+
 #if 0
 #define DELETE_EWIN_REFERENCE(ew, ew_ref) \
        ({ if (ew_ref == ew) { printf("Stale ewin ref (" #ew_ref ")\n"); ew_ref = 
NULL; } })
@@ -32,27 +35,6 @@
 #endif
 
 void
-SetFrameProperty(EWin * ewin)
-{
-   static Atom         atom_set = 0;
-   CARD32              val[4];
-
-   if (!atom_set)
-      atom_set = XInternAtom(disp, "_E_FRAME_SIZE", False);
-   if (ewin->border)
-     {
-       val[0] = ewin->border->border.left;
-       val[1] = ewin->border->border.right;
-       val[2] = ewin->border->border.top;
-       val[3] = ewin->border->border.bottom;
-     }
-   else
-      val[0] = val[1] = val[2] = val[3] = 0;
-   XChangeProperty(disp, ewin->client.win, atom_set, XA_CARDINAL, 32,
-                  PropModeReplace, (unsigned char *)&val, 4);
-}
-
-void
 KillEwin(EWin * ewin)
 {
    EWin              **gwins;
@@ -867,14 +849,7 @@
    EDBUG(4, "SyncBorderToEwin");
    b = ewin->border;
    ICCCM_GetShapeInfo(ewin);
-   /*   SetEwinBorder(ewin); */
-   SetEwinToBorder(ewin, ewin->border);
-   if (b != ewin->border)
-     {
-       ICCCM_MatchSize(ewin);
-       MoveResizeEwin(ewin, ewin->client.x, ewin->client.y, ewin->client.w,
-                      ewin->client.h);
-     }
+   EwinSetBorder(ewin, b, 1);
    EDBUG_RETURN_;
 }
 
@@ -1237,6 +1212,7 @@
        reshape |= DrawEwinWinpart(ewin, i);
        ewin->bits[i].no_expose = 1;
      }
+
    if ((reshape) || (mode.have_place_grab))
      {
        if (mode.have_place_grab)
@@ -1259,7 +1235,6 @@
 EWin               *
 Adopt(Window win)
 {
-   Border             *b;
    EWin               *ewin;
 
    EDBUG(4, "Adopt");
@@ -1278,23 +1253,21 @@
    MatchEwinToSM(ewin);
    MatchEwinToSnapInfo(ewin);
    ICCCM_GetEInfo(ewin);
-   if (!ewin->border)
-      SetEwinBorder(ewin);
 
-   b = ewin->border;
-   ewin->border = NULL;
-   ewin->border_new = 1;
+   if (!ewin->border)
+      EwinSetBorderInit(ewin);
 
-   SetEwinToBorder(ewin, b);
    ICCCM_MatchSize(ewin);
    ICCCM_Adopt(ewin);
-   HintsSetWindowState(ewin);
+
+   EwinSetBorderTo(ewin, NULL);
    UngrabX();
+
    if (ewin->shaded)
-     {
-       ewin->shaded = 0;
-       InstantShadeEwin(ewin);
-     }
+      InstantShadeEwin(ewin, 1);
+
+   HintsSetWindowState(ewin);
+
    EDBUG_RETURN(ewin);
 }
 
@@ -1302,7 +1275,6 @@
 AdoptInternal(Window win, Border * border, int type, void *ptr)
 {
    EWin               *ewin;
-   Border             *b;
 
    EDBUG(4, "AdoptInternal");
    GrabX();
@@ -1336,49 +1308,23 @@
    ICCCM_GetShapeInfo(ewin);
    ICCCM_GetGeoms(ewin, 0);
 
-   /* if (type == 1)
-    *   MatchEwinToSnapInfoPager(ewin, (Pager *)ptr);
-    * else if (type == 2)
-    *   MatchEwinToSnapInfoIconbox(ewin, (Iconbox *)ptr);
-    * else  */
-   if (!border)
-     {
-       b = MatchEwinByFunction(ewin,
-                               (void
-                                *(*)(EWin *, WindowMatch *))MatchEwinBorder);
-       if (b)
-         {
-            ewin->border = b;
-            SetFrameProperty(ewin);
-         }
-     }
    MatchEwinToSnapInfo(ewin);
+
+   ewin->border = border;
    if (!ewin->border)
-     {
-       if (border)
-         {
-            ewin->border = border;
-            SetFrameProperty(ewin);
-         }
-       else
-          SetEwinBorder(ewin);
-     }
-   b = ewin->border;
-   ewin->border = NULL;
-   ewin->border_new = 1;
-   SetEwinToBorder(ewin, b);
+      EwinSetBorderInit(ewin);
+   EwinSetBorderTo(ewin, NULL);
 
    ICCCM_MatchSize(ewin);
    ICCCM_Adopt(ewin);
-   HintsSetWindowState(ewin);
    UngrabX();
+
    if (ewin->shaded)
-     {
-       ewin->shaded = 0;
-       ShadeEwin(ewin);
-     }
+      InstantShadeEwin(ewin, 1);
+
+   HintsSetWindowState(ewin);
+
    EDBUG_RETURN(ewin);
-   ptr = NULL;
 }
 
 EWin               *
@@ -1453,7 +1399,6 @@
    ewin->client.mwm_func_close = 1;
    ewin->border = NULL;
    ewin->previous_border = NULL;
-   ewin->border_new = 0;
    ewin->bits = NULL;
    ewin->sticky = 0;
    ewin->desktop = desks.current;
@@ -1624,13 +1569,13 @@
    EDBUG_RETURN_;
 }
 
-void
-SetEwinBorder(EWin * ewin)
+static void
+EwinSetBorderInit(EWin * ewin)
 {
    Border             *b;
 
-   EDBUG(4, "SetEwinBorder");
-   b = NULL;
+   EDBUG(4, "EwinSetBorderInit");
+
    ICCCM_GetShapeInfo(ewin);
 
    if ((!ewin->client.mwm_decor_title) && (!ewin->client.mwm_decor_border))
@@ -1645,13 +1590,17 @@
                              LIST_TYPE_BORDER);
    if (!b)
       b = (Border *) FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
+
+   if (!b)
+      b = FindItem("__FALLBACK_BORDER", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
+
    ewin->border = b;
-   SetFrameProperty(ewin);
+
    EDBUG_RETURN_;
 }
 
-void
-SetEwinToBorder(EWin * ewin, Border * b)
+static void
+EwinSetBorderTo(EWin * ewin, Border * b)
 {
    int                 i;
    int                 px = -1, py = -1;
@@ -1659,14 +1608,17 @@
 
    AwaitIclass        *await;
 
-   EDBUG(4, "SetEwinToBorder");
+   EDBUG(4, "EwinSetBorderTo");
 
-   if (!b)
-      b = FindItem("__FALLBACK_BORDER", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
-
-   if ((!b) || (ewin->border == b) || (!ewin->border_new))
+   if (ewin->border == b)
       EDBUG_RETURN_;
 
+   if (b == NULL)
+     {
+       b = ewin->border;
+       ewin->border = NULL;
+     }
+
    if (ewin->border)
      {
        px = ewin->border->border.left;
@@ -1681,10 +1633,10 @@
        ewin->bits = NULL;
        ewin->border->ref_count--;
      }
-   ewin->border_new = 0;
+
    ewin->border = b;
-   SetFrameProperty(ewin);
    b->ref_count++;
+   HintsSetWindowBorder(ewin);
 
    if (b->num_winparts > 0)
       ewin->bits = Emalloc(sizeof(EWinBit) * b->num_winparts);
@@ -1790,6 +1742,38 @@
 }
 
 void
+EwinSetBorder(EWin * ewin, Border * b, int apply)
+{
+   if (!b)
+      return;
+
+   if (apply)
+     {
+       if (ewin->border != b)
+         {
+            EwinSetBorderTo(ewin, b);
+            ICCCM_MatchSize(ewin);
+            MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w,
+                           ewin->client.h);
+         }
+     }
+   else
+     {
+       ewin->border = b;
+     }
+}
+
+void
+EwinSetBorderByName(EWin * ewin, const char *name, int apply)
+{
+   Border             *b;
+
+   b = (Border *) FindItem(name, 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
+
+   EwinSetBorder(ewin, b, apply);
+}
+
+void
 ResizeEwin(EWin * ewin, int w, int h)
 {
    char                resize = 0;
@@ -2413,7 +2397,7 @@
 }
 
 void
-InstantShadeEwin(EWin * ewin)
+InstantShadeEwin(EWin * ewin, int force)
 {
    XSetWindowAttributes att;
    int                 b, d;
@@ -2426,8 +2410,9 @@
       EDBUG_RETURN_;
    if (GetZoomEWin() == ewin)
       EDBUG_RETURN_;
-   if (ewin->shaded)
+   if (ewin->shaded && !force)
       EDBUG_RETURN_;
+
    pq = queue_up;
    queue_up = 0;
    switch (ewin->border->shadedir)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewmh.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- ewmh.c      21 Dec 2003 12:10:56 -0000      1.29
+++ ewmh.c      27 Dec 2003 19:20:15 -0000      1.30
@@ -596,8 +596,6 @@
    atom = p_atoms[0];
    if (atom == _NET_WM_WINDOW_TYPE_DESKTOP)
      {
-       Border             *b;
-
        ewin->layer = 0;
        ewin->sticky = 1;
 #if 0                          /* Should be configurable */
@@ -605,10 +603,7 @@
 #endif
        ewin->skipfocus = 1;
        ewin->fixedpos = 1;
-       b = (Border *) FindItem("BORDERLESS", 0, LIST_FINDBY_NAME,
-                               LIST_TYPE_BORDER);
-       ewin->border_new = 1;
-       SetEwinToBorder(ewin, b);
+       EwinSetBorderByName(ewin, "BORDERLESS", 0);
      }
    else if (atom == _NET_WM_WINDOW_TYPE_DOCK)
      {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/groups.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- groups.c    5 Nov 2003 17:24:44 -0000       1.45
+++ groups.c    27 Dec 2003 19:20:15 -0000      1.46
@@ -365,11 +365,7 @@
 
        if (b)
          {
-            gwins[i]->border_new = 1;
-            SetEwinToBorder(gwins[i], b);
-            ICCCM_MatchSize(gwins[i]);
-            MoveResizeEwin(gwins[i], gwins[i]->x, gwins[i]->y,
-                           gwins[i]->client.w, gwins[i]->client.h);
+            EwinSetBorder(gwins[i], b, 1);
             RememberImportantInfoForEwin(gwins[i]);
          }
      }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/hints.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- hints.c     21 Dec 2003 12:25:58 -0000      1.13
+++ hints.c     27 Dec 2003 19:20:15 -0000      1.14
@@ -179,6 +179,29 @@
    EDBUG_RETURN_;
 }
 
+void
+HintsSetWindowBorder(EWin * ewin)
+{
+   static Atom         atom_set = 0;
+   CARD32              val[4];
+
+   if (!atom_set)
+      atom_set = XInternAtom(disp, "_E_FRAME_SIZE", False);
+
+   if (ewin->border)
+     {
+       val[0] = ewin->border->border.left;
+       val[1] = ewin->border->border.right;
+       val[2] = ewin->border->border.top;
+       val[3] = ewin->border->border.bottom;
+     }
+   else
+      val[0] = val[1] = val[2] = val[3] = 0;
+
+   XChangeProperty(disp, ewin->client.win, atom_set, XA_CARDINAL, 32,
+                  PropModeReplace, (unsigned char *)&val, 4);
+}
+
 /*
  * Functions that set E-internals from X11-properties
  */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- icccm.c     18 Dec 2003 23:43:26 -0000      1.45
+++ icccm.c     27 Dec 2003 19:20:15 -0000      1.46
@@ -1316,6 +1316,7 @@
                  ewin->client.w = c[6];
                  ewin->client.h = c[7];
               }
+            XFree(c);
 
             puc = NULL;
             XGetWindowProperty(disp, ewin->client.win, aa, 0, 0xffff, True,
@@ -1323,21 +1324,7 @@
             str = (char *)puc;
             num = (int)lnum;
             if ((num > 0) && (str))
-              {
-                 Border             *b = NULL;
-
-                 b = (Border *) FindItem(str, 0, LIST_FINDBY_NAME,
-                                         LIST_TYPE_BORDER);
-                 if ((ewin->border) && (strcmp(ewin->border->name, b->name)))
-                    b = NULL;
-                 if (b)
-                   {
-                      ewin->border_new = 1;
-                      ewin->border = b;
-                      SetFrameProperty(ewin);
-                   }
-              }
-            XFree(c);
+               EwinSetBorderByName(ewin, str, 0);
             XFree(str);
          }
        EDBUG_RETURN(1);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -3 -r1.78 -r1.79
--- iconify.c   14 Dec 2003 17:24:34 -0000      1.78
+++ iconify.c   27 Dec 2003 19:20:15 -0000      1.79
@@ -227,7 +227,7 @@
          }
        HideEwin(ewin);
        if (was_shaded != ewin->shaded)
-          InstantShadeEwin(ewin);
+          InstantShadeEwin(ewin, 0);
        ICCCM_Iconify(ewin);
        if (ewin == mode.focuswin)
          {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -3 -r1.123 -r1.124
--- ipc.c       21 Dec 2003 12:25:58 -0000      1.123
+++ ipc.c       27 Dec 2003 19:20:15 -0000      1.124
@@ -3986,14 +3986,8 @@
               {
                  b = (Border *) FindItem(param1, 0,
                                          LIST_FINDBY_NAME, LIST_TYPE_BORDER);
-                 if ((b) && (b != ewin->border))
-                   {
-                      ewin->border_new = 1;
-                      SetEwinToBorder(ewin, b);
-                      ICCCM_MatchSize(ewin);
-                      MoveResizeEwin(ewin, ewin->x, ewin->y,
-                                     ewin->client.w, ewin->client.h);
-                   }
+                 if (b)
+                    EwinSetBorder(ewin, b, 1);
               }
          }
        else
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -3 -r1.91 -r1.92
--- menus.c     14 Dec 2003 17:24:34 -0000      1.91
+++ menus.c     27 Dec 2003 19:20:15 -0000      1.92
@@ -295,7 +295,7 @@
                    ewin->y - desks.desk[ewin->desktop].y);
        RestackEwin(ewin);
        if (mode.menuslide)
-          InstantShadeEwin(ewin);
+          InstantShadeEwin(ewin, 0);
        ICCCM_Cmap(NULL);
        if (!noshow)
          {
@@ -304,7 +304,6 @@
                UnShadeEwin(ewin);
          }
        ewin->menu = m;
-       ewin->dialog = NULL;
      }
 
    m->stuck = 0;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/snaps.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- snaps.c     9 Dec 2003 20:35:14 -0000       1.53
+++ snaps.c     27 Dec 2003 19:20:15 -0000      1.54
@@ -1146,7 +1146,6 @@
 MatchEwinToSnapInfo(EWin * ewin)
 {
    Snapshot           *sn;
-   Border             *b;
    int                 i;
 
    sn = FindSnapshot(ewin);
@@ -1213,16 +1212,7 @@
        /* FIXME: fill this in */
      }
    if (sn->border_name)
-     {
-       b = (Border *) FindItem(sn->border_name, 0, LIST_FINDBY_NAME,
-                               LIST_TYPE_BORDER);
-       if (b)
-         {
-            ewin->border_new = 1;
-            ewin->border = b;
-            SetFrameProperty(ewin);
-         }
-     }
+      EwinSetBorderByName(ewin, sn->border_name, 0);
    if (sn->groups)
      {
        for (i = 0; i < sn->num_groups; i++)
@@ -1320,7 +1310,6 @@
 MatchEwinToSnapInfoAfter(EWin * ewin)
 {
    Snapshot           *sn;
-   Border             *b;
    int                 i;
 
    sn = FindSnapshot(ewin);
@@ -1394,7 +1383,7 @@
    if (sn->use_shade)
      {
        if (sn->shade)
-          InstantShadeEwin(ewin);
+          InstantShadeEwin(ewin, 0);
        else
           InstantUnShadeEwin(ewin);
      }
@@ -1403,18 +1392,7 @@
        /* FIXME: fill this in */
      }
    if (sn->border_name)
-     {
-       b = (Border *) FindItem(sn->border_name, 0, LIST_FINDBY_NAME,
-                               LIST_TYPE_BORDER);
-       if (b)
-         {
-            ewin->border_new = 1;
-            SetEwinToBorder(ewin, b);
-            ICCCM_MatchSize(ewin);
-            MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w,
-                           ewin->client.h);
-         }
-     }
+      EwinSetBorderByName(ewin, sn->border_name, 1);
    if (sn->groups)
      {
        for (i = 0; i < sn->num_groups; i++)




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