home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!hal.com!halaus!alf.hal.COM!not-for-mail
- From: ess@hal.COM (Eric Swildens)
- Newsgroups: comp.windows.x
- Subject: Re: Double Click in a window (Motif Drawing Area)
- Keywords: Mouse Events, double click, drawing area, ButtonPress
- Message-ID: <1513odINNqh6@alf.hal.COM>
- Date: 27 Jul 92 15:12:13 GMT
- References: <50599@dime.cs.umass.edu> <1992Jul24.183723.583@thunder.mcrcim.mcgill.edu>
- Sender: news@hal.com
- Organization: HaL Computer Systems, Inc.
- Lines: 35
-
- In article <1992Jul24.183723.583@thunder.mcrcim.mcgill.edu>
- mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes:
- >In article <50599@dime.cs.umass.edu>,
- nikoulis@venice.pilgrim.umass.edu (Panos Nikoulis) writes:
- >> Is there a way to detect a double click mouse event in a window
- >Not reliably. The protocol does not contain enough support to allow
- >this to be done right. (It needs some sort of timeout event.)
- >
- >> Currently, I am using time functions to make it "wait" for a time
- >> equal to the double click interval and detect a second ButtonPress
- >> after the first one (inside the Drawing Area callback).
- >Some toolkits/widget sets contain code that does this for you. It'll
- >work as well as your code does, presumably, but will suffer from the
- >same basic problem: it can lose big in the presence of network hiccups
- >(it can fail both ways: it can mistake a double click for two single
- >clicks, and it can mistake two single clicks for a double click).
-
- The protocol does contain support for this, but whether you can do
- this correctly is X server dependent. If the device driver for the
- mouse puts timestamps on the events when it receives them raw,
- the X server can get timestamps for the events correctly, which it
- will send on down the pipe for your application to receive and these
- timestamps wont be affected by network/server delays. You can
- check for double-click events without problems in this case:
- get a mouse down/up, check the next mouse down/up whenever it comes,
- check the delta between the two event timestamps in your application.
-
- If you are running on an X server which doesnt have a friendly device
- driver and which puts timestamps on the events itself, you are
- in trouble. If the server reads the first mouse down/up, draws some
- huge primitive which takes 10 seconds, reads the second mouse down/up
- and puts the current time as a timestamp you probably arent going to
- see that double-click in your application.
-
- ESS
-