Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h borders.c dialog.c events.c ewins.c hints.c menus.c 
        setup.c x.c 


Log Message:
Attempt to improve badly behaving client handling.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.347
retrieving revision 1.348
diff -u -3 -r1.347 -r1.348
--- E.h 22 Jan 2005 11:32:57 -0000      1.347
+++ E.h 23 Jan 2005 18:23:04 -0000      1.348
@@ -1270,9 +1270,8 @@
                                     int txa, int typ, int tya, int borigin,
                                     int bxp, int bxa, int byp, int bya,
                                     char keep_for_shade);
-void                BorderIncRefcount(const Border * b);
-void                BorderDecRefcount(const Border * b);
 void                EwinBorderSelect(EWin * ewin);
+void                EwinBorderDetach(EWin * ewin);
 void                EwinBorderSetTo(EWin * ewin, const Border * b);
 void                EwinBorderDraw(EWin * ewin, int do_shape, int queue_off);
 void                EwinBorderCalcSizes(EWin * ewin);
@@ -1593,7 +1592,6 @@
 #define EWIN_CHANGE_DESKTOP     (1<<3)
 #define EWIN_CHANGE_LAYER       (1<<4)
 
-void                EwinGetPosition(const EWin * ewin, int *px, int *py);
 void                EwinRefresh(EWin * ewin);
 void                EwinUpdateAfterMoveResize(EWin * ewin, int resize);
 void                FloatEwin(EWin * ewin);
@@ -1610,11 +1608,10 @@
 void                SetContextEwin(EWin * ewin);
 void                EwinDetermineArea(EWin * ewin);
 void                EwinPropagateShapes(EWin * ewin);
-void                AddToFamily(Window win);
+void                AddToFamily(EWin * ewin, Window win);
 EWin               *AddInternalToFamily(Window win, const char *bname, int 
type,
                                        void *ptr,
                                        void (*init) (EWin * ewin, void *ptr));
-void                EwinWithdraw(EWin * ewin);
 void                EwinConformToDesktop(EWin * ewin);
 void                EwinReparent(EWin * ewin, Window parent);
 void                SyncBorderToEwin(EWin * ewin);
@@ -2275,6 +2272,7 @@
 int                 GetWinDepth(Window win);
 Window              GetWinParent(Window win);
 int                 WinExists(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/borders.c,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -3 -r1.242 -r1.243
--- borders.c   9 Jan 2005 22:35:59 -0000       1.242
+++ borders.c   23 Jan 2005 18:23:04 -0000      1.243
@@ -484,6 +484,18 @@
    EDBUG_RETURN_;
 }
 
+static void
+BorderIncRefcount(const Border * b)
+{
+   ((Border *) b)->ref_count++;
+}
+
+static void
+BorderDecRefcount(const Border * b)
+{
+   ((Border *) b)->ref_count--;
+}
+
 void
 EwinBorderSelect(EWin * ewin)
 {
@@ -516,10 +528,34 @@
 }
 
 void
+EwinBorderDetach(EWin * ewin)
+{
+   const Border       *b = ewin->border;
+   int                 i;
+
+   if (!b)
+      return;
+
+   EventCallbackUnregister(EoGetWin(ewin), 0, BorderFrameHandleEvents, ewin);
+   for (i = 0; i < b->num_winparts; i++)
+     {
+       EventCallbackUnregister(ewin->bits[i].win, 0,
+                               BorderWinpartHandleEvents, &ewin->bits[i]);
+       if (ewin->bits[i].win)
+          EDestroyWindow(disp, ewin->bits[i].win);
+     }
+   if (ewin->bits)
+      Efree(ewin->bits);
+   ewin->bits = NULL;
+   BorderDecRefcount(b);
+
+   ewin->border = NULL;
+}
+
+void
 EwinBorderSetTo(EWin * ewin, const Border * b)
 {
    int                 i;
-   int                 px = 0, py = 0;
    char                s[1024];
 
    AwaitIclass        *await;
@@ -536,23 +572,7 @@
      }
 
    if (ewin->border)
-     {
-       EventCallbackUnregister(EoGetWin(ewin), 0, BorderFrameHandleEvents,
-                               ewin);
-       px = ewin->border->border.left;
-       py = ewin->border->border.top;
-       for (i = 0; i < ewin->border->num_winparts; i++)
-         {
-            EventCallbackUnregister(ewin->bits[i].win, 0,
-                                    BorderWinpartHandleEvents, &ewin->bits[i]);
-            if (ewin->bits[i].win)
-               EDestroyWindow(disp, ewin->bits[i].win);
-         }
-       if (ewin->bits)
-          Efree(ewin->bits);
-       ewin->bits = NULL;
-       BorderDecRefcount(ewin->border);
-     }
+      EwinBorderDetach(ewin);
 
    ewin->border = b;
    BorderIncRefcount(b);
@@ -814,18 +834,6 @@
 }
 
 void
-BorderIncRefcount(const Border * b)
-{
-   ((Border *) b)->ref_count++;
-}
-
-void
-BorderDecRefcount(const Border * b)
-{
-   ((Border *) b)->ref_count--;
-}
-
-void
 EwinBorderMinShadeSize(EWin * ewin, int *mw, int *mh)
 {
    int                 i, pw, ph, w, h, min_w, min_h;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/dialog.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -3 -r1.95 -r1.96
--- dialog.c    13 Jan 2005 20:12:22 -0000      1.95
+++ dialog.c    23 Jan 2005 18:23:04 -0000      1.96
@@ -594,10 +594,10 @@
    if (!d)
       return;
 
-   EUnmapWindow(disp, d->win);
-
    if (d->exit_func)
       d->exit_func(d, d->exit_val, NULL);
+
+   EUnmapWindow(disp, d->win);
 }
 
 DItem              *
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- events.c    9 Jan 2005 22:36:00 -0000       1.72
+++ events.c    23 Jan 2005 18:23:04 -0000      1.73
@@ -351,14 +351,6 @@
        EUnregisterWindow(ev->xdestroywindow.window);
        break;
 #endif
-
-     case MapRequest:          /* 20 */
-       /* This is to catch badly behaving client window re-mappings */
-       /* Firefox-1.0 unmap/maps during fullscreen toggle without waiting for 
reparent or state */
-       if (!FindItem
-           (NULL, ev->xmaprequest.window, LIST_FINDBY_ID, LIST_TYPE_EWIN))
-          AddToFamily(ev->xmaprequest.window);
-       break;
      }
 
    EDBUG_RETURN_;
@@ -904,8 +896,9 @@
                ev->xcreatewindow.window);
        break;
      case ReparentNotify:
-       Eprintf("%#08lx EV-%s ev=%#lx win=%#lx parent=%#lx\n", ser, name, win,
-               ev->xreparent.window, ev->xreparent.parent);
+       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);
        break;
      case ConfigureNotify:
        Eprintf
@@ -916,8 +909,8 @@
        break;
      case ConfigureRequest:
        Eprintf
-          ("%#08lx EV-%s: win=%#lx parent=%#lx m=%#lx %d+%d %dx%d bw=%d 
above=%#lx stk=%d\n",
-           ser, name, ev->xconfigurerequest.window, win,
+          ("%#08lx EV-%s: ev=%#lx win=%#lx m=%#lx %d+%d %dx%d bw=%d above=%#lx 
stk=%d\n",
+           ser, name, win, ev->xconfigurerequest.window,
            ev->xconfigurerequest.value_mask, ev->xconfigurerequest.x,
            ev->xconfigurerequest.y, ev->xconfigurerequest.width,
            ev->xconfigurerequest.height, ev->xconfigurerequest.border_width,
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewins.c     22 Jan 2005 11:32:57 -0000      1.10
+++ ewins.c     23 Jan 2005 18:23:04 -0000      1.11
@@ -62,8 +62,6 @@
    EWin               *ewin;
    XSetWindowAttributes att;
 
-   EDBUG(5, "EwinCreate");
-
    ewin = Ecalloc(1, sizeof(EWin));
 
    ewin->type = type;
@@ -148,7 +146,13 @@
 
    ModulesSignal(ESIGNAL_EWIN_CREATE, ewin);
 
-   EDBUG_RETURN(ewin);
+   return ewin;
+}
+
+static void
+EwinCleanup(EWin * ewin)
+{
+   EwinBorderDetach(ewin);
 }
 
 static void
@@ -157,9 +161,8 @@
    EWin              **lst;
    int                 i, num;
 
-   EDBUG(5, "FreeEwin");
    if (!ewin)
-      EDBUG_RETURN_;
+      return;
 
    if (EventDebug(EDBUG_TYPE_EWINS))
       Eprintf("EwinDestroy %#lx %s state=%d\n", ewin->client.win,
@@ -169,6 +172,9 @@
    ECompMgrWinDel(&ewin->o, True, False);
 
    RemoveItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
+   EventCallbackUnregister(EoGetWin(ewin), 0, EwinHandleEventsToplevel, ewin);
+   EventCallbackUnregister(ewin->win_container, 0, EwinHandleEventsContainer,
+                          ewin);
    EventCallbackUnregister(ewin->client.win, 0, EwinHandleEventsClient, ewin);
    if (!EwinIsInternal(ewin))
       EUnregisterWindow(ewin->client.win);
@@ -176,8 +182,6 @@
    EobjListStackDel(&ewin->o);
    EobjListFocusDel(&ewin->o);
 
-   XSelectInput(disp, ewin->client.win, 0);
-
    HintsSetClientList();
 
    UnmatchEwinToSnapInfo(ewin);
@@ -194,8 +198,8 @@
    if (lst)
       Efree(lst);
 
-   if (ewin->border)
-      BorderDecRefcount(ewin->border);
+   EwinCleanup(ewin);
+
    if (ewin->icccm.wm_name)
       Efree(ewin->icccm.wm_name);
    if (ewin->icccm.wm_res_class)
@@ -230,8 +234,6 @@
      }
    GroupsEwinRemove(ewin);
    Efree(ewin);
-
-   EDBUG_RETURN_;
 }
 
 void
@@ -240,8 +242,6 @@
    char                dofloat = 0;
    int                 desk, x, y, w, h, xd, yd;
 
-   EDBUG(5, "DetermineEwinFloat");
-
    desk = EoGetDesk(ewin);
    x = EoGetX(ewin);
    y = EoGetY(ewin);
@@ -283,7 +283,6 @@
        if (dofloat)
           FloatEwinAt(ewin, x + xd, y + yd);
      }
-   EDBUG_RETURN_;
 }
 
 EWin               *
@@ -293,12 +292,10 @@
    int                 dum, x, y;
    unsigned int        mr;
 
-   EDBUG(5, "GetEwinByCurrentPointer");
-
    XQueryPointer(disp, DeskGetWin(DesksGetCurrent()), &rt, &ch, &x, &y, &dum,
                 &dum, &mr);
 
-   EDBUG_RETURN(FindEwinByBase(ch));
+   return FindEwinByBase(ch);
 }
 
 EWin               *
@@ -309,8 +306,6 @@
    EWin               *const *lst, *ewin;
    int                 i, num;
 
-   EDBUG(5, "GetEwinPointerInClient");
-
    desk = DesktopAt(Mode.x, Mode.y);
    XQueryPointer(disp, DeskGetWin(desk), &rt, &ch, &dum, &dum, &px, &py,
                 (unsigned int *)&dum);
@@ -329,17 +324,16 @@
        h = EoGetH(ewin);
        if ((px >= x) && (py >= y) && (px < (x + w)) && (py < (y + h)) &&
            EwinIsMapped(ewin))
-          EDBUG_RETURN(ewin);
+          return ewin;
      }
 
-   EDBUG_RETURN(NULL);
+   return NULL;
 }
 
 EWin               *
 GetFocusEwin(void)
 {
-   EDBUG(4, "GetFocusEwin");
-   EDBUG_RETURN(Mode.focuswin);
+   return Mode.focuswin;
 }
 
 EWin               *
@@ -350,7 +344,7 @@
 #if 0
    ewin = Mode.mouse_over_ewin;
    if (ewin && ewin->type != EWIN_TYPE_MENU)
-      EDBUG_RETURN(ewin);
+      return ewin;
 #endif
 
    ewin = Mode.context_ewin;
@@ -388,8 +382,6 @@
 {
    int                 ax, ay;
 
-   EDBUG(4, "EwinDetermineArea");
-
    DeskGetArea(EoGetDesk(ewin), &ax, &ay);
    ax = (EoGetX(ewin) + (EoGetW(ewin) / 2) + (ax * VRoot.w)) / VRoot.w;
    ay = (EoGetY(ewin) + (EoGetH(ewin) / 2) + (ay * VRoot.h)) / VRoot.h;
@@ -402,14 +394,12 @@
        ewin->area_y = ay;
        HintsSetWindowArea(ewin);
      }
-
-   EDBUG_RETURN_;
 }
 
 /*
  * Derive frame window position from client window and border properties
  */
-void
+static void
 EwinGetPosition(const EWin * ewin, int *px, int *py)
 {
    int                 x, y, bw, frame_lr, frame_tb;
@@ -506,18 +496,16 @@
 {
    /* We must reparent after getting original window position */
    EReparentWindow(disp, ewin->client.win, ewin->win_container, 0, 0);
-   XMoveWindow(disp, ewin->client.win, 0, 0);
    ICCCM_Adopt(ewin);
 }
 
 static EWin        *
-Adopt(Window win)
+Adopt(EWin * ewin, Window win)
 {
-   EWin               *ewin;
-
-   EDBUG(4, "Adopt");
-
-   ewin = EwinCreate(win, EWIN_TYPE_NORMAL);
+   if (ewin)
+      EwinCleanup(ewin);
+   else
+      ewin = EwinCreate(win, EWIN_TYPE_NORMAL);
 
    ICCCM_AdoptStart(ewin);
    ICCCM_GetTitle(ewin, 0);
@@ -554,7 +542,7 @@
       Eprintf("Adopt %#lx %s state=%d\n", ewin->client.win,
              EwinGetName(ewin), ewin->state);
 
-   EDBUG_RETURN(ewin);
+   return ewin;
 }
 
 static EWin        *
@@ -562,8 +550,6 @@
 {
    EWin               *ewin;
 
-   EDBUG(4, "AdoptInternal");
-
    ewin = EwinCreate(win, type);
 
    ewin->border = border;
@@ -631,55 +617,28 @@
    HintsSetWindowState(ewin);
    HintsSetClientList();
 
-   EDBUG_RETURN(ewin);
+   return ewin;
 }
 
 void
-AddToFamily(Window win)
+AddToFamily(EWin * ewin, Window win)
 {
-   EWin               *ewin, *ewin2;
+   EWin               *ewin2;
    EWin              **lst;
-   int                 i, k, num, speed, fx, fy, x, y, desk;
+   int                 i, k, num, fx, fy, x, y, desk;
    char                doslide, manplace;
 
-   EDBUG(3, "AddToFamily");
-
-   /* find the client window if it's already managed */
-   ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
+   ecore_x_grab();
 
-   if (ewin)
+   if (!WinExists(win))
      {
-       /* Some clients MapRequest more than once ?!? */
-       Eprintf("AddToFamily: Already managing %#lx\n", ewin->client.win);
-#if 0
-       /* if its iconified - de-iconify */
-       if (ewin->iconified)
-         {
-#if 0                          /* FIXME - When do we need this? */
-            RemoveMiniIcon(ewin);
-#endif
-            EoSetDesk(ewin, DesksGetCurrent());
-            DeskGetCurrentArea(&x, &y);
-            MoveEwinToArea(ewin, x, y);
-            RaiseEwin(ewin);
-            EwinConformToDesktop(ewin);
-            ShowEwin(ewin);
-            ICCCM_DeIconify(ewin);
-            ewin->iconified = 0;
-         }
-#endif
-       EDBUG_RETURN_;
+       Eprintf("Window is gone %#lx\n", win);
+       ecore_x_ungrab();
+       return;
      }
 
-   /* grab that server */
-   ecore_x_grab();
-
-   speed = Conf.slidespeedmap;
-   doslide = Conf.mapslide && !Mode.wm.startup;
-   manplace = 0;
-
    /* adopt the new baby */
-   ewin = Adopt(win);
+   ewin = Adopt(ewin, win);
 
    /* if it hasn't been planted on a desktop - assign it the current desktop */
    desk = EoGetDesk(ewin);
@@ -691,6 +650,7 @@
        ewin->props.donthide = 1;
      }
 
+   doslide = Conf.mapslide && !Mode.wm.startup;
    /* if set for borderless then dont slide it in */
    if ((!ewin->client.mwm_decor_title) && (!ewin->client.mwm_decor_border))
       doslide = 0;
@@ -781,11 +741,12 @@
        ewin->client.already_placed = 1;
        ShowEwin(ewin);
        ecore_x_ungrab();
-       EDBUG_RETURN_;
+       return;
      }
 
    ResizeEwin(ewin, ewin->client.w, ewin->client.h);
 
+   manplace = 0;
    if ((!ewin->client.transient) && (Conf.place.manual)
        && (!ewin->client.already_placed) && (!Mode.wm.startup) && 
(!Mode.place))
      {
@@ -857,7 +818,7 @@
        ewin->state = EWIN_STATE_MAPPED;
        EwinIconify(ewin);
        ewin->state = EWIN_STATE_ICONIC;
-       EDBUG_RETURN_;
+       return;
      }
 
    /* if we should slide it in and are not currently in the middle of a slide 
*/
@@ -891,7 +852,7 @@
        ecore_x_ungrab();
        EoSetFloating(ewin, 1); /* Causes reparenting to root */
        ActionMoveStart(ewin, 1, 0, 0);
-       EDBUG_RETURN_;
+       return;
      }
    else if ((doslide) && (!Mode.doingslide))
      {
@@ -922,7 +883,7 @@
        RaiseEwin(ewin);
        MoveEwin(ewin, fx, fy);
        ShowEwin(ewin);
-       SlideEwinTo(ewin, fx, fy, x, y, speed);
+       SlideEwinTo(ewin, fx, fy, x, y, Conf.slidespeedmap);
        MoveEwinToDesktopAt(ewin, desk, x, y);
      }
    else
@@ -936,8 +897,6 @@
    EwinDetermineArea(ewin);
 
    ecore_x_ungrab();
-
-   EDBUG_RETURN_;
 }
 
 EWin               *
@@ -947,8 +906,6 @@
    EWin               *ewin;
    Border             *b;
 
-   EDBUG(3, "AddInternalToFamily");
-
    b = NULL;
    if (bname)
      {
@@ -975,29 +932,36 @@
 
    ecore_x_ungrab();
 
-   EDBUG_RETURN(ewin);
+   return ewin;
 }
 
-void
+static void
 EwinWithdraw(EWin * ewin)
 {
    Window              win;
+   int                 x, y;
 
    if (EventDebug(EDBUG_TYPE_EWINS))
       Eprintf("EwinWithdraw %#lx %s state=%d\n", ewin->client.win,
              EwinGetName(ewin), ewin->state);
 
+   ecore_x_grab();
+
    /* Park the client window on the root */
+   x = ewin->client.x;
+   y = ewin->client.y;
    XTranslateCoordinates(disp, ewin->client.win, VRoot.win,
                         -ewin->border->border.left,
-                        -ewin->border->border.top, &ewin->client.x,
-                        &ewin->client.y, &win);
-   EReparentWindow(disp, ewin->client.win, VRoot.win, ewin->client.x,
-                  ewin->client.y);
-
+                        -ewin->border->border.top, &x, &y, &win);
+   EReparentWindow(disp, ewin->client.win, VRoot.win, x, y);
    ICCCM_Withdraw(ewin);
    HintsDelWindowHints(ewin);
-   EwinDestroy(ewin);
+
+   ecore_x_sync();
+   ecore_x_ungrab();
+
+   if (EwinIsInternal(ewin))
+      EwinDestroy(ewin);
 }
 
 void
@@ -1005,8 +969,6 @@
 {
    Window              dwin;
 
-   EDBUG(3, "EwinConformToDesktop");
-
    dwin = DeskGetWin(EoGetDesk(ewin));
    if ((ewin->iconified) && (ewin->parent != dwin))
      {
@@ -1047,15 +1009,43 @@
 
    EwinDetermineArea(ewin);
    HintsSetWindowDesktop(ewin);
-
-   EDBUG_RETURN_;
 }
 
 void
 EwinReparent(EWin * ewin, Window parent)
 {
    EReparentWindow(disp, ewin->client.win, parent, 0, 0);
-   EwinDestroy(ewin);
+   EDestroyWindow(disp, EoGetWin(ewin));
+}
+
+static void
+EwinEventMapRequest(EWin * ewin, Window win)
+{
+   if (ewin)
+     {
+       if (ewin->state == EWIN_STATE_ICONIC)
+          EwinDeIconify(ewin);
+       if (ewin->state == EWIN_STATE_WITHDRAWN)
+          AddToFamily(ewin, win);
+       else
+          Eprintf("AddToFamily: Already managing %s %#lx\n", "A",
+                  ewin->client.win);
+     }
+   else
+     {
+       /* Check if we are already managing it */
+       ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
+
+       /* Some clients MapRequest more than once ?!? */
+       if (ewin)
+         {
+            Eprintf("AddToFamily: Already managing %s %#lx\n", "B",
+                    ewin->client.win);
+            ShowEwin(ewin);
+         }
+       else
+          AddToFamily(NULL, win);
+     }
 }
 
 static void
@@ -1094,13 +1084,13 @@
    if (GetZoomEWin() == ewin)
       Zoom(NULL);
 
-   /* Set state to unknown until we can set the correct one */
-   ewin->state = (ewin->iconified) ? EWIN_STATE_ICONIC : EWIN_STATE_WITHDRAWN;
-
    if (EventDebug(EDBUG_TYPE_EWINS))
       Eprintf("EwinEventUnmap %#lx %s state=%d\n", ewin->client.win,
              EwinGetName(ewin), ewin->state);
 
+   if (ewin->state == EWIN_STATE_WITHDRAWN)
+      return;
+
    ActionsEnd(ewin);
 
    if (ewin == GetContextEwin())
@@ -1120,14 +1110,18 @@
        Mode.doingslide = 0;
      }
 
+   HideEwin(ewin);
+
    ModulesSignal(ESIGNAL_EWIN_UNMAP, ewin);
 
    if (ewin->iconified)
      {
-       HideEwin(ewin);
+       ewin->state = EWIN_STATE_ICONIC;
        return;
      }
 
+   ewin->state = EWIN_STATE_WITHDRAWN;
+
    if (ewin->Close)
       ewin->Close(ewin);
 
@@ -1234,7 +1228,7 @@
        xwc.border_width = ev->xconfigurerequest.border_width;
        xwc.sibling = ev->xconfigurerequest.above;
        xwc.stack_mode = ev->xconfigurerequest.detail;
-       XConfigureWindow(disp, win, ev->xconfigurerequest.value_mask, &xwc);
+       EConfigureWindow(disp, win, ev->xconfigurerequest.value_mask, &xwc);
      }
 }
 
@@ -1363,10 +1357,9 @@
    EWin              **lst;
    int                 i, num;
 
-   EDBUG(3, "FloatEwin");
    call_depth++;
    if (call_depth > 256)
-      EDBUG_RETURN_;
+      return;
 
    EoSetFloating(ewin, 1);
    EoSetDesk(ewin, 0);
@@ -1380,7 +1373,6 @@
       Efree(lst);
 
    call_depth--;
-   EDBUG_RETURN_;
 }
 #endif
 
@@ -1392,10 +1384,9 @@
    EWin              **lst;
    int                 i, num;
 
-   EDBUG(3, "FloatEwinAt");
    call_depth++;
    if (call_depth > 256)
-      EDBUG_RETURN_;
+      return;
 
    if (EoIsFloating(ewin))
       EoSetFloating(ewin, 2);
@@ -1415,7 +1406,6 @@
       Efree(lst);
 
    call_depth--;
-   EDBUG_RETURN_;
 }
 
 /*
@@ -1429,8 +1419,6 @@
    XWindowChanges      xwc;
    unsigned int        value_mask;
 
-   EDBUG(3, "RestackEwin");
-
    if (EventDebug(EDBUG_TYPE_STACKING))
       Eprintf("RestackEwin %#lx %s\n", ewin->client.win, EwinGetName(ewin));
 
@@ -1468,7 +1456,7 @@
    ModulesSignal(ESIGNAL_EWIN_CHANGE, ewin);
 
  done:
-   EDBUG_RETURN_;
+   ;
 }
 
 void
@@ -1478,9 +1466,8 @@
    EWin              **lst;
    int                 i, num;
 
-   EDBUG(3, "RaiseEwin");
    if (call_depth > 256)
-      EDBUG_RETURN_;
+      return;
    call_depth++;
 
    if (EventDebug(EDBUG_TYPE_RAISELOWER))
@@ -1518,7 +1505,6 @@
 
  done:
    call_depth--;
-   EDBUG_RETURN_;
 }
 
 void
@@ -1528,9 +1514,8 @@
    EWin              **lst;
    int                 i, num;
 
-   EDBUG(3, "LowerEwin");
    if (call_depth > 256)
-      EDBUG_RETURN_;
+      return;
    call_depth++;
 
    if (EventDebug(EDBUG_TYPE_RAISELOWER))
@@ -1564,16 +1549,13 @@
 
  done:
    call_depth--;
-   EDBUG_RETURN_;
 }
 
 void
 ShowEwin(EWin * ewin)
 {
-   EDBUG(3, "ShowEwin");
-
    if (ewin->shown)
-      EDBUG_RETURN_;
+      return;
    ewin->shown = 1;
 
    if (ewin->client.win)
@@ -1585,26 +1567,22 @@
 
    if (EoGetWin(ewin))
       EMapWindow(disp, EoGetWin(ewin));
-
-   EDBUG_RETURN_;
 }
 
 void
 HideEwin(EWin * ewin)
 {
-   EDBUG(3, "HideEwin");
-
    if (!ewin->shown || !EwinIsMapped(ewin))
-      EDBUG_RETURN_;
+      return;
    ewin->shown = 0;
 
    if (GetZoomEWin() == ewin)
       Zoom(NULL);
 
+   EUnmapWindow(disp, ewin->client.win);
+
    if (EoGetWin(ewin))
       EUnmapWindow(disp, EoGetWin(ewin));
-
-   EDBUG_RETURN_;
 }
 
 Window
@@ -1870,13 +1848,17 @@
 {
    EWin               *ewin = (EWin *) prm;
 
+#if 0
+   Eprintf("EwinHandleEventsContainer: type=%2d win=%#lx: %s\n",
+          ev->type, ewin->client.win, EwinGetName(ewin));
+#endif
    switch (ev->type)
      {
      case ButtonPress:
        FocusHandleClick(ewin, ev->xany.window);
        break;
      case MapRequest:
-       EwinDeIconify(ewin);
+       EwinEventMapRequest(ewin, ev->xmaprequest.window);
        break;
      case ConfigureRequest:
        EwinEventConfigureRequest(ewin, ev);
@@ -1915,23 +1897,28 @@
        EwinEventVisibility(ewin, ev->xvisibility.state);
        break;
      case DestroyNotify:
-       if (ev->xdestroywindow.window == ewin->client.win)
-          EwinEventDestroy(ewin);
+       EwinEventDestroy(ewin);
        break;
      case UnmapNotify:
-       if (ev->xunmap.window != ewin->client.win)
-          break;
+#if 0
        if (ewin->state == EWIN_STATE_NEW)
          {
             Eprintf("EwinEventUnmap %#lx: Ignoring bogus Unmap event\n",
                     ewin->client.win);
             break;
          }
+#endif
        EwinEventUnmap(ewin);
        break;
      case MapNotify:
-       if (ev->xmap.window == ewin->client.win)
-          EwinEventMap(ewin);
+       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 == VRoot.win)
+          EwinEventDestroy(ewin);
        break;
 #if 0
      case ConfigureRequest:
@@ -1975,21 +1962,25 @@
        break;
 
      case MapRequest:
-       AddToFamily(ev->xmaprequest.window);
+       EwinEventMapRequest(NULL, ev->xmaprequest.window);
        break;
      case ConfigureRequest:
 #if 0
        Eprintf("EwinHandleEventsRoot ConfigureRequest %#lx\n",
                ev->xconfigurerequest.window);
 #endif
-       EwinEventConfigureRequest(NULL, ev);
+       ewin = FindItem(NULL, ev->xconfigurerequest.window, LIST_FINDBY_ID,
+                       LIST_TYPE_EWIN);
+       EwinEventConfigureRequest(ewin, ev);
        break;
      case ResizeRequest:
 #if 0
        Eprintf("EwinHandleEventsRoot ResizeRequest %#lx\n",
                ev->xresizerequest.window);
 #endif
-       EwinEventResizeRequest(NULL, ev);
+       ewin = FindItem(NULL, ev->xresizerequest.window, LIST_FINDBY_ID,
+                       LIST_TYPE_EWIN);
+       EwinEventResizeRequest(ewin, ev);
        break;
      case CirculateRequest:
 #if 0
@@ -2011,6 +2002,8 @@
        /* Catch clients destroyed after MapRequest but before being reparented 
*/
        ewin = FindItem(NULL, ev->xdestroywindow.window, LIST_FINDBY_ID,
                        LIST_TYPE_EWIN);
+       if (!ewin)
+          ewin = FindEwinByBase(ev->xdestroywindow.window);
        if (ewin)
           EwinEventDestroy(ewin);
        break;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/hints.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- hints.c     22 Jan 2005 11:32:58 -0000      1.29
+++ hints.c     23 Jan 2005 18:23:04 -0000      1.30
@@ -430,6 +430,9 @@
    CARD32             *cc;
 
    n_desks = DesksGetNumber();
+   if (n_desks <= 0)
+      return;
+
    cc = Emalloc(2 * n_desks * sizeof(CARD32));
    if (!cc)
       return;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -3 -r1.160 -r1.161
--- menus.c     21 Jan 2005 20:12:11 -0000      1.160
+++ menus.c     23 Jan 2005 18:23:04 -0000      1.161
@@ -173,10 +173,6 @@
 void
 MenuHide(Menu * m)
 {
-   EWin               *ewin;
-
-   EDBUG(5, "MenuHide");
-
    if (m->win)
       EUnmapWindow(disp, m->win);
 
@@ -184,12 +180,6 @@
 
    m->stuck = 0;
    m->shown = 0;
-
-   ewin = FindEwinByMenu(m);
-   if (ewin)
-      HideEwin(ewin);
-
-   EDBUG_RETURN_;
 }
 
 static void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -3 -r1.145 -r1.146
--- setup.c     10 Jan 2005 23:34:46 -0000      1.145
+++ setup.c     23 Jan 2005 18:23:04 -0000      1.146
@@ -97,7 +97,7 @@
                                 if (Mode.wm.exiting)
                                    EMapWindow(disp, wlist[i]);
                                 else
-                                   AddToFamily(wlist[i]);
+                                   AddToFamily(NULL, wlist[i]);
                              }
                         }
                    }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -3 -r1.73 -r1.74
--- x.c 2 Jan 2005 15:38:52 -0000       1.73
+++ x.c 23 Jan 2005 18:23:04 -0000      1.74
@@ -653,9 +653,10 @@
    if (xid)
      {
 #if 0
-       Eprintf("EReparentWindow: %p %#lx: %#lx->%#lx %d,%d %dx%d -> %d,%d\n",
-               xid, xid->win, xid->parent, parent, xid->x, xid->y, xid->w,
-               xid->h, x, y);
+       Eprintf
+          ("EReparentWindow: %p %#lx: %d %#lx->%#lx %d,%d %dx%d -> %d,%d\n",
+           xid, xid->win, xid->mapped, xid->parent, parent, xid->x, xid->y,
+           xid->w, xid->h, x, y);
 #endif
        if (parent == xid->parent)
          {
@@ -999,6 +1000,19 @@
 }
 
 Window
+WinGetParent(Window win)
+{
+   Window              parent, rt;
+   Window             *pch = NULL;
+   unsigned int        nch = 0;
+
+   if (!XQueryTree(disp, win, &rt, &parent, &pch, &nch))
+      return None;
+
+   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: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to