http://bugs.winehq.org/show_bug.cgi?id=24464
Summary: UpdateLayeredWindow() generates WM_SIZE when it should not, and other non-matching behavior Product: Wine Version: 1.1.44 Platform: All OS/Version: All Status: UNCONFIRMED Severity: normal Priority: P2 Component: user32 AssignedTo: wine-bugs@winehq.org ReportedBy: ivucica@gmail.com
Created an attachment (id=30866) --> (http://bugs.winehq.org/attachment.cgi?id=30866) test case
Below are pasted the notes from the attached source code, for easier reference. The most important bug is #4, erroneous generation of WM_SIZE when they should not be generated. I did not feel like creating several bug reports, feel free to split if necessary.
Attached is the test case demonstrating the issues. To compile test case using MinGW, use following makefile: CC=i386-mingw32msvc-gcc all: $(CC) -o updatelayeredwindow_demo.exe -lole32 -lcomdlg32 -luser32 -lwinmm main.c -lgdi32
Please compare behavior between XP and Wine. You can make the window reduce its size by left clicking. Then observe the log. You can notice that on XP, WM_SIZE is not generated. On Wine, it is continuously generated. Bugs #1-#3 can also be tested easily by modifying the source code as described and comparing output.
I presume the bug happens everywhere, although it was tested only on OS X.
At least one application development framework, Cocotron, depends on correct behavior for WM_SIZE. Cocotron reimplements OS X's Cocoa API to create source level compatibility. Wine is the easiest way to test the Cocotron executables, since Cocotron compiles on OS X to produce Windows binaries. Otherwise, one needs to have a machine (either real or virtual) that runs Windows in order to test software.
However, this bug blocks testing of any application that uses "sheets", since sheets are animated using UpdateLayeredWindow(). Sheets are captionless modal dialogs that appear on their owner window, and as their parent moves, they move as well. They are quite ubiquitous on Mac OS X and in Cocoa.
Description of Cocotron internals and cause for this bug: Animations use class instance's _size member, which is updated when WM_SIZE is sent. This member should not ordinarily be updated during execution of animation function, but it gets updated because WM_SIZE is sent.
// TESTED ON WINDOWS XP with wine-1.1.44
// bug #1: If we pass 0 as first argument to CreateWindowEx(), Windows ignore // UpdateLayeredWindow(). Wine does not. // bug #2: If we pass WS_EX_LAYERED as first argument to CreateWindowEx(), Windows does not // display the window except in taskbar. Wine displays it, and even dispatches // WM_LBUTTONDOWN. Function should also fail, with GetLastError() returning 0. // #2a: Additionally, same thing happens if we do not pass a DC as fifth argument to // UpdateLayeredWindow().
// bug #3: In WM_LBUTTONDOWN, there is the following call. // UpdateLayeredWindow(hWnd, GetDC(hWnd), &ptSrc, &sizeWnd, memDC, &origin, RGB(0xFF,0xFF,0xFF), &blend, ULW_OPAQUE); // if we pass NULL instead of memDC, Windows do not resize the window. Wine happily resizes it // Additionally function should fail.
*********************************************************************** ***********************************************************************
// MOST IMPORTANT: // bug #4: If UpdateLayeredWindow() resizes the window, Windows do not generate WM_SIZE. // Wine does generate WM_SIZE. // This causes a bug in every application displaying "sheets" that is // developed using Cocotron (http://cocotron.org/). "Sheets" in Mac OS X are // per-window modal popups attached to top of the window.