XForms: trouble with fl_show_messages()

J. P. Mellor (jpmellor@ai.mit.edu)
Tue, 17 Nov 1998 14:52:38 -0500

# To subscribers of the xforms list from "J. P. Mellor" <jpmellor@ai.mit.edu> :

I have encountered some annoying behavior with fl_show_messages()
version 0.88 on SGI's (Irix 6.2 and 6.3). With multiple forms
displayed, when fl_show_messages() is called the first form
created/shown is raised. This occurs regardless of where
fl_show_messages() is called.

This is not the behavior seen with version 0.88 on linux.

The test program below demonstrates the behavior. Two forms are
created. #1 is created/shown first and is on the bottom. #2
created/shown second is on the top. Left mouse button on form #2 will
execute fl_show_message() which causes form #1 to be raised on top of
form #2.

jp

===================================================================
#include <GL/gl.h>
#include <GL/glx.h>
#include <forms.h>
#include <stdlib.h>

typedef struct {
FL_FORM *utility;
FL_OBJECT *canvas;
void *vdata;
long ldata;
} FD_utility;

FD_utility *fd_utility1, *fd_utility2;

int
canvas_expose_handler(FL_OBJECT *obj, Window win, int w, int h,
XEvent *xev, void *data)
{
glXMakeCurrent(fl_get_display(), win, fl_get_glcanvas_context(obj));
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glFlush();

return TRUE;
}

int
utility1_button_press_handler(FL_OBJECT *obj, Window win, int w, int h,
XEvent *xev, void *data)
{
return TRUE;
}

int
utility2_button_press_handler(FL_OBJECT *obj, Window win, int w, int h,
XEvent *xev, void *data)
{
if (xev->xbutton.button == Button1) {
fl_show_messages("Hello");
}

return TRUE;
}

FD_utility *
create_form_utility1()
{
FL_OBJECT *obj;
FD_utility *fdui;
const int attributeList[] = { GLX_RGBA, None };

if ((fdui=fl_calloc(1, sizeof(*fdui))) == NULL) {
fprintf(stderr, "Could not allocate FD_utility\n");
}

fl_set_glcanvas_defaults(attributeList);

fdui->utility = fl_bgn_form(FL_UP_BOX, 272, 272);

fdui->canvas = obj = fl_add_glcanvas(FL_NORMAL_CANVAS,8,8,256,256,"");
fl_add_canvas_handler(obj, Expose, &canvas_expose_handler, NULL);
fl_add_canvas_handler(obj, ButtonPress, &utility1_button_press_handler,
NULL);

fl_end_form();

return fdui;
}

FD_utility *
create_form_utility2()
{
FL_OBJECT *obj;
FD_utility *fdui;
const int attributeList[] = { GLX_RGBA, None };

if ((fdui=fl_calloc(1, sizeof(*fdui))) == NULL) {
fprintf(stderr, "Could not allocate FD_utility\n");
}

fl_set_glcanvas_defaults(attributeList);

fdui->utility = fl_bgn_form(FL_UP_BOX, 272, 272);

fdui->canvas = obj = fl_add_glcanvas(FL_NORMAL_CANVAS,8,8,256,256,"");
fl_add_canvas_handler(obj, Expose, &canvas_expose_handler, NULL);
fl_add_canvas_handler(obj, ButtonPress, &utility2_button_press_handler,
NULL);

fl_end_form();

return fdui;
}

int
main(int argc, char **argv)
{
FL_OBJECT *obj;

fl_initialize(&argc, argv, 0, 0, 0);
fd_utility1 = create_form_utility1();
fd_utility2 = create_form_utility2();

/* show the forms */
fl_show_form(fd_utility1->utility, FL_PLACE_CENTER, FL_FULLBORDER,
"Utility1");
fl_show_form(fd_utility2->utility, FL_PLACE_CENTER, FL_FULLBORDER,
"Utility2");

obj = fl_do_forms();
return 0;
}
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/