From: Christophe CURIS Date: Sun, 16 Jun 2013 15:57:50 +0000 (+0200) Subject: wmaker: Added 'const' attribute to remaining functions X-Git-Tag: wmaker-0.95.5~18 X-Git-Url: https://repo.or.cz/w/wmaker-crm.git/commitdiff_plain/c9b816de75af6cdb44c8083ceb4eaaf76c138387 wmaker: Added 'const' attribute to remaining functions Signed-off-by: Christophe CURIS --- diff --git a/src/appicon.c b/src/appicon.c index f863974e..e1fada13 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -71,7 +71,7 @@ extern XContext wWinContext; void appIconMouseDown(WObjDescriptor * desc, XEvent * event); static void iconDblClick(WObjDescriptor * desc, XEvent * event); static void iconExpose(WObjDescriptor * desc, XEvent * event); -static void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, char *wm_class); +static void wApplicationSaveIconPathFor(const char *iconPath, const char *wm_instance, const char *wm_class); static WAppIcon *wAppIconCreate(WWindow * leader_win); static void add_to_appicon_list(WScreen *scr, WAppIcon *appicon); static void remove_from_appicon_list(WScreen *scr, WAppIcon *appicon); @@ -80,7 +80,7 @@ static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window m /* This function is used if the application is a .app. It checks if it has an icon in it * like for example /usr/local/GNUstep/Applications/WPrefs.app/WPrefs.tiff */ -void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char *wm_instance, char *wm_class) +void wApplicationExtractDirPackIcon(WScreen * scr, const char *path, const char *wm_instance, const char *wm_class) { char *iconPath = NULL; char *tmp = NULL; @@ -112,7 +112,7 @@ void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char *wm_instance } } -WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance, char *wm_class, int tile) +WAppIcon *wAppIconCreateForDock(WScreen *scr, const char *command, const char *wm_instance, const char *wm_class, int tile) { WAppIcon *aicon; @@ -1084,7 +1084,7 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event) } /* This function save the application icon and store the path in the Dictionary */ -static void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, char *wm_class) +static void wApplicationSaveIconPathFor(const char *iconPath, const char *wm_instance, const char *wm_class) { WMPropList *dict = WDWindowAttributes->dictionary; WMPropList *adict, *key, *iconk; diff --git a/src/appicon.h b/src/appicon.h index f5aa0d58..6ed90532 100644 --- a/src/appicon.h +++ b/src/appicon.h @@ -69,8 +69,8 @@ typedef struct WAppIcon { unsigned int lock:1; /* do not allow to be destroyed */ } WAppIcon; -WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance, - char *wm_class, int tile); +WAppIcon *wAppIconCreateForDock(WScreen *scr, const char *command, const char *wm_instance, + const char *wm_class, int tile); Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event); void wAppIconDestroy(WAppIcon *aicon); @@ -81,7 +81,7 @@ void removeAppIconFor(WApplication * wapp); void save_appicon(WAppIcon *aicon, Bool dock); void paint_app_icon(WApplication *wapp); void unpaint_app_icon(WApplication *wapp); -void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char *wm_instance, - char *wm_class); +void wApplicationExtractDirPackIcon(WScreen *scr, const char *path, const char *wm_instance, + const char *wm_class); WAppIcon *wAppIconFor(Window window); #endif diff --git a/src/defaults.h b/src/defaults.h index fc07f1ca..9968338d 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -46,14 +46,14 @@ RImage *get_default_image(WScreen *scr); 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, +RImage *get_icon_image(WScreen *scr, const char *winstance, const char *wclass, int max_size); +char *get_icon_filename(WScreen *scr, const char *winstance, const char *wclass, const char *command, Bool default_icon); 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); +RImage *get_rimage_from_file(WScreen *scr, const char *file_name, int max_size); void wDefaultPurgeInfo(WScreen *scr, const char *instance, const char *class); diff --git a/src/dock.c b/src/dock.c index df924868..3f44b44e 100644 --- a/src/dock.c +++ b/src/dock.c @@ -95,7 +95,7 @@ static void dockIconPaint(WAppIcon *btn); static void iconMouseDown(WObjDescriptor *desc, XEvent *event); -static pid_t execCommand(WAppIcon *btn, char *command, WSavedState *state); +static pid_t execCommand(WAppIcon *btn, const char *command, WSavedState *state); static void trackDeadProcess(pid_t pid, unsigned char status, WDock *dock); @@ -119,7 +119,7 @@ static void launchDockedApplication(WAppIcon *btn, Bool withSelection); static void clipAutoLower(void *cdata); static void clipAutoRaise(void *cdata); -static WAppIcon *mainIconCreate(WScreen *scr, int type, char *name); +static WAppIcon *mainIconCreate(WScreen *scr, int type, const char *name); static void drawerIconExpose(WObjDescriptor *desc, XEvent *event); static void removeDrawerCallback(WMenu *menu, WMenuEntry *entry); @@ -815,7 +815,7 @@ static void unhideHereCallback(WMenu *menu, WMenuEntry *entry) /* Name is only used when type == WM_DRAWER and when restoring a specific * drawer, with a specific name. When creating a drawer, leave name to NULL * and mainIconCreate will find the first unused unique name */ -WAppIcon *mainIconCreate(WScreen *scr, int type, char *name) +static WAppIcon *mainIconCreate(WScreen *scr, int type, const char *name) { WAppIcon *btn; int x_pos; @@ -1280,7 +1280,7 @@ static WMenu *dockMenuCreate(WScreen *scr, int type) return menu; } -WDock *wDockCreate(WScreen *scr, int type, char *name) +WDock *wDockCreate(WScreen *scr, int type, const char *name) { WDock *dock; WAppIcon *btn; @@ -3008,7 +3008,7 @@ static void swapDock(WDock *dock) wScreenUpdateUsableArea(scr); } -static pid_t execCommand(WAppIcon *btn, char *command, WSavedState *state) +static pid_t execCommand(WAppIcon *btn, const char *command, WSavedState *state) { WScreen *scr = btn->icon->core->screen_ptr; pid_t pid; diff --git a/src/dock.h b/src/dock.h index ffebb1e7..d88deed5 100644 --- a/src/dock.h +++ b/src/dock.h @@ -64,7 +64,7 @@ typedef struct WDock { -WDock *wDockCreate(WScreen *scr, int type, char *name); +WDock *wDockCreate(WScreen *scr, int type, const char *name); WDock *wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type); void wDockDestroy(WDock *dock); diff --git a/src/framewin.c b/src/framewin.c index 194cd2b6..db0d9880 100644 --- a/src/framewin.c +++ b/src/framewin.c @@ -61,9 +61,9 @@ static void paintButton(WCoreWindow * button, WTexture * texture, static void updateTitlebar(WFrameWindow * fwin); -static void allocFrameBorderPixel(Colormap colormap, char *color_name, unsigned long **pixel); +static void allocFrameBorderPixel(Colormap colormap, const char *color_name, unsigned long **pixel); -static void allocFrameBorderPixel(Colormap colormap, char *color_name, unsigned long **pixel) { +static void allocFrameBorderPixel(Colormap colormap, const char *color_name, unsigned long **pixel) { XColor xcol; *pixel = NULL; diff --git a/src/icon.c b/src/icon.c index 6a93b7ad..0472d7a7 100644 --- a/src/icon.c +++ b/src/icon.c @@ -150,7 +150,7 @@ WIcon *icon_create_for_wwindow(WWindow *wwin) return icon; } -WIcon *icon_create_for_dock(WScreen *scr, char *command, char *wm_instance, char *wm_class, int tile) +WIcon *icon_create_for_dock(WScreen *scr, const char *command, const char *wm_instance, const char *wm_class, int tile) { WIcon *icon; @@ -354,7 +354,7 @@ RImage *wIconValidateIconSize(RImage *icon, int max_size) return icon; } -Bool wIconChangeImageFile(WIcon *icon, char *file) +Bool wIconChangeImageFile(WIcon *icon, const char *file) { WScreen *scr = icon->core->screen_ptr; char *path; @@ -393,7 +393,7 @@ static char *get_name_for_wwin(WWindow *wwin) return get_name_for_instance_class(wwin->wm_instance, wwin->wm_class); } -char *get_name_for_instance_class(char *wm_instance, char *wm_class) +char *get_name_for_instance_class(const char *wm_instance, const char *wm_class) { char *suffix; int len; @@ -900,7 +900,7 @@ static void miniwindowMouseDown(WObjDescriptor * desc, XEvent * event) } } -void set_icon_image_from_database(WIcon *icon, char *wm_instance, char *wm_class, char *command) +void set_icon_image_from_database(WIcon *icon, const char *wm_instance, const char *wm_class, const char *command) { char *file = NULL; diff --git a/src/icon.h b/src/icon.h index e2c7d91b..58b6cf6f 100644 --- a/src/icon.h +++ b/src/icon.h @@ -53,10 +53,10 @@ typedef struct WIcon { * color */ } WIcon; -WIcon *icon_create_for_dock(WScreen *scr, char *command, char *wm_instance, char *wm_class, int tile); +WIcon *icon_create_for_dock(WScreen *scr, const char *command, const char *wm_instance, const char *wm_class, int tile); WIcon *icon_create_for_wwindow(WWindow *wwin); -void set_icon_image_from_database(WIcon *icon, char *wm_instance, char *wm_class, char *command); +void set_icon_image_from_database(WIcon *icon, const char *wm_instance, const char *wm_class, const char *command); void wIconDestroy(WIcon *icon); void wIconPaint(WIcon *icon); void wIconUpdate(WIcon *icon); @@ -64,13 +64,13 @@ void wIconSelect(WIcon *icon); void wIconChangeTitle(WIcon *icon, WWindow *wwin); void update_icon_pixmap(WIcon *icon); -Bool wIconChangeImageFile(WIcon *icon, char *file); +Bool wIconChangeImageFile(WIcon *icon, const char *file); RImage *wIconValidateIconSize(RImage *icon, int max_size); RImage *get_rimage_icon_from_wm_hints(WIcon *icon); char *wIconStore(WIcon *icon); -char *get_name_for_instance_class(char *wm_instance, char *wm_class); +char *get_name_for_instance_class(const char *wm_instance, const char *wm_class); void wIconSetHighlited(WIcon *icon, Bool flag); void set_icon_image_from_image(WIcon *icon, RImage *image); diff --git a/src/rootmenu.c b/src/rootmenu.c index c1e902ca..5d971b6b 100644 --- a/src/rootmenu.c +++ b/src/rootmenu.c @@ -68,7 +68,7 @@ extern WPreferences wPreferences; static WMenu *readMenuPipe(WScreen * scr, char **file_name); static WMenu *readPLMenuPipe(WScreen * scr, char **file_name); static WMenu *readMenuFile(WScreen *scr, const char *file_name); -static WMenu *readMenuDirectory(WScreen * scr, char *title, char **file_name, char *command); +static WMenu *readMenuDirectory(WScreen *scr, const char *title, char **file_name, const char *command); static WMenu *configureMenu(WScreen * scr, WMPropList * definition, Bool includeGlobals); static void menu_parser_register_macros(WMenuParser parser); @@ -764,7 +764,7 @@ static void cleanupWorkspaceMenu(WMenu * menu) menu->frame->screen_ptr->workspace_menu = NULL; } -static WMenuEntry *addWorkspaceMenu(WScreen * scr, WMenu * menu, char *title) +static WMenuEntry *addWorkspaceMenu(WScreen *scr, WMenu *menu, const char *title) { WMenu *wsmenu; WMenuEntry *entry; @@ -794,7 +794,7 @@ static void cleanupWindowsMenu(WMenu * menu) menu->frame->screen_ptr->switch_menu = NULL; } -static WMenuEntry *addWindowsMenu(WScreen * scr, WMenu * menu, char *title) +static WMenuEntry *addWindowsMenu(WScreen *scr, WMenu *menu, const char *title) { WMenu *wwmenu; WWindow *wwin; @@ -822,8 +822,8 @@ static WMenuEntry *addWindowsMenu(WScreen * scr, WMenu * menu, char *title) return entry; } -static WMenuEntry *addMenuEntry(WMenu * menu, char *title, char *shortcut, char *command, - char *params, const char *file_name) +static WMenuEntry *addMenuEntry(WMenu *menu, const char *title, const char *shortcut, const char *command, + const char *params, const char *file_name) { WScreen *scr; WMenuEntry *entry = NULL; @@ -1207,7 +1207,7 @@ static Bool isFilePackage(const char *file) } } -static WMenu *readMenuDirectory(WScreen * scr, char *title, char **path, char *command) +static WMenu *readMenuDirectory(WScreen *scr, const char *title, char **path, const char *command) { DIR *dir; struct dirent *dentry; diff --git a/src/texture.c b/src/texture.c index 20e74014..aaa10fb6 100644 --- a/src/texture.c +++ b/src/texture.c @@ -37,7 +37,7 @@ extern WPreferences wPreferences; static void bevelImage(RImage * image, int relief); -static RImage * get_texture_image(WScreen *scr, char *pixmap_file); +static RImage * get_texture_image(WScreen *scr, const char *pixmap_file); WTexSolid *wTextureMakeSolid(WScreen * scr, XColor * color) { @@ -259,7 +259,7 @@ WTexMGradient *wTextureMakeMGradient(WScreen * scr, int style, RColor ** colors) return texture; } -WTexPixmap *wTextureMakePixmap(WScreen * scr, int style, char *pixmap_file, XColor * color) +WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, const char *pixmap_file, XColor *color) { WTexPixmap *texture; XGCValues gcv; @@ -285,8 +285,8 @@ WTexPixmap *wTextureMakePixmap(WScreen * scr, int style, char *pixmap_file, XCol return texture; } -WTexTGradient *wTextureMakeTGradient(WScreen * scr, int style, RColor * from, RColor * to, - char *pixmap_file, int opacity) +WTexTGradient *wTextureMakeTGradient(WScreen *scr, int style, const RColor *from, const RColor *to, + const char *pixmap_file, int opacity) { WTexTGradient *texture; XGCValues gcv; @@ -318,7 +318,7 @@ WTexTGradient *wTextureMakeTGradient(WScreen * scr, int style, RColor * from, RC return texture; } -static RImage * get_texture_image(WScreen *scr, char *pixmap_file) +static RImage * get_texture_image(WScreen *scr, const char *pixmap_file) { char *file; RImage *image; diff --git a/src/texture.h b/src/texture.h index c0ed42d6..7997304b 100644 --- a/src/texture.h +++ b/src/texture.h @@ -161,9 +161,9 @@ typedef union WTexture { WTexSolid *wTextureMakeSolid(WScreen*, XColor*); WTexGradient *wTextureMakeGradient(WScreen*, int, const RColor*, const RColor*); WTexMGradient *wTextureMakeMGradient(WScreen*, int, RColor**); -WTexTGradient *wTextureMakeTGradient(WScreen*, int, RColor*, RColor*, char *, int); +WTexTGradient *wTextureMakeTGradient(WScreen*, int, const RColor*, const RColor*, const char *, int); WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]); -WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, char *pixmap_file, +WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, const char *pixmap_file, XColor *color); void wTextureDestroy(WScreen*, WTexture*); void wTexturePaint(WTexture *, Pixmap *, WCoreWindow*, int, int); diff --git a/src/wdefaults.c b/src/wdefaults.c index 8ec6ccb8..93ef0e39 100644 --- a/src/wdefaults.c +++ b/src/wdefaults.c @@ -376,7 +376,7 @@ static WMPropList *get_generic_value(const char *instance, const char *class, } /* Get the file name of the image, using instance and class */ -char *get_icon_filename(WScreen *scr, char *winstance, char *wclass, char *command, +char *get_icon_filename(WScreen *scr, const char *winstance, const char *wclass, const char *command, Bool default_icon) { char *file_name = NULL; @@ -419,7 +419,7 @@ char *get_icon_filename(WScreen *scr, char *winstance, char *wclass, char *comma } /* This function returns the image picture for the file_name file */ -RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size) +RImage *get_rimage_from_file(WScreen *scr, const char *file_name, int max_size) { RImage *image = NULL; @@ -473,7 +473,7 @@ RImage *get_default_image(WScreen *scr) return image; } -RImage *get_icon_image(WScreen *scr, char *winstance, char *wclass, int max_size) +RImage *get_icon_image(WScreen *scr, const char *winstance, const char *wclass, int max_size) { char *file_name = NULL; diff --git a/src/winspector.c b/src/winspector.c index 59b56f29..13f4799a 100644 --- a/src/winspector.c +++ b/src/winspector.c @@ -303,7 +303,7 @@ static void changePage(WMPopUpButton *bPtr, InspectorPanel *panel) WMUnmapWidget(panel->appFrm); } -static int showIconFor(WMScreen *scrPtr, InspectorPanel *panel, char *wm_instance, char *wm_class, int flags) +static int showIconFor(WMScreen *scrPtr, InspectorPanel *panel, const char *wm_instance, const char *wm_class, int flags) { WMPixmap *pixmap = (WMPixmap *) NULL; char *file = NULL, *path = NULL, *db_icon = NULL;