>From 8408fc131376e8bed574b3b92c0544cad4241cb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Wed, 14 Nov 2012 18:36:25 +0100
Subject: [PATCH] get_wwindow_image_from_wmhints scale image

The function get_wwindow_image_from_wmhints returns a image from WM Hints,
but the image could be larger than the desired.

Then, the image can be resized using wIconValidateIconSize(). The resize
should be done in get_rimage_icon_from_wm_hints(), not in the function
get_wwindow_image_from_wmhints(). This is because the function
get_wwindow_image_from_wmhints() is used in wIconStore() too. If we resize
the image before save it to disk, then if we change the icon/dock size, then
the image saved will have a different size than the curren icon size. Is
better resize the image when is painted in the screen, not the image saved.
---
 src/icon.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/icon.c b/src/icon.c
index ba059ad..aec3c6a 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -755,6 +755,9 @@ static int get_rimage_icon_from_wm_hints(WIcon *icon)
        if (!image)
                return 1;
 
+       /* Resize the icon to the wPreferences.icon_size size */
+       image = wIconValidateIconSize(image, wPreferences.icon_size);
+
        /* FIXME: If unset_icon_image, pointer double free then crash 
        unset_icon_image(icon); */
        icon->file_image = image;
-- 
1.7.10.4

-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From 8408fc131376e8bed574b3b92c0544cad4241cb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Wed, 14 Nov 2012 18:36:25 +0100
Subject: [PATCH] get_wwindow_image_from_wmhints scale image

The function get_wwindow_image_from_wmhints returns a image from WM Hints,
but the image could be larger than the desired.

Then, the image can be resized using wIconValidateIconSize(). The resize
should be done in get_rimage_icon_from_wm_hints(), not in the function
get_wwindow_image_from_wmhints(). This is because the function
get_wwindow_image_from_wmhints() is used in wIconStore() too. If we resize
the image before save it to disk, then if we change the icon/dock size, then
the image saved will have a different size than the curren icon size. Is
better resize the image when is painted in the screen, not the image saved.
---
 src/icon.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/icon.c b/src/icon.c
index ba059ad..aec3c6a 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -755,6 +755,9 @@ static int get_rimage_icon_from_wm_hints(WIcon *icon)
 	if (!image)
 		return 1;
 
+	/* Resize the icon to the wPreferences.icon_size size */
+	image = wIconValidateIconSize(image, wPreferences.icon_size);
+
 	/* FIXME: If unset_icon_image, pointer double free then crash 
 	unset_icon_image(icon); */
 	icon->file_image = image;
-- 
1.7.10.4

Reply via email to