[Pkg-wmaker-commits] [wmaker] 08/21: save the icon filename instead the full path
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Sat Jan 9 16:06:31 UTC 2016
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch upstream
in repository wmaker.
commit 8a822004eef716d3a154a78960773d52d9cc8253
Author: Rodolfo García Peñas (kix) <kix at kix.es>
Date: Sun Aug 23 20:56:58 2015 +0200
save the icon filename instead the full path
This patch saves the icon filename in the database and in the disk. wmaker
can find the icon in the different folders, including the cache folder.
This patch is based in the comments of Zoltan:
-------8<-------
Also app icon caching was broken around the same time. The app icon cache
in CachedPixmaps was meant to store icons retrieved from X clients so the
dock or clip can display those when the client is not running like after
startup. The cache should contain only such icons and the path should never
appear in WMWindowAttributes because the cache is an internal thing used to
look up icons not otherwise available. If you look at your WMWindowAttributes
now it is full of entries referring to the cache that should not be there and
if you look at the cache dir you'll find a lot of icons from all apps you've
ever started while there should be only the few docked ones that use client
side icons. Also the cache is never cleaned up only new icons are added to it.
-------8<-------
Signed-off-by: Rodolfo García Peñas (kix) <kix at kix.es>
---
src/icon.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/icon.c b/src/icon.c
index a04e11b..d53f756 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -470,7 +470,7 @@ static RImage *get_wwindow_image_from_wmhints(WWindow *wwin, WIcon *icon)
*/
char *wIconStore(WIcon *icon)
{
- char *path, *dir_path, *file;
+ char *path, *dir_path, *file, *filename;
int len = 0;
RImage *image = NULL;
WWindow *wwin = icon->owner;
@@ -488,15 +488,23 @@ char *wIconStore(WIcon *icon)
return NULL;
}
- len = strlen(dir_path) + strlen(file) + 5;
+ /* Create the file name */
+ len = strlen(file) + 5;
+ filename = wmalloc(len);
+ snprintf(filename, len, "%s.xpm", file);
+ wfree(file);
+
+ /* Create the full path, including the filename */
+ len = strlen(dir_path) + strlen(filename) + 1;
path = wmalloc(len);
- snprintf(path, len, "%s%s.xpm", dir_path, file);
+ snprintf(path, len, "%s%s", dir_path, filename);
wfree(dir_path);
- wfree(file);
/* If icon exists, exit */
- if (access(path, F_OK) == 0)
- return path;
+ if (access(path, F_OK) == 0) {
+ wfree(path);
+ return filename;
+ }
if (wwin->net_icon_image)
image = RRetainImage(wwin->net_icon_image);
@@ -505,17 +513,20 @@ char *wIconStore(WIcon *icon)
if (!image) {
wfree(path);
+ wfree(filename);
return NULL;
}
if (!RSaveImage(image, path, "XPM")) {
wfree(path);
+ wfree(filename);
path = NULL;
}
+ wfree(path);
RReleaseImage(image);
- return path;
+ return filename;
}
static void cycleColor(void *data)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmaker.git
More information about the Pkg-wmaker-commits
mailing list