XForms: 0.87 Canvas problem

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 23 Jul 97 08:29:08 PDT

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

I just installed 0.87 on my Suns running SunOS 4.1.[34] (X11R5) and
SGIs running IRIX {5.3,6.2} (X11R6). I have encountered a problem
with the GL Canvas object.

When the Canvas is created, the col1 member of the FL_OBJECT structure
is initialized to 0xffffffff, which causes fl_get_pixel() to barf with
the following messages:

In FLColor [flcolor.c 648] Bad request 4294967295
X Error of failed request: BadDrawable (invalid Pixmap or Window
parameter)
Major opcode of failed request: 67 (X_PolyRectangle)
Resource id in failed request: 0xa400040
Serial number of failed request: 676
Current serial number in output stream: 676

when the Canvas is created with a decoration set by
fl_set_canvas_decoration().

If fl_set_canvas_decoration() is not called or if col1 is forcibly set
to some color, then things work as expected.

The following code illustrates the problem:

------------------------- try_main.c ---------------------------
#include "forms.h"
#include "try.h"

int main(int argc, char *argv[])
{
FD_try *fd_try;

fl_initialize(&argc, argv, 0, 0, 0);
fd_try = create_form_try();

/* fill-in form initialization code */

/* show the first form */
( void ) fl_prepare_form_window( fd_try->try,
FL_PLACE_FREE_CENTER,
FL_FULLBORDER,
"XFido 2.0 Work Area");
fl_set_canvas_decoration( fd_try->canvas, FL_BORDER_FRAME );

fl_show_form_window( fd_try->try );

fl_do_forms();
return 0;
}
------------------------- try.c ---------------------------
/* Form definition file generated with fdesign. */

#include "forms.h"
#include <stdlib.h>
#include "try.h"

FD_try *create_form_try(void)
{
FL_OBJECT *obj;
FD_try *fdui = (FD_try *) fl_calloc(1, sizeof(*fdui));

fdui->try = fl_bgn_form(FL_NO_BOX, 320, 250);
obj = fl_add_box(FL_UP_BOX,0,0,320,250,"");
fdui->canvas = obj =
fl_add_glcanvas(FL_NORMAL_CANVAS,40,40,230,170,"");
fl_end_form();

fdui->try->fdui = fdui;

return fdui;
}
/*---------------------------------------*/
------------------------- try.h ---------------------------
#ifndef FD_try_h_
#define FD_try_h_
/* Header file generated with fdesign. */

/**** Callback routines ****/

/**** Forms and Objects ****/

typedef struct {
FL_FORM *try;
void *vdata;
long ldata;
FL_OBJECT *canvas;
} FD_try;

extern FD_try * create_form_try(void);

#endif /* FD_try_h_ */
-------------------------------------------------------------

This fails in more or less the same manner on both machines/OSes.

spl
_________________________________________________
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/