[comp.windows.x.motif] bug with panedWindow to multiple displays ?

pop@linus.mitre.org (Paul O. Perry) (11/29/90)

                          My Problem Report
                  =================================

Submitter Information (Include Email address at miminum)
---------------------

Submitter Name:         Paul O. Perry
Organization:           MITRE Corp.
Email Address:          pop@mitre.org

Hardware/Software Configuration
-------------------------------

Offering and Version:   Motif 1.1 
Component (Module):     lib/Xm/XmSash.c
Client Hardware:        Sun 4/65
Client Software:        SunOS 4.0.3, X11R4.18
Server Hardware:        SAME
Server Software:        SAME
Compiler:               SunOS 4.0.3 cc compiler

Problem Description
-------------------

Severity Level: Severe

Date of First Occurrence: Also happed with Motif1.0

One Line Description:

	BadCursor problem with multiple panedWindows.

Full Description:

I get the following error when I try to open two toplevel windows and
put panedWindows with frame childs in them:

        Error code BadCursor (invalid Cursor parameter)
        Error code BadWindow (invalid Window parameter)
        Error code BadCursor (invalid Cursor parameter)
        Error code BadWindow (invalid Window parameter)
        Error code BadWindow (invalid Window parameter)

If I comment out the error handler I receive the following error:

X Error of failed request:  BadCursor (invalid Cursor parameter)
  Major opcode of failed request:  1 (X_CreateWindow)
  Minor opcode of failed request:  0
  Resource id in failed request:  0xc0000d
  Serial number of failed request:  42
  Current serial number in output stream:  51

Anyone know why ?  If the second the creation of a second toplevel
window is commented out things are ok ...

Repeat By:

        Examine code.

---cut-here------------------------------------------snip-snip-------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	makefile
#	main-c.c
#	creation-c.c
# This archive created: Wed Nov 28 17:53:40 1990
export PATH; PATH=/bin:$PATH
if test -f 'makefile'
then
	echo shar: will not over-write existing file "'makefile'"
else
cat << \SHAR_EOF > 'makefile'
#
# Generated by the ICS builderXcessory (BX).
# Modified by P. O. Perry
#
# Builder Xcessory 1.0 Prerelease.
#
#
CC=cc
CFLAGS=-I/usr/local/include -D_NO_PROTO
LIBS=-lXm -lXt -lX11

OFILES = main-c.o creation-c.o 
CFILES = main-c.c creation-c.c 

main-c: $(OFILES)
	$(CC) $(CFLAGS) $(OFILES) -o $@ $(LIBS)

main-c_osaber:
	#load $(CFLAGS) $(OFILES) $(LIBS)

main-c_saber:
	#load $(CFLAGS) $(CFILES) $(LIBS)

SHAR_EOF
fi # end of overwriting check
if test -f 'main-c.c'
then
	echo shar: will not over-write existing file "'main-c.c'"
else
cat << \SHAR_EOF > 'main-c.c'
/*
 * Generated by the ICS builderXcessory (BX).
 *
 * Modified code by P. O. Perry (pop@mitre.org) to test multiple 
 * panedWindows.
 *
 * Builder Xcessory 1.0 Prerelease.
 * 
 */

#include <stdio.h>
#include <errno.h>

/*
 * REQUIRED MOTIF INCLUDE FILES
 */
#include <Xm/Xm.h>
#include <X11/Shell.h>
#include <Xm/DialogS.h>
/*
 * USER SUPPLIED INCLUDE FILES
 */

/* DEFINE SECTION */
#define BX_APP_NAME "builderProduct"
#define BX_APP_CLASS "BuilderClass"

int err_handler(dpy, err)
     Display     *dpy;
     XErrorEvent *err;
{
  char  msg[80];

  XGetErrorText(dpy, err->error_code, msg, 80);
  fprintf(stderr, "\tError code %s\n", msg);
}

/* GLOBAL WIDGET VARIABLES */
Widget Shell000[2];
Widget Frame[2];
Widget Createframe();

/* MAIN PROGRAM */
main(argc, argv)
int argc;
char **argv;
{
    Display *display[2];
    Arg 	args[256];
    int 	argcnt;
    XtAppContext context;

    /* comment out the next line to have the process crash on you */
    XSetErrorHandler(err_handler); 

    XtToolkitInitialize();
    context = XtCreateApplicationContext();
    display[0] = XtOpenDisplay(context, 0, BX_APP_NAME, BX_APP_CLASS,
        0, 0, &argc, argv);
    if(display[0] == NULL)
    {
	XtWarning("cannot open display");
	exit(1);
    }

    XmRegisterConverters();
    argcnt = 0;
    XtSetArg(args[argcnt], XmNx, 680); argcnt++;
    XtSetArg(args[argcnt], XmNy, 398); argcnt++;
    Shell000[0] = XtAppCreateShell( BX_APP_NAME, BX_APP_CLASS,
        applicationShellWidgetClass, display[0], args, argcnt);
    Frame[0] = Createframe(Shell000[0]);
    XtManageChild(Frame[0]);
    XtRealizeWidget(Shell000[0]);

    /* commenting out this portion up to the event loop should 
       make it work */
    display[1] = XtOpenDisplay(context, 0, BX_APP_NAME, BX_APP_CLASS,
        0, 0, &argc, argv);
    if(display[1] == NULL)
    {
	XtWarning("cannot open display");
	exit(1);
    }
    Shell000[1] = XtAppCreateShell( BX_APP_NAME, BX_APP_CLASS,
        applicationShellWidgetClass, display[1], args, argcnt);
    Frame[1] = Createframe(Shell000[1]);
    XtManageChild(Frame[1]);
    XtRealizeWidget(Shell000[1]);

    XtAppMainLoop(context);
}
SHAR_EOF
fi # end of overwriting check
if test -f 'creation-c.c'
then
	echo shar: will not over-write existing file "'creation-c.c'"
else
cat << \SHAR_EOF > 'creation-c.c'
/*
 * Generated by the ICS builderXcessory (BX).
 * Modified by P. O. Perry (pop@mitre.org).  I just removed
 * the irrelevant stuff, rest is the same.
 *
 * Builder Xcessory 1.0 Prerelease.
 *
 */

/*
 * REQUIRED MOTIF INCLUDE FILES
 */
#include <Xm/Xm.h>
#include <X11/Shell.h>
#include <Xm/Frame.h>
#include <Xm/PanedW.h>
#include <Xm/PushB.h>
#include <Xm/PushBG.h>

/*
 * CALLBACK PROCEDURE DECLARATIONS
 */

Widget
Createframe(parent)
Widget parent;
{
    Arg    	args[512];
    int    	argcnt;
    Widget 	retval;
    Widget	frame;
    Widget	panedWindow;
    Widget	frame1;
    Widget	frame2;
    XmRegisterConverters();
 
    argcnt = 0;
    XtSetArg(args[argcnt], XmNx, 0); argcnt++;
    XtSetArg(args[argcnt], XmNy, 0); argcnt++;
    XtSetArg(args[argcnt], XmNwidth, 336); argcnt++;
    XtSetArg(args[argcnt], XmNheight, 246); argcnt++;
    frame = XtCreateWidget("frame",
		xmFrameWidgetClass,
		parent,
		args,
		argcnt);

    retval = frame;
 
    argcnt = 0;
    XtSetArg(args[argcnt], XmNx, 1); argcnt++;
    XtSetArg(args[argcnt], XmNy, 1); argcnt++;
    XtSetArg(args[argcnt], XmNwidth, 334); argcnt++;
    XtSetArg(args[argcnt], XmNheight, 244); argcnt++;
    panedWindow = XtCreateWidget("panedWindow",
		xmPanedWindowWidgetClass,
		frame,
		args,
		argcnt);

    XtManageChild(panedWindow);
 
    argcnt = 0;
    XtSetArg(args[argcnt], XmNx, 3); argcnt++;
    XtSetArg(args[argcnt], XmNy, 3); argcnt++;
    XtSetArg(args[argcnt], XmNwidth, 328); argcnt++;
    XtSetArg(args[argcnt], XmNheight, 118); argcnt++;
    frame1 = XtCreateWidget("frame1",
		xmFrameWidgetClass,
		panedWindow,
		args,
		argcnt);

    XtManageChild(frame1);
 
    argcnt = 0;
    XtSetArg(args[argcnt], XmNx, 3); argcnt++;
    XtSetArg(args[argcnt], XmNy, 129); argcnt++;
    XtSetArg(args[argcnt], XmNwidth, 328); argcnt++;
    XtSetArg(args[argcnt], XmNheight, 112); argcnt++;
    frame2 = XtCreateWidget("frame2",
		xmFrameWidgetClass,
		panedWindow,
		args,
		argcnt);

    XtManageChild(frame2);

    return( retval );
}

SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0

---cut-here------------------------------------------snip-snip-------

Proposed Solution:

None to offer.  I am not sure if something is wrong in my code, or
with the panedWindow widget itself, but this is as far as I could take
it ...


--
Paul O. Perry                                    MITRE Corporation
Phone: (617) 271-5230                            Burlington Road
ARPA: pop@mitre.org                              Bedford, MA  01730
UUCP:   ...{decvax,philabs,genrad}!linus!pop