User forums > Using Code::Blocks

Bad icons of C::B in the 16.01 release

(1/4) > >>

ollydbg:
I just download this binary
codeblocks-16.01-setup.exe, and unzip it, and run the CBlauncher.exe, I noticed that the icons are really bad!

See the screen shot:



I see this issue in wx3.x build C::B, but now, I see it in wx 2.8 based C::B.

See the bug report here:
https://sourceforge.net/p/codeblocks/tickets/234/
And wx-user mail list discussion:
https://groups.google.com/d/msg/wx-users/eA2pNgviez8/ifbIpukmAQAJ

Any one has ideas how to fix this issue? Thanks.

MortenMacFly:

--- Quote from: ollydbg on January 24, 2016, 07:31:06 am ---I just download this binary
codeblocks-16.01-setup.exe, and unzip it, and run the CBlauncher.exe, I noticed that the icons are really bad!
See the screen shot:

--- End quote ---
For me, the icons are just fine on Windows 10 with the release version.

ollydbg:
I add two image shots, one is for C::B 16.01(rev10702) and the other is from nightly build rev10595. I checked all the commit logs between those two commits, but I don't know what cause this issue. I guess the issue is inside in wx (2.8.12) source.



and



The 16.01 just have much narrow column(118 pixels) then the nightly build version(146 pixels)

ollydbg:
OK, then I just build C::B against wx git master head, and the width is 141.
See image below:

ollydbg:
Guys, I found that if I put a manifest file named "codeblocks.exe.manifest" with the content:


--- Code: ---<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="*"
    name="CompanyName.ProductName.YourApplication"
    type="win32"
/>
<description>Your application description here.</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="*"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>

--- End code ---

Along with the codeblocks.exe, then this issue is GONE. (I'm on WinXP)

I just take several days to find this simple solution.

While debugged, I see we have a file named "x86.manifest" in our src\src\resources, and this file is correctly compiled into the codeblocks.exe. (I just a resource editor to open the codeblocks.exe to verify it).

But what the problem is that, when I debugged the code, I see two instance of "comctrl32.dll" is in the process's space, one is version 5, and the other is version 6, in our x86.manifest, we did require version 6, but I see in our C::B's source code, it still get version 5. The related code is here:


--- Code: ---// function to check the common controls version
#ifdef __WXMSW__
#include <windows.h>
#include <shlwapi.h>
bool UsesCommonControls6()
{
    bool result = false;
    HINSTANCE hinstDll;
    hinstDll = LoadLibrary(_T("comctl32.dll"));
    if (hinstDll)
    {
        DLLGETVERSIONPROC pDllGetVersion;
        pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hinstDll, "DllGetVersion");

        if (pDllGetVersion)
        {
            DLLVERSIONINFO dvi;
            HRESULT hr;

            ZeroMemory(&dvi, sizeof(dvi));
            dvi.cbSize = sizeof(dvi);

            hr = (*pDllGetVersion)(&dvi);

            if (SUCCEEDED(hr))
               result = dvi.dwMajorVersion == 6;
        }

        FreeLibrary(hinstDll);
    }
    return result;
}
#else
bool UsesCommonControls6()
{
    // for non-windows platforms, return true
    // as this is only used for knowing if bitmaps support transparency or not
    return true;
}
#endif

--- End code ---

This means, the icon issue is caused by using the version 5 of the common ctrl.

After I explicitly put a "codeblocks.exe.manifest" along with the codeblocks.exe, it issue is solved.

Any hints about this? maybe, our "x86.manifest" is wrong.

BTW:
The blurred icon was caused by the remove of the alpha channel from the png file(if C::B can't use the version 6 of the comctrl32.dll), see below:

--- Code: ---wxBitmap cbLoadBitmap(const wxString& filename, wxBitmapType bitmapType)
{
    // cache this, can't change while we 're running :)
    static bool oldCommonControls = !UsesCommonControls6();

    wxImage im;
    wxFileSystem* fs = new wxFileSystem;
    wxFSFile* f = fs->OpenFile(filename);
    if (f)
    {
        wxInputStream* is = f->GetStream();
        im.LoadFile(*is, bitmapType);
        delete f;
    }
    delete fs;
    if (oldCommonControls && im.HasAlpha())
        im.ConvertAlphaToMask();

    return wxBitmap(im);
}

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version