From: achan@idaho.tdd.sj.nec.com (Amy Chan)
Subject: Re: PopupMenu with XmNwhichButton changed locks X server
Organization: NEC-AM TDD, San Jose, California
Date: Wed, 30 Sep 1992 16:52:31 GMT

In article <60749@mimsy.umd.edu> nzhang@umiacs.umd.edu (Ning Zhang) writes:
>
>We are in the process to convert our programs from MOTIF 1.0.3 to
>ICS MOTIF 1.1.3. We have had many problems during the conversion
>We have got around most of the problems, but I had no idea what
>causes the problem demostrated by the following test program:
>
>#include <stdio.h>
>#include <Xm/Form.h>
>#include <Xm/PushB.h>
>#include <Xm/RowColumn.h>
> 
>Widget topshell;
>Widget form;
>Widget btn1;
>Widget btn2;
>Widget btn3;
>Widget btn4;
>Widget popup1;
> 
>Arg arg_list[10];
>int i;
> 
>dialog()
>{
>    XtManageChild(popup1);
>}
> 
>main(argc, argv)
>int argc;
>char *argv[];
>{
>    topshell = XtInitialize(argv[0], "PUBTST", NULL, 0, &argc, argv);
>    form = XmCreateForm(topshell, "form", NULL, 0);
>    XtSetArg(arg_list[0], XmNtopAttachment, XmATTACH_FORM);
>    XtSetArg(arg_list[1], XmNleftAttachment, XmATTACH_FORM);
>    XtSetArg(arg_list[2], XmNrightAttachment, XmATTACH_FORM);
>    btn1 = XmCreatePushButton(form, "button_1", arg_list, 3);
>    XtSetArg(arg_list[0], XmNtopAttachment, XmATTACH_WIDGET);
>    XtSetArg(arg_list[1], XmNtopWidget, btn1);
>    XtSetArg(arg_list[2], XmNleftAttachment, XmATTACH_FORM);
>    XtSetArg(arg_list[3], XmNrightAttachment, XmATTACH_FORM);
>    btn2 = XmCreatePushButton(form, "button_2", arg_list, 4);
> 
>    XtManageChild(btn1);
>    XtManageChild(btn2);
>    XtManageChild(form);
>    XtRealizeWidget(topshell);
>
>    XtSetArg(arg_list[0], XmNwhichButton, 1);
>    popup1 = XmCreatePopupMenu(topshell, "popup1", arg_list, 1);
>/*
>    popup1 = XmCreatePopupMenu(topshell, "popup1", arg_list, 0);
>*/
>    btn3 = XmCreatePushButton(popup1, "button_3", arg_list, 0);
>    btn4 = XmCreatePushButton(popup1, "button_4", arg_list, 0);
>    XtManageChild(btn3);
>    XtManageChild(btn4);
> 
>    XtAddCallback(btn1, XmNactivateCallback, dialog, NULL);
>    XtMainLoop();
>}
>
>When the whichButton resource is changed from the default value
>(the right mouse button) to the left mouse button, the whole
>X server was locked up after btn1 is pressed. I had to log in from
>another machine to kill the program. And sometime I got a message like
>
>    X: Warning: input queue lock broken!
>
>after the process was killed.
>
>We are running MOTIF 1.1.3 with SUN OpenWindows 3.0 XNeWS server.
>We had no such a problem with MOTIF 1.0.3 with the same X server.

I tried your program on MOTIF 1.1.0 with X11R4 on a Sun Sparc. I had
the same program as you described (the X server was locked up after btn1
was pressed).

However, after I changed 
    XtSetArg(arg_list[0], XmNwhichButton, 1);

to
    XtSetArg(arg_list[0], XmNmenuPost, "<Btn1Down>");

the program didn't cause the X server to lock up. 

From Motif 1.1 Programmer's Reference Manual,

XmNwhichButton
    Specifiess the mouse button to which a menu system is sensitive.
    ...
    This resource is obsolete; is has been replaced by XmNmenuPost and is
    present for compatibility with older releases of OSF/Motif.



Amy
    
     
--
Amy Chan                 | E-Mail:
NEC America              |  INET: achan@tdd.sj.nec.com
110 Rio Robles           |  UUCP: ...{decwrl,oliveb}!necsun!achan
San Jose, CA 95134       |