colors and cursors

Petasis Gewrgios (
Fri, 29 Nov 1996 10:19:10 -0600 (CST)

To subscribers of the xforms list from Petasis Gewrgios <> :

Steve Lamont wrote:

>> I have allready tried to use -private, with no result. Forms seem to
>> ignore my command! (i have done everything ok with fl_initiate(),
>> i've checked it ...) Is there a way to free colors that you dont
>> need any more from server's colormap?
> fl_free_colors( FL_COLOR *cols, int n );
>See Chapter 23, Drawing objects.
I have tried many times with fl_free_colors, but with no success
(Is it working ????) There is the possibility to misunderstood the manual:
What i did was:
I have an array k[100] where i put the *forms* indexes: k[0]=FL_FREE_COL1+1,
k[1]=FL_FREE_COL1+2 etc.. up to k[79] (i want about 80 colors when in 256 color
Then i "change" the colors using fl_map_color(k[i],r,g,b) in a for loop
(i use for display all the 80 colors a time...)
when i dont need them any more i use:
fl_free_colors(k,80), before i change them again with fl_map_color...
Am i doing anything wrong??? (As for Xlib calls, the whole app does not use
any of them! I am programming for X only 5 months and i know nothing about
xlib. I only use forms ...)

>> Also the problem is not that i ask for example for orange and i get
> a red, but changes colors that are not supposed to ghange: for
>> example the forms background is gray (col_1) and when color
>> substitude begin changes color continiously (!!!) and may result
>> that the col_1 in ALL FORMS of my application change to green, or
>> blue. I cannot figure what is happening inside the lib, so i cannot
>> solve it.
>What do you mean by "changes color continiously?" Do you mean that
>every time you add a color from there on in the displayed value for
>COL_1 changes or something more dramatic?
No i meen that i change for example FL_FREE_COL1 and also changes F_FREE_COL1+20
(example, not sure if is +20 or what ever). Also, which is even more dramatic,
i change FL_FREE_COL1 and FL_BLACK changes to have the same color as FL_FREE_COL1!
What i meen continiously is that everytime i use fl_map_color something on all
my forms changes color (the buttons bounding boxes, the background color etc...)
>How are you changing/adding colors? With fl_map_color() or by
>directly accessing the X Colormap with XAllocColor()? Bear in mind
>that the color indices in XForms are not the same as the pixel
>indices in the X Colormap -- this can be terribly confusing sometimes.
>For anything other than simple XForms operations, I generally just
>work with the DefaultColormap directly. I've never had a problem with
>tromping on XForms colors as long as I'm careful to use only the cells
>allocated with XAllocColorCells() or XAllocColorPlanes(). Anything
>else belongs to someone else and is "hands off."
I do understand what you are saying here, but i cannot use it. If you could
an example would have been helpfull..

>> PS: About the cursor error i take:
>> This happen when i change the cursor for 27th time. Is 26 a "magic"
>> number for cursors in forms??? ( Can handle for example only 26
>> cursor at a time??)
>I don't recall seeing the original post to which this refers. What
>error are you getting?
>As far as I know there is not limit to the number of times you can
>change either an XForms or X cursor. I have an application that does
>it a fair amount and have not ever had any problem with cursors that
>wasn't my 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*/

I get rid of it using: if(!bitmapcur) fl_create_bitmap_cursor(....
but i didn't understand the error. Could anyone explain????

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)

Thank you for your interest!!
Petasis Gewrgios...
To unsubscribe, send the message "unsubscribe" to or see