>From 252f10db88a2a3743179f3ce3bdf85b177069d41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Thu, 15 Nov 2012 00:59:34 +0100
Subject: [PATCH 6/6] applySettings icon set updated

The function applySettings() set now the icons. Updated icons are:

- Appicon: Always, with or without always_user_icon
- Window: If the window is minimized, with or without always_user_icon.
  Window must be minimized to see the icon change, else, wwin->icon
  doesn't exist and therefore you won't see this change (no icon).

There is a problem if the window is not minimized and is minimezed,
because it will show the icon in the database, not the assigned icon.
This problem must be updated not here, in the wIconifyWindow()
function, at actions.c
---
 src/winspector.c |   32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/winspector.c b/src/winspector.c
index 25e13b2..d3f49d0 100644
--- a/src/winspector.c
+++ b/src/winspector.c
@@ -778,20 +778,32 @@ static void applySettings(WMButton *button, 
InspectorPanel *panel)
                else
                        paint_app_icon(wapp);
 
-               if (wapp->app_icon && wapp->main_window == wwin->client_win) {
-                       char *file = WMGetTextFieldText(panel->fileText);
+               char *file = WMGetTextFieldText(panel->fileText);
+               if (file[0] == 0) {
+                       wfree(file);
+                       file = NULL;
+               }
 
-                       if (file[0] == 0) {
-                               wfree(file);
-                               file = NULL;
-                       }
+               if (WFLAGP(wwin, always_user_icon)) {
+                       /* Change icon image if the app is minimized */
+                       if (wwin->icon)
+                               wIconChangeImageFile(wwin->icon, file);
 
-                       wIconChangeImageFile(wapp->app_icon->icon, file);
-                       if (file)
-                               wfree(file);
+                       /* Change App Icon image */
+                       if (wapp->app_icon)
+                               wIconChangeImageFile(wapp->app_icon->icon, 
file);
+               } else {
+                       /* Change App Icon image */
+                       if (wapp->app_icon)
+                               wIconUpdate(wapp->app_icon->icon, 
get_rimage_icon_from_wm_hints(wapp->app_icon->icon));
 
-                       wAppIconPaint(wapp->app_icon);
+                       /* Change icon image if the app is minimized */
+                       if (wwin->icon)
+                               wIconUpdate(wwin->icon, 
get_rimage_icon_from_wm_hints(wwin->icon));
                }
+
+               if (file)
+                       wfree(file);
        }
 
        wNETFrameExtents(wwin);
-- 
1.7.10.4

>From 252f10db88a2a3743179f3ce3bdf85b177069d41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Thu, 15 Nov 2012 00:59:34 +0100
Subject: [PATCH 6/6] applySettings icon set updated

The function applySettings() set now the icons. Updated icons are:

- Appicon: Always, with or without always_user_icon
- Window: If the window is minimized, with or without always_user_icon.
  Window must be minimized to see the icon change, else, wwin->icon
  doesn't exist and therefore you won't see this change (no icon).

There is a problem if the window is not minimized and is minimezed,
because it will show the icon in the database, not the assigned icon.
This problem must be updated not here, in the wIconifyWindow()
function, at actions.c
---
 src/winspector.c |   32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/winspector.c b/src/winspector.c
index 25e13b2..d3f49d0 100644
--- a/src/winspector.c
+++ b/src/winspector.c
@@ -778,20 +778,32 @@ static void applySettings(WMButton *button, InspectorPanel *panel)
 		else
 			paint_app_icon(wapp);
 
-		if (wapp->app_icon && wapp->main_window == wwin->client_win) {
-			char *file = WMGetTextFieldText(panel->fileText);
+		char *file = WMGetTextFieldText(panel->fileText);
+		if (file[0] == 0) {
+			wfree(file);
+			file = NULL;
+		}
 
-			if (file[0] == 0) {
-				wfree(file);
-				file = NULL;
-			}
+		if (WFLAGP(wwin, always_user_icon)) {
+			/* Change icon image if the app is minimized */
+			if (wwin->icon)
+				wIconChangeImageFile(wwin->icon, file);
 
-			wIconChangeImageFile(wapp->app_icon->icon, file);
-			if (file)
-				wfree(file);
+			/* Change App Icon image */
+			if (wapp->app_icon)
+				wIconChangeImageFile(wapp->app_icon->icon, file);
+		} else {
+			/* Change App Icon image */
+			if (wapp->app_icon)
+				wIconUpdate(wapp->app_icon->icon, get_rimage_icon_from_wm_hints(wapp->app_icon->icon));
 
-			wAppIconPaint(wapp->app_icon);
+			/* Change icon image if the app is minimized */
+			if (wwin->icon)
+				wIconUpdate(wwin->icon, get_rimage_icon_from_wm_hints(wwin->icon));
 		}
+
+		if (file)
+			wfree(file);
 	}
 
 	wNETFrameExtents(wwin);
-- 
1.7.10.4

Reply via email to