mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-21 05:18:06 +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 "resources.h"
|
||||||
#include "screen.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);
|
wwarning(_("could not parse color \"%s\""), color_name);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
if (!XAllocColor(dpy, scr->w_colormap, color)) {
|
if (!XAllocColor(dpy, colormap, color)) {
|
||||||
wwarning(_("could not allocate color \"%s\""), color_name);
|
wwarning(_("could not allocate color \"%s\""), color_name);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
return True;
|
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)
|
void wFreeColor(WScreen * scr, unsigned long pixel)
|
||||||
{
|
{
|
||||||
if (pixel != scr->white_pixel && pixel != scr->black_pixel) {
|
if (pixel != scr->white_pixel && pixel != scr->black_pixel) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#ifndef WMRESOURCES_H_
|
#ifndef WMRESOURCES_H_
|
||||||
#define WMRESOURCES_H_
|
#define WMRESOURCES_H_
|
||||||
|
|
||||||
|
int wGetColorForColormap(Colormap colormap, char *color_name, XColor *color);
|
||||||
int wGetColor(WScreen *scr, char *color_name, XColor *color);
|
int wGetColor(WScreen *scr, char *color_name, XColor *color);
|
||||||
void wFreeColor(WScreen *scr, unsigned long pixel);
|
void wFreeColor(WScreen *scr, unsigned long pixel);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user