From c89ec25c80446b7e6d5cbe1e677c5edffe43e6b7 Mon Sep 17 00:00:00 2001 From: Bad Sector Date: Wed, 18 Apr 2018 04:33:53 +0300 Subject: [PATCH] Fixes missing appicons after restarting Window Maker Fixes the bug where if the icon image is accidentally set to nothing or the image file is deleted, the appicon keeps losing its icon (it resets to the default cube icon) when Window Maker exits/restarts (depending on how the user cleared the icon this may persist even after redocking the application if information about the application window is still in the WM). One way to easily see this bug is to open the main window's attributes and press the Save button (no need to do anything else) as this clears the icon file (this is a separate bug that needs to be fixed but it is more of a minor UI bug since clearing the image should simply reset the icon to the application provided one if the Ignore client supplied icon is not set). Another way to see it is to open the properties box in a docked application that is not running and clear the image field. After either of these two actions are performed, restart Window Maker and see that the icons are missing. This patch fixes the above bug by calling save_appicon when the appicon object is created and the application provided icon is already available (window maker actually tries to save the icon at an earlier stage but this is done as a side effect of "painting" the dock icon - which also saves the icon - but this is done too early, before ownership information is available). Note that this bug seems to be a regression introduced from commit 9c4b19d8aaee2f80f03853e62c753298edf12ceb (or one of the related commits around the same time, they seem to be a bit too aggressive in not saving icons). This patch addresses the concern in that commit about only saving the icon for docked applications. --- src/appicon.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/appicon.c b/src/appicon.c index 8eb668fc..66110661 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -159,6 +159,13 @@ void create_appicon_for_application(WApplication *wapp, WWindow *wwin) if (!WFLAGP(wapp->main_window_desc, no_appicon)) paint_app_icon(wapp); } + + /* At this point the application is fully set up and all icon and + * window data are known - so try to save the icon file for docked + * applications to ensure that the file exists when window maker + * starts up next time. */ + if (wapp->app_icon->docked && !WFLAGP(wapp->main_window_desc, no_appicon)) + save_appicon(wapp->app_icon); } void unpaint_app_icon(WApplication *wapp)