Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h ecompmgr.c eobj.h events.c ewins.c iconify.c 


Log Message:
Avoid some X-errors caused by operations on destroyed windows.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.499
retrieving revision 1.500
diff -u -3 -r1.499 -r1.500
--- E.h 12 Oct 2005 17:20:42 -0000      1.499
+++ E.h 23 Oct 2005 15:02:51 -0000      1.500
@@ -1056,9 +1056,14 @@
 
 /* events.c */
 /* Re-mapped X-events */
-#define EX_EVENT_SHAPE_NOTIFY            64
-#define EX_EVENT_SCREEN_CHANGE_NOTIFY    65
-#define EX_EVENT_DAMAGE_NOTIFY           66
+#define EX_EVENT_CREATE_GONE             64
+#define EX_EVENT_MAP_GONE                65
+#define EX_EVENT_UNMAP_GONE              66
+#define EX_EVENT_REPARENT_GONE           67
+
+#define EX_EVENT_SHAPE_NOTIFY            72
+#define EX_EVENT_SCREEN_CHANGE_NOTIFY    73
+#define EX_EVENT_DAMAGE_NOTIFY           74
 
 #define ENABLE_DEBUG_EVENTS 1
 #if ENABLE_DEBUG_EVENTS
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecompmgr.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -3 -r1.75 -r1.76
--- ecompmgr.c  21 Oct 2005 23:16:26 -0000      1.75
+++ ecompmgr.c  23 Oct 2005 15:02:51 -0000      1.76
@@ -2390,6 +2390,7 @@
        break;
 
      case ReparentNotify:
+     case EX_EVENT_REPARENT_GONE:
        xwin = ev->xreparent.window;
        if (ev->xreparent.parent == VRoot.win)
           goto case_CreateNotify;
@@ -2425,9 +2426,12 @@
        break;
 
      case UnmapNotify:
+     case EX_EVENT_UNMAP_GONE:
        eo = EobjListStackFind(ev->xunmap.window);
        if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
          {
+            if (ev->type == EX_EVENT_UNMAP_GONE)
+               eo->gone = 1;
 #if 0
             /* No. Unredirection seems to cause map/unmap => loop */
             if (Conf_compmgr.override_redirect.mode == ECM_OR_ON_MAPUNMAP)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/eobj.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- eobj.h      16 Oct 2005 09:33:49 -0000      1.15
+++ eobj.h      23 Oct 2005 15:02:51 -0000      1.16
@@ -76,6 +76,7 @@
 #define EoGetY(eo)              ((eo)->o.y)
 #define EoGetW(eo)              ((eo)->o.w)
 #define EoGetH(eo)              ((eo)->o.h)
+#define EoIsGone(eo)            ((eo)->o.gone)
 #define EoIsSticky(eo)          ((eo)->o.sticky)
 #define EoIsFloating(eo)        ((eo)->o.floating)
 #define EoIsShown(eo)           ((eo)->o.shown)
@@ -85,6 +86,7 @@
 #define EoGetPixmap(eo)         EobjGetPixmap(EoObj(eo))
 
 #define EoSetName(eo, _x)       (eo)->o.name = (_x)
+#define EoSetGone(eo)           (eo)->o.gone = 1
 #define EoSetSticky(eo, _x)     (eo)->o.sticky = ((_x)?1:0)
 #define EoSetFloating(eo, _f)   EobjSetFloating(EoObj(eo), (_f))
 #define EoSetDesk(eo, _x)       (eo)->o.desk = (_x)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -3 -r1.103 -r1.104
--- events.c    10 Sep 2005 21:24:26 -0000      1.103
+++ events.c    23 Oct 2005 15:02:51 -0000      1.104
@@ -324,6 +324,38 @@
 #endif
             break;
 
+         case DestroyNotify:
+            for (j = i - 1; j >= 0; j--)
+              {
+                 ev2 = evq + j;
+                 switch (ev2->type)
+                   {
+                   case CreateNotify:
+                      if (ev2->xcreatewindow.window !=
+                          ev->xdestroywindow.window)
+                         continue;
+                      ev2->type = EX_EVENT_CREATE_GONE;
+                      j = -1;  /* Break for() */
+                      break;
+                   case MapNotify:
+                      if (ev2->xmap.window != ev->xmap.window)
+                         continue;
+                      ev2->type = EX_EVENT_MAP_GONE;
+                      break;
+                   case UnmapNotify:
+                      if (ev2->xunmap.window != ev->xunmap.window)
+                         continue;
+                      ev2->type = EX_EVENT_UNMAP_GONE;
+                      break;
+                   case ReparentNotify:
+                      if (ev2->xreparent.window != ev->xreparent.window)
+                         continue;
+                      ev2->type = EX_EVENT_REPARENT_GONE;
+                      break;
+                   }
+              }
+            break;
+
          case Expose:
             n = 0;
             xa = ev->xexpose.x;
@@ -688,6 +720,14 @@
 
    switch (type)
      {
+     case EX_EVENT_CREATE_GONE:
+       return "Create-Gone";
+     case EX_EVENT_MAP_GONE:
+       return "Map-Gone";
+     case EX_EVENT_UNMAP_GONE:
+       return "Unmap-Gone";
+     case EX_EVENT_REPARENT_GONE:
+       return "Reparent-Gone";
      case EX_EVENT_SHAPE_NOTIFY:
        return "ShapeNotify";
      case EX_EVENT_SCREEN_CHANGE_NOTIFY:
@@ -782,10 +822,14 @@
      case UnmapNotify:
      case MapNotify:
      case MapRequest:
+     case EX_EVENT_CREATE_GONE:
+     case EX_EVENT_MAP_GONE:
+     case EX_EVENT_UNMAP_GONE:
        Eprintf("%#08lx EV-%s ev=%#lx win=%#lx\n", ser, name, win,
                ev->xcreatewindow.window);
        break;
      case ReparentNotify:
+     case EX_EVENT_REPARENT_GONE:
        Eprintf("%#08lx EV-%s ev=%#lx win=%#lx parent=%#lx %d+%d\n", ser, name,
                win, ev->xreparent.window, ev->xreparent.parent,
                ev->xreparent.x, ev->xreparent.y);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -3 -r1.115 -r1.116
--- ewins.c     18 Oct 2005 19:21:25 -0000      1.115
+++ ewins.c     23 Oct 2005 15:02:51 -0000      1.116
@@ -1022,7 +1022,10 @@
    EGrabServer();
 
    /* Refetch parent window. We cannot rely on the one in the event. */
-   parent = EWindowGetParent(_EwinGetClientWin(ewin));
+   if (EoIsGone(ewin))
+      parent = None;
+   else
+      parent = EWindowGetParent(_EwinGetClientWin(ewin));
    if (EventDebug(EDBUG_TYPE_EWINS))
       Eprintf("EwinEventReparent %#lx st=%d parent=%#lx: %s\n",
              _EwinGetClientXwin(ewin), ewin->state.state, parent,
@@ -1085,6 +1088,9 @@
        return;
      }
 
+   if (EoIsGone(ewin))
+      return;
+
    if (EWindowGetParent(_EwinGetClientWin(ewin)) == 
_EwinGetContainerXwin(ewin))
       EwinWithdraw(ewin);
 }
@@ -1722,6 +1728,9 @@
      case DestroyNotify:
        EwinEventDestroy(ewin);
        break;
+
+     case EX_EVENT_UNMAP_GONE:
+       EoSetGone(ewin);
      case UnmapNotify:
 #if 0
        if (ewin->state.state == EWIN_STATE_NEW)
@@ -1733,13 +1742,18 @@
 #endif
        EwinEventUnmap(ewin);
        break;
+
      case MapNotify:
        EwinEventMap(ewin);
        break;
+
+     case EX_EVENT_REPARENT_GONE:
+       EoSetGone(ewin);
      case ReparentNotify:
        EwinEventReparent(ewin);
        break;
 
+     case EX_EVENT_MAP_GONE:
      case GravityNotify:
      case ConfigureNotify:
        break;
@@ -1834,23 +1848,32 @@
        break;
 
      case UnmapNotify:
+     case EX_EVENT_UNMAP_GONE:
        /* Catch clients unmapped after MapRequest but before being reparented 
*/
        ewin = EwinFindByClient(ev->xunmap.window);
-       if (ewin)
-          EwinEventUnmap(ewin);
+       if (!ewin)
+          break;
+       if (ev->type == EX_EVENT_UNMAP_GONE)
+          EoSetGone(ewin);
+       EwinEventUnmap(ewin);
        break;
 
      case DestroyNotify:
        /* Catch clients destroyed after MapRequest but before being reparented 
*/
        ewin = EwinFindByClient(ev->xdestroywindow.window);
-       if (ewin)
-          EwinEventDestroy(ewin);
+       if (!ewin)
+          break;
+       EwinEventDestroy(ewin);
        break;
 
      case ReparentNotify:
+     case EX_EVENT_REPARENT_GONE:
        ewin = EwinFindByClient(ev->xreparent.window);
-       if (ewin)
-          EwinEventReparent(ewin);
+       if (!ewin)
+          break;
+       if (ev->type == EX_EVENT_REPARENT_GONE)
+          EoSetGone(ewin);
+       EwinEventReparent(ewin);
        break;
 
      case ClientMessage:
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -3 -r1.183 -r1.184
--- iconify.c   18 Oct 2005 15:45:45 -0000      1.183
+++ iconify.c   23 Oct 2005 15:02:51 -0000      1.184
@@ -2970,7 +2970,9 @@
      case DestroyNotify:
        win = ev->xdestroywindow.window;
        goto do_terminate;
+
      case ReparentNotify:
+     case EX_EVENT_REPARENT_GONE:
        /* Terminate if reparenting away from systray */
        if (ev->xreparent.parent == ev->xreparent.event)
           break;




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to