applySettings icon set updated
authorRodolfo García Peñas (kix) <kix@kix.es>
Wed, 14 Nov 2012 23:59:34 +0000 (15 00:59 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Sat, 17 Nov 2012 20:10:36 +0000 (17 21:10 +0100)
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

index 25e13b2..d3f49d0 100644 (file)
@@ -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);