mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-27 08:52:30 +01:00
Solved bug if icon doesn't exists
There is a bug in wmaker with icon files set in config files, but
that doesn't exist in the disk. For example, if the config files have:
etc/WindowMaker/WMWindowAttributes:
xcalc = {AlwaysUserIcon = Yes;Icon = "HP-16C-48.xpm";};
share/WindowMaker/IconSets/Default.iconset:
xcalc = {AlwaysUserIcon = Yes;Icon = "HP-16C-48.xpm";};
But the icon "HP-16C-48.xpm" doesn't exist in the disk, wmaker does:
1. Load the config file in memory, in a database
2. When the application is launched, wmaker tries to find their icon in
the database (using wDefaultGetIconFile), the icon is found: HP-16C-48.xpm
3. When WindowMaker try to find the full path for the icon, using FindImage(),
WindowMaker cannot find the icon, and returns NULL.
Even, if the user set the default_icon boolean variable to True, wmaker
finds in the database the wrong icon.
This patch checks that the icon exists both in the database AND in the disk. If the
icon doesn't exist in the disk and the default_icon variable is set to True,
then windowmaker loads the default icon using the function get_default_image()
because this function searches the default icon directly.
The function get_default_image() is moved from icon.c to wdefaults.c because
it is now used in both places. This function is now splitted, to find the file
(get_default_image_path) path and the file image (get_default_image)
This commit is contained in:
committed by
Carlos R. Mafra
parent
314f1dc907
commit
529276a395
22
src/icon.c
22
src/icon.c
@@ -73,7 +73,6 @@ static void get_rimage_icon_from_x11(WIcon *icon);
|
||||
static void icon_update_pixmap(WIcon *icon, RImage *image);
|
||||
static void unset_icon_image(WIcon *icon);
|
||||
|
||||
static RImage *get_default_image(WScreen *scr);
|
||||
/****** Notification Observers ******/
|
||||
|
||||
static void appearanceObserver(void *self, WMNotification * notif)
|
||||
@@ -693,27 +692,6 @@ static void get_pixmap_icon_from_default_icon(WIcon *icon)
|
||||
icon_update_pixmap(icon, icon->file_image);
|
||||
}
|
||||
|
||||
/* This function creates the RImage using the default icon */
|
||||
static RImage *get_default_image(WScreen *scr)
|
||||
{
|
||||
RImage *image = NULL;
|
||||
char *path, *file;
|
||||
|
||||
/* Get the default icon */
|
||||
file = wDefaultGetIconFile(NULL, NULL, True);
|
||||
if (file) {
|
||||
path = FindImage(wPreferences.icon_path, file);
|
||||
image = get_rimage_from_file(scr, path, wPreferences.icon_size);
|
||||
|
||||
if (!image)
|
||||
wwarning(_("could not find default icon \"%s\""), file);
|
||||
|
||||
wfree(file);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/* Get the Pixmap from the WIcon of the WWindow */
|
||||
static void get_pixmap_icon_from_icon_win(WIcon *icon)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user