[Bug 54906] New: Menu items with icons are drawn with black squares if Wine is running in Vista+ mode
https://bugs.winehq.org/show_bug.cgi?id=54906 Bug ID: 54906 Summary: Menu items with icons are drawn with black squares if Wine is running in Vista+ mode Product: Wine Version: 8.7 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: user32 Assignee: wine-bugs(a)winehq.org Reporter: george.hazan(a)gmail.com Distribution: --- The following construction fails in the all 8.x versions of Wine (currently I upgraded to version 8.7 devel) and works Ok in Wine 7.1: MENUITEMINFO mii = {}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_STRING | MIIM_STATE; if (pimi->iconId != -1) { mii.fMask |= MIIM_BITMAP; if (IsWinVerVistaPlus() && IsThemeActive()) { if (pimi->hBmp == nullptr) pimi->hBmp = ConvertIconToBitmap(pimi->parent->m_hMenuIcons, pimi->iconId); mii.hbmpItem = pimi->hBmp; } else mii.hbmpItem = HBMMENU_CALLBACK; } InsertMenuItemW(hMenu, uItem, TRUE, &mii); I.e. if I run command 'winecfg -v win2003', then everything is Ok with icons, otherwise I see black squares instead of icons. This code works Ok under all versions of Windows, from XP to Windows 11, the problem is specific to Wine 8.x under Linux (I use Kubuntu 23.04). To see the problem you can download my open source messenger Miranda NG from https://miranda-ng.org/downloads, just download a ZIP, run it and open main or tray icon menu. The full source code is avalable here: https://github.com/miranda-ng/miranda-ng, you need module menu_utils.cpp inside mir_app, InsertMenuItemWithSeparators or BuildRecursiveMenu functions. WMBR, George Hazan. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=54906 jacobbrett+winehqbugs(a)jacobbrett.id.au changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jacobbrett+winehqbugs(a)jacob | |brett.id.au -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=54906 George Hazan <george.hazan(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|8.7 |9.13 --- Comment #1 from George Hazan <george.hazan(a)gmail.com> --- Bug still exists on Wine 9.13 / Kubuntu 24.04. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=54906 Fabian Maurer <dark.shadow4(a)web.de> changed: What |Removed |Added ---------------------------------------------------------------------------- URL| |https://miranda-ng.org/down | |loads/ CC| |dark.shadow4(a)web.de Keywords| |download, regression, | |source --- Comment #2 from Fabian Maurer <dark.shadow4(a)web.de> --- Can you do a git bisect to find the faulty commit? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=54906 --- Comment #3 from George Hazan <george.hazan(a)gmail.com> --- Well, imho I've found the root of problems. In Miranda's console output there're a lot of lines like
011c:fixme:uxtheme:BeginBufferedPaint painting parameters are ignored
And inside Miranda the ICO file is converted into HBITMAP inside the following code: HBITMAP ConvertIconToBitmap(HIMAGELIST hIml, int iconId) { if (!beginBufferedPaint) { HMODULE hThemeAPI = GetModuleHandleA("uxtheme.dll"); beginBufferedPaint = (pfnBeginBufferedPaint)GetProcAddress(hThemeAPI, "BeginBufferedPaint"); endBufferedPaint = (pfnEndBufferedPaint)GetProcAddress(hThemeAPI, "EndBufferedPaint"); } BITMAPINFO bmi = { 0 }; bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biCompression = BI_RGB; bmi.bmiHeader.biBitCount = 32; bmi.bmiHeader.biWidth = g_iIconSX; bmi.bmiHeader.biHeight = g_iIconSY; HDC hdc = CreateCompatibleDC(nullptr); HBITMAP hbmp = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, nullptr, nullptr, 0); HBITMAP hbmpOld = (HBITMAP)SelectObject(hdc, hbmp); BLENDFUNCTION bfAlpha = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; BP_PAINTPARAMS paintParams = { 0 }; paintParams.cbSize = sizeof(paintParams); paintParams.dwFlags = BPPF_ERASE; paintParams.pBlendFunction = &bfAlpha; HDC hdcBuffer; RECT rcIcon = { 0, 0, g_iIconSX, g_iIconSY }; HANDLE hPaintBuffer = beginBufferedPaint(hdc, &rcIcon, BPBF_DIB, &paintParams, &hdcBuffer); if (hPaintBuffer) { ImageList_Draw(hIml, iconId, hdc, 0, 0, ILD_TRANSPARENT); endBufferedPaint(hPaintBuffer, TRUE); } SelectObject(hdc, hbmpOld); DeleteDC(hdc); return hbmp; } This function generates a black bitmap under Wine. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=54906 --- Comment #4 from George Hazan <george.hazan(a)gmail.com> --- And if I lock the interface to win2003, this code isn't executed, because the BeginBufferedPaint() call requires Vista+ compatibility level. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=54906 Jactry Zeng <jactry92(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|regression | Status|UNCONFIRMED |NEW URL|https://miranda-ng.org/down |https://web.archive.org/web |loads/ |/20240714004506if_/https:// | |www.miranda-ng.org/distr/mi | |randa-ng-alpha-latest.exe Ever confirmed|0 |1 --- Comment #5 from Jactry Zeng <jactry92(a)gmail.com> --- Well, this isn't a regression actually. I can reproduce the issue with Wine 7.0 with the Light theme enabled. Light theme was enabled by default for more recent versions of Wine, this made the issue easier to notice. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=54906 Jactry Zeng <jactry92(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Menu items with icons are |Miranda NG: menu items with |drawn with black squares if |icons are drawn with black |Wine is running in Vista+ |squares while Light theme |mode |is enabled. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=54906 KRosUser <kyle.kcsoftwares(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle.kcsoftwares(a)gmail.com --- Comment #6 from KRosUser <kyle.kcsoftwares(a)gmail.com> --- Same problem with miranda-im v0.10.21 wine Wine 10.16 https://web.archive.org/web/20140327190905if_/http://files.miranda-im.org/st... See screenshot -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=54906 --- Comment #7 from KRosUser <kyle.kcsoftwares(a)gmail.com> --- Created attachment 79425 --> http://bugs.winehq.org/attachment.cgi?id=79425 Miranda wine 10.16 black squares -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla