Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h borders.c desktops.c evhandlers.c focus.c icccm.c 
        iconify.c main.c menus.c 


Log Message:
Another attempt at fixing the "losing windows" bug, adjust event masks.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.249
retrieving revision 1.250
diff -u -3 -r1.249 -r1.250
--- E.h 15 Apr 2004 19:44:34 -0000      1.249
+++ E.h 21 Apr 2004 20:49:05 -0000      1.250
@@ -881,6 +881,11 @@
 }
 WinClient;
 
+#define EWIN_STATE_UNKNOWN      0
+#define EWIN_STATE_WITHDRAWN    1
+#define EWIN_STATE_ICONIC       2
+#define EWIN_STATE_MAPPED       3
+
 #define EWIN_TYPE_NORMAL        0x00
 #define EWIN_TYPE_DIALOG        0x01
 #define EWIN_TYPE_MENU          0x02
@@ -893,6 +898,7 @@
    int                 x, y, w, h, reqx, reqy;
    int                 lx, ly, lw, lh;
    char                type;
+   char                state;
    char                internal;
    char                toggle;
    Window              win_container;
@@ -904,7 +910,6 @@
    int                 desktop;
    Group             **groups;
    int                 num_groups;
-   char                mapped;
    char                docked;
    char                sticky;
    char                visible;
@@ -1723,8 +1728,8 @@
 EWin               *AddInternalToFamily(Window win, const char *bname, int type,
                                        void *ptr,
                                        void (*init) (EWin * ewin, void *ptr));
-void                CalcEwinSizes(EWin * ewin);
 void                HonorIclass(char *s, int id);
+void                EwinWithdraw(EWin * ewin);
 void                SyncBorderToEwin(EWin * ewin);
 void                UpdateBorderInfo(EWin * ewin);
 void                RealiseEwinWinpart(EWin * ewin, int i);
@@ -2283,7 +2288,6 @@
 void                FreePmapMask(PmapMask * pmm);
 
 /* iconify.c */
-void                IB_Animate(char iconify, EWin * from, EWin * to);
 void                IconifyEwin(EWin * ewin);
 void                DeIconifyEwin(EWin * ewin);
 void                MakeIcon(EWin * ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -3 -r1.169 -r1.170
--- borders.c   16 Apr 2004 18:10:29 -0000      1.169
+++ borders.c   21 Apr 2004 20:49:42 -0000      1.170
@@ -25,11 +25,11 @@
 
 #define EWIN_TOP_EVENT_MASK \
   (ButtonPressMask | ButtonReleaseMask | \
-   EnterWindowMask | LeaveWindowMask | PointerMotionMask | \
-   StructureNotifyMask)
+   EnterWindowMask | LeaveWindowMask | PointerMotionMask /* | \
+   StructureNotifyMask */)
 #define EWIN_CONTAINER_EVENT_MASK \
-  (ButtonPressMask | ButtonReleaseMask | \
-   StructureNotifyMask | ResizeRedirectMask | \
+  (/* ButtonPressMask | ButtonReleaseMask | */ \
+   /* StructureNotifyMask | ResizeRedirectMask | */ \
    SubstructureNotifyMask | SubstructureRedirectMask)
 #define EWIN_BORDER_PART_EVENT_MASK \
   (KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
@@ -39,7 +39,7 @@
 
 #define EWIN_CLIENT_EVENT_MASK \
   (EnterWindowMask | LeaveWindowMask | FocusChangeMask | \
-   StructureNotifyMask | ResizeRedirectMask | \
+   /* StructureNotifyMask | */ ResizeRedirectMask | \
    PropertyChangeMask | ColormapChangeMask)
 
 static void         EwinSetBorderInit(EWin * ewin);
@@ -142,7 +142,7 @@
 {
    Window              rt, ch;
    int                 dum, px, py, d;
-   EWin               *const *lst;
+   EWin               *const *lst, *ewin;
    int                 i, num;
 
    EDBUG(5, "GetEwinPointerInClient");
@@ -158,13 +158,14 @@
      {
        int                 x, y, w, h;
 
-       x = lst[i]->x;
-       y = lst[i]->y;
-       w = lst[i]->w;
-       h = lst[i]->h;
-       if ((px >= x) && (py >= y) && (px < (x + w)) && (py < (y + h))
-           && (lst[i]->visible))
-          EDBUG_RETURN(lst[i]);
+       ewin = lst[i];
+       x = ewin->x;
+       y = ewin->y;
+       w = ewin->w;
+       h = ewin->h;
+       if ((px >= x) && (py >= y) && (px < (x + w)) && (py < (y + h)) &&
+           (ewin->visible) && (ewin->state == EWIN_STATE_MAPPED))
+          EDBUG_RETURN(ewin);
      }
 
    EDBUG_RETURN(NULL);
@@ -348,8 +349,10 @@
    char                cangrab = 0;
 
    EDBUG(3, "AddToFamily");
+
    /* find the client window if it's already managed */
    ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
+
    /* it's already managed */
    if (ewin)
      {
@@ -364,6 +367,7 @@
             ConformEwinToDesktop(ewin);
             ShowEwin(ewin);
             ICCCM_DeIconify(ewin);
+            ewin->iconified = 0;
          }
        EDBUG_RETURN_;
      }
@@ -385,13 +389,7 @@
    /* if set for borderless then dont slide it in */
    if ((!ewin->client.mwm_decor_title) && (!ewin->client.mwm_decor_border))
       doslide = 0;
-   if (!Mode.startup)
-     {
-       if (ewin->client.start_iconified)
-          ewin->iconified = 1;
-     }
-   x = 0;
-   y = 0;
+
    ResizeEwin(ewin, ewin->client.w, ewin->client.h);
 
    if (ewin->client.transient)
@@ -460,6 +458,8 @@
      }
 
    /* if it hasn't been placed yet.... find a spot for it */
+   x = 0;
+   y = 0;
    if ((!ewin->client.already_placed) && (!manplace))
      {
 
@@ -558,14 +558,11 @@
      }
 
    /* if the window asked to be iconified at the start */
-   if (ewin->iconified)
+   if (ewin->client.start_iconified)
      {
        EwinBorderDraw(ewin, 1, 1);
        MoveEwinToDesktopAt(ewin, ewin->desktop, x, y);
-       RaiseEwin(ewin);
-       ShowEwin(ewin);
        UngrabX();
-       ewin->iconified = 0;
        IconifyEwin(ewin);
        EDBUG_RETURN_;
      }
@@ -1023,7 +1020,7 @@
    EDBUG_RETURN_;
 }
 
-void
+static void
 CalcEwinSizes(EWin * ewin)
 {
    int                 i;
@@ -1314,6 +1311,7 @@
    if (!ewin)
       EDBUG_RETURN_;
 
+   RemoveItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    EwinListDelete(&EwinListStack, ewin);
    EwinListDelete(&EwinListFocus, ewin);
 
@@ -1372,6 +1370,23 @@
 }
 
 void
+EwinWithdraw(EWin * ewin)
+{
+   Window              win;
+
+   /* Park the client window on the root */
+   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);
+   EwinDestroy(ewin);
+}
+
+void
 EwinEventDestroy(EWin * ewin)
 {
    EwinDestroy(ewin);
@@ -1380,19 +1395,18 @@
 void
 EwinEventMap(EWin * ewin)
 {
-   ewin->mapped = 1;
+   ewin->state = EWIN_STATE_MAPPED;
 }
 
 void
 EwinEventUnmap(EWin * ewin)
 {
-   Window              win;
-
-   ewin->mapped = 0;
-
    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;
+
    ActionsEnd(ewin);
 
    if (ewin->pager)
@@ -1430,16 +1444,7 @@
    if (ewin->Close)
       ewin->Close(ewin);
 
-   /* Park the client window on the root */
-   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);
+   EwinWithdraw(ewin);
 }
 
 static void
@@ -2065,7 +2070,7 @@
 {
    EDBUG(3, "HideEwin");
 
-   if (!ewin->mapped || !ewin->visible)
+   if (ewin->state != EWIN_STATE_MAPPED || !ewin->visible)
       EDBUG_RETURN_;
    ewin->visible = 0;
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -3 -r1.85 -r1.86
--- desktops.c  15 Apr 2004 19:44:36 -0000      1.85
+++ desktops.c  21 Apr 2004 20:50:25 -0000      1.86
@@ -28,7 +28,7 @@
 #define EDESK_EVENT_MASK \
   (KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
    EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | \
-   SubstructureNotifyMask | SubstructureRedirectMask | PropertyChangeMask)
+   /* SubstructureNotifyMask | */ SubstructureRedirectMask | PropertyChangeMask)
 
 void
 ChangeNumberOfDesktops(int quantity)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -3 -r1.161 -r1.162
--- evhandlers.c        15 Apr 2004 19:44:37 -0000      1.161
+++ evhandlers.c        21 Apr 2004 20:50:33 -0000      1.162
@@ -663,7 +663,7 @@
 
    EForgetWindow(disp, win);
 
-   ewin = RemoveItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
+   ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    if (ewin)
      {
        EwinEventDestroy(ewin);
@@ -698,7 +698,7 @@
 void
 HandleMap(XEvent * ev)
 {
-   Window              win = ev->xunmap.window;
+   Window              win = ev->xmap.window;
    EWin               *ewin;
 
    EDBUG(5, "HandleMap");
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/focus.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -3 -r1.68 -r1.69
--- focus.c     15 Apr 2004 19:54:54 -0000      1.68
+++ focus.c     21 Apr 2004 20:51:07 -0000      1.69
@@ -33,7 +33,7 @@
    if (ewin->skipfocus || ewin->neverfocus || ewin->shaded || ewin->iconified)
       return 0;
 
-   if (!ewin->mapped)
+   if (ewin->state != EWIN_STATE_MAPPED)
       return 0;
 
    return EwinIsOnScreen(ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- icccm.c     15 Apr 2004 19:44:37 -0000      1.59
+++ icccm.c     21 Apr 2004 20:51:10 -0000      1.60
@@ -225,12 +225,8 @@
 
    EDBUG(6, "ICCCM_Iconify");
 
-   if (!ewin)
-      EDBUG_RETURN_;
-
    XChangeProperty(disp, ewin->client.win, E_XA_WM_STATE, E_XA_WM_STATE,
                   32, PropModeReplace, (unsigned char *)c, 2);
-   ewin->iconified = 3;
    AddItem(ewin, "ICON", ewin->client.win, LIST_TYPE_ICONIFIEDS);
    EUnmapWindow(disp, ewin->client.win);
 
@@ -244,10 +240,6 @@
 
    EDBUG(6, "ICCCM_DeIconify");
 
-   if (!ewin)
-      EDBUG_RETURN_;
-
-   ewin->iconified = 0;
    XChangeProperty(disp, ewin->client.win, E_XA_WM_STATE, E_XA_WM_STATE,
                   32, PropModeReplace, (unsigned char *)c, 2);
    RemoveItem("ICON", ewin->client.win, LIST_FINDBY_BOTH, LIST_TYPE_ICONIFIEDS);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -3 -r1.101 -r1.102
--- iconify.c   9 Apr 2004 12:59:55 -0000       1.101
+++ iconify.c   21 Apr 2004 20:51:11 -0000      1.102
@@ -31,7 +31,7 @@
 
 #define IB_ANIM_TIME 0.25
 
-void
+static void
 IB_Animate(char iconify, EWin * from, EWin * to)
 {
    double              t1, t2, t, i, spd, ii;
@@ -204,7 +204,7 @@
    static int          call_depth = 0;
    char                was_shaded;
 
-   EDBUG(6, "IconifyEwin");
+   EDBUG(6, "IconboxIconifyEwin");
    if (!ewin)
       EDBUG_RETURN_;
    if (GetZoomEWin() == ewin)
@@ -212,56 +212,58 @@
    if (ewin->ibox)
       EDBUG_RETURN_;
 
+   if (ewin->state == EWIN_STATE_ICONIC)
+      EDBUG_RETURN_;
+
    if (call_depth > 256)
       EDBUG_RETURN_;
    call_depth++;
 
-   if (!ewin->iconified)
+   was_shaded = ewin->shaded;
+   SoundPlay("SOUND_ICONIFY");
+
+   if (ib)
      {
-       was_shaded = ewin->shaded;
-       SoundPlay("SOUND_ICONIFY");
+       if (ib->animate)
+          IB_Animate(1, ewin, ib->ewin);
+       UpdateAppIcon(ewin, ib->icon_mode);
+       IconboxAddEwin(ib, ewin);
+     }
 
-       if (ib)
-         {
-            if (ib->animate)
-               IB_Animate(1, ewin, ib->ewin);
-            UpdateAppIcon(ewin, ib->icon_mode);
-            IconboxAddEwin(ib, ewin);
-         }
+   HideEwin(ewin);
 
-       HideEwin(ewin);
+   if (was_shaded != ewin->shaded)
+      InstantShadeEwin(ewin, 0);
 
-       if (was_shaded != ewin->shaded)
-          InstantShadeEwin(ewin, 0);
+   ewin->iconified = 3;
+   ICCCM_Iconify(ewin);
 
-       ICCCM_Iconify(ewin);
+   if (ewin->has_transients)
+     {
+       EWin              **lst;
+       int                 i, num;
 
-       if (ewin->has_transients)
+       lst = ListTransientsFor(ewin->client.win, &num);
+       if (lst)
          {
-            EWin              **lst;
-            int                 i, num;
-
-            lst = ListTransientsFor(ewin->client.win, &num);
-            if (lst)
+            for (i = 0; i < num; i++)
               {
-                 for (i = 0; i < num; i++)
+                 if (!lst[i]->iconified)
                    {
-                      if (!lst[i]->iconified)
-                        {
-                           HideEwin(lst[i]);
-                           lst[i]->iconified = 4;
-                        }
+                      HideEwin(lst[i]);
+                      lst[i]->iconified = 4;
                    }
+              }
 #if ENABLE_GNOME
-                 HintsSetClientList();
+            HintsSetClientList();
 #endif
-                 Efree(lst);
-              }
+            Efree(lst);
          }
      }
-   call_depth--;
 
    HintsSetWindowState(ewin);
+
+   call_depth--;
    EDBUG_RETURN_;
 }
 
@@ -279,80 +281,82 @@
    int                 x, y, dx, dy;
 
    EDBUG(6, "DeIconifyEwin");
-   call_depth++;
+
    if (call_depth > 256)
+      EDBUG_RETURN_;
+   call_depth++;
+
+   if (ewin->state != EWIN_STATE_ICONIC && ewin->state != EWIN_STATE_UNKNOWN)
+      EDBUG_RETURN_;
+
+   RemoveMiniIcon(ewin);
+
+   dx = ewin->w / 2;
+   dy = ewin->h / 2;
+   x = (ewin->x + dx) % root.w;
+   if (x < 0)
+      x += root.w;
+   x -= dx;
+   y = (ewin->y + dy) % root.h;
+   if (y < 0)
+      y += root.h;
+   y -= dy;
+
+   dx = x - ewin->x;
+   dy = y - ewin->y;
+
+   if (!ewin->sticky)
+      MoveEwinToDesktopAt(ewin, desks.current, ewin->x + dx, ewin->y + dy);
+   else
+      MoveEwin(ewin, ewin->x + dx, ewin->y + dy);
+
+   SoundPlay("SOUND_DEICONIFY");
+   ewin->iconified = 0;
+   ib = SelectIconboxForEwin(ewin);
+   if (ib)
      {
-       call_depth--;
-       return;
+       if (ib->animate)
+          IB_Animate(0, ewin, ib->ewin);
      }
-   if (ewin->iconified)
-     {
-       ib = SelectIconboxForEwin(ewin);
-       RemoveMiniIcon(ewin);
+   RaiseEwin(ewin);
+   ShowEwin(ewin);
+   ICCCM_DeIconify(ewin);
+   FocusToEWin(ewin, FOCUS_SET);
 
-       dx = ewin->w / 2;
-       dy = ewin->h / 2;
-       x = (ewin->x + dx) % root.w;
-       if (x < 0)
-          x += root.w;
-       x -= dx;
-       y = (ewin->y + dy) % root.h;
-       if (y < 0)
-          y += root.h;
-       y -= dy;
+   if (ewin->has_transients)
+     {
+       EWin              **lst, *e;
+       int                 i, num;
 
-       dx = x - ewin->x;
-       dy = y - ewin->y;
+       lst = ListTransientsFor(ewin->client.win, &num);
+       if (lst)
+         {
+            for (i = 0; i < num; i++)
+              {
+                 e = lst[i];
 
-       if (!ewin->sticky)
-          MoveEwinToDesktopAt(ewin, desks.current, ewin->x + dx, ewin->y + dy);
-       else
-          MoveEwin(ewin, ewin->x + dx, ewin->y + dy);
+                 if (e->iconified != 4)
+                    continue;
 
-       SoundPlay("SOUND_DEICONIFY");
-       if (ib)
-         {
-            if (ib->animate)
-               IB_Animate(0, ewin, ib->ewin);
-         }
-       RaiseEwin(ewin);
-       ShowEwin(ewin);
-       ICCCM_DeIconify(ewin);
-       FocusToEWin(ewin, FOCUS_SET);
-       if (ewin->has_transients)
-         {
-            EWin              **lst, *e;
-            int                 i, num;
-
-            lst = ListTransientsFor(ewin->client.win, &num);
-            if (lst)
-              {
-                 for (i = 0; i < num; i++)
-                   {
-                      e = lst[i];
-
-                      if (e->iconified != 4)
-                         continue;
-
-                      if (!e->sticky)
-                         MoveEwinToDesktopAt(e, desks.current,
-                                             e->x + dx, e->y + dy);
-                      else
-                         MoveEwin(e, e->x + dx, e->y + dy);
-                      RaiseEwin(e);
-                      ShowEwin(e);
-                      e->iconified = 0;
-                   }
+                 if (!e->sticky)
+                    MoveEwinToDesktopAt(e, desks.current,
+                                        e->x + dx, e->y + dy);
+                 else
+                    MoveEwin(e, e->x + dx, e->y + dy);
+                 RaiseEwin(e);
+                 ShowEwin(e);
+                 e->iconified = 0;
+              }
 #if ENABLE_GNOME
-                 HintsSetClientList();
+            HintsSetClientList();
 #endif
-                 Efree(lst);
-              }
+            Efree(lst);
          }
      }
-   call_depth--;
 
    HintsSetWindowState(ewin);
+
+   call_depth--;
    EDBUG_RETURN_;
 }
 
@@ -1279,7 +1283,7 @@
          }
        break;
      case 2:
-       /* try E first, then snap */
+       /* try E first, then snap, then app */
        if (!ewin->icon_pmm.pmap)
           IB_GetEIcon(ewin);
        if (!ewin->icon_pmm.pmap)
@@ -1289,6 +1293,8 @@
             RaiseEwin(ewin);
             IB_SnapEWin(ewin);
          }
+       if (!ewin->icon_pmm.pmap)
+          IB_GetAppIcon(ewin);
        break;
      default:
        break;
@@ -2260,7 +2266,6 @@
 void
 IB_Setup(void)
 {
-   EWin               *const *lst;
    int                 i, num;
    Iconbox           **ibl;
 
@@ -2272,12 +2277,6 @@
           IconboxShow(ibl[i]);
        Efree(ibl);
      }
-   lst = EwinListGetAll(&num);
-   for (i = 0; i < num; i++)
-     {
-       if (lst[i]->client.start_iconified)
-          IconifyEwin(lst[i]);
-     }
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -3 -r1.87 -r1.88
--- main.c      12 Apr 2004 08:28:33 -0000      1.87
+++ main.c      21 Apr 2004 20:51:42 -0000      1.88
@@ -251,8 +251,10 @@
        SoundPlay("SOUND_STARTUP");
        SoundFree("SOUND_STARTUP");
      }
+
    /* toss down the dragbar and related */
    InitDesktopControls();
+
    /* then draw all the buttons that belong on the desktop */
    ShowDesktopButtons();
 
@@ -260,16 +262,18 @@
    SessionInit();
    ShowDesktopControls();
    CheckEvent();
+
    /* retreive stuff from last time we were loaded if we're restarting */
    ICCCM_GetMainEInfo();
    SetupEnv();
    if (Conf.mapslide)
       CreateStartupDisplay(0);
-   MapUnmap(1);
+
    /* set some more hints */
    HintsSetDesktopViewport();
    desks.current = 0;
-   /* Set up the internal pagers */
+
+   /* Set up the iconboxes and pagers */
    IB_Setup();
    if (Conf.pagers.enable)
      {
@@ -279,6 +283,8 @@
        Mode.queue_up = DRAW_QUEUE_ENABLE;
      }
 
+   MapUnmap(1);
+
    /* Kill the E process owning the "init window" */
    if (Mode.wm.master && init_win_ext)
      {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -3 -r1.123 -r1.124
--- menus.c     15 Apr 2004 19:44:37 -0000      1.123
+++ menus.c     21 Apr 2004 20:51:57 -0000      1.124
@@ -131,6 +131,8 @@
    m->stuck = 0;
    m->shown = 0;
 
+   EwinWithdraw(ewin);
+
    EDBUG_RETURN_;
 }
 




-------------------------------------------------------
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