Re: Question about gdk_colormap_free_colors()



On Fri, 27 Jul 2001 14:14:44 +0200, Fabien Bouleau said:

Yes, you have. 
 
 When you allocate colors with both flags set to true (nearest color and
 allocate color), GDK looks for any existing color with same rgb
 components. If found, the "pixel" field of your color structure is
 updated and an internal counter is increased (to know how many "clients"
 use it). If it's not found or nearest color flag is set to false, a new
 entry is allocated and counter is set to 1 (GdkERROR occurs if colormap
 is full).
 
 When freeing color, this counter is decreased and deleted as soon as it
 reaches 0.
 
 Hope it will help
 FB

Thanks, what if the color is allocated and set to a GtkStyle.

Ie:

c = &style->fg[GTK_STATE_NORMAL];
c->red = 0 * (guint16)-1;
c->green = 0 * (guint16)-1;
c->blue = 1 * (guint16)-1;
gdk_colormap_alloc_color(colormap, c, TRUE, TRUE);

/* ... */

gtk_style_unref(style);


Will this also free the allocated color when gtk_style_unref()
is called, dropping the styles's ref count to 0?



-- 
--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
.__                          ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                  http://furry.ao.net/~learfox/






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