In Xlib there is a function called XSetWindowBorder() which takes a color value (an unsigned long). In the documentation, it talks about "entries in the color map" and other stuff but I just tried it with a normally encoded RGB color and it seems to work. What are the potential pitfalls with this?
My encoding function is:
unsigned long _RGB(int r,int g, int b)
{
return b + (g<<8) + (r<<16);
}
Your display probably uses TrueColor (24-bit deep) visual. On that visual, the colormap essentially implements an identity mapping: a colormap entry equals its index. On PseudoColor or StaticColor visuals, that is not true anymore. Your program will not work or will work incorrectly on less than 24-bit visuals.