mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 12:58:08 +01:00
Added wGetColorForColormap().
Abstract the wGetColor() function to operate on any colormap not just the screen colormap.
This commit is contained in:
committed by
Carlos R. Mafra
parent
4222204abc
commit
69ff0d72cc
@@ -35,19 +35,24 @@
|
||||
#include "resources.h"
|
||||
#include "screen.h"
|
||||
|
||||
int wGetColor(WScreen * scr, char *color_name, XColor * color)
|
||||
int wGetColorForColormap(Colormap colormap, char *color_name, XColor * color)
|
||||
{
|
||||
if (!XParseColor(dpy, scr->w_colormap, color_name, color)) {
|
||||
if (!XParseColor(dpy, colormap, color_name, color)) {
|
||||
wwarning(_("could not parse color \"%s\""), color_name);
|
||||
return False;
|
||||
}
|
||||
if (!XAllocColor(dpy, scr->w_colormap, color)) {
|
||||
if (!XAllocColor(dpy, colormap, color)) {
|
||||
wwarning(_("could not allocate color \"%s\""), color_name);
|
||||
return False;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
int wGetColor(WScreen * scr, char *color_name, XColor * color)
|
||||
{
|
||||
return wGetColorForColormap(scr->w_colormap, color_name, color);
|
||||
}
|
||||
|
||||
void wFreeColor(WScreen * scr, unsigned long pixel)
|
||||
{
|
||||
if (pixel != scr->white_pixel && pixel != scr->black_pixel) {
|
||||
|
||||
Reference in New Issue
Block a user