1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 12:00:31 +01:00

WINGs: Added 'const' attribute to functions in wapplication, wappresource, wcolor, wfont, wpixmap

This makes both the API and local function const-correct on their
input parameters.
This commit is contained in:
Christophe CURIS
2013-05-09 17:34:01 +02:00
committed by Carlos R. Mafra
parent af403073f0
commit e7c8ac76ea
6 changed files with 37 additions and 37 deletions

View File

@@ -608,15 +608,15 @@ WMRect wmkrect(int x, int y, unsigned int width, unsigned int height);
void WMInitializeApplication(char *applicationName, int *argc, char **argv);
void WMInitializeApplication(const char *applicationName, int *argc, char **argv);
void WMSetResourcePath(char *path);
void WMSetResourcePath(const char *path);
/* don't free the returned string */
char* WMGetApplicationName(void);
/* Try to locate resource file. ext may be NULL */
char* WMPathForResourceOfType(char *resource, char *ext);
char* WMPathForResourceOfType(const char *resource, const char *ext);
/* ---[ WINGs/widgets.c ]------------------------------------------------- */
@@ -654,7 +654,7 @@ void WMSetApplicationIconPixmap(WMScreen *app, WMPixmap *icon);
WMPixmap* WMGetApplicationIconPixmap(WMScreen *app);
/* If color==NULL it will use the default color for panels: ae/aa/ae */
WMPixmap* WMCreateApplicationIconBlendedPixmap(WMScreen *scr, RColor *color);
WMPixmap* WMCreateApplicationIconBlendedPixmap(WMScreen *scr, const RColor *color);
void WMSetApplicationIconWindow(WMScreen *scr, Window window);
@@ -745,7 +745,7 @@ void WMSetViewDragDestinationProcs(WMView *view, WMDragDestinationProcs *procs);
Bool WMIsAntialiasingEnabled(WMScreen *scrPtr);
WMFont* WMCreateFont(WMScreen *scrPtr, char *fontName);
WMFont* WMCreateFont(WMScreen *scrPtr, const char *fontName);
WMFont* WMCopyFontWithStyle(WMScreen *scrPtr, WMFont *font, WMFontStyle style);
@@ -770,13 +770,13 @@ WMFont* WMSystemFontOfSize(WMScreen *scrPtr, int size);
WMFont* WMBoldSystemFontOfSize(WMScreen *scrPtr, int size);
void WMDrawString(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
int x, int y, char *text, int length);
int x, int y, const char *text, int length);
void WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color,
WMColor *background, WMFont *font, int x, int y,
char *text, int length);
const char *text, int length);
int WMWidthOfString(WMFont *font, char *text, int length);
int WMWidthOfString(WMFont *font, const char *text, int length);
/* ---[ WINGs/wpixmap.c ]------------------------------------------------- */
@@ -798,13 +798,13 @@ WMPixmap* WMCreatePixmapFromXPMData(WMScreen *scrPtr, char **data);
WMSize WMGetPixmapSize(WMPixmap *pixmap);
WMPixmap* WMCreatePixmapFromFile(WMScreen *scrPtr, char *fileName);
WMPixmap* WMCreatePixmapFromFile(WMScreen *scrPtr, const char *fileName);
WMPixmap* WMCreateBlendedPixmapFromRImage(WMScreen *scrPtr, RImage *image,
RColor *color);
const RColor *color);
WMPixmap* WMCreateBlendedPixmapFromFile(WMScreen *scrPtr, char *fileName,
RColor *color);
WMPixmap* WMCreateBlendedPixmapFromFile(WMScreen *scrPtr, const char *fileName,
const RColor *color);
void WMDrawPixmap(WMPixmap *pixmap, Drawable d, int x, int y);
@@ -846,7 +846,7 @@ WMColor* WMCreateRGBAColor(WMScreen *scr, unsigned short red,
unsigned short green, unsigned short blue,
unsigned short alpha, Bool exact);
WMColor* WMCreateNamedColor(WMScreen *scr, char *name, Bool exact);
WMColor* WMCreateNamedColor(WMScreen *scr, const char *name, Bool exact);
RColor WMGetRColorFromColor(WMColor *color);

View File

@@ -16,7 +16,7 @@ Bool W_ApplicationInitialized(void)
return _WINGS_progname != NULL;
}
void WMInitializeApplication(char *applicationName, int *argc, char **argv)
void WMInitializeApplication(const char *applicationName, int *argc, char **argv)
{
int i;
@@ -49,7 +49,7 @@ void WMInitializeApplication(char *applicationName, int *argc, char **argv)
W_InitNotificationCenter();
}
void WMSetResourcePath(char *path)
void WMSetResourcePath(const char *path)
{
if (WMApplication.resourcePath)
wfree(WMApplication.resourcePath);
@@ -102,7 +102,7 @@ error:
return NULL;
}
char *WMPathForResourceOfType(char *resource, char *ext)
char *WMPathForResourceOfType(const char *resource, const char *ext)
{
char *path, *tmp, *appdir;
int i;

View File

@@ -77,17 +77,17 @@ WMPixmap *WMGetApplicationIconPixmap(WMScreen * scr)
return scr->applicationIconPixmap;
}
WMPixmap *WMCreateApplicationIconBlendedPixmap(WMScreen * scr, RColor * color)
WMPixmap *WMCreateApplicationIconBlendedPixmap(WMScreen * scr, const RColor * color)
{
WMPixmap *pix;
if (scr->applicationIconImage) {
RColor gray;
gray.red = 0xae;
gray.green = 0xaa;
gray.blue = 0xae;
gray.alpha = 0xff;
static const RColor gray = {
/* red */ 0xAE,
/* green */ 0xAA,
/* blue */ 0xAE,
/* alpha */ 0xFF
};
if (!color)
color = &gray;

View File

@@ -122,7 +122,7 @@ WMColor *WMCreateRGBAColor(WMScreen * scr, unsigned short red, unsigned short gr
return color;
}
WMColor *WMCreateNamedColor(WMScreen * scr, char *name, Bool exact)
WMColor *WMCreateNamedColor(WMScreen * scr, const char *name, Bool exact)
{
WMColor *color;
XColor xcolor;

View File

@@ -16,7 +16,7 @@
#define DEFAULT_SIZE WINGsConfiguration.defaultFontSize
static FcPattern *xlfdToFcPattern(char *xlfd)
static FcPattern *xlfdToFcPattern(const char *xlfd)
{
FcPattern *pattern;
char *fname, *ptr;
@@ -41,7 +41,7 @@ static FcPattern *xlfdToFcPattern(char *xlfd)
return pattern;
}
static char *xlfdToFcName(char *xlfd)
static char *xlfdToFcName(const char *xlfd)
{
FcPattern *pattern;
char *fname;
@@ -64,7 +64,7 @@ static Bool hasProperty(FcPattern * pattern, const char *property)
return False;
}
static Bool hasPropertyWithStringValue(FcPattern * pattern, const char *object, char *value)
static Bool hasPropertyWithStringValue(FcPattern * pattern, const char *object, const char *value)
{
FcChar8 *str;
int id;
@@ -83,7 +83,7 @@ static Bool hasPropertyWithStringValue(FcPattern * pattern, const char *object,
return False;
}
static char *makeFontOfSize(char *font, int size, char *fallback)
static char *makeFontOfSize(const char *font, int size, const char *fallback)
{
FcPattern *pattern;
char *result;
@@ -91,7 +91,7 @@ static char *makeFontOfSize(char *font, int size, char *fallback)
if (font[0] == '-') {
pattern = xlfdToFcPattern(font);
} else {
pattern = FcNameParse((FcChar8 *) font);
pattern = FcNameParse((const FcChar8 *) font);
}
/*FcPatternPrint(pattern); */
@@ -104,7 +104,7 @@ static char *makeFontOfSize(char *font, int size, char *fallback)
}
if (fallback && !hasPropertyWithStringValue(pattern, FC_FAMILY, fallback)) {
FcPatternAddString(pattern, FC_FAMILY, (FcChar8 *) fallback);
FcPatternAddString(pattern, FC_FAMILY, (const FcChar8 *) fallback);
}
/*FcPatternPrint(pattern); */
@@ -115,7 +115,7 @@ static char *makeFontOfSize(char *font, int size, char *fallback)
return result;
}
WMFont *WMCreateFont(WMScreen * scrPtr, char *fontName)
WMFont *WMCreateFont(WMScreen * scrPtr, const char *fontName)
{
Display *display = scrPtr->display;
WMFont *font;
@@ -250,7 +250,7 @@ WMFont *WMBoldSystemFontOfSize(WMScreen * scrPtr, int size)
return font;
}
int WMWidthOfString(WMFont * font, char *text, int length)
int WMWidthOfString(WMFont * font, const char *text, int length)
{
XGlyphInfo extents;
@@ -261,7 +261,7 @@ int WMWidthOfString(WMFont * font, char *text, int length)
return extents.xOff; /* don't ask :P */
}
void WMDrawString(WMScreen * scr, Drawable d, WMColor * color, WMFont * font, int x, int y, char *text, int length)
void WMDrawString(WMScreen * scr, Drawable d, WMColor * color, WMFont * font, int x, int y, const char *text, int length)
{
XftColor xftcolor;
@@ -280,7 +280,7 @@ void WMDrawString(WMScreen * scr, Drawable d, WMColor * color, WMFont * font, in
void
WMDrawImageString(WMScreen * scr, Drawable d, WMColor * color, WMColor * background,
WMFont * font, int x, int y, char *text, int length)
WMFont * font, int x, int y, const char *text, int length)
{
XftColor textColor;
XftColor bgColor;

View File

@@ -64,7 +64,7 @@ WMPixmap *WMCreatePixmapFromXPixmaps(WMScreen * scrPtr, Pixmap pixmap, Pixmap ma
return pixPtr;
}
WMPixmap *WMCreatePixmapFromFile(WMScreen * scrPtr, char *fileName)
WMPixmap *WMCreatePixmapFromFile(WMScreen * scrPtr, const char *fileName)
{
WMPixmap *pixPtr;
RImage *image;
@@ -101,7 +101,7 @@ WMPixmap *WMCreatePixmapFromRImage(WMScreen * scrPtr, RImage * image, int thresh
return pixPtr;
}
WMPixmap *WMCreateBlendedPixmapFromRImage(WMScreen * scrPtr, RImage * image, RColor * color)
WMPixmap *WMCreateBlendedPixmapFromRImage(WMScreen * scrPtr, RImage * image, const RColor * color)
{
WMPixmap *pixPtr;
RImage *copy;
@@ -117,7 +117,7 @@ WMPixmap *WMCreateBlendedPixmapFromRImage(WMScreen * scrPtr, RImage * image, RCo
return pixPtr;
}
WMPixmap *WMCreateBlendedPixmapFromFile(WMScreen * scrPtr, char *fileName, RColor * color)
WMPixmap *WMCreateBlendedPixmapFromFile(WMScreen * scrPtr, const char *fileName, const RColor * color)
{
WMPixmap *pixPtr;
RImage *image;