[comp.windows.x.motif] Synthetic Event needed.

slc1290@hare.udev.cdc.com (steve chesney x4662) (08/25/90)

Because our Motif application is a port from a screen based application,
there is considerable processing between invocations of the standard X
Event Loop mechanism.  Since we destroy widgets in this mainline code,
we frequently flush the event queues after each XtDestroyWidget to
minimize the chance of partially destroyed widgets giving us grief.  The
flush is done with something like this:

   /* Loop until there are no more pending events. */
   while (XtPending())
   {
      /* Get the next event to process. */
      XtNextEvent(&Event);

      if (Event.type == ClientMessage)
      {
         /* Strip-off inter-client communication events for application 
messages. */
         if (StripApplicationICInputEvent(&Event) != -1)
            continue;
      }

      /* Let the X toolkit dispatch all other event types, and inter-client
         communication events that are not IC messages. */
      XtDispatchEvent(&Event);
   }

Sometimes this is called when there are no server events to Dispatch and
it does not get to the XtDispatchEvent and thus does not do pase 2 of
the widget destroy process.  At other times it seems to block at the
XtNextEvent call; at these times the user is forced to hit a key or
wiggle the mouse to shove an event through and unfreeze the application.

I need a way to mimic a server event (it should be a do-nothing) so that
at each flush there is at least one event to get and dispatch
immediately.  Can I use XSencEvent for this, and if so, how do I set it up?

Thanks!

Steve Chesney       Control Data Corporation      slc1290@hare.udev.cdc.com

nazgul@alphalpha.com (Kee Hinckley) (08/25/90)

> the widget destroy process.  At other times it seems to block at the
> XtNextEvent call; at these times the user is forced to hit a key or
> wiggle the mouse to shove an event through and unfreeze the application.

I used to see this behavior.  Doing:

	XtInputMask     mask;
	while (mask = XtPending()) XtProcessEvent(mask);

seemed to make it go away.


Alphalpha Software, Inc.	|	motif-request@alphalpha.com
nazgul@alphalpha.com		|-----------------------------------
617/646-7703 (voice/fax)	|	Proline BBS: 617/641-3722

I'm not sure which upsets me more; that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

-------