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

wmaker: Added 'const' attribute to most global functions

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2013-06-16 17:57:48 +02:00
committed by Carlos R. Mafra
parent f0c1dc9fc3
commit 9b5db31d95
22 changed files with 65 additions and 64 deletions

View File

@@ -37,24 +37,24 @@ void wDefaultUpdateIcons(WScreen *scr);
void wReadStaticDefaults(WMPropList *dict);
void wDefaultsCheckDomains(void *arg);
void wSaveDefaults(WScreen *scr);
void wDefaultFillAttributes(char *instance, char *class,
void wDefaultFillAttributes(const char *instance, const char *class,
WWindowAttributes *attr, WWindowAttributes *mask,
Bool useGlobalDefault);
char *get_default_image_path(void);
RImage *get_default_image(WScreen *scr);
char *wDefaultGetIconFile(char *instance, char *class, Bool default_icon);
char *wDefaultGetIconFile(const char *instance, const char *class, Bool default_icon);
RImage *get_icon_image(WScreen *scr, char *winstance, char *wclass, int max_size);
char *get_icon_filename(WScreen *scr, char *winstance, char *wclass, char *command,
Bool default_icon);
int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
int wDefaultGetStartWorkspace(WScreen *scr, const char *instance, const char *class);
void wDefaultChangeIcon(WScreen *scr, const char *instance, const char* class, const char *file);
RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size);
void wDefaultPurgeInfo(WScreen *scr, char *instance, char *class);
void wDefaultPurgeInfo(WScreen *scr, const char *instance, const char *class);
#endif /* WMDEFAULTS_H_ */

View File

@@ -67,7 +67,7 @@ static WMPoint getCenter(WScreen * scr, int width, int height)
return wGetPointToCenterRectInHead(scr, wGetHeadForPointerLocation(scr), width, height);
}
int wMessageDialog(WScreen * scr, char *title, char *message, char *defBtn, char *altBtn, char *othBtn)
int wMessageDialog(WScreen *scr, const char *title, const char *message, const char *defBtn, const char *altBtn, const char *othBtn)
{
WMAlertPanel *panel;
Window parent;
@@ -109,7 +109,7 @@ static void toggleSaveSession(WMWidget *w, void *data)
wPreferences.save_session_on_exit = WMGetButtonSelected((WMButton *) w);
}
int wExitDialog(WScreen * scr, char *title, char *message, char *defBtn, char *altBtn, char *othBtn)
int wExitDialog(WScreen *scr, const char *title, const char *message, const char *defBtn, const char *altBtn, const char *othBtn)
{
WMAlertPanel *panel;
WMButton *saveSessionBtn;
@@ -407,7 +407,7 @@ static void handleHistoryKeyPress(XEvent * event, void *clientData)
}
}
int wAdvancedInputDialog(WScreen * scr, char *title, char *message, char *name, char **text)
int wAdvancedInputDialog(WScreen *scr, const char *title, const char *message, const char *name, char **text)
{
WWindow *wwin;
Window parent;
@@ -471,7 +471,7 @@ int wAdvancedInputDialog(WScreen * scr, char *title, char *message, char *name,
}
}
int wInputDialog(WScreen * scr, char *title, char *message, char **text)
int wInputDialog(WScreen *scr, const char *title, const char *message, char **text)
{
WWindow *wwin;
Window parent;
@@ -891,7 +891,7 @@ static void keyPressHandler(XEvent * event, void *data)
}
}
Bool wIconChooserDialog(WScreen * scr, char **file, char *instance, char *class)
Bool wIconChooserDialog(WScreen *scr, char **file, const char *instance, const char *class)
{
WWindow *wwin;
Window parent;

View File

@@ -30,15 +30,15 @@ enum {
};
int wMessageDialog(WScreen *scr, char *title, char *message,
char *defBtn, char *altBtn, char *othBtn);
int wAdvancedInputDialog(WScreen *scr, char *title, char *message, char *name, char **text);
int wInputDialog(WScreen *scr, char *title, char *message, char **text);
int wMessageDialog(WScreen *scr, const char *title, const char *message,
const char *defBtn, const char *altBtn, const char *othBtn);
int wAdvancedInputDialog(WScreen *scr, const char *title, const char *message, const char *name, char **text);
int wInputDialog(WScreen *scr, const char *title, const char *message, char **text);
int wExitDialog(WScreen *scr, char *title, char *message, char *defBtn,
char *altBtn, char *othBtn);
int wExitDialog(WScreen *scr, const char *title, const char *message, const char *defBtn,
const char *altBtn, const char *othBtn);
Bool wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class);
Bool wIconChooserDialog(WScreen *scr, char **file, const char *instance, const char *class);
void wShowInfoPanel(WScreen *scr);
void wShowLegalPanel(WScreen *scr);

View File

@@ -1191,7 +1191,7 @@ void wFrameWindowResize(WFrameWindow * fwin, int width, int height)
reconfigure(fwin, 0, 0, width, height, True);
}
int wFrameWindowChangeTitle(WFrameWindow * fwin, char *new_title)
int wFrameWindowChangeTitle(WFrameWindow *fwin, const char *new_title)
{
/* check if the title is the same as before */
if (fwin->title) {

View File

@@ -181,7 +181,7 @@ void wFrameWindowShowButton(WFrameWindow *fwin, int flags);
void wFrameWindowHideButton(WFrameWindow *fwin, int flags);
int wFrameWindowChangeTitle(WFrameWindow *fwin, char *new_title);
int wFrameWindowChangeTitle(WFrameWindow *fwin, const char *new_title);
#ifdef XKB_BUTTON_HINT
void wFrameWindowUpdateLanguageButton(WFrameWindow *fwin);

View File

@@ -353,7 +353,7 @@ static void shellCommandHandler(pid_t pid, unsigned char status, _tuple * data)
wfree(data);
}
void ExecuteShellCommand(WScreen * scr, char *command)
void ExecuteShellCommand(WScreen *scr, const char *command)
{
static char *shell = NULL;
pid_t pid;

View File

@@ -31,7 +31,7 @@
noreturn void Exit(int status);
void Restart(char *manager, Bool abortOnFailure);
void SetupEnvironment(WScreen *scr);
void ExecuteShellCommand(WScreen *scr, char *command);
void ExecuteShellCommand(WScreen *scr, const char *command);
Bool RelaunchWindow(WWindow *wwin);
noreturn void wAbort(Bool dumpCore);
void ExecExitScript(void);

View File

@@ -140,7 +140,7 @@ static void appearanceObserver(void *self, WMNotification * notif)
* The created menu.
*----------------------------------------------------------------------
*/
WMenu *wMenuCreate(WScreen * screen, char *title, int main_menu)
WMenu *wMenuCreate(WScreen *screen, const char *title, int main_menu)
{
WMenu *menu;
static int brother = 0;
@@ -230,7 +230,7 @@ WMenu *wMenuCreate(WScreen * screen, char *title, int main_menu)
return menu;
}
WMenu *wMenuCreateForApp(WScreen * screen, char *title, int main_menu)
WMenu *wMenuCreateForApp(WScreen *screen, const char *title, int main_menu)
{
WMenu *menu;
@@ -254,7 +254,7 @@ static void insertEntry(WMenu * menu, WMenuEntry * entry, int index)
menu->entries[index] = entry;
}
WMenuEntry *wMenuInsertCallback(WMenu * menu, int index, char *text,
WMenuEntry *wMenuInsertCallback(WMenu *menu, int index, const char *text,
void (*callback) (WMenu * menu, WMenuEntry * entry), void *clientdata)
{
WMenuEntry *entry;

View File

@@ -106,9 +106,9 @@ typedef struct WMenu {
void wMenuPaint(WMenu *menu);
void wMenuDestroy(WMenu *menu, int recurse);
void wMenuRealize(WMenu *menu);
WMenuEntry *wMenuInsertCascade(WMenu *menu, int index, char *text,
WMenuEntry *wMenuInsertCascade(WMenu *menu, int index, const char *text,
WMenu *cascade);
WMenuEntry *wMenuInsertCallback(WMenu *menu, int index, char *text,
WMenuEntry *wMenuInsertCallback(WMenu *menu, int index, const char *text,
void (*callback)(WMenu *menu, WMenuEntry *entry),
void *clientdata);
@@ -119,8 +119,8 @@ void wMenuEntrySetCascade(WMenu *menu, WMenuEntry *entry, WMenu *cascade);
void wMenuRemoveItem(WMenu *menu, int index);
WMenu *wMenuCreate(WScreen *screen, char *title, int main_menu);
WMenu *wMenuCreateForApp(WScreen *screen, char *title, int main_menu);
WMenu *wMenuCreate(WScreen *screen, const char *title, int main_menu);
WMenu *wMenuCreateForApp(WScreen *screen, const char *title, int main_menu);
void wMenuMap(WMenu *menu);
void wMenuMapAt(WMenu *menu, int x, int y, int keyboard);
#define wMenuMapCopyAt(menu, x, y) wMenuMapAt((menu)->brother, (x), (y), False)

View File

@@ -316,7 +316,7 @@ char *ShrinkString(WMFont *font, const char *string, int width)
return text;
}
char *FindImage(char *paths, char *file)
char *FindImage(const char *paths, const char *file)
{
char *tmp, *path = NULL;
@@ -507,7 +507,7 @@ getuserinput(WScreen *scr, const char *line, int *ptr, Bool advanced)
* OPTION etc. NORMAL %<input>
*/
#define TMPBUFSIZE 64
char *ExpandOptions(WScreen * scr, char *cmdline)
char *ExpandOptions(WScreen *scr, const char *cmdline)
{
int ptr, optr, state, len, olen;
char *out, *nout;
@@ -688,7 +688,7 @@ char *ExpandOptions(WScreen * scr, char *cmdline)
return NULL;
}
void ParseWindowName(WMPropList * value, char **winstance, char **wclass, char *where)
void ParseWindowName(WMPropList *value, char **winstance, char **wclass, const char *where)
{
char *name;
@@ -815,7 +815,7 @@ char *GetShortcutKey(WShortKey key)
return GetShortcutString(tmp);
}
char *EscapeWM_CLASS(char *name, char *class)
char *EscapeWM_CLASS(const char *name, const char *class)
{
char *ret;
char *ename = NULL, *eclass = NULL;
@@ -921,7 +921,7 @@ static void UnescapeWM_CLASS(const char *str, char **name, char **class)
}
}
void SendHelperMessage(WScreen * scr, char type, int workspace, char *msg)
void SendHelperMessage(WScreen *scr, char type, int workspace, const char *msg)
{
char *buffer;
int len;
@@ -986,7 +986,7 @@ Bool UpdateDomainFile(WDDomain * domain)
return result;
}
char *StrConcatDot(char *a, char *b)
char *StrConcatDot(const char *a, const char *b)
{
int len;
char *str;

View File

@@ -32,15 +32,15 @@ Bool UpdateDomainFile(WDDomain * domain);
void move_window(Window win, int from_x, int from_y, int to_x, int to_y);
void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y);
void SlideWindows(Window *wins[], int n, int from_x, int from_y, int to_x, int to_y);
void ParseWindowName(WMPropList * value, char **winstance, char **wclass, char *where);
void SendHelperMessage(WScreen * scr, char type, int workspace, char *msg);
void ParseWindowName(WMPropList *value, char **winstance, char **wclass, const char *where);
void SendHelperMessage(WScreen *scr, char type, int workspace, const char *msg);
char *ShrinkString(WMFont *font, const char *string, int width);
char *FindImage(char *paths, char *file);
char *ExpandOptions(WScreen * scr, char *cmdline);
char *FindImage(const char *paths, const char *file);
char *ExpandOptions(WScreen * scr, const char *cmdline);
char *GetShortcutString(const char *text);
char *GetShortcutKey(WShortKey key);
char *EscapeWM_CLASS(char *name, char *class);
char *StrConcatDot(char *a, char *b);
char *EscapeWM_CLASS(const char *name, const char *class);
char *StrConcatDot(const char *a, const char *b);
char *GetCommandForWindow(Window win);
#endif

View File

@@ -35,7 +35,7 @@
#include "resources.h"
#include "screen.h"
int wGetColorForColormap(Colormap colormap, char *color_name, XColor * color)
int wGetColorForColormap(Colormap colormap, const char *color_name, XColor *color)
{
if (!XParseColor(dpy, colormap, color_name, color)) {
wwarning(_("could not parse color \"%s\""), color_name);
@@ -48,7 +48,7 @@ int wGetColorForColormap(Colormap colormap, char *color_name, XColor * color)
return True;
}
int wGetColor(WScreen * scr, char *color_name, XColor * color)
int wGetColor(WScreen *scr, const char *color_name, XColor *color)
{
return wGetColorForColormap(scr->w_colormap, color_name, color);
}

View File

@@ -21,8 +21,8 @@
#ifndef WMRESOURCES_H_
#define WMRESOURCES_H_
int wGetColorForColormap(Colormap colormap, char *color_name, XColor *color);
int wGetColor(WScreen *scr, char *color_name, XColor *color);
int wGetColorForColormap(Colormap colormap, const char *color_name, XColor *color);
int wGetColor(WScreen *scr, const char *color_name, XColor *color);
void wFreeColor(WScreen *scr, unsigned long pixel);
#endif

View File

@@ -175,7 +175,7 @@ void wTextureDestroy(WScreen * scr, WTexture * texture)
#undef CANFREE
}
WTexGradient *wTextureMakeGradient(WScreen * scr, int style, RColor * from, RColor * to)
WTexGradient *wTextureMakeGradient(WScreen *scr, int style, const RColor *from, const RColor *to)
{
WTexGradient *texture;
XGCValues gcv;
@@ -199,8 +199,8 @@ WTexGradient *wTextureMakeGradient(WScreen * scr, int style, RColor * from, RCol
return texture;
}
WTexIGradient *wTextureMakeIGradient(WScreen * scr, int thickness1, RColor colors1[2],
int thickness2, RColor colors2[2])
WTexIGradient *wTextureMakeIGradient(WScreen *scr, int thickness1, const RColor colors1[2],
int thickness2, const RColor colors2[2])
{
WTexIGradient *texture;
XGCValues gcv;

View File

@@ -159,10 +159,10 @@ typedef union WTexture {
WTexSolid *wTextureMakeSolid(WScreen*, XColor*);
WTexGradient *wTextureMakeGradient(WScreen*, int, RColor*, RColor*);
WTexGradient *wTextureMakeGradient(WScreen*, int, const RColor*, const RColor*);
WTexMGradient *wTextureMakeMGradient(WScreen*, int, RColor**);
WTexTGradient *wTextureMakeTGradient(WScreen*, int, RColor*, RColor*, char *, int);
WTexIGradient *wTextureMakeIGradient(WScreen*, int, RColor[], int, RColor[]);
WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, char *pixmap_file,
XColor *color);
void wTextureDestroy(WScreen*, WTexture*);

View File

@@ -200,7 +200,7 @@ static WMPropList *get_value_from_instanceclass(const char *value)
*
*----------------------------------------------------------------------
*/
void wDefaultFillAttributes(char *instance, char *class,
void wDefaultFillAttributes(const char *instance, const char *class,
WWindowAttributes *attr, WWindowAttributes *mask,
Bool useGlobalDefault)
{
@@ -483,7 +483,7 @@ RImage *get_icon_image(WScreen *scr, char *winstance, char *wclass, int max_size
return get_rimage_from_file(scr, file_name, max_size);
}
int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
int wDefaultGetStartWorkspace(WScreen *scr, const char *instance, const char *class)
{
WMPropList *value;
int w;
@@ -512,7 +512,7 @@ int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
}
/* Get the name of the Icon File. If default_icon is True, then, default value included */
char *wDefaultGetIconFile(char *instance, char *class, Bool default_icon)
char *wDefaultGetIconFile(const char *instance, const char *class, Bool default_icon)
{
WMPropList *value;
char *tmp;
@@ -533,7 +533,7 @@ char *wDefaultGetIconFile(char *instance, char *class, Bool default_icon)
return tmp;
}
void wDefaultChangeIcon(WScreen * scr, char *instance, char *class, char *file)
void wDefaultChangeIcon(WScreen *scr, const char *instance, const char *class, const char *file)
{
WDDomain *db = WDWindowAttributes;
WMPropList *icon_value = NULL, *value, *attr, *key, *def_win, *def_icon = NULL;
@@ -597,7 +597,7 @@ void wDefaultChangeIcon(WScreen * scr, char *instance, char *class, char *file)
WMPLSetCaseSensitive(False);
}
void wDefaultPurgeInfo(WScreen *scr, char *instance, char *class)
void wDefaultPurgeInfo(WScreen *scr, const char *instance, const char *class)
{
WMPropList *value, *key, *dict;
char *buffer;

View File

@@ -1324,7 +1324,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
}
WWindow *wManageInternalWindow(WScreen *scr, Window window, Window owner,
char *title, int x, int y, int width, int height)
const char *title, int x, int y, int width, int height)
{
WWindow *wwin;
int foo;
@@ -2548,7 +2548,8 @@ void wWindowUpdateGNUstepAttr(WWindow * wwin, GNUstepWMAttributes * attr)
}
}
WMagicNumber wWindowAddSavedState(char *instance, char *class, char *command, pid_t pid, WSavedState * state)
WMagicNumber wWindowAddSavedState(const char *instance, const char *class,
const char *command, pid_t pid, WSavedState * state)
{
WWindowState *wstate;

View File

@@ -370,7 +370,7 @@ void wWindowSetKeyGrabs(WWindow *wwin);
void wWindowResetMouseGrabs(WWindow *wwin);
WWindow *wManageInternalWindow(WScreen *scr, Window window, Window owner,
char *title, int x, int y,
const char *title, int x, int y,
int width, int height);
void wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace);
@@ -383,7 +383,7 @@ void wWindowUnmap(WWindow *wwin);
void wWindowDeleteSavedStatesForPID(pid_t pid);
WMagicNumber wWindowAddSavedState(char *instance, char *class, char *command,
WMagicNumber wWindowAddSavedState(const char *instance, const char *class, const char *command,
pid_t pid, WSavedState *state);
WMagicNumber wWindowGetSavedState(Window win);

View File

@@ -667,7 +667,7 @@ static void newWSCommand(WMenu *menu, WMenuEntry *foo)
wWorkspaceChange(menu->frame->screen_ptr, ws);
}
void wWorkspaceRename(WScreen * scr, int workspace, char *name)
void wWorkspaceRename(WScreen *scr, int workspace, const char *name)
{
char buf[MAX_WORKSPACENAME_WIDTH + 1];
char *tmp;
@@ -923,7 +923,7 @@ void wWorkspaceRestoreState(WScreen *scr)
}
/* Returns the workspace number for a given workspace name */
int wGetWorkspaceNumber(WScreen * scr, char * value)
int wGetWorkspaceNumber(WScreen *scr, const char *value)
{
int w, i;

View File

@@ -31,7 +31,7 @@ typedef struct WWorkspace {
void wWorkspaceMake(WScreen *scr, int count);
int wWorkspaceNew(WScreen *scr);
int wGetWorkspaceNumber(WScreen * scr, char * value);
int wGetWorkspaceNumber(WScreen *scr, const char *value);
Bool wWorkspaceDelete(WScreen *scr, int workspace);
void wWorkspaceChange(WScreen *scr, int workspace);
void wWorkspaceForceChange(WScreen *scr, int workspace);
@@ -40,7 +40,7 @@ void wWorkspaceMenuUpdate(WScreen *scr, WMenu *menu);
void wWorkspaceMenuEdit(WScreen *scr);
void wWorkspaceSaveState(WScreen *scr, WMPropList *old_state);
void wWorkspaceRestoreState(WScreen *scr);
void wWorkspaceRename(WScreen *scr, int workspace, char *name);
void wWorkspaceRename(WScreen *scr, int workspace, const char *name);
void wWorkspaceRelativeChange(WScreen *scr, int amount);
#endif

View File

@@ -262,7 +262,7 @@ static void x_reset_modifier_mapping(Display * display)
XFreeModifiermap(x_modifier_keymap);
}
int wXModifierFromKey(char *key)
int wXModifierFromKey(const char *key)
{
if (strcasecmp(key, "SHIFT") == 0 && ShiftMask != 0)
return ShiftMask;

View File

@@ -21,6 +21,6 @@
#define _XMODIFIER_H_INCLUDED
void wXModifierInitialize(void);
int wXModifierFromKey(char *key);
int wXModifierFromKey(const char *key);
#endif /* _XMODIFIER_H_INCLUDED */