Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h borders.c dialog.c evhandlers.c icccm.c iconify.c menus.c 
        pager.c 


Log Message:
Simplify ewin unmap/destroy handling (fixes "losing windows" bug).
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.239
retrieving revision 1.240
diff -u -3 -r1.239 -r1.240
--- E.h 7 Apr 2004 14:32:31 -0000       1.239
+++ E.h 7 Apr 2004 21:50:12 -0000       1.240
@@ -963,6 +963,7 @@
    } ewmh;
    void                (*MoveResize) (EWin * ewin, int resize);
    void                (*Refresh) (EWin * ewin);
+   void                (*Close) (EWin * ewin);
 };
 
 typedef struct _groupconfig
@@ -1703,8 +1704,10 @@
 int                 ChangeEwinWinpart(EWin * ewin, int i);
 void                DrawEwin(EWin * ewin);
 int                 ChangeEwinWinpartContents(EWin * ewin, int i);
-EWin               *CreateEwin(void);
-void                FreeEwin(EWin * ewin);
+EWin               *EwinCreate(void);
+void                EwinDestroy(EWin * ewin);
+void                EwinEventMap(EWin * ewin);
+void                EwinEventUnmap(EWin * ewin);
 void                EwinSetArea(EWin * ewin, int ax, int ay);
 void                MoveEwinToArea(EWin * ewin, int ax, int ay);
 void                SetEwinToCurrentArea(EWin * ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -3 -r1.159 -r1.160
--- borders.c   4 Apr 2004 21:44:45 -0000       1.159
+++ borders.c   7 Apr 2004 21:50:14 -0000       1.160
@@ -1158,7 +1158,7 @@
 
    EDBUG(4, "Adopt");
    GrabX();
-   ewin = CreateEwin();
+   ewin = EwinCreate();
    ewin->client.win = win;
    ICCCM_AdoptStart(ewin);
    ICCCM_GetTitle(ewin, 0);
@@ -1188,6 +1188,7 @@
       InstantShadeEwin(ewin, 1);
 
    HintsSetWindowState(ewin);
+   HintsSetClientList();
 
    EDBUG_RETURN(ewin);
 }
@@ -1199,7 +1200,7 @@
 
    EDBUG(4, "AdoptInternal");
    GrabX();
-   ewin = CreateEwin();
+   ewin = EwinCreate();
    ewin->client.win = win;
    ewin->border = border;
    ewin->internal = 1;
@@ -1249,17 +1250,18 @@
       InstantShadeEwin(ewin, 1);
 
    HintsSetWindowState(ewin);
+   HintsSetClientList();
 
    EDBUG_RETURN(ewin);
 }
 
 EWin               *
-CreateEwin()
+EwinCreate(void)
 {
    EWin               *ewin;
    XSetWindowAttributes att;
 
-   EDBUG(5, "CreateEwin");
+   EDBUG(5, "EwinCreate");
    ewin = Emalloc(sizeof(EWin));
    memset(ewin, 0, sizeof(EWin));
    ewin->x = -1;
@@ -1327,7 +1329,7 @@
 }
 
 void
-FreeEwin(EWin * ewin)
+EwinDestroy(EWin * ewin)
 {
    EWin               *ewin2;
    int                 i, num_groups;
@@ -1341,45 +1343,11 @@
 
    HintsSetClientList();
 
-   if (GetZoomEWin() == ewin)
-      Zoom(NULL);
-
    UnmatchEwinToSnapInfo(ewin);
 
-   PagerEwinOutsideAreaUpdate(ewin);
-   PagerHideAllHi();
-
    if (ewin->iconified > 0)
       RemoveMiniIcon(ewin);
 
-   ActionsEnd(ewin);
-   if (ewin == GetContextEwin())
-      SlideoutsHide();
-
-   if (Mode.doingslide)
-     {
-       DrawEwinShape(ewin, Conf.slidemode, ewin->x, ewin->y,
-                     ewin->client.w, ewin->client.h, 2);
-       Mode.doingslide = 0;
-     }
-
-   /* hide any menus this ewin has brought up if they are still up when we */
-   /* destroy this ewin */
-   if (ewin->shownmenu)
-      MenusHideByWindow(ewin->shownmenu);
-
-   FocusToEWin(ewin, FOCUS_EWIN_GONE);
-
-   if (ewin->docked)
-      DockDestroy(ewin);
-   if (ewin->pager)
-      PagerDestroy(ewin->pager);
-   if (ewin->ibox)
-      IconboxDestroy(ewin->ibox);
-
-   if (ewin == Mode.mouse_over_win)
-      Mode.mouse_over_win = NULL;
-
    HintsDelWindowHints(ewin);
 
    if (ewin->client.transient)
@@ -1432,6 +1400,70 @@
    EDBUG_RETURN_;
 }
 
+void
+EwinEventMap(EWin * ewin)
+{
+   ewin->mapped = 1;
+}
+
+void
+EwinEventUnmap(EWin * ewin)
+{
+   Window              win;
+
+   ewin->mapped = 0;
+
+   if (GetZoomEWin() == ewin)
+      Zoom(NULL);
+
+   ActionsEnd(ewin);
+
+   if (ewin->pager)
+      PagerEventUnmap(ewin->pager);
+
+   if (Conf.dockapp_support && ewin->docked)
+      DockDestroy(ewin);
+
+   if (ewin == GetContextEwin())
+      SlideoutsHide();
+
+   if (ewin == Mode.focuswin)
+      FocusToEWin(ewin, FOCUS_EWIN_GONE);
+   if (ewin == Mode.mouse_over_win)
+      Mode.mouse_over_win = NULL;
+
+   /* hide any menus this ewin has brought up if they are still up when we */
+   /* destroy this ewin */
+   if (ewin->shownmenu)
+      MenusHideByWindow(ewin->shownmenu);
+
+   if (Mode.doingslide)
+     {
+       DrawEwinShape(ewin, Conf.slidemode, ewin->x, ewin->y,
+                     ewin->client.w, ewin->client.h, 2);
+       Mode.doingslide = 0;
+     }
+
+   HideEwin(ewin);
+
+   if (!ewin->internal)
+      return;
+
+   if (ewin->Close)
+      ewin->Close(ewin);
+
+   /* Park the client window on the root so we can use it again later */
+   XTranslateCoordinates(disp, ewin->client.win, root.win,
+                        -ewin->border->border.left,
+                        -ewin->border->border.top, &ewin->client.x,
+                        &ewin->client.y, &win);
+   EReparentWindow(disp, ewin->client.win, root.win, ewin->client.x,
+                  ewin->client.y);
+   ICCCM_Withdraw(ewin);
+   RemoveItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
+   EwinDestroy(ewin);
+}
+
 static void
 EwinSetBorderInit(EWin * ewin)
 {
@@ -2064,7 +2096,7 @@
 {
    EDBUG(3, "HideEwin");
 
-   if (!ewin->visible)
+   if (!ewin->mapped || !ewin->visible)
       EDBUG_RETURN_;
    ewin->visible = 0;
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/dialog.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- dialog.c    21 Mar 2004 01:39:40 -0000      1.83
+++ dialog.c    7 Apr 2004 21:50:16 -0000       1.84
@@ -566,7 +566,7 @@
 }
 
 static void
-DialogMoveResize(EWin * ewin, int resize)
+DialogEwinMoveResize(EWin * ewin, int resize)
 {
    Dialog             *d = ewin->dialog;
 
@@ -580,17 +580,25 @@
 }
 
 static void
-DialogRefresh(EWin * ewin)
+DialogEwinRefresh(EWin * ewin)
 {
-   DialogMoveResize(ewin, 0);
+   DialogEwinMoveResize(ewin, 0);
+}
+
+static void
+DialogEwinClose(EWin * ewin)
+{
+   DialogClose(ewin->dialog);
+   ewin->dialog = NULL;
 }
 
 static void
 DialogEwinInit(EWin * ewin, void *ptr)
 {
    ewin->dialog = (Dialog *) ptr;
-   ewin->MoveResize = DialogMoveResize;
-   ewin->Refresh = DialogRefresh;
+   ewin->MoveResize = DialogEwinMoveResize;
+   ewin->Refresh = DialogEwinRefresh;
+   ewin->Close = DialogEwinClose;
 }
 
 void
@@ -711,23 +719,13 @@
 void
 DialogClose(Dialog * d)
 {
-   EWin               *ewin;
-   XEvent              ev;
-
    if (!d)
       return;
-   ewin = FindEwinByDialog(d);
+
    EDestroyWindow(disp, d->win);
-   if (ewin)
-     {
-       HideEwin(ewin);
-       ev.xunmap.window = d->win;
-       HandleUnmap(&ev);
-     }
    if (d->exit_func)
       (d->exit_func) (d->exit_val, d->exit_data);
    RemoveItem(NULL, d->win, LIST_FINDBY_ID, LIST_TYPE_DIALOG);
-   DialogDestroy(d);
 }
 
 DItem              *
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -3 -r1.159 -r1.160
--- evhandlers.c        7 Apr 2004 14:36:08 -0000       1.159
+++ evhandlers.c        7 Apr 2004 21:50:16 -0000       1.160
@@ -666,7 +666,7 @@
    ewin = RemoveItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    if (ewin)
      {
-       FreeEwin(ewin);
+       EwinDestroy(ewin);
        EDBUG_RETURN_;
      }
 
@@ -690,41 +690,8 @@
 
    ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    if (ewin)
-     {
-       ewin->mapped = 0;
-
-       if (ewin->pager)
-          PagerEventUnmap(ewin->pager);
-
-       if (Conf.dockapp_support && ewin->docked)
-          DockDestroy(ewin);
-
-       ActionsEnd(ewin);
-       if (ewin == GetContextEwin())
-          SlideoutsHide();
-
-       if (ewin == Mode.focuswin)
-          FocusToEWin(ewin, FOCUS_EWIN_GONE);
-       if (ewin == Mode.mouse_over_win)
-          Mode.mouse_over_win = NULL;
+      EwinEventUnmap(ewin);
 
-       if (!ewin->iconified)
-         {
-            XTranslateCoordinates(disp, ewin->client.win, root.win,
-                                  -ewin->border->border.left,
-                                  -ewin->border->border.top, &ewin->client.x,
-                                  &ewin->client.y, &win);
-            EReparentWindow(disp, ewin->client.win, root.win, ewin->client.x,
-                            ewin->client.y);
-            ICCCM_Withdraw(ewin);
-            RemoveItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
-            FreeEwin(ewin);
-         }
-       else
-         {
-            HideEwin(ewin);
-         }
-     }
    EDBUG_RETURN_;
 }
 
@@ -735,23 +702,22 @@
    EWin               *ewin;
 
    EDBUG(5, "HandleMap");
+
    ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    if (ewin)
-     {
-       ewin->mapped = 1;
-     }
+      EwinEventMap(ewin);
+
    EDBUG_RETURN_;
 }
 
 void
 HandleMapRequest(XEvent * ev)
 {
-   Window              win;
+   Window              win = ev->xconfigurerequest.window;
    EWin               *ewin;
 
    EDBUG(5, "HandleMapRequest");
 
-   win = ev->xconfigurerequest.window;
    ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    if (ewin && ewin->iconified)
      {
@@ -760,7 +726,6 @@
    else
      {
        AddToFamily(ev->xmap.window);
-       HintsSetClientList();
      }
 
    EDBUG_RETURN_;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- icccm.c     1 Apr 2004 22:41:21 -0000       1.57
+++ icccm.c     7 Apr 2004 21:50:17 -0000       1.58
@@ -167,24 +167,7 @@
 
    if (ewin->internal)
      {
-       XEvent              xev;
-
-       if (ewin->menu)
-          MenuHide(ewin->menu);
-       if (ewin->pager)
-         {
-            HideEwin(ewin);
-            xev.xunmap.window = PagerGetWin(ewin->pager);
-            HandleUnmap(&xev);
-         }
-       if (ewin->ibox)
-         {
-            HideEwin(ewin);
-            xev.xunmap.window = IconboxGetWin(ewin->ibox);
-            HandleUnmap(&xev);
-         }
-       if (ewin->dialog)
-          DialogClose(ewin->dialog);
+       EUnmapWindow(disp, ewin->client.win);
        EDBUG_RETURN_;
      }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -3 -r1.99 -r1.100
--- iconify.c   7 Apr 2004 14:36:08 -0000       1.99
+++ iconify.c   7 Apr 2004 21:50:18 -0000       1.100
@@ -523,7 +523,7 @@
 }
 
 static void
-IconboxMoveResize(EWin * ewin, int resize)
+IconboxEwinMoveResize(EWin * ewin, int resize)
 {
    static int          call_depth = 0; /* Ugly! */
    Iconbox            *ib = ewin->ibox;
@@ -546,7 +546,7 @@
 }
 
 static void
-IconboxRefresh(EWin * ewin)
+IconboxEwinRefresh(EWin * ewin)
 {
    Iconbox            *ib = ewin->ibox;
 
@@ -561,11 +561,19 @@
 }
 
 static void
+IconboxEwinClose(EWin * ewin)
+{
+   IconboxDestroy(ewin->ibox);
+   ewin->ibox = NULL;
+}
+
+static void
 IconboxEwinInit(EWin * ewin, void *ptr)
 {
    ewin->ibox = (Iconbox *) ptr;
-   ewin->MoveResize = IconboxMoveResize;
-   ewin->Refresh = IconboxRefresh;
+   ewin->MoveResize = IconboxEwinMoveResize;
+   ewin->Refresh = IconboxEwinRefresh;
+   ewin->Close = IconboxEwinClose;
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -3 -r1.117 -r1.118
--- menus.c     6 Apr 2004 23:19:03 -0000       1.117
+++ menus.c     7 Apr 2004 21:50:18 -0000       1.118
@@ -119,9 +119,7 @@
 
    ewin = FindEwinByMenu(m);
    if (ewin)
-     {
-       HideEwin(ewin);
-     }
+      HideEwin(ewin);
 
    if (m->sel_item)
      {
@@ -137,7 +135,7 @@
 }
 
 static void
-MenuMoveResize(EWin * ewin, int resize)
+MenuEwinMoveResize(EWin * ewin, int resize)
 {
    Menu               *m = ewin->menu;
 
@@ -152,17 +150,24 @@
 }
 
 static void
-MenuRefresh(EWin * ewin)
+MenuEwinRefresh(EWin * ewin)
+{
+   MenuEwinMoveResize(ewin, 0);
+}
+
+static void
+MenuEwinClose(EWin * ewin)
 {
-   MenuMoveResize(ewin, 0);
+   ewin->menu = NULL;
 }
 
 static void
 MenuEwinInit(EWin * ewin, void *ptr)
 {
    ewin->menu = (Menu *) ptr;
-   ewin->MoveResize = MenuMoveResize;
-   ewin->Refresh = MenuRefresh;
+   ewin->MoveResize = MenuEwinMoveResize;
+   ewin->Refresh = MenuEwinRefresh;
+   ewin->Close = MenuEwinClose;
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -3 -r1.80 -r1.81
--- pager.c     1 Apr 2004 22:41:22 -0000       1.80
+++ pager.c     7 Apr 2004 21:50:19 -0000       1.81
@@ -222,7 +222,7 @@
 }
 
 static void
-PagerMoveResize(EWin * ewin, int resize)
+PagerEwinMoveResize(EWin * ewin, int resize)
 {
    Pager              *p = ewin->pager;
    int                 w, h;
@@ -286,7 +286,7 @@
 }
 
 static void
-PagerRefresh(EWin * ewin)
+PagerEwinRefresh(EWin * ewin)
 {
    /* This doesn't do anything anymore apparently
     * --Mandrake
@@ -297,11 +297,19 @@
 }
 
 static void
+PagerEwinClose(EWin * ewin)
+{
+   PagerDestroy(ewin->pager);
+   ewin->pager = NULL;
+}
+
+static void
 PagerEwinInit(EWin * ewin, void *ptr)
 {
    ewin->pager = (Pager *) ptr;
-   ewin->MoveResize = PagerMoveResize;
-   ewin->Refresh = PagerRefresh;
+   ewin->MoveResize = PagerEwinMoveResize;
+   ewin->Refresh = PagerEwinRefresh;
+   ewin->Close = PagerEwinClose;
 }
 
 void




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to