The function set_icon_image_from_database depends on the WScreen
because it calls to wIconValidateIconSize.

wIconValidateIconSize needs that the RImage contains a valid data
painted on the screen to do the resize (the image must be painted).

Then, if we move the wIconValidateIconSize call to the functions
that calls set_icon_image_from_database, the function can be screen
independent.

The function name is set_icon_image_from_database, so it should set
the icon image from the database, without screen interaction.

Signed-off-by: Rodolfo García Peñas (kix) <[email protected]>
---
 src/appicon.c | 1 +
 src/icon.c    | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/appicon.c b/src/appicon.c
index a9536a1..e7e74f1 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -273,6 +273,7 @@ void removeAppIconFor(WApplication *wapp)
                /* Set the icon image */
                set_icon_image_from_database(aicon->icon, aicon->wm_instance,
                                             aicon->wm_class, aicon->command);
+               aicon->icon->file_image = 
wIconValidateIconSize(aicon->icon->file_image, wPreferences.icon_size);
 
                /* Update the icon, because aicon->icon could be NULL */
                wIconUpdate(aicon->icon);
diff --git a/src/icon.c b/src/icon.c
index eff9431..f4fe86c 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -143,6 +143,8 @@ WIcon *icon_create_for_wwindow(WWindow *wwin)
        icon->tile_type = TILE_NORMAL;
 
        set_icon_image_from_database(icon, wwin->wm_instance, wwin->wm_class, 
NULL);
+       icon->file_image = wIconValidateIconSize(icon->file_image, 
wPreferences.icon_size);
+
        /* Update the icon, because icon could be NULL */
        wIconUpdate(icon);
 
@@ -162,6 +164,8 @@ WIcon *icon_create_for_dock(WScreen *scr, const char 
*command, const char *wm_in
        icon->tile_type = tile;
 
        set_icon_image_from_database(icon, wm_instance, wm_class, command);
+       icon->file_image = wIconValidateIconSize(icon->file_image, 
wPreferences.icon_size);
+
        /* Update the icon, because icon could be NULL */
        wIconUpdate(icon);
 
@@ -913,7 +917,6 @@ void set_icon_image_from_database(WIcon *icon, const char 
*wm_instance, const ch
        if (file) {
                icon->file = wstrdup(file);
                image = RLoadImage(icon->core->screen_ptr->rcontext, 
icon->file, 0);
-               image = wIconValidateIconSize(image, wPreferences.icon_size);
                icon->file_image = image;
                if (!image)
                        wwarning(_("error loading image file \"%s\": %s"), 
icon->file,
-- 
1.8.4.rc3


-- 
To unsubscribe, send mail to [email protected].

Reply via email to