"Bad Window" error on Linux - Motif

This is a discussion on "Bad Window" error on Linux - Motif ; Hi all. I've written this code to test some aspects of the video adapter. It is very simple really - just opens two top-level dialogs, each with one OpenGL widget. On HP-UX this is running just fine. On linux, however, ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: "Bad Window" error on Linux

  1. "Bad Window" error on Linux

    Hi all.
    I've written this code to test some aspects of the video adapter. It is very simple really - just opens two top-level dialogs, each with one OpenGL widget.
    On HP-UX this is running just fine. On linux, however, I get this 'Bad Window' error with some 'property delete' detail or something like that. I don't understand what is wrong. Following is the code (note that it needs the OpenGL-Motif widgets to compile, however it never gets there. I marked the position it is falling on in red).

    Itai.


    #include

    #include
    #include
    #include
    #include

    #include
    #include

    #include
    #include
    #include

    #include
    #include

    int main (int argc, char** argv)
    {
    Widget form1, form2;
    Widget frame1, frame2;
    Widget da1, da2;
    Widget topLevel1, topLevel2;
    XtAppContext app_context;
    Display* disp;
    GLXContext glx_cont;

    Arg args[20];

    XtSetLanguageProc (NULL, (XtLanguageProc)NULL, NULL);

    // XtSetArg(args[0], XmNwidth, 400);
    // XtSetArg(args[1], XmNheight, 400);

    XtToolkitInitialize();
    app_context = XtCreateApplicationContext();
    disp = XtOpenDisplay(app_context, NULL,
    "oltest2", "oltest", NULL, 0, &argc, argv);

    cout << "creating topLevel1" << endl;
    topLevel1 = XtVaAppCreateShell ("underlay", "oltest",
    topLevelShellWidgetClass,
    disp,
    XmNtitle, "underlay",
    XmNinput, False,
    XtNwidth, 400,
    XtNheight, 400,
    XmNresizePolicy, XmRESIZE_ANY,
    NULL);

    cout << "creating topLevel2" << endl;
    topLevel2 = XtVaAppCreateShell ("overlay", "oltest",
    topLevelShellWidgetClass,
    disp,
    XmNtitle, "overlay",
    XmNinput, False,
    XtNwidth, 400,
    XtNheight, 400,
    XmNresizePolicy, XmRESIZE_ANY,
    NULL);

    cout << "creating form1" << endl;
    form1 = XmCreateForm (topLevel1, const_cast("form1"), NULL, 0);
    cout << "managing form1" << endl;
    XtManageChild (form1);

    cout << "creating form2" << endl;
    form2 = XmCreateForm (topLevel2, const_cast("form2"), NULL, 0);
    XtManageChild (form2);

    frame1 = XmCreateFrame (form1, const_cast("drawing_frame"), NULL, 0);
    XtVaSetValues (frame1,
    XmNbottomAttachment, XmATTACH_FORM,
    XmNtopAttachment, XmATTACH_FORM,
    XmNleftAttachment, XmATTACH_FORM,
    XmNrightAttachment, XmATTACH_FORM,
    NULL);
    XtManageChild (frame1);

    frame2 = XmCreateFrame (form2, const_cast("drawing_frame"), NULL, 0);
    XtVaSetValues (frame2,
    XmNbottomAttachment, XmATTACH_FORM,
    XmNtopAttachment, XmATTACH_FORM,
    XmNleftAttachment, XmATTACH_FORM,
    XmNrightAttachment, XmATTACH_FORM,
    NULL);
    XtManageChild (frame2);

    XtRealizeWidget (topLevel1);
    XtRealizeWidget (topLevel2);

    // if (argc == 1)
    // {
    cout << "underlay" << endl;

    XtSetArg(args[0], const_cast(GLwNlevel), 0);
    XtSetArg(args[1], const_cast(GLwNrgba), true);
    XtSetArg(args[2], const_cast(GLwNdoublebuffer), true);
    da1 = GLwCreateMDrawingArea (frame1, const_cast("glwd"), args, 3);
    XtManageChild (da1);
    XVisualInfo* vi1;
    XtVaGetValues (da1, GLwNvisualInfo, &vi1, NULL);
    glx_cont = glXCreateContext (disp, vi1, 0, GL_TRUE);
    GLwDrawingAreaMakeCurrent (da1, glx_cont);
    glClearColor(1,1,1,1);
    glClear(GL_COLOR_BUFFER_BIT);
    GLwDrawingAreaSwapBuffers (da1);
    // }
    // else
    // {
    cout << "overlay" << endl;

    XtSetArg(args[0], const_cast(GLwNlevel), 1);
    XtSetArg(args[1], const_cast(GLwNrgba), false);
    XtSetArg(args[2], const_cast(GLwNdoublebuffer), false);
    da2 = GLwCreateMDrawingArea (frame2, const_cast("glwd"), args, 3);
    XtManageChild (da2);
    XVisualInfo* vi2;
    XtVaGetValues (da2, GLwNvisualInfo, &vi2, NULL);

    glx_cont = glXCreateContext (disp, vi2, 0, GL_TRUE);

    int res;
    glXGetConfig (disp, vi2, GLX_TRANSPARENT_INDEX_VALUE_EXT, &res);
    cout << "transparent pixel: " << res << endl;
    GLwDrawingAreaMakeCurrent (da2, glx_cont);
    glClearIndex(res);
    glClear(GL_COLOR_BUFFER_BIT);
    // }

    XtPopup(topLevel1, XtGrabNone);
    XtPopup(topLevel2, XtGrabNone);
    XEvent event;
    for(;
    {
    XtAppNextEvent(app_context, &event);
    }

    return 0;
    }



  2. Re: "Bad Window" error on Linux

    Itai Bar-Haim wrote:

    > Hi all.
    > I've written this code to test some aspects of the video adapter. It is
    > very simple really - just opens two top-level dialogs, each with one
    > OpenGL widget.
    > On HP-UX this is running just fine. On linux, however, I get this 'Bad
    > Window' error with some 'property delete' detail or something like that.
    > I don't understand what is wrong. Following is the code (note that it
    > needs the OpenGL-Motif widgets to compile, however it never gets there.
    > I marked the position it is falling on in red).
    >
    > Itai.
    >

    Please post:

    * The command line to compile the program

    * The error message.

    * The versions of Linux, Motif, etc... you are using.

    Why, oh why, do people think "... or something like that" is sufficient
    information?

    HaND,
    --
    Michel Bardiaux
    Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
    Tel : +32 2 790.29.41


+ Reply to Thread