Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!mips!apple!oliveb!mintaka!bloom-beacon!EXPO.LCS.MIT.EDU!converse From: converse@EXPO.LCS.MIT.EDU (Donna Converse) Newsgroups: comp.windows.x Subject: Re: Single/Double Click Message-ID: <9004082245.AA24269@expo.lcs.mit.edu> Date: 8 Apr 90 22:45:16 GMT References: <899@dcl-vitus.comp.lancs.ac.uk> Sender: daemon@athena.mit.edu (Mr Background) Organization: X Consortium, MIT Laboratory for Computer Science Lines: 38 > I need > to be able to cause two different actions depending on whether I click once > or twice on a mouse button. My translation table looks (in part) like this: > > (2): action_one\n\ > ,: action_two\n\ > > With this table, a single click calls action_two as required, but a double > click calls action_two followed by action_one. (2) is equivalent to specifying ,,. The event sequence of one of your translations is an initial subsequence of the other. When the longer event sequence occurs, the Intrinsics will take the actions specified for both event sequences, as you have observed. > How can I ensure action_two is not called from a double click? Rework the action corresponding to a single click to be a timer callback procedure. Add the timer callback in a new action procedure which is bound to ,; remove the timer callback and do the double click stuff if the action procedure is called again in some small amount of time. > The order of the two entries in the table doesn't seem to matter, and some > alternatives I have tried (for instance, omitting the on the > second line) do not call action_two at all. Right, and try pressing the button down outside of your application and releasing it over your application to see the effect of the latter. > If X windows insists on calling action_two in all cases, must I wait a bit > and see if there is another event waiting? Yes, in one way or another, the single click action must be deferred. Donna Converse converse@expo.lcs.mit.edu