DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T e

⟦4babdf6ab⟧ TextFile

    Length: 28969 (0x7129)
    Types: TextFile
    Names: »extevent.diff«

Derivation

└─⟦8648bda34⟧ Bits:30007244 EUUGD5_II: X11R5
    └─⟦b23e377d7⟧ »./contrib-2/contrib-2.00« 
        └─⟦0ed22c3ba⟧ 
            └─⟦this⟧ »contrib/lib/Xt/extevent.diff« 

TextFile

*** old/Display.c
--- /mit/lib/Xt/Display.c
***************
*** 1,4 ****
! /* $XConsortium: Display.c,v 1.81 91/07/12 13:45:00 rws Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Display.c,v 1.81.1.1 91/08/27 18:05:30 swick Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 44,50 ****
  	(XtAppContext)NULL,
  	(XtAppContext)NULL,
  	(ConverterTable)NULL,
! 	{(XtLanguageProc)NULL, (XtPointer)NULL}
      };
  
      return &processContextRec;
--- 44,51 ----
  	(XtAppContext)NULL,
  	(XtAppContext)NULL,
  	(ConverterTable)NULL,
! 	{(XtLanguageProc)NULL, (XtPointer)NULL},
! 	(XtEventDispatchProc*)NULL
      };
  
      return &processContextRec;
***************
*** 293,298 ****
--- 294,308 ----
  	app->process->appContextList = app;
  	app->langProcRec.proc = app->process->globalLangProcRec.proc;
  	app->langProcRec.closure = app->process->globalLangProcRec.closure;
+ 	if (app->process->globalDispatcherList) {
+ 	    app->dispatcherList =
+ 		(XtEventDispatchProc*) XtMalloc(0x7f *
+ 						sizeof(XtEventDispatchProc));
+ 	    bcopy(app->process->globalDispatcherList, app->dispatcherList,
+ 		  0x7f * sizeof(XtEventDispatchProc));
+ 	}
+ 	else app->dispatcherList = NULL;
+ 
  	app->destroy_callbacks = NULL;
  	app->list = NULL;
  	app->count = app->max = app->last = 0;
***************
*** 347,352 ****
--- 357,363 ----
  	while (app->workQueue) XtRemoveWorkProc((XtWorkProcId)app->workQueue);
  	if (app->input_list) _XtRemoveAllInputs(app);
  	XtFree((char*)app->destroy_list);
+ 	XtFree((char*)app->dispatcherList);
  	_XtHeapFree(&app->heap);
  	while (*prev_app != app) prev_app = &(*prev_app)->next;
  	*prev_app = app->next;
*** old/Event.c
--- /mit/lib/Xt/Event.c
***************
*** 1,4 ****
! /* $XConsortium: Event.c,v 1.134 91/08/26 14:20:42 swick Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Event.c,v 1.134.1.2 91/08/27 18:41:09 swick Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 34,39 ****
--- 34,47 ----
  #define Const /**/
  #endif
  
+ typedef struct _XtEventRecExt {
+     int			type;
+     XtPointer		select_data[1];	/* actual dimension is [mask] */
+ } XtEventRecExt;
+ 
+ #define TYPE(p)		 (((XtEventRecExt*) ((p)+1))->type)
+ #define SELECT_DATA(p,n) (((XtEventRecExt*) ((p)+1))->select_data[n])
+ 
  #define NonMaskableMask ((EventMask)0x80000000L)
  
  /*
***************
*** 60,66 ****
      EventMask	mask = 0L;
  
      for (ev = widget->core.event_table; ev != NULL; ev = ev->next)
! 	if (ev->select) mask |= ev->mask;
      if (widget->core.widget_class->core_class.expose != NULL)
  	mask |= ExposureMask;
      if (widget->core.widget_class->core_class.visible_interest) 
--- 68,86 ----
      EventMask	mask = 0L;
  
      for (ev = widget->core.event_table; ev != NULL; ev = ev->next)
! 	if (ev->select) {
! 	    if (!ev->has_type_specifier)
! 		mask |= ev->mask;
! 	    else if (TYPE(ev) < LASTEvent) {
! 		int i;
! 		for (i = 0; i < ev->mask; i++)
! 		    if (SELECT_DATA(ev,i))
! 			mask |= *(EventMask*)SELECT_DATA(ev,i);
! 	    }
! 	    /* %%% eventually, call a select routine here when
! 	     * TYPE(ev) >= LASTEvent
! 	     */
! 	}
      if (widget->core.widget_class->core_class.expose != NULL)
  	mask |= ExposureMask;
      if (widget->core.widget_class->core_class.visible_interest) 
***************
*** 72,100 ****
  }
  
  static void
! RemoveEventHandler(widget, eventMask, other, proc, closure, raw)
  Widget	        widget;
! EventMask       eventMask;
! Boolean	        other;
  XtEventHandler  proc;
  XtPointer	closure;
  Boolean	        raw;
  {
      XtEventRec *p, **pp;
!     EventMask oldMask = XtBuildEventMask(widget);
  
      if (raw) raw = 1;
      pp = &widget->core.event_table;
      while ((p = *pp) &&
! 	   (p->proc != proc || p->closure != closure || p->select == raw))
  	pp = &p->next;
      if (!p) return;
  
      /* un-register it */
!     eventMask &= ~NonMaskableMask;
!     if (other)
! 	eventMask |= NonMaskableMask;
!     p->mask &= ~eventMask;
  
      if (!p->mask) {        /* delete it entirely */
          *pp = p->next;
--- 92,144 ----
  }
  
  static void
! RemoveEventHandler(widget, select_data, type, has_type_specifier, other,
! 		   proc, closure, raw)
  Widget	        widget;
! XtPointer	select_data;
! Boolean	        has_type_specifier, other;
  XtEventHandler  proc;
  XtPointer	closure;
  Boolean	        raw;
  {
      XtEventRec *p, **pp;
!     EventMask eventMask, oldMask = XtBuildEventMask(widget);
  
      if (raw) raw = 1;
      pp = &widget->core.event_table;
      while ((p = *pp) &&
! 	   (p->proc != proc || p->closure != closure || p->select == raw ||
! 	    has_type_specifier != p->has_type_specifier ||
! 	    (has_type_specifier && TYPE(p) != type)))
  	pp = &p->next;
      if (!p) return;
  
      /* un-register it */
!     if (!has_type_specifier) {
! 	eventMask = *(EventMask*)select_data;
! 	eventMask &= ~NonMaskableMask;
! 	if (other)
! 	    eventMask |= NonMaskableMask;
! 	p->mask &= ~eventMask;
!     }
!     else {
! 	int i;
! 	/* p->mask specifies count of SELECT_DATA(p)
! 	 * search through the list of selection data, if not found
! 	 * don't remove this handler
! 	 */
! 	for (i = 0; i < p->mask && select_data != SELECT_DATA(p,i);) i++;
! 	if (i == p->mask) return;
! 	if (p->mask == 1)
! 	    p->mask = 0;
! 	else {
! 	    p->mask--;
! 	    while (i < p->mask) {
! 		SELECT_DATA(p,i) = SELECT_DATA(p,i+1);
! 		i++;
! 	    }
! 	}
!     }
  
      if (!p->mask) {        /* delete it entirely */
          *pp = p->next;
***************
*** 127,162 ****
   */
  
  static void 
! AddEventHandler(widget, eventMask, other, proc, 
  		closure, position, force_new_position, raw)
  Widget	        widget;
! EventMask       eventMask;
! Boolean         other, force_new_position, raw;
  XtEventHandler  proc;
  XtPointer	closure;
  XtListPosition  position;
  {
      register XtEventRec *p, **pp;
!     EventMask oldMask;
!     
!     eventMask &= ~NonMaskableMask;
!     if (other)
! 	eventMask |= NonMaskableMask;
!     if (!eventMask) return;
!     
      if (XtIsRealized(widget) && !raw) oldMask = XtBuildEventMask(widget);
      
      if (raw) raw = 1;
      pp = &widget->core.event_table;
      while ((p = *pp) &&
! 	   (p->proc != proc || p->closure != closure || p->select == raw))
  	pp = &p->next;
  
      if (!p) {		                /* New proc to add to list */
! 	p = XtNew(XtEventRec);
  	p->proc = proc;
  	p->closure = closure;
- 	p->mask = eventMask;
  	p->select = ! raw;
  	
  	if (position == XtListHead) {
--- 171,222 ----
   */
  
  static void 
! AddEventHandler(widget, select_data, type, has_type_specifier, other, proc, 
  		closure, position, force_new_position, raw)
  Widget	        widget;
! XtPointer       select_data;
! Boolean         has_type_specifier, other, force_new_position, raw;
  XtEventHandler  proc;
  XtPointer	closure;
  XtListPosition  position;
  {
      register XtEventRec *p, **pp;
!     EventMask eventMask, oldMask;
! 
!     if (!has_type_specifier) {
! 	eventMask = *(EventMask*)select_data & ~NonMaskableMask;
! 	if (other)
! 	    eventMask |= NonMaskableMask;
! 	if (!eventMask) return;
!     }
!     else if (!type) return;
! 
      if (XtIsRealized(widget) && !raw) oldMask = XtBuildEventMask(widget);
      
      if (raw) raw = 1;
      pp = &widget->core.event_table;
      while ((p = *pp) &&
! 	   (p->proc != proc || p->closure != closure || p->select == raw ||
! 	    has_type_specifier != p->has_type_specifier ||
! 	    (has_type_specifier && TYPE(p) != type)))
  	pp = &p->next;
  
      if (!p) {		                /* New proc to add to list */
! 	if (has_type_specifier) {
! 	    p = (XtEventRec*) XtMalloc(sizeof(XtEventRec) +
! 				       sizeof(XtEventRecExt));
! 	    TYPE(p) = type;
! 	    SELECT_DATA(p,0) = select_data;
! 	    p->mask = 1;
! 	    p->has_type_specifier = True;
! 	}
! 	else {
! 	    p = (XtEventRec*) XtMalloc(sizeof(XtEventRec));
! 	    p->mask = eventMask;
! 	    p->has_type_specifier = False;
! 	}
  	p->proc = proc;
  	p->closure = closure;
  	p->select = ! raw;
  	
  	if (position == XtListHead) {
***************
*** 174,179 ****
--- 234,240 ----
  	    if (position == XtListHead) {
  		p->next = widget->core.event_table;
  		widget->core.event_table = p;
+ 		pp = &widget->core.event_table;
  	    } else {
  	       	/*
  		 * Find the last element in the list.
***************
*** 185,192 ****
  	    }
  	}
  
! 	/* update existing proc */
! 	p->mask |= eventMask;
      }
  
      if (XtIsRealized(widget) && !raw) {
--- 246,267 ----
  	    }
  	}
  
! 	if (! has_type_specifier)
! 	    p->mask |= eventMask;
! 	else {
! 	    int i;
! 	    /* p->mask specifies count of SELECT_DATA(p) */
! 	    for (i = 0; i < p->mask && select_data != SELECT_DATA(p,i);) i++;
! 	    if (i == p->mask) {
! 		p = (XtEventRec*) XtRealloc((char*)p,
! 					    sizeof(XtEventRec) +
! 					    sizeof(XtEventRecExt) +
! 					    p->mask * sizeof(XtPointer));
! 		SELECT_DATA(p,i) = select_data;
! 		p->mask++;
! 		*pp = p;
! 	    }
! 	}
      }
  
      if (XtIsRealized(widget) && !raw) {
***************
*** 215,221 ****
      XtPointer	    closure;
  #endif
  {
!     RemoveEventHandler(widget, eventMask, other, proc, closure, FALSE);
  }
  
  #if NeedFunctionPrototypes
--- 290,297 ----
      XtPointer	    closure;
  #endif
  {
!     RemoveEventHandler(widget, (XtPointer)&eventMask, 0, FALSE,
! 		       other, proc, closure, FALSE);
  }
  
  #if NeedFunctionPrototypes
***************
*** 235,241 ****
      XtPointer	    closure;
  #endif
  {
!     AddEventHandler(widget, eventMask, other, 
  		    proc, closure, XtListTail, FALSE, FALSE);
  }
  
--- 311,317 ----
      XtPointer	    closure;
  #endif
  {
!     AddEventHandler(widget, (XtPointer)&eventMask, 0, FALSE, other, 
  		    proc, closure, XtListTail, FALSE, FALSE);
  }
  
***************
*** 258,264 ****
      XtListPosition  position;
  #endif
  {
!     AddEventHandler(widget, eventMask, other, 
  		    proc, closure, position, TRUE, FALSE);
  }
  
--- 334,340 ----
      XtListPosition  position;
  #endif
  {
!     AddEventHandler(widget, (XtPointer)&eventMask, 0, FALSE, other, 
  		    proc, closure, position, TRUE, FALSE);
  }
  
***************
*** 279,285 ****
      XtPointer	    closure;
  #endif
  {
!     RemoveEventHandler(widget, eventMask, other, proc, closure, TRUE);
  }
  
  #if NeedFunctionPrototypes
--- 355,362 ----
      XtPointer	    closure;
  #endif
  {
!     RemoveEventHandler(widget, (XtPointer)&eventMask, 0, FALSE,
! 		       other, proc, closure, TRUE);
  }
  
  #if NeedFunctionPrototypes
***************
*** 301,307 ****
      XtListPosition  position;
  #endif
  {
!     AddEventHandler(widget, eventMask, other, 
  		    proc, closure, position, TRUE, TRUE);
  }
  
--- 378,384 ----
      XtListPosition  position;
  #endif
  {
!     AddEventHandler(widget, (XtPointer)&eventMask, 0, FALSE, other, 
  		    proc, closure, position, TRUE, TRUE);
  }
  
***************
*** 322,331 ****
      XtPointer	    closure;
  #endif
  {
!     AddEventHandler(widget, eventMask, other, 
  		    proc, closure, XtListTail, FALSE, TRUE);
  }
  
  typedef struct _WWPair {
      struct _WWPair *next;
      Window window;
--- 399,460 ----
      XtPointer	    closure;
  #endif
  {
!     AddEventHandler(widget, (XtPointer)&eventMask, 0, FALSE, other, 
  		    proc, closure, XtListTail, FALSE, TRUE);
  }
  
+ #if NeedFunctionPrototypes
+ void XtRemoveEventTypeHandler(
+     Widget	    widget,
+     int		    type,			      
+     XtPointer	    select_data,
+     XtEventHandler  proc,
+     XtPointer	    closure
+     )
+ #else
+ void XtRemoveEventTypeHandler(widget, type, select_data, proc, closure)
+     Widget	    widget;
+     int		    type;
+     XtPointer	    select_data;
+     XtEventHandler  proc;
+     XtPointer	    closure;
+ #endif
+ {
+     RemoveEventHandler(widget, select_data, type, TRUE,
+ 		       FALSE, proc, closure, FALSE);
+ }
+ 
+ #if NeedFunctionPrototypes
+ void XtAddEventTypeHandler(
+     Widget	    widget,
+     int		    type,
+     XtPointer	    select_data,
+     XtEventHandler  proc,
+     XtPointer	    closure,
+     XtListPosition  position
+     )
+ #else
+ void XtAddEventTypeHandler(widget, type, select_data, proc, closure, position)
+     Widget	    widget;
+     int		    type;
+     XtPointer	    select_data;
+     XtEventHandler  proc;
+     XtPointer	    closure;
+     XtListPosition  position;
+ #endif
+ {
+     if (type >= LASTEvent && select_data) {
+ 	XtAppWarningMsg(XtWidgetToApplicationContext(widget),
+ 			"invalidData", "xtAddEventTypeHandler",
+ 			XtCXtToolkitError,
+    "XtAddEventTypeHandler requires select_data to be NULL for non-core events",
+ 		(String *) NULL, (Cardinal *) NULL);
+     }
+ 
+     AddEventHandler(widget, select_data, type, TRUE, FALSE, 
+ 		    proc, closure, position, TRUE, FALSE);
+ }
+ 
  typedef struct _WWPair {
      struct _WWPair *next;
      Window window;
***************
*** 528,534 ****
  
      numprocs = 0;
      for (p=widget->core.event_table; p; p = p->next) {
! 	if (mask & p->mask)
  	    numprocs++;
      }
      if (numprocs > EHMAXSIZE) {
--- 657,664 ----
  
      numprocs = 0;
      for (p=widget->core.event_table; p; p = p->next) {
! 	if ((! p->has_type_specifier && (mask & p->mask)) ||
! 	    (p->has_type_specifier && event->type == TYPE(p)))
  	    numprocs++;
      }
      if (numprocs > EHMAXSIZE) {
***************
*** 541,547 ****
      }
      numprocs = 0;
      for (p=widget->core.event_table; p; p = p->next) {
! 	if (mask & p->mask) {
  	    proc[numprocs] = p->proc;
  	    closure[numprocs] = p->closure;
  	    numprocs++;
--- 671,679 ----
      }
      numprocs = 0;
      for (p=widget->core.event_table; p; p = p->next) {
! 	if ((! p->has_type_specifier && (mask & p->mask)) ||
! 	    (p->has_type_specifier && event->type == TYPE(p))) {
! 
  	    proc[numprocs] = p->proc;
  	    closure[numprocs] = p->closure;
  	    numprocs++;
***************
*** 571,583 ****
      XtPerDisplay pd;
  {
      register XtEventRec *p;   
-     XEvent nextEvent;
      Boolean was_dispatched = XtDidNothing;
      Boolean call_tm = XtDidNothing;
  
-     if (XFilterEvent(event, XtWindow(widget)))
- 	return XtDidFilter;
- 	
      if ( (mask == ExposureMask) ||
  	 ((event->type == NoExpose) && NO_EXPOSE) ||
  	 ((event->type == GraphicsExpose) && GRAPHICS_EXPOSE) ) {
--- 703,711 ----
***************
*** 599,631 ****
  	}
      }
  
-     if (mask == EnterWindowMask &&
- 	    widget->core.widget_class->core_class.compress_enterleave) {
- 	if (XPending(event->xcrossing.display)) {
- 	    XPeekEvent(event->xcrossing.display, &nextEvent);
- 	    if (nextEvent.type == LeaveNotify &&
- 		  event->xcrossing.window == nextEvent.xcrossing.window &&
- 		  event->xcrossing.subwindow == nextEvent.xcrossing.subwindow){
- 		/* skip the enter/leave pair */
- 		XNextEvent(event->xcrossing.display, &nextEvent);
- 		return XtDidNothing;
- 	    }
- 	}
-     }
- 
-     if (event->type == MotionNotify &&
- 	    widget->core.widget_class->core_class.compress_motion) {
- 	while (XPending(event->xmotion.display)) {
- 	    XPeekEvent(event->xmotion.display, &nextEvent);
- 	    if (nextEvent.type == MotionNotify &&
- 		    event->xmotion.window == nextEvent.xmotion.window &&
- 		    event->xmotion.subwindow == nextEvent.xmotion.subwindow) {
- 		/* replace the current event with the next one */
- 		XNextEvent(event->xmotion.display, event);
- 	    } else break;
- 	}
-     }
- 
      if ((mask == VisibilityChangeMask) &&
          XtClass(widget)->core_class.visible_interest) {
  	    was_dispatched = XtDidDispatch;
--- 727,732 ----
***************
*** 663,669 ****
  	     * call XtRemoveEventHandler, which would break our linked list. */
  
  	    for (; p; p = p->next) {
! 		if (mask & p->mask) {
  		    if (numprocs >= EHSIZE)
  			break;
  		    proc[numprocs] = p->proc;
--- 764,772 ----
  	     * call XtRemoveEventHandler, which would break our linked list. */
  
  	    for (; p; p = p->next) {
! 		if ((! p->has_type_specifier && (mask & p->mask)) ||
! 		    (p->has_type_specifier && event->type == TYPE(p))) {
! 
  		    if (numprocs >= EHSIZE)
  			break;
  		    proc[numprocs] = p->proc;
***************
*** 682,688 ****
  		}
  		was_dispatched = XtDidDispatch;
  	    }
! 	} else if (mask & p->mask) {
  	    was_dispatched = XtDidDispatch;
  	    (*p->proc)(widget, p->closure, event, &was_dispatched);
  	    was_dispatched = XtDidDispatch;
--- 785,792 ----
  		}
  		was_dispatched = XtDidDispatch;
  	    }
! 	} else if ((! p->has_type_specifier && (mask & p->mask)) ||
! 		   (p->has_type_specifier && event->type == TYPE(p))) {
  	    was_dispatched = XtDidDispatch;
  	    (*p->proc)(widget, p->closure, event, &was_dispatched);
  	    was_dispatched = XtDidDispatch;
***************
*** 693,698 ****
--- 797,812 ----
      return (was_dispatched|call_tm);
  }
  
+ Boolean XtDispatchEventToWidget(widget, event)
+     Widget	widget;
+     XEvent	*event;
+ {
+     return (DispatchEvent(event, widget,
+ 			  _XtConvertTypeToMask(event->xany.type),
+ 			  _XtGetPerDisplay(event->xany.display))
+ 	    ? True : False);
+ }
+ 
  /*
   * This structure is passed into the check exposure proc.
   */
***************
*** 951,956 ****
--- 1065,1111 ----
      return NULL;
  }
  
+ static Boolean DefaultDispatcher(event, widget, mask, pd)
+     XEvent *event;
+     Widget widget;
+     EventMask mask;
+     XtPerDisplay pd;
+ {
+     if (XFilterEvent(event, XtWindow(widget)))
+ 	return XtDidFilter;
+ 
+     if (mask == EnterWindowMask &&
+ 	    widget->core.widget_class->core_class.compress_enterleave) {
+ 	if (XPending(event->xcrossing.display)) {
+ 	    XEvent nextEvent;
+ 	    XPeekEvent(event->xcrossing.display, &nextEvent);
+ 	    if (nextEvent.type == LeaveNotify &&
+ 		  event->xcrossing.window == nextEvent.xcrossing.window &&
+ 		  event->xcrossing.subwindow == nextEvent.xcrossing.subwindow){
+ 		/* skip the enter/leave pair */
+ 		XNextEvent(event->xcrossing.display, &nextEvent);
+ 		return XtDidNothing;
+ 	    }
+ 	}
+     }
+ 
+     if (event->type == MotionNotify &&
+ 	    widget->core.widget_class->core_class.compress_motion) {
+ 	while (XPending(event->xmotion.display)) {
+ 	    XEvent nextEvent;
+ 	    XPeekEvent(event->xmotion.display, &nextEvent);
+ 	    if (nextEvent.type == MotionNotify &&
+ 		    event->xmotion.window == nextEvent.xmotion.window &&
+ 		    event->xmotion.subwindow == nextEvent.xmotion.subwindow) {
+ 		/* replace the current event with the next one */
+ 		XNextEvent(event->xmotion.display, event);
+ 	    } else break;
+ 	}
+     }
+ 
+     return DispatchEvent(event, widget, mask, pd);
+ }
+ 
  typedef enum _GrabType {pass, ignore, remap} GrabType;
  
  static Boolean DecideToDispatch(event)
***************
*** 965,976 ****
      XtPerDisplayInput pdi;
      XtGrabList  grabList;
  
-     widget = XtWindowToWidget (event->xany.display, event->xany.window);
      pd = _XtGetPerDisplay(event->xany.display);
-     pdi = _XtGetPerDisplayInput(event->xany.display);
-     grabList = *_XtGetGrabList(pdi);
-     
-     mask = _XtConvertTypeToMask(event->xany.type);
  
      grabType = pass;
      switch (event->xany.type & 0x7f) {
--- 1120,1126 ----
***************
*** 997,1002 ****
--- 1147,1163 ----
  
      if (time) pd->last_timestamp = time;
  
+     if (pd->appContext->dispatcherList) {
+ 	XtEventDispatchProc d;	
+ 	if (d = pd->appContext->dispatcherList[event->xany.type & 0x7f])
+ 	    return (*d)(event);
+     }
+ 
+     pdi = _XtGetPerDisplayInput(event->xany.display);
+     grabList = *_XtGetGrabList(pdi);
+     mask = _XtConvertTypeToMask(event->xany.type);
+     widget = XtWindowToWidget (event->xany.display, event->xany.window);
+ 
      if (widget == NULL) {
  	if (grabType != remap)
  	    return XFilterEvent(event, None);
***************
*** 1003,1020 ****
  	/* event occurred in a non-widget window, but we've promised also
  	   to dispatch it to the nearest accessible spring_loaded widget */
  	else if ((widget = LookupSpringLoaded(grabList)) != NULL)
! 	    return DispatchEvent(event, widget, mask, pd);
  	return XFilterEvent(event, None);
      }
  
      switch(grabType) {
  	case pass:
! 	    return DispatchEvent(event, widget, mask, pd);
  
  	case ignore:
  	    if ((grabList == NULL || _XtOnGrabList(widget,grabList))
  		&& XtIsSensitive(widget)) {
! 		return DispatchEvent(event, widget, mask, pd);
  	    }
  	    return XtDidNothing;
  
--- 1164,1181 ----
  	/* event occurred in a non-widget window, but we've promised also
  	   to dispatch it to the nearest accessible spring_loaded widget */
  	else if ((widget = LookupSpringLoaded(grabList)) != NULL)
! 	    return DefaultDispatcher(event, widget, mask, pd);
  	return XFilterEvent(event, None);
      }
  
      switch(grabType) {
  	case pass:
! 	    return DefaultDispatcher(event, widget, mask, pd);
  
  	case ignore:
  	    if ((grabList == NULL || _XtOnGrabList(widget,grabList))
  		&& XtIsSensitive(widget)) {
! 		return DefaultDispatcher(event, widget, mask, pd);
  	    }
  	    return XtDidNothing;
  
***************
*** 1030,1037 ****
  		if ((grabList == NULL || 
  		     _XtOnGrabList(dspWidget, grabList)) &&
  		    XtIsSensitive(dspWidget)) {
! 		    was_dispatched = DispatchEvent(event, dspWidget,
! 						   mask, pd);
  		    if (was_dispatched & XtDidFilter)
  			return was_dispatched;
  		}
--- 1191,1198 ----
  		if ((grabList == NULL || 
  		     _XtOnGrabList(dspWidget, grabList)) &&
  		    XtIsSensitive(dspWidget)) {
! 		    was_dispatched = DefaultDispatcher(event, dspWidget,
! 						       mask, pd);
  		    if (was_dispatched & XtDidFilter)
  			return was_dispatched;
  		}
***************
*** 1042,1049 ****
  		grabList = *_XtGetGrabList(pdi);
  		widget = LookupSpringLoaded(grabList);
  		if (widget != NULL && widget != dspWidget) {
! 		    was_dispatched |= DispatchEvent(event, widget,
! 						    mask, pd);
  		}
  		
  		return was_dispatched;
--- 1203,1210 ----
  		grabList = *_XtGetGrabList(pdi);
  		widget = LookupSpringLoaded(grabList);
  		if (widget != NULL && widget != dspWidget) {
! 		    was_dispatched |= DefaultDispatcher(event, widget,
! 							mask, pd);
  		}
  		
  		return was_dispatched;
***************
*** 1274,1280 ****
  	event.window = XtWindow(child);
  	event.mode = NotifyNormal;
  	event.detail = NotifyAncestor;
! 	DispatchEvent((XEvent*)&event, child, _XtConvertTypeToMask(type),
! 		      _XtGetPerDisplay(XtDisplay(child)));
      }
  }
--- 1435,1508 ----
  	event.window = XtWindow(child);
  	event.mode = NotifyNormal;
  	event.detail = NotifyAncestor;
! 	DefaultDispatcher((XEvent*)&event, child, _XtConvertTypeToMask(type),
! 			  _XtGetPerDisplay(XtDisplay(child)));
!     }
! }
! 
! 
! static XtEventDispatchProc* NewDispatcherList()
! {
!     XtEventDispatchProc* l =
! 	(XtEventDispatchProc*) XtCalloc((Cardinal)0x7f,
! 					(Cardinal)sizeof(XtEventDispatchProc));
!     return l;
! }
! 
! #if NeedFunctionPrototypes
! void XtSetEventDispatcher(
!     XtAppContext	app,
!     int			min_event_type,
!     int			max_event_type,
!     XtEventDispatchProc	proc
!     )
! #else
! void XtSetEventDispatcher(app, min_event_type, max_event_type, proc)
!     register XtAppContext app;
!     int			  min_event_type;
!     int			  max_event_type;
!     XtEventDispatchProc	  proc;
! #endif
! {
!     ProcessContext pctx;
!     XtEventDispatchProc *list;
!     register int type;
! 
!     if (min_event_type > 0x7f || max_event_type > 0x7f) return;
! 
!     if (app) {
! 	list = app->dispatcherList;
! 	if (!list) {
! 	    if (proc)
! 		list = app->dispatcherList = NewDispatcherList();
! 	    else
! 		return;
! 	}
! 	while (min_event_type <= max_event_type)
! 	    list[min_event_type++] = proc;
! 	return;
!     }
! 
!     /* no app context; do global list & all current contexts */
! 
!     pctx = _XtGetProcessContext();
! 
!     list = pctx->globalDispatcherList;
!     if (!list && proc)
! 	list = pctx->globalDispatcherList = NewDispatcherList();
! 
!     if (list && proc)
! 	for (type=min_event_type; type <= max_event_type;)
! 	    list[type++] = proc;
! 
! 
!     for (app=pctx->appContextList; app; app=app->next) {
! 	list = app->dispatcherList;
! 	if (!list && proc)
! 	    list = app->dispatcherList = NewDispatcherList();
! 
! 	if (list && proc)
! 	    for (type=min_event_type; type <= max_event_type;)
! 		list[type++] = proc;
      }
  }
*** old/EventI.h
--- /mit/lib/Xt/EventI.h
***************
*** 1,4 ****
! /* $XConsortium: EventI.h,v 1.18 91/01/29 10:56:58 rws Exp $ */
  /* $oHeader: EventI.h,v 1.3 88/08/24 09:21:11 asente Exp $ */
  
  /***********************************************************
--- 1,4 ----
! /* $XConsortium: EventI.h,v 1.18.1.1 91/08/27 18:07:30 swick Exp $ */
  /* $oHeader: EventI.h,v 1.3 88/08/24 09:21:11 asente Exp $ */
  
  /***********************************************************
***************
*** 61,70 ****
  
  typedef struct _XtEventRec {
       XtEventTable	next;
!      EventMask		mask;
       XtEventHandler	proc;
       XtPointer		closure;
       unsigned int	select:1;
       unsigned int	async:1; /* not used, here for Digital extension? */
  } XtEventRec;
  
--- 61,71 ----
  
  typedef struct _XtEventRec {
       XtEventTable	next;
!      EventMask		mask;	/* also select_data count for RecExt */
       XtEventHandler	proc;
       XtPointer		closure;
       unsigned int	select:1;
+      unsigned int	has_type_specifier:1;
       unsigned int	async:1; /* not used, here for Digital extension? */
  } XtEventRec;
  
*** /old/InitialI.h
--- /mit/lib/Xt/InitialI.h
***************
*** 1,4 ****
! /* $XConsortium: InitialI.h,v 1.61 91/07/12 12:33:51 rws Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: InitialI.h,v 1.61.1.1 91/08/27 18:08:21 swick Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 104,109 ****
--- 104,110 ----
      XtAppContext	appContextList;
      ConverterTable	globalConverterTable;
      LangProcRec		globalLangProcRec;
+     XtEventDispatchProc *globalDispatcherList;
  } ProcessContextRec, *ProcessContext;
  
  typedef struct {
***************
*** 147,152 ****
--- 148,154 ----
      DestroyRec* destroy_list;
      Widget in_phase2_destroy;
      LangProcRec langProcRec;
+     XtEventDispatchProc *dispatcherList;
  } XtAppStruct;
  
  #ifdef XTTRACEMEMORY
*** /old/Intrinsic.h
--- /mit/lib/Xt/Intrinsic.h
***************
*** 1,4 ****
! /* $XConsortium: Intrinsic.h,v 1.173 91/07/21 00:19:04 rws Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Intrinsic.h,v 1.173.1.1 91/08/27 18:08:53 swick Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 515,520 ****
--- 515,526 ----
  #endif
  );
  
+ typedef Boolean (*XtEventDispatchProc)(
+ #if NeedFunctionPrototypes
+     XEvent*		/* event */
+ #endif
+ );
+ 
  /***************************************************************
   *
   * Exported Interfaces
***************
*** 1018,1023 ****
--- 1024,1066 ----
      XtEventHandler 	/* proc */,
      XtPointer 		/* closure */,
      XtListPosition 	/* position */
+ #endif
+ );
+ 
+ extern void XtSetEventDispatcher(
+ #if NeedFunctionPrototypes
+     XtAppContext	/* app */,
+     int			/* min_event_type */,
+     int			/* max_event_type */,
+     XtEventDispatchProc	/* proc */
+ #endif
+ );
+ 
+ extern Boolean XtDispatchEventToWidget(
+ #if NeedFunctionPrototypes
+     Widget		/* widget */,
+     XEvent*		/* event */
+ #endif
+ );
+ 
+ extern void XtAddEventTypeHandler(
+ #if NeedFunctionPrototypes
+     Widget		/* widget */,
+     int			/* type */,
+     XtPointer		/* select_data */,
+     XtEventHandler	/* proc */,
+     XtPointer		/* closure */,
+     XtListPosition	/* position */
+ #endif
+ );
+ 
+ extern void XtRemoveEventTypeHandler(
+ #if NeedFunctionPrototypes
+     Widget		/* widget */,
+     int			/* type */,			      
+     XtPointer		/* select_data */,
+     XtEventHandler	/* proc */,
+     XtPointer		/* closure */
  #endif
  );