[comp.windows.x] Getting a time stamp in Xt

ken@msc.umn.EDU (Ken Chin-Purcell) (07/05/89)

I would like to call XtGetSelectionValue while in a command 
widget callback.

In order to be ICCCM compliant (to avoid race conditions,
I suppose), the time stamp of the mouse down event that 
triggered the callback needs to pe passed as a parameter.  
The toolkit however seems to hide the XEvent record.

One solution is to register an event handler with the command 
widget, using XtAddRawEventHandler.  When that handler is called,
cache the XEvent in a global, and then assume that the callback is
called immeadiately after the event handler (so I can depend
on my cached XEvent being correct).  

Is there a cleaner way to get the time stamp?

-- Ken    [ aka: ken@msc.umn.edu  (612) 626-1340 ]

rws@EXPO.LCS.MIT.EDU (07/06/89)

    I would like to call XtGetSelectionValue while in a command 
    widget callback.

    Is there a cleaner way to get the time stamp?

You could lobby your widget implementor to make the information available to
you.

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (07/06/89)

> Is there a cleaner way to get the time stamp?

Here is one.

Rather than using the callback proceedure for the widget define your
own global action routine (see XtAppAddActions) and bind it to your 
widget via a translation.  One of the parameters passed to an action
routine is the event.  Thus your application will have the event.

One caution when using this method is that in configurable programs you may not
be able to assume the type of event that activates the proceedure (The user
can modify the translation table to suit his/her tastes).  Be sure to check the
"type" field in the event, so that you are getting the right structure
element out of the Event's Union.


						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213