Re: Q: About popups & cascade menus

Steve Lamont (spl@szechuan.ucsd.edu)
Mon, 23 Dec 96 12:14:10 PST

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> The example program "pup" in DEMOS directory gives the following
> error when the button "menu" is pushed.
>
> X Error of failed request: BadMatch (invalid parameter attributes)
> Major opcode of failed request: 1 (X_CreateWindow)
> Serial number of failed request: 447
> Current serial number in output stream: 455
>
> This happens on only HP machines at school but the program works
> fine under linux at home. Also if the program is run on HP but use
> the linux as the display, it works.
>
> I have found that the culprit is in function "init_menu" in the line
>
> mm=fl_newpup(0);
>
> The argument is supposed to be ID of the window to which the popup
> belongs. I don't know why 0 is used here and why sometimes it works
> but sometimes it doesn't.

An argument of 0 means that the popup will be parented by the root
window. I'm not sure if this is documented anywhere -- I did a quick
vgrep on the manual and didn't see it right off.

My guess is that the HP machine has a 24 bit TrueColor Visual
available and XForms is creating its windows using that Visual. It
then tries to create a Window parented to the root window, which is
probably an 8 bit PseudoColor visual. Thus the BadMatch error.

The reason why it runs on the Linux server is most likely that the
Linux server will only usefully support PseudoColor visuals.

At least that's my guess.

Run xwininfo and clicking on the root window to see what it coughs
up. I'll bet it will say something like

alex:spl> xwininfo

xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.

xwininfo: Window id: 0x2a (the root window) (has no name)

[...]
Depth: 8
Visual Class: PseudoColor
[...]

Then run your program and run xwininfo on it.

You can probably make the program work with the XForms flag

-visual PseudoColor

spl