Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h ewins.c ewins.h main.c session.c setup.c x.c 


Log Message:
Simplify initial window management at startup.

===================================================================
RCS file: /cvs/e/e16/e/src/E.h,v
retrieving revision 1.587
retrieving revision 1.588
diff -u -3 -r1.587 -r1.588
--- E.h 17 Jun 2007 08:33:22 -0000      1.587
+++ E.h 11 Jul 2007 09:05:42 -0000      1.588
@@ -634,7 +634,6 @@
 int                 matchregexp(const char *rx, const char *s);
 
 /* setup.c */
-void                MapUnmap(int start);
 void                SetupX(const char *dstr);
 
 /* slideouts.c */
===================================================================
RCS file: /cvs/e/e16/e/src/ewins.c,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -3 -r1.202 -r1.203
--- ewins.c     11 Jul 2007 08:54:19 -0000      1.202
+++ ewins.c     11 Jul 2007 09:05:43 -0000      1.203
@@ -1150,10 +1150,15 @@
       Eprintf("EwinEventUnmap %#lx st=%d: %s\n", EwinGetClientXwin(ewin),
              ewin->state.state, EwinGetTitle(ewin));
 
-   if (ewin->state.state == EWIN_STATE_NEW)
+   if (ewin->state.state == EWIN_STATE_STARTUP ||
+       ewin->state.state == EWIN_STATE_NEW)
      {
+#if 0
+       /* We get here after reparenting to container and occasionally in
+        * other(?) situations */
        Eprintf("EwinEventUnmap %#lx: Ignoring bogus Unmap event\n",
                EwinGetClientXwin(ewin));
+#endif
        return;
      }
 
@@ -2075,6 +2080,54 @@
 }
 
 void
+EwinsManage(void)
+{
+   Window             *xwins, xwin, par, rt;
+   XWindowAttributes   attr;
+   unsigned int        i, num;
+
+#ifdef USE_EXT_INIT_WIN
+   Window              init_win = ExtInitWinGet();
+#endif
+
+   xwins = NULL;
+   num = 0;
+   XQueryTree(disp, VRoot.xwin, &rt, &par, &xwins, &num);
+   if (!xwins)
+      return;
+
+   for (i = 0; i < num; i++)
+     {
+       xwin = xwins[i];
+
+       /* Skip if already "known" */
+       if (EobjListStackFind(xwin))
+          continue;
+
+       if (!XGetWindowAttributes(disp, xwin, &attr))
+          continue;
+
+       if (attr.map_state == IsUnmapped)
+          continue;
+
+       if (attr.override_redirect)
+         {
+            XUnmapWindow(disp, xwin);  /* Makes the CM catch it on map */
+            XMapRaised(disp, xwin);
+#ifdef USE_EXT_INIT_WIN
+            if (init_win)
+               XRaiseWindow(disp, init_win);
+#endif
+         }
+       else
+         {
+            AddToFamily(NULL, xwin);
+         }
+     }
+   XFree(xwins);
+}
+
+void
 EwinsSetFree(void)
 {
    int                 i, num;
@@ -2388,13 +2441,8 @@
        EwinsInit();
        break;
 #if 0
-     case ESIGNAL_CONFIGURE:
-       if (!Conf.mapslide || Mode.wm.restart)
-          MapUnmap(1);
-       break;
      case ESIGNAL_START:
-       if (Conf.mapslide && !Mode.wm.restart)
-          MapUnmap(1);
+       EwinsManage();
        break;
 #endif
      case ESIGNAL_DESK_RESIZE:
===================================================================
RCS file: /cvs/e/e16/e/src/ewins.h,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -3 -r1.76 -r1.77
--- ewins.h     16 Jun 2007 08:41:53 -0000      1.76
+++ ewins.h     11 Jul 2007 09:05:43 -0000      1.77
@@ -394,6 +394,7 @@
 EWin              **EwinListTransientFor(const EWin * ewin, int *num);
 
 void                EwinsEventsConfigure(int mode);
+void                EwinsManage(void);
 void                EwinsSetFree(void);
 void                EwinsShowDesktop(int on);
 void                EwinsMoveStickyToDesk(Desk * d);
===================================================================
RCS file: /cvs/e/e16/e/src/main.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -3 -r1.159 -r1.160
--- main.c      18 May 2007 08:25:02 -0000      1.159
+++ main.c      11 Jul 2007 09:05:43 -0000      1.160
@@ -29,6 +29,7 @@
 #include "eimage.h"
 #include "emodule.h"
 #include "events.h"
+#include "ewins.h"
 #include "file.h"
 #include "grabs.h"
 #include "hints.h"
@@ -245,9 +246,6 @@
    Esetenv("ECACHEDIR", EDirUserCache());
    Esetenv("ETHEME", Mode.theme.path);
 
-   /* Unmap the clients */
-   MapUnmap(0);
-
    /* Move elsewhere? */
    EImageInit(disp);
    HintsInit();
@@ -285,9 +283,7 @@
 
    ModulesSignal(ESIGNAL_START, NULL);
    DialogsInit();
-
-   /* Map the clients */
-   MapUnmap(1);
+   EwinsManage();
 
    RunInitPrograms();
    SpawnSnappedCmds();
===================================================================
RCS file: /cvs/e/e16/e/src/session.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -3 -r1.143 -r1.144
--- session.c   20 May 2007 12:46:24 -0000      1.143
+++ session.c   11 Jul 2007 09:05:43 -0000      1.144
@@ -517,8 +517,6 @@
      {
        /* We may get here from HandleXIOError */
        EwinsSetFree();
-       if (Mode.wm.startup && Mode.wm.exiting)
-          MapUnmap(1);
        XSelectInput(disp, VRoot.xwin, 0);
        ExtInitWinKill();
        ESync();
===================================================================
RCS file: /cvs/e/e16/e/src/setup.c,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -3 -r1.184 -r1.185
--- setup.c     11 Jul 2007 08:54:19 -0000      1.184
+++ setup.c     11 Jul 2007 09:05:43 -0000      1.185
@@ -29,85 +29,6 @@
 #include <signal.h>
 #include <X11/keysym.h>
 
-void
-MapUnmap(int start)
-{
-   /* this function will map and unmap all the windows based on the progress
-    * through the startup sequence
-    */
-
-   static Window      *wlist = NULL;
-   static unsigned int num = 0;
-   Window              par, rt;
-   XWindowAttributes   attr;
-   unsigned int        i;
-
-#ifdef USE_EXT_INIT_WIN
-   Window              init_win = ExtInitWinGet();
-#endif
-
-   switch (start)
-     {
-     case 0:
-       EGrabServer();
-       XQueryTree(disp, VRoot.xwin, &rt, &par, &wlist, &num);
-       for (i = 0; i < num; i++)
-         {
-#ifdef USE_EXT_INIT_WIN
-            if (init_win == wlist[i])
-              {
-                 wlist[i] = None;
-                 continue;
-              }
-#endif
-            XGetWindowAttributes(disp, wlist[i], &attr);
-            if (attr.map_state == IsUnmapped)
-               wlist[i] = None;
-            else
-               XUnmapWindow(disp, wlist[i]);
-         }
-       /* Flush (get rid of unmap events) */
-       XSync(disp, True);
-       EUngrabServer();
-       break;
-
-     case 1:
-       if (!wlist)
-          break;
-
-       for (i = 0; i < num; i++)
-         {
-            if (!wlist[i])
-               continue;
-
-            if (!XGetWindowAttributes(disp, wlist[i], &attr))
-               continue;
-
-            if (attr.override_redirect)
-              {
-#ifdef USE_EXT_INIT_WIN
-                 if (init_win)
-                    XRaiseWindow(disp, init_win);
-#endif
-                 XMapWindow(disp, wlist[i]);
-              }
-            else
-              {
-                 if (Mode.wm.exiting)
-                    XMapWindow(disp, wlist[i]);
-                 else
-                    AddToFamily(NULL, wlist[i]);
-              }
-         }
-       XFree(wlist);
-       wlist = NULL;
-       break;
-
-     default:
-       break;
-     }
-}
-
 /*
  * This function sets up all of our connections to X
  */
===================================================================
RCS file: /cvs/e/e16/e/src/x.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -3 -r1.160 -r1.161
--- x.c 11 Jul 2007 08:54:19 -0000      1.160
+++ x.c 11 Jul 2007 09:05:43 -0000      1.161
@@ -762,6 +762,7 @@
 #endif
    win = EXidSet(xwin, None, pxwa->x, pxwa->y, pxwa->width, pxwa->height,
                 pxwa->depth, pxwa->visual, pxwa->colormap);
+   win->mapped = pxwa->map_state != IsUnmapped;
    win->attached = 1;
 
  done:



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to