shakes@athena.mit.edu (Sue Downing) (03/10/91)
I am repeating these questions for a friend of mine who doesn't have access to netnews. Could you please forward your answers to: bj@oak.com (uunet!oak!bj) Thanks. ------- I have two questions: 1) How can I detect double mouse clicks in a portable way? I have written a loop that sleeps for a small period of time and then checks the event queue. After the double-mouse-click interval has passed (and no events are detected) I note a single mouse click. Is there a readevent with timeout? Or is there a way to ask the server to send a "timer" event at a future time? 2) What is the best way to determine the size of the image data that needs to be allocated for an XImage? XCreateImage notes that it does not allocate space for the image itself. Is there a portable method to determine the number of bytes needed? XGetImage knows how to do this. Thanks a bunch. --Bjoren Davis (bj@oak.com or uunet!oak!bj)
mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (03/10/91)
> 1) How can I detect double mouse clicks in a portable way? You can't. As you've noticed, there is no way to ask the server for a timer event, or anything similar. > I have written a loop that sleeps for a small period of time and then > checks the event queue. After the double-mouse-click interval has > passed (and no events are detected) I note a single mouse click. It would be better to wait until an event is received, and if you don't get any, force the server to generate one (such as a zero-length append to a property). Then you can get your time values from the server all the time, thus making the code reliable, even if it does require an extra round-trip. (Why don't I count this as "portable"? Because it involves playing with (typically) sub-second timeout values.) I'm hoping R5 will improve this. One of the talks at the X conference included something about an input server sort of thing; if done right, this should be able to cure things. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu