From d7fe9a5bcd9e4f1946692f5c9c9fd4de0fac5a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Tue, 22 Jan 2013 21:18:13 +0100 Subject: [PATCH] Update docked icon after kill dockapp This patch sets the correct icon after kill a docked application. To reproduce the problem (as Carlos reported to me), follow these steps: 1. With a docked application, not running, set the icon image. 2. Launch the docked application. 3. Kill the application, using for example the app dock menu. The icon is lost. But if wmaker is restarted, the icon backs again. The problem is because when the application is closed, the function removeAppIconFor() calls wIconUpdate(), but this function doesn't find the icon in the file system again. The icon is loaded from the filesystem only when the application is created. This patch creates the icon image again, then calls wIconUpdate() to set the icon image or the default icon image if the icon image was not found, then wPaint it. These lines comes from the create_appicon_from_* functions, used to set the icon image for docks and applications. Are copy/pasted. --- src/appicon.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/appicon.c b/src/appicon.c index 902559c2..9f51daca 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -240,6 +240,8 @@ void paint_app_icon(WApplication *wapp) void removeAppIconFor(WApplication *wapp) { + char *file = NULL; + if (!wapp->app_icon) return; @@ -256,6 +258,14 @@ void removeAppIconFor(WApplication *wapp) wapp->app_icon->icon->icon_win = None; /* Update the icon images */ + /* Search the icon using instance and class, without default icon */ + file = get_icon_filename(wapp->app_icon->icon->core->screen_ptr, wapp->app_icon->wm_instance, wapp->app_icon->wm_class, wapp->app_icon->command, False); + if (file) { + wapp->app_icon->icon->file = wstrdup(file); + wapp->app_icon->icon->file_image = get_rimage_from_file(wapp->app_icon->icon->core->screen_ptr, wapp->app_icon->icon->file, wPreferences.icon_size); + wfree(file); + } + wIconUpdate(wapp->app_icon->icon, NULL); /* Paint it */