http://bugs.winehq.org/show_bug.cgi?id=28678
Bug #: 28678 Summary: DirectDraw primary buffer is obscured by transparent window Product: Wine Version: unspecified Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-ddraw AssignedTo: wine-bugs@winehq.org ReportedBy: octavian.voicu@gmail.com Classification: Unclassified
Created attachment 36852 --> http://bugs.winehq.org/attachment.cgi?id=36852 Screenshot showing the obscured dialog.
When trying to exit from the game The Longest Journey (either via menu option or pressing Alt+F4), a dialog box is shown with Yes/No options.
The application uses DirectDraw for rendering. The dialog box and mouse cursor are rendered on an offscreen surface (dialog has an image as the background and buttons use a custom implementation afaics), which is then blitted to the primary buffer (happens like this when you force single buffer mode; with double buffering it could be slightly different, but the overall effect is the same).
The dialog is a parent of the main application window, uses the standard dialog window class (atom #32270 or 8000 in hex) and has the WS_POPUP and WS_EX_TRANSPARENT window styles. Window receives a WM_ERASEBKGND message, which is handled by the default dialog proc by painting the background in the standard window background color (gray in this case).
When primary buffer is blitted to the d3d surface (ddraw_surface_update_frontbuffer which uses OpenGL), the rendering of the dialog is masked by the window boundaries and the gray rectangle remains. Dialog is interactable and you can click the buttons (if you can do that without seeing where the mouse is).
The question is: how can we make the primary buffer draw over WS_EX_TRANSPARENT child windows, as it works on native? Removing the WS_EX_TRANSPARENT style from the dialog window (on runtime, using WinSpy++ 1.7) makes native's behavior identical to current wine behavior (only a gray rectangle is visible).
http://bugs.winehq.org/show_bug.cgi?id=28678
Octavian Voicu octavian.voicu@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download URL| |http://games.softpedia.com/ | |get/Games-Demo/The-Longest- | |Journey-161-Demo.shtml
http://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #1 from Dmitry Timoshkov dmitry@baikal.ru 2011-10-12 11:38:11 CDT --- Please always specify Wine version you are using in the Version field above.
http://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #2 from Henri Verbeet hverbeet@gmail.com 2011-10-12 11:40:27 CDT --- I suspect this isn't all that specific to ddraw/wined3d. Does this work with a plain OpenGL application, or even normal windows?
http://bugs.winehq.org/show_bug.cgi?id=28678
Octavian Voicu octavian.voicu@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |1.3.30
--- Comment #3 from Octavian Voicu octavian.voicu@gmail.com 2011-10-12 11:46:17 CDT --- Tested with wine 1.3.30.
(In reply to comment #2)
I suspect this isn't all that specific to ddraw/wined3d. Does this work with a plain OpenGL application, or even normal windows?
Haven't tested that, I'm going to try to write a small app to test this. I don't really understand how it actually happens that the rectangle is obscured though. Is it based on Z-ordering of windows and ddraw->wined3d_frontbuffer has an attached Z-buffer?
Octavian
http://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #4 from Henri Verbeet hverbeet@gmail.com 2011-10-12 12:04:04 CDT --- (In reply to comment #3)
Haven't tested that, I'm going to try to write a small app to test this. I don't really understand how it actually happens that the rectangle is obscured though. Is it based on Z-ordering of windows and ddraw->wined3d_frontbuffer has an attached Z-buffer?
We don't do anything special about this in ddraw/wined3d. From your description it sounds like the gray rectangle you're seeing is the dialog painting its background while it shouldn't (because of WS_EX_TRANSPARENT).
http://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #5 from Octavian Voicu octavian.voicu@gmail.com 2011-10-12 12:46:31 CDT --- (In reply to comment #4)
(In reply to comment #3)
Haven't tested that, I'm going to try to write a small app to test this. I don't really understand how it actually happens that the rectangle is obscured though. Is it based on Z-ordering of windows and ddraw->wined3d_frontbuffer has an attached Z-buffer?
We don't do anything special about this in ddraw/wined3d. From your description it sounds like the gray rectangle you're seeing is the dialog painting its background while it shouldn't (because of WS_EX_TRANSPARENT).
I think WS_EX_TRANSPARENT says nothing about default handling of WM_ERASEBKGND in DefDlgProc. I checked using Spy++ and also on native, even with WS_EX_TRANSPARENT set, dialog paints its background using a solid brush.
Sequence of messages is (M - main window, D - dialog/child window): D: WM_NCPAINT D: WM_ERASEBKGND -> returns fErased: True M: WM_NCPAINT M: WM_ERASEBKGND -> returns fErased: False M: WM_PAINT D: WM_PAINT D: WM_PAINT D: WM_PAINT ...
Even if the dialog paints its background, I'm guessing its WM_PAINT handler renders the window to the front buffer, and that it should be able to draw over WS_EX_TRANSPARENT windows. Removing the WS_EX_TRANSPARENT style makes the main window not receive the WM_PAINT message after WM_ERASEBKGND.
The weird thing is that if I hack wine and change the DefDlgProc code to not erase the background on WM_ERASEBKGND, then I won't see anything at all! Then I hacked IDirectDraw::Blt function to offset all destination rects 10 pixels up and right, and after this I see 10x10 of the window. So it is obvious that whatever happens inside wined3d, it is somehow masking the area occupied by the dialog window.
Doing a WINEDDBLT_COLORFILL on the front buffer is the only thing that can draw over the window (a simple blit is still masked by it).
http://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #6 from Octavian Voicu octavian.voicu@gmail.com 2011-10-12 14:47:20 CDT --- Created attachment 36862 --> http://bugs.winehq.org/attachment.cgi?id=36862 Testcase showing problem with WS_EX_TRANSPARENT.
Testcase has a main window (with a red background) with two child WS_POPUP windows (with default background). The one on the right has WS_EX_TRANSPARENT extended style.
On native, only one gray rectangle on the left is visible (the background of the left window). On wine, both gray rectangles are visible.
http://bugs.winehq.org/show_bug.cgi?id=28678
Octavian Voicu octavian.voicu@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |testcase Component|directx-ddraw |user32
--- Comment #7 from Octavian Voicu octavian.voicu@gmail.com 2011-10-12 14:49:38 CDT --- It looks like the problem is somewhere in user32, definitely not ddraw or opengl specific.
http://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #8 from Octavian Voicu octavian.voicu@gmail.com 2011-10-30 18:09:34 CDT --- Created attachment 37213 --> http://bugs.winehq.org/attachment.cgi?id=37213 Patch that fixes both the game and testcase.
This looks a bit hacky, but it does fix the problem. With this patch applied, game correctly shows the exit dialog. Also, Wine has a behavior similar to native for the testcase.
Unless there is a way to make X11 windows transparent and allow drawing over them (which I couldn't find), I don't see any other way to fix this.
http://bugs.winehq.org/show_bug.cgi?id=28678
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |adys.wh@gmail.com
--- Comment #9 from Jerome Leclanche adys.wh@gmail.com 2011-10-30 18:50:43 CDT --- Patch sent
http://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #10 from Jerome Leclanche adys.wh@gmail.com 2011-10-30 18:52:09 CDT --- (disregard that)
http://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #11 from Octavian Voicu octavian.voicu@gmail.com 2011-10-30 18:56:26 CDT --- See discussion I started on wine-devel. Patch is actually a really ugly and rough hack which makes WS_EX_TRANSPARENT windows completely invisible, but at least it highlights where the problem is.
http://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #12 from Octavian Voicu octavian.voicu@gmail.com 2011-10-30 19:20:07 CDT --- Created attachment 37214 --> http://bugs.winehq.org/attachment.cgi?id=37214 More complex test case.
This test case enables window decorations for the two windows and also draws something on them. Seems that window decorations are not visible for WS_EX_TRANSPARENT windows on native.
http://bugs.winehq.org/show_bug.cgi?id=28678
Octavian Voicu octavian.voicu@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #36862|0 |1 is obsolete| |
http://bugs.winehq.org/show_bug.cgi?id=28678
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|patch | Component|user32 |-unknown
http://bugs.winehq.org/show_bug.cgi?id=28678
GyB gyebro69@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alessandro_pezzoni@lavabit. | |com
--- Comment #13 from GyB gyebro69@gmail.com 2012-03-10 14:07:54 CST --- *** Bug 30133 has been marked as a duplicate of this bug. ***
http://bugs.winehq.org/show_bug.cgi?id=28678
Vitaliy Margolen vitaliy-bugzilla@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #14 from Vitaliy Margolen vitaliy-bugzilla@kievinfo.com 2012-03-11 11:18:45 CDT --- Confirming - multiple reports/bugs.
http://bugs.winehq.org/show_bug.cgi?id=28678
Gaurav Jain gaurav@gauravjain.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gaurav@gauravjain.org
http://bugs.winehq.org/show_bug.cgi?id=28678
sacrediou sacrediou@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sacrediou@yahoo.fr
http://bugs.winehq.org/show_bug.cgi?id=28678
karl@huftis.org karl@huftis.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |karl@huftis.org
https://bugs.winehq.org/show_bug.cgi?id=28678
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #15 from joaopa jeremielapuree@yahoo.fr --- Bug still there in current wine-1.7.23
https://bugs.winehq.org/show_bug.cgi?id=28678
Martin Fontaigne martinrs@softhome.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |martinrs@softhome.net
--- Comment #16 from Martin Fontaigne martinrs@softhome.net --- According to a thread in forums.longestjourney.com a similar problem is in Windows 8, so it may not be a wine bug at all.
It mentions that a simple 'Y' or 'N' key would suffice to confirm the dialog, and possibly run the game in windowed mode by editing preferences.ini may also work.
https://bugs.winehq.org/show_bug.cgi?id=28678
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
--- Comment #17 from winetest@luukku.com --- Still valid wine 2.0rc6.
https://bugs.winehq.org/show_bug.cgi?id=28678
Ralph Little littlesincanada@yahoo.co.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |littlesincanada@yahoo.co.uk
--- Comment #18 from Ralph Little littlesincanada@yahoo.co.uk --- Still valid bug in 2.14 staging.
https://bugs.winehq.org/show_bug.cgi?id=28678
Jeff D. Hanson jhansonxi@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jhansonxi@gmail.com
--- Comment #19 from Jeff D. Hanson jhansonxi@gmail.com --- Still occurring with Wine 3.16 on Xbuntu 16.04.5 x86_64. Reproduced with demo 161 and full version (GOG.com) build 142. Demo still available from URL above.
MD5: 6d7f91e0a19513e859775862b2ac43d8 thelongestjourneydemo_english.exe
https://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #20 from joaopa jeremielapuree@yahoo.fr --- Created attachment 63494 --> https://bugs.winehq.org/attachment.cgi?id=63494 compileed test case
You can check with the demo that the bug occurs also in a real windows 10 box. I compiled the test case and it behave the same in a real windows 10 box and wine. So, what to do with such a bug report?
https://bugs.winehq.org/show_bug.cgi?id=28678
Bruni newdell338@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |newdell338@gmail.com
--- Comment #21 from Bruni newdell338@gmail.com --- Created attachment 64292 --> https://bugs.winehq.org/attachment.cgi?id=64292 The way the testcase looks on windows 7.
This is how the last compiled testcase looks on windows 7. Test1 and Test2 windows appear absolutely identical, with no regard for WS_EX_TRANSPARENT attribute.
Most likely, the test case is wrong.
https://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #22 from joaopa jeremielapuree@yahoo.fr --- Created attachment 64297 --> https://bugs.winehq.org/attachment.cgi?id=64297 Picture after clicking (real XP)
The two following pictures are taken in a real windows XP box. One can see the behaviour is different between Windows 10 (or windows 7) and Windows XP. What to do with such differences?
https://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #23 from joaopa jeremielapuree@yahoo.fr --- Created attachment 64298 --> https://bugs.winehq.org/attachment.cgi?id=64298 Picture before clicking (real XP)
https://bugs.winehq.org/show_bug.cgi?id=28678
--- Comment #24 from joaopa jeremielapuree@yahoo.fr --- Bug still occurs with wine-8.11