Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h alert.c edge.c events.c extinitwin.c x.c 


Log Message:
Event handling fixes and tweaks (avoid graphics exposure events). Cleanups.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.379
retrieving revision 1.380
diff -u -3 -r1.379 -r1.380
--- E.h 27 Feb 2005 14:42:25 -0000      1.379
+++ E.h 2 Mar 2005 19:20:25 -0000       1.380
@@ -2234,8 +2234,9 @@
 #define EClearArea(win, x, y, w, h, exp) XClearArea(disp, win, x, y, w, h, exp)
 #define ECreatePixmap(draw, w, h, dep) XCreatePixmap(disp, draw, w, h, dep)
 #define EFreePixmap(pmap) XFreePixmap(disp, pmap)
-#define ECreateGC(draw, mask, val) XCreateGC(disp, draw, mask, val)
-#define EFreeGC(gc) XFreeGC(disp, gc)
+
+GC                  ECreateGC(Drawable d, unsigned long mask, XGCValues * val);
+int                 EFreeGC(GC gc);
 
 void                ESetColor(XColor * pxc, int r, int g, int b);
 void                EGetColor(const XColor * pxc, int *pr, int *pg, int *pb);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/alert.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- alert.c     2 Feb 2005 17:11:29 -0000       1.40
+++ alert.c     2 Mar 2005 19:20:26 -0000       1.41
@@ -237,28 +237,24 @@
    mask = CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWSaveUnder |
       CWBackingStore;
    win = XCreateWindow(dd, DefaultRootWindow(dd), -100, -100, 1, 1, 0,
-                      DefaultDepth(dd, DefaultScreen(dd)), InputOutput,
-                      DefaultVisual(dd, DefaultScreen(dd)), mask, &att);
+                      CopyFromParent, InputOutput, CopyFromParent, mask, &att);
 
    if (sscanf(str1, "%s", line) > 0)
      {
-       b1 = XCreateWindow(dd, win, -100, -100, 1, 1, 0,
-                          DefaultDepth(dd, DefaultScreen(dd)), InputOutput,
-                          DefaultVisual(dd, DefaultScreen(dd)), mask, &att);
+       b1 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
+                          InputOutput, CopyFromParent, mask, &att);
        XMapWindow(dd, b1);
      }
    if (sscanf(str2, "%s", line) > 0)
      {
-       b2 = XCreateWindow(dd, win, -100, -100, 1, 1, 0,
-                          DefaultDepth(dd, DefaultScreen(dd)), InputOutput,
-                          DefaultVisual(dd, DefaultScreen(dd)), mask, &att);
+       b2 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
+                          InputOutput, CopyFromParent, mask, &att);
        XMapWindow(dd, b2);
      }
    if (sscanf(str3, "%s", line) > 0)
      {
-       b3 = XCreateWindow(dd, win, -100, -100, 1, 1, 0,
-                          DefaultDepth(dd, DefaultScreen(dd)), InputOutput,
-                          DefaultVisual(dd, DefaultScreen(dd)), mask, &att);
+       b3 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
+                          InputOutput, CopyFromParent, mask, &att);
        XMapWindow(dd, b3);
      }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/edge.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- edge.c      2 Feb 2005 17:11:52 -0000       1.11
+++ edge.c      2 Mar 2005 19:20:26 -0000       1.12
@@ -22,8 +22,6 @@
  */
 #include "E.h"
 
-extern char         throw_move_events_away;
-
 static Window       w1 = 0, w2 = 0, w3 = 0, w4 = 0;
 
 static void
@@ -46,7 +44,6 @@
    if (ewin && ewin->st.fullscreen)
       return;
 
-   throw_move_events_away = 1;
    DeskGetCurrentArea(&ax, &ay);
    GetAreaSize(&aw, &ah);
    dx = 0;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -3 -r1.78 -r1.79
--- events.c    22 Feb 2005 21:04:20 -0000      1.78
+++ events.c    2 Mar 2005 19:20:26 -0000       1.79
@@ -56,8 +56,6 @@
 static int          error_base_render = 0;
 #endif
 
-char                throw_move_events_away = 0;
-
 static int          evq_num = 0;
 static XEvent      *evq_ptr = NULL;
 
@@ -366,7 +364,7 @@
 #endif
 
    /* Loop through event list, starting with latest */
-   for (i = count - 1; i > 0; i--)
+   for (i = count - 1; i >= 0; i--)
      {
        ev = evq + i;
 
@@ -377,10 +375,8 @@
             break;
 
          case MotionNotify:
-            if (throw_move_events_away)        /* Discard all motion events */
-               j = i;
-            else               /* Discard all but last motion event */
-               j = i - 1;
+            /* Discard all but last motion event */
+            j = i - 1;
             n = 0;
             for (; j >= 0; j--)
               {
@@ -438,26 +434,32 @@
 #endif
             break;
 
-         default:
-            if (ev->type == event_base_shape + ShapeNotify)
+         case EX_EVENT_SHAPE_NOTIFY:
+            n = 0;
+            for (j = i - 1; j >= 0; j--)
               {
-                 n = 0;
-                 for (j = i - 1; j >= 0; j--)
+                 ev2 = evq + j;
+                 if (ev2->type == ev->type &&
+                     ev2->xany.window == ev->xany.window)
                    {
-                      ev2 = evq + j;
-                      if (ev2->type == ev->type &&
-                          ev2->xany.window == ev->xany.window)
-                        {
-                           n++;
-                           ev2->type = 0;
-                        }
+                      n++;
+                      ev2->type = 0;
                    }
+              }
 #if ENABLE_DEBUG_EVENTS
-                 if (n && EventDebug(EDBUG_TYPE_COMPRESSION))
-                    Eprintf("EventsCompress n=%4d %s %#lx\n",
-                            n, EventName(ev->type), ev->xmotion.window);
+            if (n && EventDebug(EDBUG_TYPE_COMPRESSION))
+               Eprintf("EventsCompress n=%4d %s %#lx\n",
+                       n, EventName(ev->type), ev->xmotion.window);
 #endif
-              }
+            break;
+
+         case GraphicsExpose:
+         case NoExpose:
+            /* Not using these */
+            ev->type = 0;
+            break;
+
+         default:
             break;
          }
      }
@@ -859,7 +861,6 @@
      case KeymapNotify:
      case Expose:
      case GraphicsExpose:
-     case NoExpose:
        Eprintf("%#08lx EV-%s: win=%#lx %d+%d %dx%d\n", ser, name, win,
                ev->xexpose.x, ev->xexpose.y,
                ev->xexpose.width, ev->xexpose.height);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/extinitwin.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- extinitwin.c        22 Feb 2005 21:44:36 -0000      1.5
+++ extinitwin.c        2 Mar 2005 19:20:27 -0000       1.6
@@ -59,8 +59,8 @@
    attr.border_pixel = 0;
    attr.background_pixel = 0;
    attr.save_under = True;
-   win = XCreateWindow(disp, VRoot.win, 0, 0, VRoot.w, VRoot.h, 0, VRoot.depth,
-                      InputOutput, VRoot.vis,
+   win = XCreateWindow(disp, VRoot.win, 0, 0, VRoot.w, VRoot.h, 0,
+                      CopyFromParent, InputOutput, CopyFromParent,
                       CWOverrideRedirect | CWSaveUnder | CWBackingStore |
                       CWColormap | CWBackPixel | CWBorderPixel, &attr);
 
@@ -91,8 +91,8 @@
       Cursor              cs = 0;
       XColor              cl;
 
-      w2 = XCreateWindow(disp, win, 0, 0, 32, 32, 0, VRoot.depth, InputOutput,
-                        VRoot.vis,
+      w2 = XCreateWindow(disp, win, 0, 0, 32, 32, 0, CopyFromParent,
+                        InputOutput, CopyFromParent,
                         CWOverrideRedirect | CWBackingStore | CWColormap |
                         CWBackPixel | CWBorderPixel, &attr);
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -3 -r1.79 -r1.80
--- x.c 22 Feb 2005 21:45:25 -0000      1.79
+++ x.c 2 Mar 2005 19:20:27 -0000       1.80
@@ -264,8 +264,8 @@
       attr.save_under = True;
    else
       attr.save_under = False;
-   win = XCreateWindow(disp, parent, x, y, w, h, 0, VRoot.depth, InputOutput,
-                      VRoot.vis,
+   win = XCreateWindow(disp, parent, x, y, w, h, 0,
+                      CopyFromParent, InputOutput, CopyFromParent,
                       CWOverrideRedirect | CWSaveUnder | CWBackingStore |
                       CWColormap | CWBackPixmap | CWBorderPixel, &attr);
    EXidSet(win, parent, x, y, w, h, VRoot.depth);
@@ -273,6 +273,53 @@
    return win;
 }
 
+Window
+ECreateEventWindow(Window parent, int x, int y, int w, int h)
+{
+   Window              win;
+   XSetWindowAttributes attr;
+
+   attr.override_redirect = False;
+   win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly,
+                      CopyFromParent, CWOverrideRedirect, &attr);
+   EXidSet(win, parent, x, y, w, h, VRoot.depth);
+
+   return win;
+}
+
+#if 0                          /* Not used */
+/*
+ * create a window which will accept the keyboard focus when no other 
+ * windows have it
+ */
+Window
+ECreateFocusWindow(Window parent, int x, int y, int w, int h)
+{
+   Window              win;
+   XSetWindowAttributes attr;
+
+   attr.backing_store = NotUseful;
+   attr.override_redirect = True;
+   attr.colormap = VRoot.cmap;
+   attr.border_pixel = 0;
+   attr.background_pixel = 0;
+   attr.save_under = False;
+   attr.event_mask = KeyPressMask | FocusChangeMask;
+
+   win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly,
+                      CopyFromParent,
+                      CWOverrideRedirect | CWSaveUnder | CWBackingStore |
+                      CWColormap | CWBackPixel | CWBorderPixel | CWEventMask,
+                      &attr);
+
+   XSetWindowBackground(disp, win, 0);
+   XMapWindow(disp, win);
+   XSetInputFocus(disp, win, RevertToParent, CurrentTime);
+
+   return win;
+}
+#endif
+
 void
 EMoveWindow(Window win, int x, int y)
 {
@@ -814,59 +861,39 @@
       XSetWindowBackground(disp, win, col);
 }
 
-Window
-ECreateEventWindow(Window parent, int x, int y, int w, int h)
+void
+ESelectInputAdd(Window win, long mask)
 {
-   Window              win;
-   XSetWindowAttributes attr;
-
-   attr.override_redirect = False;
-   win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly, VRoot.vis,
-                      CWOverrideRedirect, &attr);
-   EXidSet(win, parent, x, y, w, h, VRoot.depth);
+   XWindowAttributes   xwa;
 
-   return win;
+   XGetWindowAttributes(disp, win, &xwa);
+   xwa.your_event_mask |= mask;
+   XSelectInput(disp, win, xwa.your_event_mask);
 }
 
-/*
- * create a window which will accept the keyboard focus when no other 
- * windows have it
- */
-Window
-ECreateFocusWindow(Window parent, int x, int y, int w, int h)
+GC
+ECreateGC(Drawable d, unsigned long mask, XGCValues * val)
 {
-   Window              win;
-   XSetWindowAttributes attr;
-
-   attr.backing_store = NotUseful;
-   attr.override_redirect = True;
-   attr.colormap = VRoot.cmap;
-   attr.border_pixel = 0;
-   attr.background_pixel = 0;
-   attr.save_under = False;
-   attr.event_mask = KeyPressMask | FocusChangeMask;
+   XGCValues           xgcv;
 
-   win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly,
-                      CopyFromParent,
-                      CWOverrideRedirect | CWSaveUnder | CWBackingStore |
-                      CWColormap | CWBackPixel | CWBorderPixel | CWEventMask,
-                      &attr);
-
-   XSetWindowBackground(disp, win, 0);
-   XMapWindow(disp, win);
-   XSetInputFocus(disp, win, RevertToParent, CurrentTime);
-
-   return win;
+   if (val)
+     {
+       mask |= GCGraphicsExposures;
+       val->graphics_exposures = False;
+     }
+   else
+     {
+       mask = GCGraphicsExposures;
+       val = &xgcv;
+       val->graphics_exposures = False;
+     }
+   return XCreateGC(disp, d, mask, val);
 }
 
-void
-ESelectInputAdd(Window win, long mask)
+int
+EFreeGC(GC gc)
 {
-   XWindowAttributes   xwa;
-
-   XGetWindowAttributes(disp, win, &xwa);
-   xwa.your_event_mask |= mask;
-   XSelectInput(disp, win, xwa.your_event_mask);
+   return XFreeGC(disp, gc);
 }
 
 void




-------------------------------------------------------
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://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to