Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h events.c
Log Message:
events.c cosmetics: Make local functions static.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -3 -r1.124 -r1.125
--- E.h 11 Jul 2003 18:36:50 -0000 1.124
+++ E.h 11 Jul 2003 19:45:53 -0000 1.125
@@ -1935,9 +1935,6 @@
int GetPointerScreenGeometry(int *px, int *py, int *pw,
int *ph);
-char *NukeBoringevents(XEvent * ev, int num);
-void DebugEvent(XEvent * ev);
-void HandleEvent(XEvent * ev);
void CheckEvent(void);
void WaitEvent(void);
@@ -2488,41 +2485,6 @@
void BadThemeDialog(void);
char *FindTheme(char *theme);
char *ExtractTheme(char *theme);
-
-void HKeyPress(XEvent * ev);
-void HKeyRelease(XEvent * ev);
-void HButtonPress(XEvent * ev);
-void HButtonRelease(XEvent * ev);
-void HMotionNotify(XEvent * ev);
-void HEnterNotify(XEvent * ev);
-void HLeaveNotify(XEvent * ev);
-void HFocusIn(XEvent * ev);
-void HFocusOut(XEvent * ev);
-void HKeymapNotify(XEvent * ev);
-void HExpose(XEvent * ev);
-void HGraphicsExpose(XEvent * ev);
-void HNoExpose(XEvent * ev);
-void HVisibilityNotify(XEvent * ev);
-void HCreateNotify(XEvent * ev);
-void HDestroyNotify(XEvent * ev);
-void HUnmapNotify(XEvent * ev);
-void HMapNotify(XEvent * ev);
-void HMapRequest(XEvent * ev);
-void HReparentNotify(XEvent * ev);
-void HConfigureNotify(XEvent * ev);
-void HConfigureRequest(XEvent * ev);
-void HGravityNotify(XEvent * ev);
-void HResizeRequest(XEvent * ev);
-void HCirculateNotify(XEvent * ev);
-void HCirculateRequest(XEvent * ev);
-void HPropertyNotify(XEvent * ev);
-void HSelectionClear(XEvent * ev);
-void HSelectionRequest(XEvent * ev);
-void HSelectionNotify(XEvent * ev);
-void HColormapNotify(XEvent * ev);
-void HClientMessage(XEvent * ev);
-void HMappingNotify(XEvent * ev);
-void DefaultFunc(XEvent * ev);
/* iconify.c functions */
void IB_Animate(char iconify, EWin * from, EWin * to);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- events.c 22 May 2003 19:14:59 -0000 1.31
+++ events.c 11 Jul 2003 19:45:56 -0000 1.32
@@ -27,50 +27,10 @@
#endif
char throw_move_events_away = 0;
-void DeskAccountTimeout(int val, void *data);
-
-HandleStruct HArray[] = {
- {DefaultFunc},
- {DefaultFunc},
- {HKeyPress},
- {HKeyRelease},
- {HButtonPress},
- {HButtonRelease},
- {HMotionNotify},
- {HEnterNotify},
- {HLeaveNotify},
- {HFocusIn},
- {HFocusOut},
- {HKeymapNotify},
- {HExpose},
- {HGraphicsExpose},
- {HNoExpose},
- {HVisibilityNotify},
- {HCreateNotify},
- {HDestroyNotify},
- {HUnmapNotify},
- {HMapNotify},
- {HMapRequest},
- {HReparentNotify},
- {HConfigureNotify},
- {HConfigureRequest},
- {HGravityNotify},
- {HResizeRequest},
- {HCirculateNotify},
- {HCirculateRequest},
- {HPropertyNotify},
- {HSelectionClear},
- {HSelectionRequest},
- {HSelectionNotify},
- {HColormapNotify},
- {HClientMessage},
- {HMappingNotify},
- {DefaultFunc}
-};
static char diddeskaccount = 1;
-void
+static void
DeskAccountTimeout(int val, void *data)
{
EDBUG(5, "DeskAccountTimeout");
@@ -142,7 +102,8 @@
return ok;
}
-void
+#if 0
+static void
DebugEvent(XEvent * ev)
{
EDBUG(8, "DebugEvent");
@@ -258,377 +219,141 @@
}
EDBUG_RETURN_;
}
+#endif
-void
-HandleEvent(XEvent * ev)
+static void
+HKeyPress(XEvent * ev)
{
- void **lst;
- int i, num;
+ Dialog *d;
- EDBUG(7, "HandleEvent");
- WarpFocusHandleEvent(ev);
- if (ev->type == event_base_shape + ShapeNotify)
- HandleChildShapeChange(ev);
- if ((ev->type == KeyPress) || (ev->type == KeyRelease)
- || (ev->type == ButtonPress) || (ev->type == ButtonRelease)
- || (ev->type == EnterNotify) || (ev->type == LeaveNotify))
+ EDBUG(7, "HKeyPress");
+ d = FindDialog(ev->xkey.window);
+ if (d)
{
- if (((ev->type == KeyPress) || (ev->type == KeyRelease))
- && (ev->xkey.root != root.win))
- {
- XSetInputFocus(disp, ev->xkey.root, RevertToPointerRoot,
- CurrentTime);
- XSync(disp, False);
- ev->xkey.time = CurrentTime;
- XSendEvent(disp, ev->xkey.root, False, 0, ev);
- }
- else
+ int i;
+
+ for (i = 0; i < d->num_bindings; i++)
{
- lst = ListItemType(&num, LIST_TYPE_ACLASS_GLOBAL);
- if (lst)
- {
- for (i = 0; i < num; i++)
- EventAclass(ev, (ActionClass *) lst[i]);
- Efree(lst);
- }
+ if (ev->xkey.keycode == d->keybindings[i].key)
+ (d->keybindings[i].func) (d->keybindings[i].val,
+ d->keybindings[i].data);
}
}
- if (ev->type <= 35)
- HArray[ev->type].func(ev);
- IconboxHandleEvent(ev);
-
- if (diddeskaccount)
- {
- DoIn("DESKTOP_ACCOUNTING_TIMEOUT", 30.0, DeskAccountTimeout, 0, NULL);
- diddeskaccount = 0;
- }
EDBUG_RETURN_;
}
-void
-CheckEvent()
+static void
+HKeyRelease(XEvent * ev)
{
- XEvent ev;
-
- EDBUG(7, "CheckEvent");
- while (XPending(disp))
- {
- XNextEvent(disp, &ev);
- HandleEvent(&ev);
- }
+ EDBUG(7, "HKeyRelease");
+ ev = NULL;
EDBUG_RETURN_;
}
-#ifdef DEBUG
-#define DBUG_STACKSTART \
- int save = call_level + 1;
-#define DBUG_STACKCHECK \
- if (save != call_level) { \
- fprintf (stderr, "Unstack error: ["); \
- for (save = 0; save < 4; ++ save) \
- fprintf (stderr, "%s%s", save ? ", " : "", call_stack[save]); \
- fprintf (stderr, "]\n"); \
- save = call_level; \
- }
-#else
-#define DBUG_STACKSTART
-#define DBUG_STACKCHECK
-#endif
+#if 0
+struct _pbuf
+{
+ int w, h, depth;
+ Pixmap id;
+ void *stack[32];
+ struct _pbuf *next;
+};
+extern struct _pbuf *pbuf = NULL;
- /* This is the primary event loop. Everything that is going to happen in the
- * window manager has to start here at some point. This is where all the
- * events from the X server are interpreted, timer events are inserted, etc
- */
+#endif
-void
-WaitEvent()
+static void
+HButtonPress(XEvent * ev)
{
-/* XEvent ev; */
- fd_set fdset;
- struct timeval tval;
- static struct timeval tval_last = { 0, 0 };
- double time1, time2;
- Qentry *qe;
- int count, pcount;
- int fdsize;
- int xfd, smfd;
- int i;
- static int evq_num = 0;
- static XEvent *evq = NULL;
- char *ok;
+ EDBUG(7, "HButtonPress");
+ ApplySclass(FindItem
+ ("SOUND_BUTTON_CLICK", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+ HandleMouseDown(ev);
+#if 0
+ {
+ int x, y, maxh = 0, count = 0, mcount = 0, ww, hh;
+ struct _pbuf *pb;
+ GC gc;
+ XGCValues gcv;
- DBUG_STACKSTART;
+ gc = XCreateGC(disp, root.win, 0, &gcv);
+ XSetForeground(disp, gc, WhitePixel(disp, root.scr));
+ fprintf(stderr, "Pixmaps allocated:\n");
+ x = 0;
+ y = 0;
+ XClearWindow(disp, root.win);
+ for (pb = pbuf; pb; pb = pb->next)
+ {
+ ww = pb->w;
+ hh = pb->h;
+ if (ww > 64)
+ ww = 64;
+ if (hh > 64)
+ hh = 64;
+ if (x + ww > root.w)
+ {
+ x = 0;
+ y += maxh;
+ maxh = 0;
+ }
+ XCopyArea(disp, pb->id, root.win, gc, 0, 0, ww, hh, x, y);
+ XDrawRectangle(disp, root.win, gc, x, y, ww, hh);
+ x += ww;
+ if (hh > maxh)
+ maxh = hh;
+ count++;
+ if (pb->depth == 1)
+ mcount++;
+ fprintf(stderr,
+ "%08x (%5ix%5i %i) : " "%x %x %x %x %x %x %x %x "
+ "%x %x %x %x %x %x %x %x " "%x %x %x %x %x %x %x %x "
+ "%x %x %x %x %x %x %x %x\n", pb->id, pb->w, pb->h,
+ pb->depth, pb->stack[0], pb->stack[1], pb->stack[2],
+ pb->stack[3], pb->stack[4], pb->stack[5], pb->stack[6],
+ pb->stack[7], pb->stack[8], pb->stack[9], pb->stack[10],
+ pb->stack[11], pb->stack[12], pb->stack[13], pb->stack[14],
+ pb->stack[15], pb->stack[16], pb->stack[17], pb->stack[18],
+ pb->stack[19], pb->stack[20], pb->stack[21], pb->stack[22],
+ pb->stack[23], pb->stack[24], pb->stack[25], pb->stack[26],
+ pb->stack[27], pb->stack[28], pb->stack[29], pb->stack[30],
+ pb->stack[31]);
+ }
+ fprintf(stderr, "Total %i, %i of them bitmaps\n", count, mcount);
+ XFreeGC(disp, gc);
+ }
+#endif
+ EDBUG_RETURN_;
+}
- EDBUG(7, "WaitEvent");
- smfd = GetSMfd();
- xfd = ConnectionNumber(disp);
- fdsize = MAX(xfd, smfd) + 1;
+static void
+HButtonRelease(XEvent * ev)
+{
+ EDBUG(7, "HButtonRelease");
+ ApplySclass(FindItem
+ ("SOUND_BUTTON_RAISE", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
+ HandleMouseUp(ev);
+ EDBUG_RETURN_;
+}
- /* if we've never set the time we were last here before */
- if ((tval_last.tv_sec == 0) && (tval_last.tv_usec == 0))
- gettimeofday(&tval_last, NULL);
- /* time1 = time we last entered this routine */
- time1 = ((double)tval_last.tv_sec) + (((double)tval_last.tv_usec) / 1000000);
- gettimeofday(&tval, NULL);
- tval_last.tv_sec = tval.tv_sec;
- tval_last.tv_usec = tval.tv_usec;
- /* time2 = current time */
- time2 = ((double)tval.tv_sec) + (((double)tval.tv_usec) / 1000000);
- time2 -= time1;
- if (time2 < 0.0)
- time2 = 0.0;
- /* time2 = time spent since we last were here */
+static void
+HMotionNotify(XEvent * ev)
+{
+ EDBUG(7, "HMotionNotify");
+ HandleMotion(ev);
+ EDBUG_RETURN_;
+}
- count = 0;
- while (XPending(disp))
+static void
+HEnterNotify(XEvent * ev)
+{
+ EDBUG(7, "HEnterNotify");
+ if (mode.mode == MODE_NONE)
{
- count++;
- if (count > evq_num)
- {
- evq_num += 16;
- if (!evq)
- evq = Emalloc(sizeof(XEvent) * evq_num);
- else
- evq = Erealloc(evq, sizeof(XEvent) * evq_num);
- }
- XNextEvent(disp, &(evq[count - 1]));
- }
- /* remove multiple extraneous events here */
- ok = NukeBoringevents(evq, count);
- if (ok)
- {
- for (i = 0; i < count; i++)
- {
- if (ok[i])
- HandleEvent(&(evq[i]));
- }
- Efree(ok);
- }
-
- DBUG_STACKCHECK;
-
- HandleDrawQueue();
- XFlush(disp);
- pcount = count;
-
- DBUG_STACKCHECK;
-
- count = 0;
- while (XPending(disp))
- {
- count++;
- if (count > evq_num)
- {
- evq_num += 16;
- if (!evq)
- evq = Emalloc(sizeof(XEvent) * evq_num);
- else
- evq = Erealloc(evq, sizeof(XEvent) * evq_num);
- }
- XNextEvent(disp, &(evq[count - 1]));
- }
- /* remove multiple extraneous events here */
- ok = NukeBoringevents(evq, count);
- if (ok)
- {
- for (i = 0; i < count; i++)
- {
- if (ok[i])
- HandleEvent(&(evq[i]));
- }
- Efree(ok);
- }
- if (count > 0)
- XFlush(disp);
-
- if (pcount > count)
- count = pcount;
- if ((evq) && ((evq_num - count) > 64))
- {
- evq_num = 0;
- Efree(evq);
- evq = NULL;
- }
-
- DBUG_STACKCHECK;
-
- FD_ZERO(&fdset);
- FD_SET(xfd, &fdset);
- if (smfd >= 0)
- FD_SET(smfd, &fdset);
-
- qe = GetHeadTimerQueue();
- if (qe)
- {
- if (qe->just_added)
- {
- qe->just_added = 0;
- time1 = qe->in_time;
- }
- else
- {
- time1 = qe->in_time - time2;
- if (time1 < 0.0)
- time1 = 0.0;
- qe->in_time = time1;
- }
- tval.tv_sec = (long)time1;
- tval.tv_usec = (long)((time1 - ((double)tval.tv_sec)) * 1000000);
- count = select(fdsize, &fdset, NULL, NULL, &tval);
- }
- else
- count = select(fdsize, &fdset, NULL, NULL, NULL);
- if (count < 0)
- {
- EDBUG_RETURN_;
- }
- if ((smfd >= 0) && (count > 0) && (FD_ISSET(smfd, &fdset)))
- ProcessICEMSGS();
-
- DBUG_STACKCHECK;
-
- if ((!(FD_ISSET(xfd, &fdset))) && (qe) && (count == 0)
- && (((smfd >= 0) && (!(FD_ISSET(smfd, &fdset)))) || (smfd < 0)))
- HandleTimerEvent();
-
- DBUG_STACKCHECK;
-
- EDBUG_RETURN_;
-}
-
-void
-HKeyPress(XEvent * ev)
-{
- Dialog *d;
-
- EDBUG(7, "HKeyPress");
- d = FindDialog(ev->xkey.window);
- if (d)
- {
- int i;
-
- for (i = 0; i < d->num_bindings; i++)
- {
- if (ev->xkey.keycode == d->keybindings[i].key)
- (d->keybindings[i].func) (d->keybindings[i].val,
- d->keybindings[i].data);
- }
- }
- EDBUG_RETURN_;
-}
-
-void
-HKeyRelease(XEvent * ev)
-{
- EDBUG(7, "HKeyRelease");
- ev = NULL;
- EDBUG_RETURN_;
-}
-
-#if 0
-struct _pbuf
-{
- int w, h, depth;
- Pixmap id;
- void *stack[32];
- struct _pbuf *next;
-};
-extern struct _pbuf *pbuf = NULL;
-
-#endif
-
-void
-HButtonPress(XEvent * ev)
-{
- EDBUG(7, "HButtonPress");
- ApplySclass(FindItem
- ("SOUND_BUTTON_CLICK", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
- HandleMouseDown(ev);
-#if 0
- {
- int x, y, maxh = 0, count = 0, mcount = 0, ww, hh;
- struct _pbuf *pb;
- GC gc;
- XGCValues gcv;
-
- gc = XCreateGC(disp, root.win, 0, &gcv);
- XSetForeground(disp, gc, WhitePixel(disp, root.scr));
- fprintf(stderr, "Pixmaps allocated:\n");
- x = 0;
- y = 0;
- XClearWindow(disp, root.win);
- for (pb = pbuf; pb; pb = pb->next)
- {
- ww = pb->w;
- hh = pb->h;
- if (ww > 64)
- ww = 64;
- if (hh > 64)
- hh = 64;
- if (x + ww > root.w)
- {
- x = 0;
- y += maxh;
- maxh = 0;
- }
- XCopyArea(disp, pb->id, root.win, gc, 0, 0, ww, hh, x, y);
- XDrawRectangle(disp, root.win, gc, x, y, ww, hh);
- x += ww;
- if (hh > maxh)
- maxh = hh;
- count++;
- if (pb->depth == 1)
- mcount++;
- fprintf(stderr,
- "%08x (%5ix%5i %i) : " "%x %x %x %x %x %x %x %x "
- "%x %x %x %x %x %x %x %x " "%x %x %x %x %x %x %x %x "
- "%x %x %x %x %x %x %x %x\n", pb->id, pb->w, pb->h,
- pb->depth, pb->stack[0], pb->stack[1], pb->stack[2],
- pb->stack[3], pb->stack[4], pb->stack[5], pb->stack[6],
- pb->stack[7], pb->stack[8], pb->stack[9], pb->stack[10],
- pb->stack[11], pb->stack[12], pb->stack[13], pb->stack[14],
- pb->stack[15], pb->stack[16], pb->stack[17], pb->stack[18],
- pb->stack[19], pb->stack[20], pb->stack[21], pb->stack[22],
- pb->stack[23], pb->stack[24], pb->stack[25], pb->stack[26],
- pb->stack[27], pb->stack[28], pb->stack[29], pb->stack[30],
- pb->stack[31]);
- }
- fprintf(stderr, "Total %i, %i of them bitmaps\n", count, mcount);
- XFreeGC(disp, gc);
- }
-#endif
- EDBUG_RETURN_;
-}
-
-void
-HButtonRelease(XEvent * ev)
-{
- EDBUG(7, "HButtonRelease");
- ApplySclass(FindItem
- ("SOUND_BUTTON_RAISE", 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
- HandleMouseUp(ev);
- EDBUG_RETURN_;
-}
-
-void
-HMotionNotify(XEvent * ev)
-{
- EDBUG(7, "HMotionNotify");
- HandleMotion(ev);
- EDBUG_RETURN_;
-}
-
-void
-HEnterNotify(XEvent * ev)
-{
- EDBUG(7, "HEnterNotify");
- if (mode.mode == MODE_NONE)
- {
- /*
- * multi screen handling -- root windows receive
- * enter / leave notify
- */
- if (ev->xany.window == root.win)
+ /*
+ * multi screen handling -- root windows receive
+ * enter / leave notify
+ */
+ if (ev->xany.window == root.win)
{
PagerHideAllHi();
if (!mode.focuswin || FOCUS_POINTER == mode.focusmode)
@@ -643,7 +368,7 @@
EDBUG_RETURN_;
}
-void
+static void
HLeaveNotify(XEvent * ev)
{
EDBUG(7, "HLeaveNotify");
@@ -671,7 +396,7 @@
EDBUG_RETURN_;
}
-void
+static void
HFocusIn(XEvent * ev)
{
EDBUG(7, "HFocusIn");
@@ -680,7 +405,7 @@
EDBUG_RETURN_;
}
-void
+static void
HFocusOut(XEvent * ev)
{
EDBUG(7, "HFocusOut");
@@ -700,7 +425,7 @@
EDBUG_RETURN_;
}
-void
+static void
HKeymapNotify(XEvent * ev)
{
EDBUG(7, "HKeymapNotify");
@@ -708,7 +433,7 @@
EDBUG_RETURN_;
}
-void
+static void
HExpose(XEvent * ev)
{
EDBUG(7, "HExpose");
@@ -716,7 +441,7 @@
EDBUG_RETURN_;
}
-void
+static void
HGraphicsExpose(XEvent * ev)
{
EDBUG(7, "HGraphicsExpose");
@@ -724,7 +449,7 @@
EDBUG_RETURN_;
}
-void
+static void
HNoExpose(XEvent * ev)
{
EDBUG(7, "HNoExpose");
@@ -732,7 +457,7 @@
EDBUG_RETURN_;
}
-void
+static void
HVisibilityNotify(XEvent * ev)
{
EDBUG(7, "HVisibilityNotify");
@@ -740,7 +465,7 @@
EDBUG_RETURN_;
}
-void
+static void
HCreateNotify(XEvent * ev)
{
EDBUG(7, "HCreateNotify");
@@ -748,7 +473,7 @@
EDBUG_RETURN_;
}
-void
+static void
HDestroyNotify(XEvent * ev)
{
EDBUG(7, "HDestroyNotify");
@@ -756,7 +481,7 @@
EDBUG_RETURN_;
}
-void
+static void
HUnmapNotify(XEvent * ev)
{
EDBUG(7, "HUnmapNotify");
@@ -764,7 +489,7 @@
EDBUG_RETURN_;
}
-void
+static void
HMapNotify(XEvent * ev)
{
EDBUG(7, "HMapNotify");
@@ -772,7 +497,7 @@
EDBUG_RETURN_;
}
-void
+static void
HMapRequest(XEvent * ev)
{
EDBUG(7, "HMapRequest");
@@ -780,7 +505,7 @@
EDBUG_RETURN_;
}
-void
+static void
HReparentNotify(XEvent * ev)
{
EDBUG(7, "HReparentNotify");
@@ -788,7 +513,7 @@
EDBUG_RETURN_;
}
-void
+static void
HConfigureNotify(XEvent * ev)
{
EDBUG(7, "HConfigureNotify");
@@ -796,7 +521,7 @@
EDBUG_RETURN_;
}
-void
+static void
HConfigureRequest(XEvent * ev)
{
EDBUG(7, "HConfigureRequest");
@@ -804,7 +529,7 @@
EDBUG_RETURN_;
}
-void
+static void
HGravityNotify(XEvent * ev)
{
EDBUG(7, "HGravityNotify");
@@ -812,7 +537,7 @@
EDBUG_RETURN_;
}
-void
+static void
HResizeRequest(XEvent * ev)
{
EDBUG(7, "HResizeRequest");
@@ -820,7 +545,7 @@
EDBUG_RETURN_;
}
-void
+static void
HCirculateNotify(XEvent * ev)
{
EDBUG(7, "HCirculateNotify");
@@ -828,7 +553,7 @@
EDBUG_RETURN_;
}
-void
+static void
HCirculateRequest(XEvent * ev)
{
EDBUG(7, "HCirculateRequest");
@@ -836,7 +561,7 @@
EDBUG_RETURN_;
}
-void
+static void
HPropertyNotify(XEvent * ev)
{
EDBUG(7, "HPropertyNotify");
@@ -844,7 +569,7 @@
EDBUG_RETURN_;
}
-void
+static void
HSelectionClear(XEvent * ev)
{
EDBUG(7, "HSelectionClear");
@@ -852,7 +577,7 @@
EDBUG_RETURN_;
}
-void
+static void
HSelectionRequest(XEvent * ev)
{
EDBUG(7, "HSelectionRequest");
@@ -860,7 +585,7 @@
EDBUG_RETURN_;
}
-void
+static void
HSelectionNotify(XEvent * ev)
{
EDBUG(7, "HSelectionNotify");
@@ -868,7 +593,7 @@
EDBUG_RETURN_;
}
-void
+static void
HColormapNotify(XEvent * ev)
{
EDBUG(7, "HColormapNotify");
@@ -876,7 +601,7 @@
EDBUG_RETURN_;
}
-void
+static void
HClientMessage(XEvent * ev)
{
EDBUG(7, "HClientMessage");
@@ -884,7 +609,7 @@
EDBUG_RETURN_;
}
-void
+static void
HMappingNotify(XEvent * ev)
{
EDBUG(7, "HMappingNotify");
@@ -892,10 +617,286 @@
EDBUG_RETURN_;
}
-void
+static void
DefaultFunc(XEvent * ev)
{
EDBUG(7, "DefaultFunc");
ev = NULL;
+ EDBUG_RETURN_;
+}
+
+static HandleStruct HArray[] = {
+ {DefaultFunc},
+ {DefaultFunc},
+ {HKeyPress},
+ {HKeyRelease},
+ {HButtonPress},
+ {HButtonRelease},
+ {HMotionNotify},
+ {HEnterNotify},
+ {HLeaveNotify},
+ {HFocusIn},
+ {HFocusOut},
+ {HKeymapNotify},
+ {HExpose},
+ {HGraphicsExpose},
+ {HNoExpose},
+ {HVisibilityNotify},
+ {HCreateNotify},
+ {HDestroyNotify},
+ {HUnmapNotify},
+ {HMapNotify},
+ {HMapRequest},
+ {HReparentNotify},
+ {HConfigureNotify},
+ {HConfigureRequest},
+ {HGravityNotify},
+ {HResizeRequest},
+ {HCirculateNotify},
+ {HCirculateRequest},
+ {HPropertyNotify},
+ {HSelectionClear},
+ {HSelectionRequest},
+ {HSelectionNotify},
+ {HColormapNotify},
+ {HClientMessage},
+ {HMappingNotify},
+ {DefaultFunc}
+};
+
+static void
+HandleEvent(XEvent * ev)
+{
+ void **lst;
+ int i, num;
+
+ EDBUG(7, "HandleEvent");
+ WarpFocusHandleEvent(ev);
+ if (ev->type == event_base_shape + ShapeNotify)
+ HandleChildShapeChange(ev);
+ if ((ev->type == KeyPress) || (ev->type == KeyRelease)
+ || (ev->type == ButtonPress) || (ev->type == ButtonRelease)
+ || (ev->type == EnterNotify) || (ev->type == LeaveNotify))
+ {
+ if (((ev->type == KeyPress) || (ev->type == KeyRelease))
+ && (ev->xkey.root != root.win))
+ {
+ XSetInputFocus(disp, ev->xkey.root, RevertToPointerRoot,
+ CurrentTime);
+ XSync(disp, False);
+ ev->xkey.time = CurrentTime;
+ XSendEvent(disp, ev->xkey.root, False, 0, ev);
+ }
+ else
+ {
+ lst = ListItemType(&num, LIST_TYPE_ACLASS_GLOBAL);
+ if (lst)
+ {
+ for (i = 0; i < num; i++)
+ EventAclass(ev, (ActionClass *) lst[i]);
+ Efree(lst);
+ }
+ }
+ }
+ if (ev->type <= 35)
+ HArray[ev->type].func(ev);
+ IconboxHandleEvent(ev);
+
+ if (diddeskaccount)
+ {
+ DoIn("DESKTOP_ACCOUNTING_TIMEOUT", 30.0, DeskAccountTimeout, 0, NULL);
+ diddeskaccount = 0;
+ }
+ EDBUG_RETURN_;
+}
+
+void
+CheckEvent()
+{
+ XEvent ev;
+
+ EDBUG(7, "CheckEvent");
+ while (XPending(disp))
+ {
+ XNextEvent(disp, &ev);
+ HandleEvent(&ev);
+ }
+ EDBUG_RETURN_;
+}
+
+#ifdef DEBUG
+#define DBUG_STACKSTART \
+ int save = call_level + 1;
+#define DBUG_STACKCHECK \
+ if (save != call_level) { \
+ fprintf (stderr, "Unstack error: ["); \
+ for (save = 0; save < 4; ++ save) \
+ fprintf (stderr, "%s%s", save ? ", " : "", call_stack[save]); \
+ fprintf (stderr, "]\n"); \
+ save = call_level; \
+ }
+#else
+#define DBUG_STACKSTART
+#define DBUG_STACKCHECK
+#endif
+
+ /* This is the primary event loop. Everything that is going to happen in the
+ * window manager has to start here at some point. This is where all the
+ * events from the X server are interpreted, timer events are inserted, etc
+ */
+
+void
+WaitEvent()
+{
+/* XEvent ev; */
+ fd_set fdset;
+ struct timeval tval;
+ static struct timeval tval_last = { 0, 0 };
+ double time1, time2;
+ Qentry *qe;
+ int count, pcount;
+ int fdsize;
+ int xfd, smfd;
+ int i;
+ static int evq_num = 0;
+ static XEvent *evq = NULL;
+ char *ok;
+
+ DBUG_STACKSTART;
+
+ EDBUG(7, "WaitEvent");
+ smfd = GetSMfd();
+ xfd = ConnectionNumber(disp);
+ fdsize = MAX(xfd, smfd) + 1;
+
+ /* if we've never set the time we were last here before */
+ if ((tval_last.tv_sec == 0) && (tval_last.tv_usec == 0))
+ gettimeofday(&tval_last, NULL);
+ /* time1 = time we last entered this routine */
+ time1 = ((double)tval_last.tv_sec) + (((double)tval_last.tv_usec) / 1000000);
+ gettimeofday(&tval, NULL);
+ tval_last.tv_sec = tval.tv_sec;
+ tval_last.tv_usec = tval.tv_usec;
+ /* time2 = current time */
+ time2 = ((double)tval.tv_sec) + (((double)tval.tv_usec) / 1000000);
+ time2 -= time1;
+ if (time2 < 0.0)
+ time2 = 0.0;
+ /* time2 = time spent since we last were here */
+
+ count = 0;
+ while (XPending(disp))
+ {
+ count++;
+ if (count > evq_num)
+ {
+ evq_num += 16;
+ if (!evq)
+ evq = Emalloc(sizeof(XEvent) * evq_num);
+ else
+ evq = Erealloc(evq, sizeof(XEvent) * evq_num);
+ }
+ XNextEvent(disp, &(evq[count - 1]));
+ }
+ /* remove multiple extraneous events here */
+ ok = NukeBoringevents(evq, count);
+ if (ok)
+ {
+ for (i = 0; i < count; i++)
+ {
+ if (ok[i])
+ HandleEvent(&(evq[i]));
+ }
+ Efree(ok);
+ }
+
+ DBUG_STACKCHECK;
+
+ HandleDrawQueue();
+ XFlush(disp);
+ pcount = count;
+
+ DBUG_STACKCHECK;
+
+ count = 0;
+ while (XPending(disp))
+ {
+ count++;
+ if (count > evq_num)
+ {
+ evq_num += 16;
+ if (!evq)
+ evq = Emalloc(sizeof(XEvent) * evq_num);
+ else
+ evq = Erealloc(evq, sizeof(XEvent) * evq_num);
+ }
+ XNextEvent(disp, &(evq[count - 1]));
+ }
+ /* remove multiple extraneous events here */
+ ok = NukeBoringevents(evq, count);
+ if (ok)
+ {
+ for (i = 0; i < count; i++)
+ {
+ if (ok[i])
+ HandleEvent(&(evq[i]));
+ }
+ Efree(ok);
+ }
+ if (count > 0)
+ XFlush(disp);
+
+ if (pcount > count)
+ count = pcount;
+ if ((evq) && ((evq_num - count) > 64))
+ {
+ evq_num = 0;
+ Efree(evq);
+ evq = NULL;
+ }
+
+ DBUG_STACKCHECK;
+
+ FD_ZERO(&fdset);
+ FD_SET(xfd, &fdset);
+ if (smfd >= 0)
+ FD_SET(smfd, &fdset);
+
+ qe = GetHeadTimerQueue();
+ if (qe)
+ {
+ if (qe->just_added)
+ {
+ qe->just_added = 0;
+ time1 = qe->in_time;
+ }
+ else
+ {
+ time1 = qe->in_time - time2;
+ if (time1 < 0.0)
+ time1 = 0.0;
+ qe->in_time = time1;
+ }
+ tval.tv_sec = (long)time1;
+ tval.tv_usec = (long)((time1 - ((double)tval.tv_sec)) * 1000000);
+ count = select(fdsize, &fdset, NULL, NULL, &tval);
+ }
+ else
+ count = select(fdsize, &fdset, NULL, NULL, NULL);
+ if (count < 0)
+ {
+ EDBUG_RETURN_;
+ }
+ if ((smfd >= 0) && (count > 0) && (FD_ISSET(smfd, &fdset)))
+ ProcessICEMSGS();
+
+ DBUG_STACKCHECK;
+
+ if ((!(FD_ISSET(xfd, &fdset))) && (qe) && (count == 0)
+ && (((smfd >= 0) && (!(FD_ISSET(smfd, &fdset)))) || (smfd < 0)))
+ HandleTimerEvent();
+
+ DBUG_STACKCHECK;
+
EDBUG_RETURN_;
}
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs