[comp.soft-sys.andrew] im_SetInteractionEvent doesn't do what the documentation says

guy@auspex.UUCP (Guy Harris) (12/14/89)

First, it doesn't return "void", it returns the event queued up by
"im_EnqueueEvent" to cause the specified function to be called.

Second, and more importantly, the function does *not* get called on the
next interaction, at least under X11.  The problem appears to be that
the event isn't triggered until the specified time increment has
occurred, so it never gets moved to the "pendingInteractionEvents"
queue, and thus never gets seen by the main interaction loop.

Is this intentional?  As I read the ATK documentation, the event queued
up by "im_SetInteractionEvent" should occur either on the next user
interaction or after the specified timeout, whichever comes first.  This
is definitely not happening, as can be attested to by the fact that, if
you type ^G and get the "Cancelled." message, the "Cancelled." message
stays on the message line until replaced by some other message.

ajp+@ANDREW.CMU.EDU (Andrew Palay) (12/14/89)

Excerpts from internet.info-andrew: 14-Dec-89 im_SetInteractionEvent
does.. Guy Harris@uunet.uu.net (889)

> First, it doesn't return "void", it returns the event queued up by
> "im_EnqueueEvent" to cause the specified function to be called.

> Second, and more importantly, the function does *not* get called on the
> next interaction, at least under X11.  The problem appears to be that
> the event isn't triggered until the specified time increment has
> occurred, so it never gets moved to the "pendingInteractionEvents"
> queue, and thus never gets seen by the main interaction loop.

> Is this intentional?  As I read the ATK documentation, the event queued
> up by "im_SetInteractionEvent" should occur either on the next user
> interaction or after the specified timeout, whichever comes first.  This
> is definitely not happening, as can be attested to by the fact that, if
> you type ^G and get the "Cancelled." message, the "Cancelled." message
> stays on the message line until replaced by some other message.

I believe you are correct that the documentation is in error.  The
actual behavior of SetInteractionEvent is to be called on the first user
interaction after the time interval has expired.  In your example, the
word "Cancelled" should stay visible until the first interaction after
15 seconds.  You can test this out by typing ^G and then hitting the
space bar once a second.  At some point the message should go away.

Andy

guy@auspex.UUCP (Guy Harris) (12/19/89)

>I believe you are correct that the documentation is in error.  The
>actual behavior of SetInteractionEvent is to be called on the first user
>interaction after the time interval has expired.  In your example, the
>word "Cancelled" should stay visible until the first interaction after
>15 seconds.  You can test this out by typing ^G and then hitting the
>space bar once a second.  At some point the message should go away.

Thanks.  Yup, I tried it after sending out my message, and that's what
it does.  I put

	*.messagetimeout: 0

into my ".Xdefaults", and now it works the way I want it to.

Here's a first cut at a fix to "atk/basics/common/im.doc" (which fixes
both the bugs I noted); the description of what "timeIncrement" means
can almost certainly be improved from my version:

*** im.doc.dist	Wed Nov 15 17:14:22 1989
--- im.doc	Thu Dec 14 17:16:58 1989
***************
*** 558,564 ****
  \paragraph{Setting an interaction event}\indexi{Interaction manager++Setting 
  an interaction event} \indexi{ \italic{im_SetInteractionEvent}}
  
! \example{void im_SetInteractionEvent (im, interactionFunction, 
  interactionData, timeIncrement) 
  
  struct im *im;  
--- 558,564 ----
  \paragraph{Setting an interaction event}\indexi{Interaction manager++Setting 
  an interaction event} \indexi{ \italic{im_SetInteractionEvent}}
  
! \example{struct event *im_SetInteractionEvent (im, interactionFunction, 
  interactionData, timeIncrement) 
  
  struct im *im;  
***************
*** 571,580 ****
  
  
  \leftindent{\bold{Method description.  }  \italic{im_SetInteractionEvent 
! } sets up an interaction event.  The interactionFunction will be called with 
! the parameter interactionData when either a user interaction (mouse hit, 
! key-stroke or menu selection) occurs, or after timeIncrement seconds, which 
! ever comes first. 
  
  
  \bold{Usage.}  Be careful with this function.  Because Toolkit objects are do 
--- 571,579 ----
  
  
  \leftindent{\bold{Method description.  }  \italic{im_SetInteractionEvent 
! } sets up an interaction event.  After a delay of timeIncrement seconds, the 
! interactionFunction will be called with the parameter interactionData when the 
! next user interaction (mouse hit, key-stroke or menu selection) occurs. 
  
  
  \bold{Usage.}  Be careful with this function.  Because Toolkit objects are do