Re: Double buffering and canvases.

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 5 Dec 96 07:15:43 PST

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

> I tried -sync and i get (among thousants of screens!) :
>
> MainLoopUser Event(7,w=0x2400016 s=1032) EnterNotify Mode Normal
> In EventCallback [events.c 37] Unknown window=0x2400016
> Ignored Event(7,w=0x2400016 s=1032) EnterNotify Mode Normal
> PutbackEvent Event(7,w=40390x2400016 s=1032) EnterNotify Mode Normal
> X Error of failed request: BadWindow (invalid Window parameter)
> Major opcode of failed request: 10 (X_UnmapWindow)
> Resource id in failed request: 0x2400038
> Serial number of failed request: 14038
> Current serial number in output stream: 1
>
> Anyone understanding anything ????

Have you tried using a debugger to determine from *where* this message
is being issued? I realize that trapping X errors is a little
problematic since X uses its own error handlers. Insert the following
code right after your fl_initialize() call:

XSetErrorHandler( my_handler );

and then create a function called my_handler (obviously, you can call
it anything you wish):

int my_handler( Display *display, XErrorEvent *xerror_event )
{

fprintf( stderr, "I lose!\n" );

}

Now compile and link. Fire up your debugger and load your application
program. Set a breakpoint at my_handler in whatever way is
appropriate to your debugger (in gdb and dbx it would be 'break
my_handler), then run the program in -sync mode.

When the error occurs, X will vector to the installed error handler
rather than its own internal handler and your program will halt
execution and return control to the debugger. Get a traceback with
the 'where' command (if you're using gdb -- I forget what the command
is in dbx). Examine the traceback to see exactly where the error is
occuring. Is it due to some function call you're making from a
callback? Is it due to something you're doing in the initialization
of XForms?

How many forms are you creating? What kind of objects are in the form(s)?

Can you reduce the problem to a minimal subset of your code?

Without complete information this is very difficult to debug.

> Also, the first time i allocate the colors i get :
> In fl_mapcolor [flcolor.c 760] mapping 1006 (20,19,19)
> In XFreeColor [flcolor.c 1126] bad pixel

> for all the colors i allocate. This message is because forms free
> the colors FL_FREE_COL1 or should i start worring about ?????

This means your mapping color 20,19,19 with XForms index 1006. Most
(but not all) colormapped displays only support 256 simultaneous
colors. Do you get any messages about "ColormapFull"? You may only
get one.

> About the fl_deactivate_form, although i have used it, i get messages about
> mouse moves, mouse clicks, while drawing in the free object. Does these
> functions (activate,deactivate) produce a message that i should see???

I don't know of any other than if you try to deactivate a NULL form
(pass fl_deactivate_form() a NULL pointer).

Deactivated forms should ignore all XForms events other than FL_DRAW.
They need to handle those in order to deal with X Expose events and
internally generated redraws. Mouse clicks, etc., should be tossed on
the floor.

Hope this helps but you're going to have to try to reduce the problems
to something manageable. You need to work on one problem at a time.

spl
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html