Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
      Tag: branch-exp
        E.h events.c ewin-ops.c ewins.c gnome.c icccm.c menus.c mwm.c 
        session.c x.c 


Log Message:
Fix menus, cleanups.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.314.2.62
retrieving revision 1.314.2.63
diff -u -3 -r1.314.2.62 -r1.314.2.63
--- E.h 21 Nov 2004 22:15:19 -0000      1.314.2.62
+++ E.h 23 Nov 2004 23:46:20 -0000      1.314.2.63
@@ -692,6 +692,7 @@
 #define EWIN_TYPE_PAGER         0x08
 
 #define EwinIsMapped(ewin) (ewin->state >= EWIN_STATE_MAPPED)
+#define EwinIsInternal(ewin) (ewin->type != EWIN_TYPE_NORMAL)
 
 struct _ewin
 {
@@ -701,7 +702,6 @@
    int                 lx, ly, lw, lh, ll;
    char                type;
    char                state;
-   char                internal;
    char                toggle;
    Window              win_container;
    WinClient           client;
@@ -1047,7 +1047,6 @@
    int                 start_x, start_y;
    char                have_place_grab;
    char                action_inhibit;
-   char                justclicked;
    EWin               *focuswin;
    EWin               *mouse_over_ewin;
    EWin               *context_ewin;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.69.2.18
retrieving revision 1.69.2.19
diff -u -3 -r1.69.2.18 -r1.69.2.19
--- events.c    31 Oct 2004 19:47:11 -0000      1.69.2.18
+++ events.c    23 Nov 2004 23:46:25 -0000      1.69.2.19
@@ -322,13 +322,9 @@
        /* This shouldn't be here */
        GrabPointerRelease();
 
-       if (MenusActive() && (!Mode.justclicked))
-          MenusHide();
-
        if ((Mode.slideout) && (pslideout))
           SlideoutHide(Mode.slideout);
 
-       Mode.justclicked = 0;
        Mode.last_bpress = 0;
        Mode.action_inhibit = 0;
        break;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewin-ops.c,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -u -3 -r1.1.2.17 -r1.1.2.18
--- ewin-ops.c  30 Oct 2004 15:04:27 -0000      1.1.2.17
+++ ewin-ops.c  23 Nov 2004 23:46:26 -0000      1.1.2.18
@@ -1222,8 +1222,8 @@
 
        if (on)
          {
-            if (ewin->internal || ewin->iconified || ewin->props.donthide ||
-                ewin->client.transient)
+            if (EwinIsInternal(ewin) || ewin->iconified || ewin->props.donthide
+                || ewin->client.transient)
                continue;
 
             ewin->st.showingdesk = 1;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewins.c,v
retrieving revision 1.1.2.29
retrieving revision 1.1.2.30
diff -u -3 -r1.1.2.29 -r1.1.2.30
--- ewins.c     21 Nov 2004 22:15:20 -0000      1.1.2.29
+++ ewins.c     23 Nov 2004 23:46:26 -0000      1.1.2.30
@@ -156,7 +156,8 @@
       Eprintf("EwinDestroy %#lx state=%d\n", ewin->client.win, ewin->state);
 
    RemoveItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
-   EUnregisterWindow(disp, ewin->client.win);
+   EventCallbackUnregister(ewin->client.win, 0, EwinHandleEventsClient, ewin);
+
    EobjListStackDel(&ewin->o);
    EobjListFocusDel(&ewin->o);
 
@@ -541,7 +542,6 @@
    ewin = EwinCreate(win);
 
    ewin->border = border;
-   ewin->internal = 1;
    ewin->type = type;
    switch (type)
      {
@@ -1735,7 +1735,7 @@
    for (i = num - 1; i >= 0; i--)
      {
        ewin = lst[i];
-       if (ewin->internal)
+       if (EwinIsInternal(ewin))
           continue;
 
        /* This makes E determine the client window stacking at exit */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/gnome.c,v
retrieving revision 1.39.2.5
retrieving revision 1.39.2.6
diff -u -3 -r1.39.2.5 -r1.39.2.6
--- gnome.c     21 Oct 2004 17:25:46 -0000      1.39.2.5
+++ gnome.c     23 Nov 2004 23:46:26 -0000      1.39.2.6
@@ -290,8 +290,10 @@
    Pixmap              mask;
 
    EDBUG(6, "GNOME_GetHintIcons");
-   if (ewin->internal)
+
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
+
    if (!atom_get)
       atom_get = XInternAtom(disp, XA_WIN_ICONS, False);
    if ((atom_change) && (atom_change != atom_get))
@@ -317,8 +319,10 @@
    int                 size;
 
    EDBUG(6, "GNOME_GetHintLayer");
-   if (ewin->internal)
+
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
+
    if (!atom_get)
       atom_get = XInternAtom(disp, XA_WIN_LAYER, False);
    if ((atom_change) && (atom_change != atom_get))
@@ -341,8 +345,10 @@
    int                 size;
 
    EDBUG(6, "GNOME_GetHintState");
-   if (ewin->internal)
+
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
+
    if (!atom_get)
       atom_get = XInternAtom(disp, XA_WIN_STATE, False);
    if ((atom_change) && (atom_change != atom_get))
@@ -372,8 +378,10 @@
 
    /* have nothing interesting to do with an app state (lamp) right now */
    EDBUG(6, "GNOME_GetHintAppState");
-   if (ewin->internal)
+
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
+
    if (!atom_get)
       atom_get = XInternAtom(disp, XA_WIN_APP_STATE, False);
    if ((atom_change) && (atom_change != atom_get))
@@ -395,8 +403,10 @@
    int                *desk;
 
    EDBUG(6, "GNOME_GetHintDesktop");
-   if (ewin->internal)
+
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
+
    if (!atom_get)
       atom_get = XInternAtom(disp, XA_WIN_WORKSPACE, False);
    if ((atom_change) && (atom_change != atom_get))
@@ -421,8 +431,10 @@
 
    /* E doesn't really care about these hints right now */
    EDBUG(6, "GNOME_GetHint");
-   if (ewin->internal)
+
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
+
    if (!atom_get)
       atom_get = XInternAtom(disp, XA_WIN_HINTS, False);
    if ((atom_change) && (atom_change != atom_get))
@@ -511,8 +523,10 @@
    int                 size;
 
    EDBUG(6, "GNOME_GetExpandedSize");
-   if (ewin->internal)
+
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
+
    if (!atom_get)
       atom_get = XInternAtom(disp, XA_WIN_EXPANDED_SIZE, False);
    if ((atom_change) && (atom_change != atom_get))
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.76.2.13
retrieving revision 1.76.2.14
diff -u -3 -r1.76.2.13 -r1.76.2.14
--- icccm.c     30 Oct 2004 15:04:27 -0000      1.76.2.13
+++ icccm.c     23 Nov 2004 23:46:28 -0000      1.76.2.14
@@ -133,7 +133,7 @@
          }
        XFree(xtp.value);
      }
-   else if (!ewin->internal)
+   else if (!EwinIsInternal(ewin))
      {
        ewin->icccm.wm_name = Estrdup("No Title");
      }
@@ -152,7 +152,7 @@
 
    EDBUG(6, "ICCCM_GetColormap");
 
-   if (ewin->internal)
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
 
    win = ewin->client.win;
@@ -173,7 +173,7 @@
 void
 ICCCM_Delete(EWin * ewin)
 {
-   if (ewin->internal)
+   if (EwinIsInternal(ewin))
      {
        EUnmapWindow(disp, ewin->client.win);
        return;
@@ -189,7 +189,7 @@
 void
 ICCCM_Save(EWin * ewin)
 {
-   if (ewin->internal)
+   if (EwinIsInternal(ewin))
       return;
 
    ecore_x_icccm_send_save_yourself(ewin->client.win);
@@ -350,7 +350,7 @@
 {
    Window              win = ewin->client.win;
 
-   if (!ewin->internal)
+   if (!EwinIsInternal(ewin))
       XAddToSaveSet(disp, win);
 }
 
@@ -359,7 +359,7 @@
 {
    Window              win = ewin->client.win;
 
-   if (!ewin->internal)
+   if (!EwinIsInternal(ewin))
      {
        XSetWindowBorderWidth(disp, win, 0);
        ewin->client.bw = 0;
@@ -397,7 +397,7 @@
 
    ICCCM_GetColormap(ewin);
 
-   if (ewin->internal)
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
 
    if ((ewin->client.cmap) && (Mode.current_cmap != ewin->client.cmap))
@@ -769,7 +769,7 @@
 
    EDBUG(6, "ICCCM_GetHints");
 
-   if (ewin->internal)
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
 
    MWM_GetHints(ewin, atom_change);
@@ -1014,8 +1014,10 @@
    CARD32              c[8];
 
    EDBUG(6, "ICCCM_SetEInfo");
-   if (ewin->internal)
+
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
+
    if (!a)
       a = XInternAtom(disp, "ENL_INTERNAL_DATA", False);
    if (!aa)
@@ -1124,7 +1126,8 @@
    unsigned char      *puc;
 
    EDBUG(6, "ICCCM_GetEInfo");
-   if (ewin->internal)
+
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN(0);
 
    if (!a)
@@ -1185,7 +1188,7 @@
 
    lst = EwinListGetAll(&num);
    for (i = 0; i < num; i++)
-      if (!(lst[i]->internal))
+      if (!EwinIsInternal(lst[i]))
         ICCCM_SetEInfo(lst[i]);
 
    ICCCM_SetMainEInfo();
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.147.2.20
retrieving revision 1.147.2.21
diff -u -3 -r1.147.2.20 -r1.147.2.21
--- menus.c     20 Nov 2004 20:48:58 -0000      1.147.2.20
+++ menus.c     23 Nov 2004 23:46:39 -0000      1.147.2.21
@@ -23,12 +23,15 @@
 #include "E.h"
 #include <X11/keysym.h>
 
+#define DEBUG_MENU_EVENTS 0
+
 struct
 {
    EWin               *context_ewin;
    int                 current_depth;
    Menu               *list[256];
    char                clicked;
+   char                just_shown;
    Window              cover_win;
    Window              win_covered;
 } Mode_menus;
@@ -98,6 +101,7 @@
 
 static void         MenuHandleEvents(XEvent * ev, void *m);
 static void         MenuItemHandleEvents(XEvent * ev, void *mi);
+static void         MenuMaskerHandleEvents(XEvent * ev, void *prm);
 
 static Menu        *active_menu = NULL;
 static MenuItem    *active_item = NULL;
@@ -109,6 +113,9 @@
 
    rc = XGrabKeyboard(disp, win, False, GrabModeAsync, GrabModeAsync,
                      CurrentTime);
+#if DEBUG_MENU_EVENTS
+   Eprintf("GrabKeyboard %#lx %d\n", win, rc);
+#endif
 }
 
 static void
@@ -117,6 +124,9 @@
    int                 rc;
 
    rc = XUngrabKeyboard(disp, CurrentTime);
+#if DEBUG_MENU_EVENTS
+   Eprintf("UngrabKeyboard %d\n", rc);
+#endif
 }
 
 Menu               *
@@ -225,6 +235,8 @@
    ewin->Close = MenuEwinClose;
 }
 
+static void         MenuShowMasker(Menu * m);
+
 static void
 MenuShow(Menu * m, char noshow)
 {
@@ -235,6 +247,7 @@
    int                 head_num = 0;
 
    EDBUG(5, "MenuShow");
+
    if ((m->num <= 0) || (!m->style))
       EDBUG_RETURN_;
 
@@ -369,15 +382,25 @@
    if (!FindMenu(m->win))
       AddItem(m, m->name, m->win, LIST_TYPE_MENU);
 
+   Mode_menus.just_shown = 1;
+
    m->shown = 1;
    if (Mode_menus.current_depth == 0)
      {
        Mode_menus.context_ewin = GetContextEwin();
+#if 0
        Eprintf("Mode_menus.context_ewin set %s\n",
                EwinGetTitle(Mode_menus.context_ewin));
+#endif
        ecore_x_sync();
+#if 1                          /* ??? */
+       Mode_menus.list[0] = m;
+       Mode_menus.current_depth = 1;
+       MenuShowMasker(m);
+#endif
        GrabKeyboard(m->win);
      }
+   m->ref_count++;
 
    EDBUG_RETURN_;
 }
@@ -1003,6 +1026,8 @@
                     LeaveWindowMask);
        XRestackWindows(disp, wl, 2);
        EMapWindow(disp, Mode_menus.cover_win);
+       EventCallbackRegister(Mode_menus.cover_win, 0, MenuMaskerHandleEvents,
+                             NULL);
      }
 }
 
@@ -1029,6 +1054,7 @@
      {
        if (!FindEwinByMenu(m)) /* Don't show if already shown */
           MenuShow(m, 0);
+#if 0
        Mode_menus.list[0] = m;
        Mode_menus.current_depth = 1;
        MenuShowMasker(m);
@@ -1039,6 +1065,7 @@
        Mode_menus.list[0] = NULL;
        Mode_menus.current_depth = 0;
        MenuHideMasker();
+#endif
      }
 
    EDBUG_RETURN_;
@@ -1139,9 +1166,11 @@
             MoveEwin(ewin, lx, ly);
             ShowEwin(ewin);
          }
+#if 0
        Mode_menus.list[0] = m;
        Mode_menus.current_depth = 1;
        MenuShowMasker(m);
+#endif
      }
 
    EDBUG_RETURN(m);
@@ -1171,6 +1200,7 @@
      {
        if (!FindEwinByMenu(m))
           MenuShow(m, 0);
+#if 0
        Mode_menus.list[0] = m;
        Mode_menus.current_depth = 1;
        MenuShowMasker(m);
@@ -1180,6 +1210,7 @@
        Mode_menus.list[0] = NULL;
        Mode_menus.current_depth = 0;
        MenuHideMasker();
+#endif
      }
 
    EDBUG_RETURN_;
@@ -1369,31 +1400,7 @@
    Menu               *m;
    EWin               *ewin;
 
-#if 1                          /* Previously in HandleMouseDown() ??? */
-   if (MenusActive() && (!Mode_menus.clicked))
-     {
-       unsigned int        bmask = 0, evmask;
-
-       evmask =
-          ev->xbutton.state & (Button1Mask | Button2Mask | Button3Mask |
-                               Button4Mask | Button5Mask);
-       if (ev->xbutton.button == 1)
-          bmask = Button1Mask;
-       else if (ev->xbutton.button == 2)
-          bmask = Button2Mask;
-       else if (ev->xbutton.button == 3)
-          bmask = Button3Mask;
-       else if (ev->xbutton.button == 4)
-          bmask = Button4Mask;
-       else if (ev->xbutton.button == 5)
-          bmask = Button5Mask;
-
-       if (bmask != evmask)
-          Mode_menus.clicked = 1;
-       else
-          EDBUG_RETURN_;
-     }
-#endif
+   Mode_menus.just_shown = 0;
 
    m = mi->menu;
    mi->state = STATE_CLICKED;
@@ -1405,9 +1412,11 @@
        unsigned int        mw, mh;
        EWin               *ewin2;
 
+#if 0
        Mode_menus.list[0] = m;
        Mode_menus.current_depth = 1;
        MenuShowMasker(m);
+#endif
        ewin = FindEwinByMenu(m);
        if (ewin)
          {
@@ -1443,16 +1452,12 @@
 MenuItemEventMouseUp(MenuItem * mi, XEvent * ev __UNUSED__)
 {
    Menu               *m;
-   EWin               *ewin;
 
-#if 1                          /* Previously in HandleMouseUp() ??? */
-   if ((((float)(ev->xbutton.time - Mode.last_time) / 1000) < 0.5)
-       && (MenusActive()) && (!Mode_menus.clicked))
+   if (Mode_menus.just_shown)
      {
-       Mode_menus.clicked = 1;
-       Mode.justclicked = 1;
+       Mode_menus.just_shown = 0;
+       return;
      }
-#endif
 
    m = mi->menu;
 
@@ -1460,7 +1465,7 @@
      {
        mi->state = STATE_HILITED;
        MenuDrawItem(m, mi, 1);
-       if ((mi->params) && (!Mode.justclicked))
+       if ((mi->params) /* && (!Mode_menus.just_shown) */ )
          {
             MenusHide();
             SetContextEwin(Mode_menus.context_ewin);
@@ -1469,41 +1474,6 @@
             return;
          }
      }
-
-   if (MenusActive() && (!Mode_menus.clicked))
-     {
-       if (!m)
-         {
-            Window              ww;
-
-            ww = WindowAtXY(Mode.x, Mode.y);
-            if ((ewin = FindEwinByChildren(ww)))
-              {
-                 int                 i;
-
-                 for (i = 0; i < ewin->border->num_winparts; i++)
-                   {
-                      if (ww == ewin->bits[i].win)
-                        {
-                           if ((ewin->border->part[i].flags & FLAG_TITLE) &&
-                               (ewin->type == EWIN_TYPE_MENU))
-                             {
-                                ((Menu *) (ewin->data))->stuck = 1;
-                                i = ewin->border->num_winparts;
-                             }
-                        }
-                   }
-              }
-         }
-       MenusHide();
-       return;
-     }
-
-   if (MenusActive() && (!Mode.justclicked))
-     {
-       MenusHide();
-       return;
-     }
 }
 
 #if 0                          /* Was in HandleMotion() */
@@ -1885,6 +1855,9 @@
 {
    Menu               *m = (Menu *) prm;
 
+#if DEBUG_MENU_EVENTS
+   Eprintf("MenuHandleEvents %d\n", ev->type);
+#endif
    switch (ev->type)
      {
      case KeyPress:
@@ -1892,6 +1865,9 @@
        break;
      case ButtonRelease:
        break;
+     case EnterNotify:
+       GrabKeyboard(m->win);
+       break;
      }
 }
 
@@ -1900,6 +1876,9 @@
 {
    MenuItem           *mi = (MenuItem *) prm;
 
+#if DEBUG_MENU_EVENTS
+   Eprintf("MenuItemHandleEvents %d\n", ev->type);
+#endif
    switch (ev->type)
      {
      case ButtonPress:
@@ -1917,6 +1896,20 @@
      }
 }
 
+static void
+MenuMaskerHandleEvents(XEvent * ev, void *prm __UNUSED__)
+{
+#if DEBUG_MENU_EVENTS
+   Eprintf("MenuMaskerHandleEvents %d\n", ev->type);
+#endif
+   switch (ev->type)
+     {
+     case ButtonRelease:
+       MenusHide();
+       break;
+     }
+}
+
 /*
  * Configuration load/save
  */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/mwm.c,v
retrieving revision 1.21
retrieving revision 1.21.2.1
diff -u -3 -r1.21 -r1.21.2.1
--- mwm.c       5 Jul 2004 11:25:20 -0000       1.21
+++ mwm.c       23 Nov 2004 23:46:42 -0000      1.21.2.1
@@ -78,7 +78,7 @@
 
    EDBUG(6, "MWM_GetHints");
 
-   if (ewin->internal)
+   if (EwinIsInternal(ewin))
       EDBUG_RETURN_;
 
    if (!_MOTIF_WM_HINTS)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/session.c,v
retrieving revision 1.75.2.15
retrieving revision 1.75.2.16
diff -u -3 -r1.75.2.15 -r1.75.2.16
--- session.c   20 Oct 2004 21:04:11 -0000      1.75.2.15
+++ session.c   23 Nov 2004 23:46:42 -0000      1.75.2.16
@@ -88,7 +88,7 @@
    for (i = 0; i < num; i++)
      {
        ewin = lst[i];
-       if ((!(ewin->internal))
+       if ((!EwinIsInternal(ewin))
            && ((ewin->icccm.wm_command) || (ewin->session_id)))
          {
             x = 0;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.71.2.12
retrieving revision 1.71.2.13
diff -u -3 -r1.71.2.12 -r1.71.2.13
--- x.c 26 Sep 2004 20:09:51 -0000      1.71.2.12
+++ x.c 23 Nov 2004 23:46:44 -0000      1.71.2.13
@@ -73,7 +73,7 @@
       XFree(xid->rects);
 #if 0
    if (xid->cbl.lst)
-      Eprintf("EventCallbacksUnregister: %p %#lx\n", xid, win);
+      Eprintf("EXidDestroy: %p %#lx\n", xid, xid->win);
 #endif
    if (xid->cbl.lst)
       Efree(xid->cbl.lst);




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to