https://bugs.winehq.org/show_bug.cgi?id=38124
Bug ID: 38124 Summary: Can't enable visual style in a DLL. Product: Wine Version: 1.7.37 Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: jactry92@gmail.com Distribution: ---
Created attachment 50815 --> https://bugs.winehq.org/attachment.cgi?id=50815 testcase
Hi all,
I tired to enable visual style[1] for dialog in shell32.dll and comdlg32.dll. Normally, a dialog will be themed by visual style when comctl32.dll v6 and InitCommonControls() was used. I implemented a dialog in a dll, and used 'Activation Contexts'[2] to let the dll depend on comctl32.dll and call InitCommonControls(), but when the dialog was called by another program, the dialog didn't be themed.
testcase.tar.gz is testcase I wrote for reproducing this bug. You can reproduce the bug follow: 1. Install and enable a visual style theme in winecfg; 2. Download the testcase, unarchive it and make; 3. $ wine main.exe, click the 'OK' button. You can see button in the main windows was themed but two buttons in the dialog was not themed. (as picture testcase_wine.png showing)
Expected result: The dialog also is themed, as picture testcase_windows.png showing.
[1] https://msdn.microsoft.com/en-us/library/windows/desktop/bb773187(v=vs.85).a... [2] https://msdn.microsoft.com/en-us/library/aa374153(v=vs.85).aspx
https://bugs.winehq.org/show_bug.cgi?id=38124
--- Comment #1 from Jactry Zeng jactry92@gmail.com --- Created attachment 50816 --> https://bugs.winehq.org/attachment.cgi?id=50816 testcase on Wine
https://bugs.winehq.org/show_bug.cgi?id=38124
--- Comment #2 from Jactry Zeng jactry92@gmail.com --- Created attachment 50817 --> https://bugs.winehq.org/attachment.cgi?id=50817 testcase on Windows
https://bugs.winehq.org/show_bug.cgi?id=38124
Jactry Zeng jactry92@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fracting@gmail.com, | |litimetal@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=38124
Jactry Zeng jactry92@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source, testcase
https://bugs.winehq.org/show_bug.cgi?id=38124
--- Comment #3 from Nikolay Sivov bunglehead@gmail.com --- Short answer is no - Wine doesn't implement any of that properly. In your test case you statically link to dialog.dll, which means that by the time you call CreateWindow("BUTTON") you already have a context activated from dll's PROCESS_ATTACH. Wine's own comctl32 doesn't care at all about active context, it's simply never used, and theme is enabled as soon as you enable it globally with winecfg. So it's not easy to compare this to what Windows does, because it's already different in more than one aspect:
- we have only one comctl32 that tries to implement everything, instead of having 2 (at least), with one in system32 and the rest in WinSxS; - user32 controls are subclasses in comctl32, and I believe that's not what Windows does; - classes made available with context are not picked up by user32, it's simply not aware of that fact.
What happens on Windows if you don't call load_v6_module() at all? I'd expected both dialogs to be not themed.
https://bugs.winehq.org/show_bug.cgi?id=38124
--- Comment #4 from Nikolay Sivov bunglehead@gmail.com --- Personally I'm more interested in activation context behavior regarding dll loading, newly created threads, SendMessage() behavior etc. So if you find any of that being broken feel free to CC me on a new report.
https://bugs.winehq.org/show_bug.cgi?id=38124
--- Comment #5 from Jactry Zeng jactry92@gmail.com --- Hi Nikolay, (In reply to Nikolay Sivov from comment #3)
Short answer is no - Wine doesn't implement any of that properly. In your test case you statically link to dialog.dll, which means that by the time you call CreateWindow("BUTTON") you already have a context activated from dll's PROCESS_ATTACH. Wine's own comctl32 doesn't care at all about active context, it's simply never used, and theme is enabled as soon as you enable it globally with winecfg. So it's not easy to compare this to what Windows does, because it's already different in more than one aspect:
- we have only one comctl32 that tries to implement everything, instead of having 2 (at least), with one in system32 and the rest in WinSxS;
- user32 controls are subclasses in comctl32, and I believe that's not what Windows does;
- classes made available with context are not picked up by user32, it's
simply not aware of that fact.
Thanks for your comment!
What happens on Windows if you don't call load_v6_module() at all? I'd expected both dialogs to be not themed.
You are right.
And I have some other tests about it here: https://gitcafe.com/Jactry/winetests In these tests, I used '#define ISOLATION_AWARE_ENABLED 1' instead of 'Activation Context API'. (There are some others bugs when compile dialog.dll with mingw, so I compile it with MSVC).
All_with_theming: Enable visual style in both main.exe and dialog.dll All_without_theming: Didn't enable visual style in both main.exe and dialog.dll Main_program_with_theming_dialog_without_theming: Visual style was enabled in main.exe but didn't enable in dialog.dll Main_program_without_theming_dialog_with_theming: Visual style was enabled in dialog.dll but didn't enable in main.exe
1.png in every folder is what it looks like in windows. In https://gitcafe.com/Jactry/winetests/blob/master/Main_program_without_themin... we can find the main windows didn't be themed, but the dialog was themed. It is so different to the testcase using 'Activation Context API'.
Do you know the different between ISOLATION_AWARE_ENABLED and 'Activation Context API'? Thanks again!
https://bugs.winehq.org/show_bug.cgi?id=38124
--- Comment #6 from Jactry Zeng jactry92@gmail.com --- In https://gitcafe.com/Jactry/winetests/tree/master/All_with_theming, visual style was enable in both main.exe and dialog.dll. But on Wine, the dialog still didn't be themed. So far, I still don't understand why comctl32.dll was used and InitCommonControls() was called in dialog.dll, but control in the dialog still didn't be themed. Did the dialog still used control in user32 but not control in comctl32 because of bug?
btw, do you have any idea to enable visual style for comdlg32.dll and shell32.dll on Wine?
Thank you!
https://bugs.winehq.org/show_bug.cgi?id=38124
--- Comment #7 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Jactry Zeng from comment #5)
Do you know the different between ISOLATION_AWARE_ENABLED and 'Activation Context API'?
ISOLATION_AWARE_ENABLED replaces lots of different API calls with wrappers that activate/deactivate context for you around this call. It's done with inline wrappers at header level, Wine doesn't provide those, don't know about mingw. Which means this define has no effect.
https://bugs.winehq.org/show_bug.cgi?id=38124
--- Comment #8 from Qian Hong fracting@gmail.com --- Mark Harmstone has sent a patch for this bug: http://source.winehq.org/patches/data/110362
https://bugs.winehq.org/show_bug.cgi?id=38124
Alex Henrie alexhenrie24@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alexhenrie24@gmail.com Keywords| |patch
https://bugs.winehq.org/show_bug.cgi?id=38124
--- Comment #9 from Nikolay Sivov bunglehead@gmail.com --- Jactry, is this still a problem with current Wine?
https://bugs.winehq.org/show_bug.cgi?id=38124
--- Comment #10 from Jactry Zeng jactry92@gmail.com --- (In reply to Nikolay Sivov from comment #9)
Jactry, is this still a problem with current Wine?
Yes, this was fixed. Tested with current Wine wine-3.19. Is 9b9f97e3f668c9d291b4f9fa2944ddb11509970f the commit fixed it?
Thanks.
https://bugs.winehq.org/show_bug.cgi?id=38124
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Component|-unknown |user32 Status|NEW |RESOLVED Fixed by SHA1| |9b9f97e3f668c9d291b4f9fa294 | |4ddb11509970f
--- Comment #11 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Jactry Zeng from comment #10)
(In reply to Nikolay Sivov from comment #9)
Jactry, is this still a problem with current Wine?
Yes, this was fixed. Tested with current Wine wine-3.19. Is 9b9f97e3f668c9d291b4f9fa2944ddb11509970f the commit fixed it?
Thanks.
It was more than this one of course, but let's use that.
https://bugs.winehq.org/show_bug.cgi?id=38124
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #12 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.21.