This pach removes the icon from the icon cache when the icon is detached from the dock/clip.
That helps to hold tidy the icon cache folder. -------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) <k...@kix.es> --- src/dock.c | 4 ++++ src/icon.c | 18 ++++++++++++++++++ src/icon.h | 1 + 3 files changed, 23 insertions(+) diff --git a/src/dock.c b/src/dock.c index e27b28a..3b3313b 100644 --- a/src/dock.c +++ b/src/dock.c @@ -2425,6 +2425,9 @@ void wDockDetach(WDock *dock, WAppIcon *icon) dock->icon_count--; + /* Remove the Cached Icon */ + remove_cache_icon(icon->icon->file); + /* if the dock is not attached to an application or * the application did not set the appropriate hints yet, * destroy the icon */ @@ -2452,6 +2455,7 @@ void wDockDetach(WDock *dock, WAppIcon *icon) if (wPreferences.auto_arrange_icons) wArrangeIcons(dock->screen_ptr, True); } + if (dock->auto_collapse || dock->auto_raise_lower) clipLeave(dock); } diff --git a/src/icon.c b/src/icon.c index d53f756..0dbd6ac 100644 --- a/src/icon.c +++ b/src/icon.c @@ -529,6 +529,24 @@ char *wIconStore(WIcon *icon) return filename; } +void remove_cache_icon(char *filename) +{ + char *cachepath; + + if (!filename) + return; + + cachepath = get_icon_cache_path(); + if (!cachepath) + return; + + /* Filename check/parse could be here */ + if (!strncmp(filename, cachepath, strlen(cachepath))) + unlink(filename); + + wfree(cachepath); +} + static void cycleColor(void *data) { WIcon *icon = (WIcon *) data; diff --git a/src/icon.h b/src/icon.h index dbcb289..cccd7a8 100644 --- a/src/icon.h +++ b/src/icon.h @@ -80,4 +80,5 @@ void wIconSetHighlited(WIcon *icon, Bool flag); void set_icon_image_from_image(WIcon *icon, RImage *image); void set_icon_minipreview(WIcon *icon, RImage *image); +void remove_cache_icon(char *filename); #endif /* WMICON_H_ */ -- 2.5.0 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.