>From 5153f6bff17bbbb5eb472232ee88cc8309bfbd99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <k...@kix.es> Date: Thu, 29 Nov 2012 00:10:18 +0100 Subject: [PATCH 4/4] 4 Avoid icon change to default on winspector save
For a icon, the icon image is stored in icon->file_image. If we repaint the image, we we don't need search the icon again. We can continue using icon->file_image. Indeed, if launch the "window inspector" window (winspector), using a saved icon and "ignore client icon" set, then the database holds the name of the icon to draw on the screen. If we remove the icon info in the winspector (removing the file name or un-setting the "ignore client icon" flag, then the database losts the icon name and then the function wDefaultUpdateIcons() cannot find the icon to draw for the icon. In winspector, with this patch, the previous image set by "ApplySettings" and stored at icon->file_image is used. --- src/defaults.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/defaults.c b/src/defaults.c index 8eb960d..52fa64b 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -1125,16 +1125,11 @@ void wDefaultUpdateIcons(WScreen *scr) { WAppIcon *aicon = scr->app_icon_list; WWindow *wwin = scr->focused_window; - char *file; while (aicon) { /* Get the application icon, default included */ - file = wDefaultGetIconFile(aicon->wm_instance, aicon->wm_class, True); - if ((file && aicon->icon->file && strcmp(file, aicon->icon->file) != 0) - || (file && !aicon->icon->file)) { - wIconChangeImageFile(aicon->icon, file); - wAppIconPaint(aicon); - } + wIconChangeImageFile(aicon->icon, NULL); + wAppIconPaint(aicon); aicon = aicon->next; } @@ -1142,13 +1137,8 @@ void wDefaultUpdateIcons(WScreen *scr) wClipIconPaint(scr->clip_icon); while (wwin) { - if (wwin->icon && wwin->flags.miniaturized) { - /* Get the application icon, default included */ - file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, True); - if ((file && wwin->icon->file && strcmp(file, wwin->icon->file) != 0) - || (file && !wwin->icon->file)) - wIconChangeImageFile(wwin->icon, file); - } + if (wwin->icon && wwin->flags.miniaturized) + wIconChangeImageFile(wwin->icon, NULL); wwin = wwin->prev; } } -- 1.7.10.4
>From 5153f6bff17bbbb5eb472232ee88cc8309bfbd99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <k...@kix.es> Date: Thu, 29 Nov 2012 00:10:18 +0100 Subject: [PATCH 4/4] 4 Avoid icon change to default on winspector save For a icon, the icon image is stored in icon->file_image. If we repaint the image, we we don't need search the icon again. We can continue using icon->file_image. Indeed, if launch the "window inspector" window (winspector), using a saved icon and "ignore client icon" set, then the database holds the name of the icon to draw on the screen. If we remove the icon info in the winspector (removing the file name or un-setting the "ignore client icon" flag, then the database losts the icon name and then the function wDefaultUpdateIcons() cannot find the icon to draw for the icon. In winspector, with this patch, the previous image set by "ApplySettings" and stored at icon->file_image is used. --- src/defaults.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/defaults.c b/src/defaults.c index 8eb960d..52fa64b 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -1125,16 +1125,11 @@ void wDefaultUpdateIcons(WScreen *scr) { WAppIcon *aicon = scr->app_icon_list; WWindow *wwin = scr->focused_window; - char *file; while (aicon) { /* Get the application icon, default included */ - file = wDefaultGetIconFile(aicon->wm_instance, aicon->wm_class, True); - if ((file && aicon->icon->file && strcmp(file, aicon->icon->file) != 0) - || (file && !aicon->icon->file)) { - wIconChangeImageFile(aicon->icon, file); - wAppIconPaint(aicon); - } + wIconChangeImageFile(aicon->icon, NULL); + wAppIconPaint(aicon); aicon = aicon->next; } @@ -1142,13 +1137,8 @@ void wDefaultUpdateIcons(WScreen *scr) wClipIconPaint(scr->clip_icon); while (wwin) { - if (wwin->icon && wwin->flags.miniaturized) { - /* Get the application icon, default included */ - file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, True); - if ((file && wwin->icon->file && strcmp(file, wwin->icon->file) != 0) - || (file && !wwin->icon->file)) - wIconChangeImageFile(wwin->icon, file); - } + if (wwin->icon && wwin->flags.miniaturized) + wIconChangeImageFile(wwin->icon, NULL); wwin = wwin->prev; } } -- 1.7.10.4