https://bugs.winehq.org/show_bug.cgi?id=49487
Bug ID: 49487 Summary: list control custom draw in report view shows blank item if handler clears uItemState CDIS_SELECTED flag Product: Wine Version: 5.0.1 Hardware: x86 OS: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: victimofleisure@yahoo.com
I'm the developer of a free software application called Polymeter. The issue occurs when running Polymeter under Mac OS / High Sierra. I have reproduced it on multiple machines. I install my software using WineBottler (both 1.8.6 and 4.0.1 exhibited the issue). WineBottler uses WineHQ 5.0 according to their page.
The issue is per-item background color for *selected* list control items in report view. The usual method for achieving per-item color is to request item notifications, and when the prepaint notification is received, set the per-item background color (pLVCD->clrTextBk). However by default this only works for non-selected items: selected items continue to use the system default background color (typically a dark blue) instead of the per-item color. The workaround is for the custom draw handler to also clear the "selected" flag (CDIS_SELECTED) in the item state (pLVCD->uItemState). This technique is fairly common and can be observed in the wild, e.g. here.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/40234af5-a9e7-433f-a3...
However in my application under WineBottler, this technique causes the list item in question to be completely white, both text and background.
I enclose a code snippet below. This may be related to 39721 or even a duplicate of it, but it's hard to tell because that report is not as specific and doesn't mention selected items. If list control per-item background color is broken in all cases regardless of selection, that would explain my issue obviously, but that seems doubtful since many Windows programs use list control custom draw.
Best wishes, Chris Korda https://victimofleisure.github.io/Polymeter/
void CMappingBar::OnListCustomDraw(NMHDR* pNMHDR, LRESULT* pResult) { NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR); *pResult = CDRF_DODEFAULT; if (theApp.m_bIsMidiLearn) { // if learning MIDI input switch (pLVCD->nmcd.dwDrawStage) { case CDDS_PREPAINT: *pResult = CDRF_NOTIFYITEMDRAW; break; case CDDS_ITEMPREPAINT: // this will NOT work with LVS_SHOWSELALWAYS; see uItemState in NMCUSTOMDRAW doc if (pLVCD->nmcd.uItemState & CDIS_SELECTED) { // if item selected pLVCD->clrTextBk = MIDI_LEARN_COLOR; // customize item background color // trick system into using our custom color instead of selection color pLVCD->nmcd.uItemState &= ~CDIS_SELECTED; // clear item's selected flag } break; } } }
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- Hi, Chris.
Thank you for detailed report. Could you describe how to reproduce this issue in your application? We seem to have some logic in prepaint_setup() that overrides colors for CDIS_SELECTED, but I'd like to see a test scenario with your application to see how it breaks.
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #2 from RCK victimofleisure@yahoo.com --- Created attachment 67604 --> https://bugs.winehq.org/attachment.cgi?id=67604 Demo app
This is the simplest app I can make that demonstrates the issue. It's a stock Visual Studio 2012 dialog app with very minor modifications. The dialog has only a virtual (owner data) list control. The list control uses the custom draw technique described in the bug report to display *selected* list items in bright red. Under Wine (if the bug is reproducible) the selected list items will display incorrectly or more likely not display at all.
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #3 from RCK victimofleisure@yahoo.com --- (In reply to Nikolay Sivov from comment #1)
Hi, Chris.
Thank you for detailed report. Could you describe how to reproduce this issue in your application? We seem to have some logic in prepaint_setup() that overrides colors for CDIS_SELECTED, but I'd like to see a test scenario with your application to see how it breaks.
Hi. I attached a demo app to my original report. The zip file includes 32-bit and 64-bit static build executables as well as all sources. It's a stock Visual Studio 2012 dialog app with very minor modifications. The dialog has only a virtual (owner data) list control. The list control uses the custom draw technique described in the bug report to display *selected* list items in bright red. Under Wine (if the bug is reproducible), the selected list items will display incorrectly or more likely will not display at all.
https://bugs.winehq.org/attachment.cgi?id=67604
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #4 from RCK victimofleisure@yahoo.com --- I should have mentioned that my case involves a virtual (owner-data) list control. I haven't explored whether the issue would also appear with a non-virtual list control. Apologies for the omission. Best wishes, Chris
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #5 from Nikolay Sivov bunglehead@gmail.com --- Created attachment 67605 --> https://bugs.winehq.org/attachment.cgi?id=67605 diff
Ok, thanks. Color gets replaced back to default one in subitems loop. Attach diff disables that. It will need more testing and examination of all possible paths.
https://bugs.winehq.org/show_bug.cgi?id=49487
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Component|-unknown |comctl32
--- Comment #6 from Nikolay Sivov bunglehead@gmail.com --- Confirming.
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #7 from RCK victimofleisure@yahoo.com --- Created attachment 67606 --> https://bugs.winehq.org/attachment.cgi?id=67606 Image of desired output
This is a screen shot of the demo app running under Windows 7. The selected item is bright red, rather than the default selection color (typical dark blue).
https://bugs.winehq.org/show_bug.cgi?id=49487
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |c32720349cd4a6f4c32fdcff6a4 | |cce054fbfe33e Status|NEW |RESOLVED
--- Comment #8 from Nikolay Sivov bunglehead@gmail.com --- This is fixed now, c32720349cd4a6f4c32fdcff6a4cce054fbfe33e. Please retest.
https://bugs.winehq.org/show_bug.cgi?id=49487
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|list control custom draw in |ListView control custom |report view shows blank |draw in report view shows |item if handler clears |blank item if handler |uItemState CDIS_SELECTED |clears uItemState |flag |CDIS_SELECTED flag
https://bugs.winehq.org/show_bug.cgi?id=49487
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 5.14.
https://bugs.winehq.org/show_bug.cgi?id=49487
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |5.0.x
https://bugs.winehq.org/show_bug.cgi?id=49487
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|5.0.x |---
--- Comment #10 from Michael Stefaniuc mstefani@winehq.org --- Removing the 5.0.x milestone from bug fixes included in 5.0.3.
https://bugs.winehq.org/show_bug.cgi?id=49487
RCK victimofleisure@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|FIXED |--- Status|CLOSED |REOPENED
--- Comment #11 from RCK victimofleisure@yahoo.com --- Hi. I am sorry to report that this bug was not fixed. Nikolay Sivov's 2020-07-22 revision c32720349cd4a6f4c32fdcff6a4cce054fbfe33e has no effect on this bug. The simple test program I provided in comment 2 still fails.
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #12 from Nikolay Sivov bunglehead@gmail.com --- I just checked and it works fine for me on wine 7.1 - I get red background for selected item. What is your full wine version as "wine --version" reports?
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #13 from RCK victimofleisure@yahoo.com --- Thanks for your reply. I’ll look into that. It might take me a few days to get an answer. It looks like the fix was released in 5.x, so it should definitely be present in 6.x too yes?
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #14 from Nikolay Sivov bunglehead@gmail.com --- Sure, it should work in 6.x as well. I'm curious though, how did you come to conclusion that this commit has no effect in a first place?
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #15 from RCK victimofleisure@yahoo.com --- Mac users reported the issue. To rule out version trouble, I need to borrow a Mac. Hopefully I’ll manage that this weekend.
https://bugs.winehq.org/show_bug.cgi?id=49487
--- Comment #16 from RCK victimofleisure@yahoo.com --- I withdraw my objection, and confirm that bug 49487 is definitely fixed in Wine 5.22 (the highest Wine version I can test). Apologies for the false alarm.
https://bugs.winehq.org/show_bug.cgi?id=49487
RCK victimofleisure@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |FIXED
--- Comment #17 from RCK victimofleisure@yahoo.com --- I withdraw my objection, and confirm that bug 49487 is definitely fixed in Wine 5.22 (the highest Wine version I can test). Apologies for the false alarm.
https://bugs.winehq.org/show_bug.cgi?id=49487
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #18 from Nikolay Sivov bunglehead@gmail.com --- Thanks, closing again.