Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h desktops.c events.c ewins.c x.c 


Log Message:
Attempt to make client handling more solid.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.437
retrieving revision 1.438
diff -u -3 -r1.437 -r1.438
--- E.h 25 May 2005 22:57:38 -0000      1.437
+++ E.h 28 May 2005 11:43:35 -0000      1.438
@@ -2236,6 +2236,8 @@
 Window              ECreateFocusWindow(Window parent, int x, int y, int w,
                                       int h);
 void                EWindowSync(Window win);
+void                EWindowSetMapped(Window win, int mapped);
+Window              EWindowGetParent(Window win);
 void                ESelectInputAdd(Window win, long mask);
 
 void                EMoveWindow(Window win, int x, int y);
@@ -2288,8 +2290,6 @@
 void                EGetColor(const XColor * pxc, int *pr, int *pg, int *pb);
 
 int                 GetWinDepth(Window win);
-Window              GetWinParent(Window win);
-Window              WinGetParent(Window win);
 Window              WindowAtXY_0(Window base, int bx, int by, int x, int y);
 Window              WindowAtXY(int x, int y);
 Bool                PointerAt(int *x, int *y);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -3 -r1.147 -r1.148
--- desktops.c  22 May 2005 13:45:09 -0000      1.147
+++ desktops.c  28 May 2005 11:43:36 -0000      1.148
@@ -1290,7 +1290,8 @@
      {
        Eprintf("StackDesktop %d:\n", desk);
        for (i = 0; i < tot; i++)
-          Eprintf(" win=%#10lx parent=%#10lx\n", wl[i], GetWinParent(wl[i]));
+          Eprintf(" win=%#10lx parent=%#10lx\n", wl[i],
+                  EWindowGetParent(wl[i]));
      }
 
    XRestackWindows(disp, wl, tot);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -3 -r1.89 -r1.90
--- events.c    14 May 2005 19:40:34 -0000      1.89
+++ events.c    28 May 2005 11:43:36 -0000      1.90
@@ -432,6 +432,27 @@
 #endif
             break;
 
+#if 1                          /* FIXME - Do this? */
+         case ReparentNotify:
+            n = 0;
+            for (j = i - 1; j >= 0; j--)
+              {
+                 ev2 = evq + j;
+                 if (ev2->type == ev->type &&
+                     ev2->xreparent.window == ev->xreparent.window)
+                   {
+                      n++;
+                      ev2->type = 0;
+                   }
+              }
+#if ENABLE_DEBUG_EVENTS
+            if (n && EventDebug(EDBUG_TYPE_COMPRESSION))
+               Eprintf("EventsCompress n=%4d %s %#lx\n",
+                       n, EventName(ev->type), ev->xreparent.window);
+#endif
+            break;
+#endif
+
          case EX_EVENT_SHAPE_NOTIFY:
             n = 0;
             for (j = i - 1; j >= 0; j--)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -3 -r1.66 -r1.67
--- ewins.c     25 May 2005 21:42:58 -0000      1.66
+++ ewins.c     28 May 2005 11:43:57 -0000      1.67
@@ -151,8 +151,8 @@
    AddItem(ewin, "EWIN", win, LIST_TYPE_EWIN);
 
    if (EventDebug(EDBUG_TYPE_EWINS))
-      Eprintf("EwinCreate %#lx frame=%#lx state=%d\n", ewin->client.win,
-             EoGetWin(ewin), ewin->state);
+      Eprintf("EwinCreate %#lx frame=%#lx cont=%#lx st=%d\n", ewin->client.win,
+             EoGetWin(ewin), ewin->win_container, ewin->state);
 
    EventCallbackRegister(EoGetWin(ewin), 0, EwinHandleEventsToplevel, ewin);
    EventCallbackRegister(ewin->win_container, 0, EwinHandleEventsContainer,
@@ -192,8 +192,8 @@
       return;
 
    if (EventDebug(EDBUG_TYPE_EWINS))
-      Eprintf("EwinDestroy %#lx %s state=%d\n", ewin->client.win,
-             EwinGetName(ewin), ewin->state);
+      Eprintf("EwinDestroy %#lx st=%d: %s\n", ewin->client.win, ewin->state,
+             EwinGetName(ewin));
 
    RemoveItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    EventCallbackUnregister(EoGetWin(ewin), 0, EwinHandleEventsToplevel, ewin);
@@ -558,8 +558,8 @@
    HintsSetClientList();
 
    if (EventDebug(EDBUG_TYPE_EWINS))
-      Eprintf("Adopt %#lx %s state=%d\n", ewin->client.win,
-             EwinGetName(ewin), ewin->state);
+      Eprintf("Adopt %#lx st=%d: %s\n", ewin->client.win, ewin->state,
+             EwinGetName(ewin));
 }
 
 void
@@ -907,8 +907,8 @@
    /* Only external clients should go here */
 
    if (EventDebug(EDBUG_TYPE_EWINS))
-      Eprintf("EwinWithdraw %#lx %s state=%d\n", ewin->client.win,
-             EwinGetName(ewin), ewin->state);
+      Eprintf("EwinWithdraw %#lx st=%d: %s\n", ewin->client.win, ewin->state,
+             EwinGetName(ewin));
 
    EGrabServer();
 
@@ -936,8 +936,11 @@
        if (ewin->state == EWIN_STATE_WITHDRAWN)
           AddToFamily(ewin, win);
        else
-          Eprintf("AddToFamily: Already managing %s %#lx\n", "A",
-                  ewin->client.win);
+         {
+            Eprintf("AddToFamily: Already managing %s %#lx\n", "A",
+                    ewin->client.win);
+            EReparentWindow(ewin->client.win, ewin->win_container, 0, 0);
+         }
      }
    else
      {
@@ -949,6 +952,7 @@
          {
             Eprintf("AddToFamily: Already managing %s %#lx\n", "B",
                     ewin->client.win);
+            EReparentWindow(ewin->client.win, ewin->win_container, 0, 0);
             ShowEwin(ewin);
          }
        else
@@ -960,13 +964,31 @@
 EwinEventDestroy(EWin * ewin)
 {
    if (EventDebug(EDBUG_TYPE_EWINS))
-      Eprintf("EwinEventDestroy %#lx %s state=%d\n", ewin->client.win,
-             EwinGetName(ewin), ewin->state);
+      Eprintf("EwinEventDestroy %#lx st=%d: %s\n", ewin->client.win,
+             ewin->state, EwinGetName(ewin));
 
    EwinDestroy(ewin);
 }
 
 static void
+EwinEventReparent(EWin * ewin)
+{
+   Window              parent;
+
+   EGrabServer();
+
+   /* Refetch parent window. We cannot rely on the one in the event. */
+   parent = EWindowGetParent(ewin->client.win);
+   if (EventDebug(EDBUG_TYPE_EWINS))
+      Eprintf("EwinEventReparent %#lx st=%d parent=%#lx: %s\n",
+             ewin->client.win, ewin->state, parent, EwinGetName(ewin));
+   if (parent != ewin->win_container)
+      EwinDestroy(ewin);
+
+   EUngrabServer();
+}
+
+static void
 EwinEventMap(EWin * ewin)
 {
    int                 old_state = ewin->state;
@@ -974,8 +996,8 @@
    ewin->state = EWIN_STATE_MAPPED;
 
    if (EventDebug(EDBUG_TYPE_EWINS))
-      Eprintf("EwinEventMap %#lx %s state=%d\n", ewin->client.win,
-             EwinGetName(ewin), ewin->state);
+      Eprintf("EwinEventMap %#lx st=%d: %s\n", ewin->client.win, ewin->state,
+             EwinGetName(ewin));
 
    /* If first time we may want to focus it (unless during startup) */
    if (old_state == EWIN_STATE_NEW)
@@ -990,25 +1012,23 @@
 EwinEventUnmap(EWin * ewin)
 {
    if (EventDebug(EDBUG_TYPE_EWINS))
-      Eprintf("EwinEventUnmap %#lx %s state=%d\n", ewin->client.win,
-             EwinGetName(ewin), ewin->state);
+      Eprintf("EwinEventUnmap %#lx st=%d: %s\n", ewin->client.win, ewin->state,
+             EwinGetName(ewin));
 
    if (ewin->state == EWIN_STATE_WITHDRAWN)
       return;
 
-   if (ewin->iconified)
-      ewin->state = EWIN_STATE_ICONIC;
-   else
+   if (ewin->state == EWIN_STATE_ICONIC || !ewin->iconified)
       ewin->state = EWIN_STATE_WITHDRAWN;
+   else
+      ewin->state = EWIN_STATE_ICONIC;
 
    EwinUnmap1(ewin);
-
-   EUnmapWindow(ewin->client.win);
+   EWindowSetMapped(ewin->client.win, 0);
    EoUnmap(ewin);
-
    EwinUnmap2(ewin);
 
-   if (ewin->iconified)
+   if (ewin->state == EWIN_STATE_ICONIC)
       return;
 
    if (EwinIsInternal(ewin))
@@ -1020,7 +1040,7 @@
        return;
      }
 
-   if (WinGetParent(ewin->client.win) == ewin->win_container)
+   if (EWindowGetParent(ewin->client.win) == ewin->win_container)
       EwinWithdraw(ewin);
 }
 
@@ -1612,7 +1632,7 @@
 
        /* This makes E determine the client window stacking at exit */
        EwinInstantUnShade(ewin);
-       EReparentWindow(ewin->client.win, VRoot.win,
+       EReparentWindow(ewin->client.win, RRoot.win,
                        ewin->client.x, ewin->client.y);
      }
 }
@@ -1717,11 +1737,7 @@
        EwinEventMap(ewin);
        break;
      case ReparentNotify:
-       /* Check if window parent hasn't changed already (compress?) */
-       if (WinGetParent(ev->xreparent.window) != ev->xreparent.parent)
-          break;
-       if (ev->xreparent.parent != ewin->win_container)
-          EwinEventDestroy(ewin);
+       EwinEventReparent(ewin);
        break;
 
      case GravityNotify:
@@ -1818,12 +1834,21 @@
        /* Catch clients destroyed after MapRequest but before being reparented 
*/
        ewin = FindItem(NULL, ev->xdestroywindow.window, LIST_FINDBY_ID,
                        LIST_TYPE_EWIN);
+#if 0                          /* FIXME - Should not be here - Remove? */
        if (!ewin)
           ewin = FindEwinByBase(ev->xdestroywindow.window);
+#endif
        if (ewin)
           EwinEventDestroy(ewin);
        break;
 
+     case ReparentNotify:
+       ewin = FindItem(NULL, ev->xreparent.window, LIST_FINDBY_ID,
+                       LIST_TYPE_EWIN);
+       if (ewin)
+          EwinEventReparent(ewin);
+       break;
+
      default:
 #if 0
        Eprintf("EwinHandleEventsRoot: type=%2d win=%#lx\n",
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -3 -r1.92 -r1.93
--- x.c 21 May 2005 21:49:36 -0000      1.92
+++ x.c 28 May 2005 11:43:57 -0000      1.93
@@ -475,6 +475,39 @@
 }
 
 void
+EWindowSetMapped(Window win, int mapped)
+{
+   EXID               *xid;
+
+   xid = EXidFind(win);
+   if (!xid)
+      return;
+
+   xid->mapped = mapped;
+}
+
+Window
+EWindowGetParent(Window win)
+{
+   EXID               *xid;
+   Window              parent, rt;
+   Window             *pch = NULL;
+   unsigned int        nch = 0;
+
+   parent = None;
+   if (!XQueryTree(disp, win, &rt, &parent, &pch, &nch))
+      parent = None;
+   else if (pch)
+      XFree(pch);
+
+   xid = EXidFind(win);
+   if (xid)
+      xid->parent = parent;
+
+   return parent;
+}
+
+void
 ERegisterWindow(Window win)
 {
    EXID               *xid;
@@ -1208,18 +1241,6 @@
    XSync(disp, False);
 }
 
-Window
-GetWinParent(Window win)
-{
-   EXID               *xid;
-
-   xid = EXidFind(win);
-   if (xid)
-      return xid->parent;
-
-   return 0;
-}
-
 int
 GetWinDepth(Window win)
 {
@@ -1231,22 +1252,6 @@
 }
 
 Window
-WinGetParent(Window win)
-{
-   Window              parent, rt;
-   Window             *pch = NULL;
-   unsigned int        nch = 0;
-
-   if (!XQueryTree(disp, win, &rt, &parent, &pch, &nch))
-      return None;
-
-   if (pch)
-      XFree(pch);
-
-   return parent;
-}
-
-Window
 WindowAtXY_0(Window base, int bx, int by, int x, int y)
 {
    Window             *list = NULL;




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to