colormaps and cursors

Steve Lamont (spl@szechuan.ucsd.edu)
Fri, 29 Nov 96 08:54:27 PST

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

[colormap problem]
> fl_free_colors(k,80), before i change them again with
> fl_map_color... Am i doing anything wrong??? ...

I don't see any reason to free the colors. You can just change them
with fl_mapcolor() on the fly. I whipped up a little test program
where I changed colors thousands of times and didn't have a problem
just calling fl_mapcolor() without doing the fl_free_colors() [though,
to be completely honest, I'm not sure why you're having a problem if
you're not disarranging the 'k' array in some manner.

[cursor error]
> I was getting:
> X Error of failed request: BadValue (integer parameter out of range for operation)
> Major opcode of failed request: 94 (X_CreateGlyphCursor)
> Value 0xb5
> Serial number of failed request: 6715
> Current serial number in output stream: 6717
>
> On the 27th time i changed the cursor. What i was doing was:
> static int bitmapcur;
> ...
> each time cursor enters in the free object (where i use it) i do:
> bitmapcur = fl_create_bitmap_cursor((const char*)cur_bits,
> (const char*)cur2_bits,cur_width,cur_height,cur_x_hot,cur_y_hot);
> fl_set_cursor(FL_ObjWin(obj), bitmapcur);
> and each time cursor leaves i do:
> fl_set_cursor(FL_ObjWin(obj),-1); /* default Cursor*/

Ah. Now I think I see the source of the problem.

Yes, there is a limit to the number of Cursors you can *create* in
XForms. XForms has an array of 32 named Cursors. The first six
entries in the array are reserved by XForms and the rest (26 of them,
obviously) are free for the use of the application. When you try to
create the cursor for the 27th time, you lose.

The answer is to create the cursor only once at the initialization of
your application and then just use fl_set_cursor() to change the
cursor when you enter and leave the object, which is *almost* what you
are doing.

To TC:

XForms probably should generate an error message or return a error
value when it runs out of cursor table.

> And something else:

> If the application has in its filename a dot (.) for example a.out,
> test.something etc. the program does not take the line arguments
> such -display etc. Is a wanted feature (personally i dont want to
> happen) or a bug of fl_initialise? (at least on my platform, IBM
> AIX 4.2)

This is not a bug in XForms. It is a restriction in Xlib itself.

Having an executable name with a '.' in it breaks X Resource
parsing. The '.' character is not a valid character in the name of a
program since it is used as a delimiter in a resource name.

Refer to the discussion of the Resource File Format in the O'Reilly X
books for further information.

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