[ icewm-Bugs-3393557 ] Icons not displayed correctly

SourceForge.net <[email protected]> Mon, 11 Jun 2012 15:28:15 -0700
Newsgroups gmane.comp.window-managers.icewm.devel
Message-ID <[email protected]>
Bugs item #3393557, was opened at 2011-08-17 22:54
Message generated for change (Comment added) made by marcusmoeller76
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100031&aid=3393557&group_id=31

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: icewm-1.3
Group: appearance
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Marcus Moeller (marcusmoeller76)
Assigned to: Nobody/Anonymous (nobody)
Summary: Icons not displayed correctly

Initial Comment:
I have upgraded my IceWM Installation to 1.3.7-1 (Debian package version) and noticed that some icons of applications like nautilus or gnome-terminal are not displayed correctly anymore (unknown application icon is shown, instead). They have been displayed correctly in the previous version (which was 1.3.7~pre2-1+b1).

I have also re-checked if it's an IceWM problem by using another panel (in this case tint2), where the icons are shown correctly.


----------------------------------------------------------------------

>Comment By: Marcus Moeller (marcusmoeller76)
Date: 2012-06-11 15:28

Message:
@thefirstone:

I have used the following patch on several installations and architectures
and can confirm that it works fine:

http://paste.debian.net/174019/

Never experienced any cropped icons.

----------------------------------------------------------------------

Comment By: Stanislav Maslovski (s_i_m)
Date: 2012-05-28 22:28

Message:
thefirstone,

Can you please tell what modifications precisely you did when applying the
patch and why? Here it works flawlessly on 64 bit without any changes (if
you read carefully the documentation you will see that no modification is
needed for 64 bit).


----------------------------------------------------------------------

Comment By: Marcus Moeller (marcusmoeller76)
Date: 2012-05-27 09:37

Message:
@thefirstone have you just tried to apply the wmclient.cc patch from below?
It works fine on a nearly unpatched and current 64bit build here (only
use_ICEWM_deprecated.patch and package_build_fixes + the below wmclient
patch). I have never experienced any of the described problems, btw.

----------------------------------------------------------------------

Comment By: Eduard Bloch (thefirstone)
Date: 2012-05-27 04:37

Message:
Update: sorry, this page does NOT work well on 64-bit and the adoptation is
not as trivial as you claimed in
https://sourceforge.net/mailarchive/message.php?msg_id=25125642 .

Changing as above cuts the icon to the half and adds random garbage to the
second half.

If I change the call of GetFullWindowProperty (itemSize parameter from 32
to 8*sizeof(long) ) then some icons appear, some still don't appear and
some appear with a garbled palette. There must be some very simple
explanation but I haven't figured it out yet.

Anyhow, for the time being, I think I will refrain from adding this patch.
Having no icon is better than having many garbled icons.

----------------------------------------------------------------------

Comment By: Eduard Bloch (thefirstone)
Date: 2012-05-27 02:10

Message:
Hello Stanislav,

thanks for providing this modification. I planed to change it in 1.3.7-3 in
Debian but it was somehow lost in transition. I guess I will make an update
of the Debian package with this change as soon as 1.3.7-4 hits stable
(which is more important ATM).

Anyway, your explanation makes sense and I agree, my initial workaround for
the icon problem was not well founded and was simply focused on somehow
working around that crashes.


----------------------------------------------------------------------

Comment By: Marcus Moeller (marcusmoeller76)
Date: 2012-05-27 01:37

Message:
Yes, the attached patch works fine. Could you please include it in the next
release?

----------------------------------------------------------------------

Comment By: Marcus Moeller (marcusmoeller76)
Date: 2011-11-15 01:32

Message:
At least the icons of gtk3 applications are not displayed correctly.

The rest works again (icewm-1.2.37-7)

----------------------------------------------------------------------

Comment By: Stanislav Maslovski (s_i_m)
Date: 2011-08-18 04:32

Message:
See patch #3393827 "Fix reading window icon property".

----------------------------------------------------------------------

Comment By: Stanislav Maslovski (s_i_m)
Date: 2011-08-18 04:25

Message:
Oh, f**k, the formatting in the comments is completely broken.

God, please, make the person who developed this new sourceforge
webinterface die a painful death! Amen.

----------------------------------------------------------------------

Comment By: Stanislav Maslovski (s_i_m)
Date: 2011-08-18 04:21

Message:
It seems it is impossible to attach a file to a comment, therefore, here it
goes inline. Copy and paste it to a file and apply with "patch -p1 <
saved_patch_file"

Index: icewm-1.3.7/src/wmclient.cc
===================================================================
--- icewm-1.3.7.orig/src/wmclient.cc	2010-10-31 17:09:36.000000000 +0300
+++ icewm-1.3.7/src/wmclient.cc	2011-08-18 13:24:28.666429265 +0400
@@ -1044,20 +1044,11 @@
         while (XGetWindowProperty(display, handle,
                                propAtom, (itemCount * itemSize) / 32,
1024*32, False, AnyPropertyType,
                                &r_type, &r_format, &nitems, &bytes_remain,
-                               &prop) == Success && prop && bytes_remain
== 0)
+                               &prop) == Success && prop)
         {
             if (r_format == itemSize1 && nitems > 0) {
                 data = realloc(data, (itemCount + nitems) * itemSize / 8);
 
-                // access to memory beyound 256MiB causes crashes! But
anyhow, size
-                // >>2MiB looks suspicious. Detect this case ASAP.
However, if
-                // the usable icon is somewhere in the beginning, it's
okay to
-                // return truncated data.
-                if (itemCount * itemSize / 8 >= 2097152) {
-                     XFree(prop);
-                     break;
-                }
-
                 memcpy((char *)data + itemCount * itemSize / 8, prop,
nitems * itemSize / 8);
                 itemCount += nitems;
                 XFree(prop);


----------------------------------------------------------------------

Comment By: Stanislav Maslovski (s_i_m)
Date: 2011-08-18 04:11

Message:
This is introduced in revision 1.27.2.11.2.14 by captnmark, Sun Oct 17
17:38:56 2010 UTC of wmclient.cc.

Unfortunately, this change was not done exactly in the same way I proposed
in https://sourceforge.net/mailarchive/message.php?msg_id=25125642 .
Namelly, in the current code the icon property is not read in full because
of the redundant check "bytes_remain == 0" in the while() loop. Also, the
current code still imposes the unneeded artificial limit for the icon size.

Can you please check that with the attached patch the icons are displayed
correctly?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100031&aid=3393557&group_id=31

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/