1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-14 12:55:47 +01:00

Remove dup code from getWindowMakerIconImage()

The code to find the icon in the function getWindowMakerIconImage()
is duplicated, because it is the same code as in get_default_icon_filename()

This patch includes the prototypes of get_default_icon_filename()
and get_default_icon_rimage() in defaults.h, so these functions
can be used in other files.
This commit is contained in:
Rodolfo García Peñas (kix)
2012-07-03 12:43:02 +02:00
committed by Carlos R. Mafra
parent 76e8a8f963
commit 39fa6d9e2c
2 changed files with 14 additions and 33 deletions

View File

@@ -48,4 +48,7 @@ RImage * wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int max_s
int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class); int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file); void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, char *command,
Bool noDefault);
RImage *get_default_icon_rimage(WScreen *scr, char *file_name, int max_size);
#endif /* WMDEFAULTS_H_ */ #endif /* WMDEFAULTS_H_ */

View File

@@ -1463,31 +1463,10 @@ static void setCrashAction(void *self, void *clientData)
/* Make this read the logo from a compiled in pixmap -Dan */ /* Make this read the logo from a compiled in pixmap -Dan */
static WMPixmap *getWindowMakerIconImage(WMScreen *scr) static WMPixmap *getWindowMakerIconImage(WMScreen *scr)
{ {
WMPropList *dict, *key, *option, *value = NULL;
WMPixmap *pix = NULL; WMPixmap *pix = NULL;
char *path; char *path = NULL;
if (!WDWindowAttributes || !WDWindowAttributes->dictionary) path = get_default_icon_filename(NULL, "Logo", "WMPanel", NULL, True);
return NULL;
WMPLSetCaseSensitive(True);
key = WMCreatePLString("Logo.WMPanel");
option = WMCreatePLString("Icon");
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
if (dict) {
value = WMGetFromPLDictionary(dict, option);
}
WMReleasePropList(key);
WMReleasePropList(option);
WMPLSetCaseSensitive(False);
if (value && WMIsPLString(value)) {
path = FindImage(wPreferences.icon_path, WMGetFromPLString(value));
if (path) { if (path) {
RColor gray; RColor gray;
@@ -1500,7 +1479,6 @@ static WMPixmap *getWindowMakerIconImage(WMScreen * scr)
pix = WMCreateBlendedPixmapFromFile(scr, path, &gray); pix = WMCreateBlendedPixmapFromFile(scr, path, &gray);
wfree(path); wfree(path);
} }
}
return pix; return pix;
} }