From: mj@lpi.liant.com (MJ Franzago)
Subject: HP ButtonRelease event problem
Reply-To: mj@lpi.liant.com	
Organization: Liant Software Corporation, Framingham MA	
Date: Mon, 28 Sep 1992 18:11:02 GMT

I am running Motif 1.1 on an HP 9000/720 and am having problems 
overriding the translation for a ButtonRelease event in a 
DrawingArea widget.  My action routines correctly interpret 
MotionNotify events until a ButtonPress event is incurred.  
Then MotionNotify events are not interpreted until the mouse 
leaves the window and comes back in.  ButtonRelease events 
are *never* incurred.

My test program (which is included) works fine on a Sun/4, also
running Motif 1.1.  Has anyone seen this problem on the HP
and if so, is there a workaround?

Please respond via e-mail as my news feed has been a bit flaky.
Thanks in advance for any help.

Test program follows...
================================================================

#include <Xm/BulletinB.h>
#include <Xm/XmP.h>
#include <Xm/DrawingA.h>
#include <Xm/DialogS.h>
#include <Xm/MainW.h>
#include <Xm/MenuShell.h>
#include <Xm/PushB.h>
#include <Xm/Text.h>
#include <Xm/ToggleB.h>
#include <Xm/ToggleBG.h>
#include <Xm/ScrollBar.h>
#include <Xm/Protocols.h>
#include <X11/IntrinsicP.h>
#include <stdio.h>

#define TOP_ARGCOUNT	4
#define WORK_ARGCOUNT	7

void my_handle_button();
void my_handle_motion();

static char worktrans[] =
    "<Motion>:  	handle_motion()\n\
     <BtnDown>:     	handle_button()\n\
     <BtnUp>:       	handle_button()\n";

static XtActionsRec actions[] =
    { /*{"name",              	procedure}, */
    {"handle_button",     	my_handle_button},
    {"handle_motion",     	my_handle_motion},
};

main(argc, argv)
unsigned int argc;
char **argv;
{
    Widget		toplevel;
    Widget		main_w;
    Widget		work;
    XtAppContext	app;
    int			n;
    Arg			args[10];

    toplevel = XtAppInitialize (
			&app,
			"XVT",
			NULL, 
			0,
			&argc,
			argv,
			NULL,
			NULL,
			0 );

    XtVaSetValues (	toplevel,
			XmNwidth, 	(XtArgVal)653,
			XmNheight, 	(XtArgVal)223,
			NULL );

    main_w = XmCreateMainWindow (
			toplevel, 
			"cwxm",
			NULL, 
			0 );

    work = XmCreateDrawingArea (	
			main_w,
			"", 
			NULL, 
			0 );

    XtVaCreateManagedWidget (
			"dummy", 
			xmLabelWidgetClass, 
			work,
    			XmNmappedWhenManaged, 	False, 
			XmNwidth, 		653,
			XmNheight, 		223,
			NULL );

    XtAppAddActions(app, actions, XtNumber(actions));
    XtOverrideTranslations(work, XtParseTranslationTable(worktrans));

    XtManageChild(main_w);
    XtManageChild(work);

    XtRealizeWidget (toplevel); 
    XtAppMainLoop (app);
			
}

void
my_handle_button(widget, xevent, params, num_params)
Widget widget;
XEvent *xevent;
String *params;            /* unused */
Cardinal *num_params;      /* unused */
{
    switch (xevent->xbutton.type) {
        case ButtonPress:
	    fprintf (stdout, "**my_handle_button: ButtonPress\n");
            break;
        case ButtonRelease:
	    fprintf (stdout, "**my_handle_button: ButtonRelease\n");
            break;
        default:
	    fprintf (stdout, "**my_handle_button: Some other event\n");
            break;
    }
}

void
my_handle_motion(widget, xevent, params, num_params)
Widget widget;
XEvent *xevent;
String *params;            /* unused */
Cardinal *num_params;      /* unused */
{
    fprintf (stdout, "**handle_motion**\n");
}

--------------------------------------------------------------------
   MJ Franzago                       mj@lpi.liant.com 
   Liant Software Corporation        tel: (508) 872-8700
   Framinghan, MA 01760 USA          fax: (508) 626-2221
--------------------------------------------------------------------
Newsgroups: comp.windows.x.motif