GDK/GTK Color stuff



-----BEGIN PGP SIGNED MESSAGE-----

Hi Everyone !

I'd like to do some extra color things in my application, so I had a
look into it only to find that the documentation is extremely
spartanic or rather nonexistent. :-)

What I have is a lot of widgets (well - of course) where single
widgets should be able to shift through several colors at certain
events. Only that one widget should perform the shift, of course.

I copied the standard GtkStyle of the objects into a new one, attached
that to the widget and then just changed the rgb values to something
else: That worked, but it is probably not the way it should be
done. The X server needs to allocate the colors, so I had a look at
the gdk_color functions.

gint gdk_color_alloc     (GdkColormap   *colormap,
                          GdkColor      *color);

obviously lets me allocate a color for my application - only if I try
to add another color to that style's colormap via

gdk_color_alloc (newstyle->colormap, &color);

I am getting the message

** WARNING **: file gdkcolor.c: line 451 (gdk_color_alloc): "colormap!= NULL"

during runtime. So what does this tell me ? I always thought of a
colormap as a whole bunch of colors so adding one shouldn't cause an
error even if the others are already in use.

Alright - so once that is solved I will probably run into another
problem. Since I don't want to allocate colors all over the place
(which would be waste of resources) I'd like to change that single
color through the steps I want it to take... so 

gint gdk_color_change    (GdkColormap   *colormap,
                          GdkColor      *color);

seems like a good bet. But: Which color does it change ? The colormap
is an array of colors - how does it determine which one to change ???


I am sorry if all this has been told before, but I was looking through
some source and the docu without really finding the big clue... 

All help would be appreciated, Thanks,
				Georg

P.S. Preben: I might even be willing enough to write at least a LITTLE
documentation about the color stuff so this doesn't have to be asked
every time - just in case noone else is doing it right now.

- -- 
Georg C. F. Greve <greve@fusebox.hanse.de>
http://porter.desy.de/~greve/ - ICQ#10016966
"People who fight may lose. People who do not
fight have already lost." -- Bertolt Brecht

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: Processed

iQCVAwUBNZzYm1ZXgZXDxqJtAQE1vgP/boV4Qj9SuG3S4DcjtiUZ5JO5GAjEG1gP
uvZrcjodKFrP6kaGAlJ/hPor8tDilmHIy+drEf30jGq9Z6RqpmsYGyCRtWaVfTrC
WRFrUWNfqIMvqdffFR8cK9t9mZsIK42yjnbikVSFY17+LqfYrIjONhlAS+40A8Jv
5K0ai4YqerM=
=TfJy
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]