schultz@NRL-AIC.ARPA (Alan Schultz) (06/10/88)
I am having trouble figuring out how to do the following in CLX. The CLX documentation (doc.lisp) along with the Xlib documentation have not made it clear to me. I want to write a lisp function that when called will wait a certain amount of time for a mouse button to be clicked, and return the x, y coordinates of the mouse at the time the button was pressed. If the button is not pressed within that time limit, the function will return nil. All graphics occur on the ROOT WINDOW! There are no other windows in use. Yes, I know this is not a good way to do things, but I am tasked with porting this system with MINIMAL changes to the original code, and this is a standalone system where it is assumed that nothing else is going on. All of the CLX code I have written up to know was graphics oriented, and there was no event processing going on. I am having trouble understanding how to do the above, in the simplest was possible. Thanks, Alan C. Schultz Code 5510 Navy Center for Applied Research in Artificial Intelligence (NCAR A I) Naval Research Laboratory Washington, D.C. 20375-5000 ARPA: schultz@nrl-aic.arpa (202) 767-2877
RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (06/10/88)
XLIB:EVENT-CASE has a :TIMEOUT option that you can use to do what you want. As a simplified example of what you are attempting to do: (xlib:event-case (dpy :timeout 7.5) (button-press (x y) `(,x ,y)))