mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-12 03:35:52 +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:
committed by
Carlos R. Mafra
parent
76e8a8f963
commit
39fa6d9e2c
@@ -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_ */
|
||||||
|
|||||||
44
src/dialog.c
44
src/dialog.c
@@ -1461,45 +1461,23 @@ 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);
|
if (path) {
|
||||||
|
RColor gray;
|
||||||
|
|
||||||
key = WMCreatePLString("Logo.WMPanel");
|
gray.red = 0xae;
|
||||||
option = WMCreatePLString("Icon");
|
gray.green = 0xaa;
|
||||||
|
gray.blue = 0xae;
|
||||||
|
gray.alpha = 0;
|
||||||
|
|
||||||
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
|
pix = WMCreateBlendedPixmapFromFile(scr, path, &gray);
|
||||||
|
wfree(path);
|
||||||
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) {
|
|
||||||
RColor gray;
|
|
||||||
|
|
||||||
gray.red = 0xae;
|
|
||||||
gray.green = 0xaa;
|
|
||||||
gray.blue = 0xae;
|
|
||||||
gray.alpha = 0;
|
|
||||||
|
|
||||||
pix = WMCreateBlendedPixmapFromFile(scr, path, &gray);
|
|
||||||
wfree(path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pix;
|
return pix;
|
||||||
|
|||||||
Reference in New Issue
Block a user