Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


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


Log Message:
Attempt to set event masks consistently.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.248
retrieving revision 1.249
diff -u -3 -r1.248 -r1.249
--- E.h 12 Apr 2004 13:57:42 -0000      1.248
+++ E.h 15 Apr 2004 19:44:34 -0000      1.249
@@ -877,6 +877,7 @@
    char                mwm_func_maximize;
    char                mwm_func_close;
    unsigned int        app_state;
+   long                event_mask;
 }
 WinClient;
 
@@ -1730,8 +1731,7 @@
 void                ChangeEwinWinpart(EWin * ewin, int i);
 void                EwinBorderDraw(EWin * ewin, int do_shape, int queue_off);
 int                 ChangeEwinWinpartContents(EWin * ewin, int i);
-EWin               *EwinCreate(void);
-void                EwinDestroy(EWin * ewin);
+void                EwinEventDestroy(EWin * ewin);
 void                EwinEventMap(EWin * ewin);
 void                EwinEventUnmap(EWin * ewin);
 void                EwinSetArea(EWin * ewin, int ax, int ay);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -3 -r1.167 -r1.168
--- borders.c   12 Apr 2004 13:57:42 -0000      1.167
+++ borders.c   15 Apr 2004 19:44:35 -0000      1.168
@@ -23,11 +23,32 @@
 #include "E.h"
 #include <sys/time.h>
 
+#define EWIN_TOP_EVENT_MASK \
+  (ButtonPressMask | ButtonReleaseMask | \
+   EnterWindowMask | LeaveWindowMask | PointerMotionMask | \
+   StructureNotifyMask)
+#define EWIN_CONTAINER_EVENT_MASK \
+  (ButtonPressMask | ButtonReleaseMask | \
+   StructureNotifyMask | ResizeRedirectMask | \
+   SubstructureNotifyMask | SubstructureRedirectMask)
+#define EWIN_BORDER_PART_EVENT_MASK \
+  (KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
+   EnterWindowMask | LeaveWindowMask | PointerMotionMask | ExposureMask)
+#define EWIN_BORDER_TITLE_EVENT_MASK \
+  (EWIN_BORDER_PART_EVENT_MASK | ExposureMask)
+
+#define EWIN_CLIENT_EVENT_MASK \
+  (EnterWindowMask | LeaveWindowMask | FocusChangeMask | \
+   StructureNotifyMask | ResizeRedirectMask | \
+   PropertyChangeMask | ColormapChangeMask)
+
 static void         EwinSetBorderInit(EWin * ewin);
 static void         EwinSetBorderTo(EWin * ewin, Border * b);
 static void         DetermineEwinArea(EWin * ewin);
-EWin               *Adopt(Window win);
-EWin               *AdoptInternal(Window win, Border * border, int type);
+static EWin        *EwinCreate(Window win);
+static EWin        *Adopt(Window win);
+static EWin        *AdoptInternal(Window win, Border * border, int type);
+static void         EwinEventsConfigure(EWin * ewin, int mode);
 
 void
 DetermineEwinFloat(EWin * ewin, int dx, int dy)
@@ -1092,15 +1113,16 @@
    EDBUG_RETURN_;
 }
 
-EWin               *
+static EWin        *
 Adopt(Window win)
 {
    EWin               *ewin;
 
    EDBUG(4, "Adopt");
+
    GrabX();
-   ewin = EwinCreate();
-   ewin->client.win = win;
+   ewin = EwinCreate(win);
+
    ICCCM_AdoptStart(ewin);
    ICCCM_GetTitle(ewin, 0);
    ICCCM_GetHints(ewin, 0);
@@ -1114,14 +1136,13 @@
    MatchEwinToSnapInfo(ewin);
    ICCCM_GetEInfo(ewin);
 
-   AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
-
    if (!ewin->border)
       EwinSetBorderInit(ewin);
    EwinSetBorderTo(ewin, NULL);
 
    ICCCM_MatchSize(ewin);
    ICCCM_Adopt(ewin);
+   EwinEventsConfigure(ewin, 0);
 
    UngrabX();
 
@@ -1134,15 +1155,16 @@
    EDBUG_RETURN(ewin);
 }
 
-EWin               *
+static EWin        *
 AdoptInternal(Window win, Border * border, int type)
 {
    EWin               *ewin;
 
    EDBUG(4, "AdoptInternal");
+
    GrabX();
-   ewin = EwinCreate();
-   ewin->client.win = win;
+   ewin = EwinCreate(win);
+
    ewin->border = border;
    ewin->internal = 1;
    ewin->type = type;
@@ -1176,14 +1198,13 @@
    ICCCM_GetGeoms(ewin, 0);
    MatchEwinToSnapInfo(ewin);
 
-   AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
-
    if (!ewin->border)
       EwinSetBorderInit(ewin);
    EwinSetBorderTo(ewin, NULL);
 
    ICCCM_MatchSize(ewin);
    ICCCM_Adopt(ewin);
+   EwinEventsConfigure(ewin, 0);
 
    UngrabX();
 
@@ -1196,8 +1217,8 @@
    EDBUG_RETURN(ewin);
 }
 
-EWin               *
-EwinCreate(void)
+static EWin        *
+EwinCreate(Window win)
 {
    EWin               *ewin;
    XSetWindowAttributes att;
@@ -1248,24 +1269,27 @@
    ewin->area_x = -1;
    ewin->area_y = -1;
 
-   att.event_mask =
-      StructureNotifyMask | ResizeRedirectMask | ButtonPressMask |
-      ButtonReleaseMask | SubstructureNotifyMask | SubstructureRedirectMask;
+   att.event_mask = EWIN_CONTAINER_EVENT_MASK;
    att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask;
    XChangeWindowAttributes(disp, ewin->win_container,
                           CWEventMask | CWDontPropagate, &att);
    EMapWindow(disp, ewin->win_container);
-   att.event_mask =
-      StructureNotifyMask | PointerMotionMask | ButtonPressMask |
-      ButtonReleaseMask | EnterWindowMask | LeaveWindowMask;
+
+   att.event_mask = EWIN_TOP_EVENT_MASK;
    att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask;
-   XChangeWindowAttributes(disp, ewin->win, CWEventMask | CWDontPropagate,
-                          &att);
+   XChangeWindowAttributes(disp, ewin->win,
+                          CWEventMask | CWDontPropagate, &att);
    FocusEwinSetGrabs(ewin);
    GrabButtonGrabs(ewin);
    EwinListAdd(&EwinListStack, ewin);
    EwinListAdd(&EwinListFocus, ewin);
 
+   ewin->client.win = win;
+   ewin->client.event_mask = EWIN_CLIENT_EVENT_MASK;
+   AddItem(ewin, "EWIN", win, LIST_TYPE_EWIN);
+
+   XShapeSelectInput(disp, win, ShapeNotifyMask);
+
    EDBUG_RETURN(ewin);
 }
 
@@ -1279,7 +1303,7 @@
       RemoveEwinFromGroup(ewin, ewin->groups[0]);
 }
 
-void
+static void
 EwinDestroy(EWin * ewin)
 {
    EWin               *ewin2;
@@ -1346,6 +1370,12 @@
 }
 
 void
+EwinEventDestroy(EWin * ewin)
+{
+   EwinDestroy(ewin);
+}
+
+void
 EwinEventMap(EWin * ewin)
 {
    ewin->mapped = 1;
@@ -1519,20 +1549,11 @@
              * OwnerGrabButtonMask
              */
             if (b->part[i].flags & FLAG_TITLE)
-              {
-                 XSelectInput(disp, ewin->bits[i].win,
-                              ExposureMask | KeyPressMask | KeyReleaseMask |
-                              ButtonPressMask | ButtonReleaseMask |
-                              EnterWindowMask | LeaveWindowMask |
-                              PointerMotionMask);
-              }
+               XSelectInput(disp, ewin->bits[i].win,
+                            EWIN_BORDER_TITLE_EVENT_MASK);
             else
-              {
-                 XSelectInput(disp, ewin->bits[i].win,
-                              KeyPressMask | KeyReleaseMask | ButtonPressMask |
-                              ButtonReleaseMask | EnterWindowMask |
-                              LeaveWindowMask | PointerMotionMask);
-              }
+               XSelectInput(disp, ewin->bits[i].win,
+                            EWIN_BORDER_PART_EVENT_MASK);
             ewin->bits[i].x = -10;
             ewin->bits[i].y = -10;
             ewin->bits[i].w = -10;
@@ -3171,87 +3192,38 @@
 EwinEventsConfigure(EWin * ewin, int mode)
 {
    int                 i;
+   long                emask;
 
    if (mode)
      {
-       XSelectInput(disp, ewin->win,
-                    SubstructureNotifyMask | SubstructureRedirectMask |
-                    PropertyChangeMask | ResizeRedirectMask);
-
-       if (ewin->pager)
-         {
-#if 0                          /* ??? */
-            XSelectInput(disp, ewin->client.win,
-                         PropertyChangeMask | FocusChangeMask |
-                         ResizeRedirectMask | StructureNotifyMask |
-                         ColormapChangeMask | ButtonPressMask |
-                         ButtonReleaseMask | PointerMotionMask);
-#endif
-         }
-       else if (ewin->dialog)
-          XSelectInput(disp, ewin->client.win,
-                       PropertyChangeMask | FocusChangeMask |
-                       ResizeRedirectMask | StructureNotifyMask |
-                       ColormapChangeMask | ExposureMask | KeyPressMask);
-       else
-          XSelectInput(disp, ewin->client.win,
-                       PropertyChangeMask | FocusChangeMask |
-                       ResizeRedirectMask | StructureNotifyMask |
-                       ColormapChangeMask);
+       emask = ~(EnterWindowMask | LeaveWindowMask);
+
+       XSelectInput(disp, ewin->win, EWIN_TOP_EVENT_MASK & emask);
+       XSelectInput(disp, ewin->client.win, ewin->client.event_mask & emask);
 
        for (i = 0; i < ewin->border->num_winparts; i++)
          {
             if (ewin->border->part[i].flags & FLAG_TITLE)
                XSelectInput(disp, ewin->bits[i].win,
-                            ExposureMask | ButtonPressMask |
-                            ButtonReleaseMask);
+                            EWIN_BORDER_TITLE_EVENT_MASK & emask);
             else
                XSelectInput(disp, ewin->bits[i].win,
-                            ButtonPressMask | ButtonReleaseMask);
+                            EWIN_BORDER_PART_EVENT_MASK & emask);
          }
      }
    else
      {
-       XSelectInput(disp, ewin->win,
-                    SubstructureNotifyMask | SubstructureRedirectMask |
-                    EnterWindowMask | LeaveWindowMask | PointerMotionMask
-                    | PropertyChangeMask | ResizeRedirectMask |
-                    ButtonPressMask | ButtonReleaseMask);
-
-       if (ewin->pager)
-          XSelectInput(disp, ewin->client.win,
-                       PropertyChangeMask | EnterWindowMask |
-                       LeaveWindowMask | FocusChangeMask |
-                       ResizeRedirectMask | StructureNotifyMask |
-                       ColormapChangeMask | ButtonPressMask |
-                       ButtonReleaseMask | PointerMotionMask);
-       else if (ewin->dialog)
-          XSelectInput(disp, ewin->client.win,
-                       PropertyChangeMask | EnterWindowMask |
-                       LeaveWindowMask | FocusChangeMask |
-                       ResizeRedirectMask | StructureNotifyMask |
-                       ColormapChangeMask | ExposureMask | KeyPressMask);
-       else
-          XSelectInput(disp, ewin->client.win,
-                       PropertyChangeMask | EnterWindowMask |
-                       LeaveWindowMask | FocusChangeMask |
-                       ResizeRedirectMask | StructureNotifyMask |
-                       ColormapChangeMask);
+       XSelectInput(disp, ewin->win, EWIN_TOP_EVENT_MASK);
+       XSelectInput(disp, ewin->client.win, ewin->client.event_mask);
 
        for (i = 0; i < ewin->border->num_winparts; i++)
          {
             if (ewin->border->part[i].flags & FLAG_TITLE)
                XSelectInput(disp, ewin->bits[i].win,
-                            ExposureMask | KeyPressMask | KeyReleaseMask |
-                            ButtonPressMask | ButtonReleaseMask |
-                            EnterWindowMask | LeaveWindowMask |
-                            PointerMotionMask);
+                            EWIN_BORDER_TITLE_EVENT_MASK);
             else
                XSelectInput(disp, ewin->bits[i].win,
-                            KeyPressMask | KeyReleaseMask |
-                            ButtonPressMask | ButtonReleaseMask |
-                            EnterWindowMask | LeaveWindowMask |
-                            PointerMotionMask);
+                            EWIN_BORDER_PART_EVENT_MASK);
          }
      }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -3 -r1.84 -r1.85
--- desktops.c  12 Apr 2004 13:57:43 -0000      1.84
+++ desktops.c  15 Apr 2004 19:44:36 -0000      1.85
@@ -25,6 +25,11 @@
 #include <time.h>
 #include <sys/time.h>
 
+#define EDESK_EVENT_MASK \
+  (KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
+   EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | \
+   SubstructureNotifyMask | SubstructureRedirectMask | PropertyChangeMask)
+
 void
 ChangeNumberOfDesktops(int quantity)
 {
@@ -283,12 +288,7 @@
          {
             d->win =
                ECreateWindow(root.win, -root.w, -root.h, root.w, root.h, 0);
-            XSelectInput(disp, d->win,
-                         SubstructureNotifyMask | ButtonPressMask |
-                         ButtonReleaseMask | EnterWindowMask | LeaveWindowMask
-                         | ButtonMotionMask | PropertyChangeMask |
-                         SubstructureRedirectMask | KeyPressMask |
-                         KeyReleaseMask | PointerMotionMask);
+            XSelectInput(disp, d->win, EDESK_EVENT_MASK);
          }
        at = XInternAtom(disp, "ENLIGHTENMENT_DESKTOP", False);
        XChangeProperty(disp, d->win, at, XA_CARDINAL, 32, PropModeReplace,
@@ -1293,12 +1293,7 @@
         PropertyChangeMask | SubstructureRedirectMask |
         ButtonPressMask | ButtonReleaseMask;
    else
-      event_mask =
-        SubstructureNotifyMask | ButtonPressMask |
-        ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
-        ButtonMotionMask | PropertyChangeMask |
-        SubstructureRedirectMask | KeyPressMask | KeyReleaseMask
-        | PointerMotionMask;
+      event_mask = EDESK_EVENT_MASK;
 
    for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
       XSelectInput(disp, desks.desk[i].win, event_mask);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/dialog.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -3 -r1.85 -r1.86
--- dialog.c    9 Apr 2004 12:59:54 -0000       1.85
+++ dialog.c    15 Apr 2004 19:44:36 -0000      1.86
@@ -685,11 +685,13 @@
 
    ewin = AddInternalToFamily(d->win, NULL, EWIN_TYPE_DIALOG, d,
                              DialogEwinInit);
-   XSelectInput(disp, d->win,
-               ExposureMask | PointerMotionMask | EnterWindowMask |
-               LeaveWindowMask | FocusChangeMask | KeyPressMask);
    if (ewin)
      {
+#if 0                          /* Do we need this? */
+       ewin->client.event_mask |=
+          KeyPressMask | PointerMotionMask | ExposureMask;
+       XSelectInput(disp, d->win, ewin->client.event_mask);
+#endif
        sn = FindSnapshot(ewin);
        /* get the size right damnit! */
        if (sn && sn->use_wh)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -3 -r1.160 -r1.161
--- evhandlers.c        7 Apr 2004 21:50:16 -0000       1.160
+++ evhandlers.c        15 Apr 2004 19:44:37 -0000      1.161
@@ -666,7 +666,7 @@
    ewin = RemoveItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    if (ewin)
      {
-       EwinDestroy(ewin);
+       EwinEventDestroy(ewin);
        EDBUG_RETURN_;
      }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- icccm.c     7 Apr 2004 21:50:17 -0000       1.58
+++ icccm.c     15 Apr 2004 19:44:37 -0000      1.59
@@ -392,19 +392,12 @@
 {
    Window              win = ewin->client.win;
    unsigned long       c[2] = { 0, 0 };
-   XWindowAttributes   att;
 
    EDBUG(6, "ICCCM_Adopt");
 
    if (!ewin->internal)
       XSetWindowBorderWidth(disp, win, 0);
    EReparentWindow(disp, win, ewin->win_container, 0, 0);
-   XGetWindowAttributes(disp, win, &att);
-   XSelectInput(disp, win,
-               att.your_event_mask | PropertyChangeMask | EnterWindowMask |
-               LeaveWindowMask | FocusChangeMask | ResizeRedirectMask |
-               StructureNotifyMask | ColormapChangeMask);
-   XShapeSelectInput(disp, win, ShapeNotifyMask);
    c[0] = (ewin->client.start_iconified) ? IconicState : NormalState;
    XChangeProperty(disp, win, E_XA_WM_STATE, E_XA_WM_STATE, 32, PropModeReplace,
                   (unsigned char *)c, 2);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -3 -r1.122 -r1.123
--- menus.c     12 Apr 2004 08:28:33 -0000      1.122
+++ menus.c     15 Apr 2004 19:44:37 -0000      1.123
@@ -323,6 +323,11 @@
                              MenuEwinInit);
    if (ewin)
      {
+#if 0                          /* Do we need this? */
+       ewin->client.event_mask |= PointerMotionMask;
+       XSelectInput(disp, m->win, ewin->client.event_mask);
+#endif
+
        ewin->head = head_num;
        if (Conf.menuslide)
           InstantShadeEwin(ewin, 0);
@@ -651,8 +656,6 @@
    maxx2 = 0;
    has_i = 0;
    has_s = 0;
-   att.event_mask = PointerMotionMask;
-   XChangeWindowAttributes(disp, m->win, CWEventMask, &att);
    att.event_mask =
       ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask
       | PointerMotionMask;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -3 -r1.84 -r1.85
--- pager.c     12 Apr 2004 08:28:34 -0000      1.84
+++ pager.c     15 Apr 2004 19:44:38 -0000      1.85
@@ -198,8 +198,6 @@
    p->pmap = ECreatePixmap(disp, p->win, p->w, p->h, root.depth);
    p->bgpmap = ECreatePixmap(disp, p->win, p->w / ax, p->h / ay, root.depth);
    ESetWindowBackgroundPixmap(disp, p->win, p->pmap);
-   XSelectInput(disp, p->win,
-               ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
    p->hi_win = ECreateWindow(root.win, 0, 0, 3, 3, 0);
    p->hi_visible = 0;
    p->hi_ewin = NULL;
@@ -346,6 +344,12 @@
        Snapshot           *sn;
        double              aspect;
 
+#if 1                          /* Do we need this? */
+       ewin->client.event_mask |=
+          ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
+       XSelectInput(disp, p->win, ewin->client.event_mask);
+#endif
+
        aspect = ((double)root.w) / ((double)root.h);
        GetAreaSize(&ax, &ay);
        ewin->client.aspect_min = aspect * ((double)ax / (double)ay);




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