From: syj@ecmwf.co.uk (Jean-Philippe Martin-Flatin)
Newsgroups: comp.windows.x
Subject: Re:Double click in XmDrawingArea
Date: 6 Nov 92 14:42:11 GMT
Followup-To: comp.windows.x.intrinsics
Organization: ECMWF

(this discussion started on motif-talk --- background included)

<*> > Forgive me, but I have never before played with that. XmDrawing area
<*> > translation table appears to recognize double click as a distinct
<*> > event:
<*> > 
<*> > <Btn1Down>:     DrawingAreaInput() ManagerGadgetArm()\n\
<*> > <Btn1Down>,<Btn1Up>:    DrawingAreaInput() ManagerGadgetActivate()\n\
<*> > <Btn1Up>:       DrawingAreaInput() ManagerGadgetActivate()\n\
<*> > <Btn1Down>(2+): DrawingAreaInput() ManagerGadgetMultiArm()\n\
<*> > <Btn1Up>(2+):   DrawingAreaInput() ManagerGadgetMultiActivate()\n\
<*> >         ^^^^^^
<*> > 
<*> > But when I arm the callback, I get separate notification for each 
<*> > <Btn1Down> and <Btn1Up> no matter how fast I try to click.
<*> > [My interpretation of <Btn1Up>(2+) is that it should swallow the
<*> >  first Down/Up/Down, and call me on the last one ONLY].
<*> > 
<*> > What am I doing wrong ?
<*> > 
<*> > Also, if I can make it work, is there any way I can detect the double
<*> > click activation in my Input callback ? (I don't see anything...).
<*> > 
<*> > Oh. Motif 1.1.3, build against X11R4 patchlevel 18, running on the top
<*> > of R4 or X11R5 (seems to make no difference here). SunOS 4.1.2.
<*> > 
<*> > -- Martin
<*> 
<*> Do you have a window manager binding for Btn1 on the actual
<*> client window in your .mwmrc ? I recall some strange behavior,
<*> where mwm would grab the button presses, then replay them to
<*> the client. This would cause a Leave and Enter event to appear
<*> in the client event queue between button presses - breaking
<*> Xt's recognition of double click.
<*> 
<*> Try removing from .mwmrc, any lines of the form:
<*> 
<*>     <Btn1Down>  window  f.raise
<*> 
<*> This may no longer be a problem, but it is worth checking -  try
<*> running xev, and see if your server is sending the correct sequence
<*> of Press/Release, without any intervening events.
<*> 
<*> 	Alastair.

Could you please elaborate on that "strange behaviour" ? I seem to have
a similar problem: double-clicking on an icon, I would expect just the
application to pop up. The application does pop up, but it also receives
the last ButtonRelease event. And when my pointer happens to be above
a gadget in a DrawingArea, this one gets activated (translations similar
to above), and a callback gets called, etc...

It looks like the icon performs no grab, and the DrawingArea is fooled
by the ButtonRelease event that it should not receive. Is this problem
due to Xt or the Motif window manager ?

I tried all sorts of window manager bindings (in .mwmrc) to prevent the
ButtonRelease event from being passed on to the application:

	<Btn1Up>(2)                               icon    f.normalize
	<Btn1Down>,<Btn1Up>,<Btn1Down>,<Btn1Up>   icon    f.normalize
	...

I tried several contexts: X11R4, X11R5, Motif 1.1.4 and Motif 1.1.5 under
SunOS 4.1.1, but none succeeded.

Any idea ? Can it be something wrong in the application itself ?

Thanks in advance

/----------------------------------------------------\
| Jean-Philippe Martin-Flatin                        |
| European Centre for Medium-Range Weather Forecasts |
| Shinfield Park                                     |
| Reading RG2 9AX                                    |
| England                                            |
|----------------------------------------------------|
|  Disclaimer: I speak for myself, not my employer   |
\----------------------------------------------------/
Newsgroups: comp.windows.x