Missing WM_CAPTURECHANGED message
cthielen at gmail.com
Thu Nov 19 22:14:03 CST 2015
Thanks again Ken. WINEPREFIX and a window manager switch helped get the
existing tests passing.
My patch doesn't break any existing tests in user32 but I'm having
trouble writing my own test.
The crux of the bug fix is that calling SetCapture() twice in a row
passing your own HWND both times should result in a WM_CAPTURECHANGED
message in which the lParam == your HWND. Below is my attempt at writing
a test for that but the test never receives the WM_CAPTURECHANGED message.
My own Win32 example code (a regular program, not a test) demonstrates
this behavior as posted at the original bug report:
https://bugs.winehq.org/show_bug.cgi?id=13683 (see the latest attachment).
My guess is there's some difference between the regular win proc handler
I'm used to writing and the internal wait_for_message() debug function.
static void test_SetCapture(void)
HANDLE hInstance = GetModuleHandleA( NULL );
wclass.lpszClassName = "capture";
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = WndProc;
wclass.hInstance = hInstance;
wclass.hIcon = LoadIconA( 0, (LPCSTR)IDI_APPLICATION );
wclass.hCursor = LoadCursorA( NULL, (LPCSTR)IDC_ARROW );
wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
wclass.cbWndExtra = 0;
RegisterClassA( &wclass );
capture_win = CreateWindowA("capture", "capture", WS_VISIBLE |
100, 100, 100, 100, 0, NULL, NULL, NULL);
ok(capture_win != 0, "CreateWindow failed\n");
/* flush pending messages */
while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA(
/* simple SetCapture() twice test */
got_capture_changed = FALSE;
if (msg.message == WM_CAPTURECHANGED)
// do additional checking here to ensure lParam == capture_win
got_capture_changed = TRUE;
ok(got_capture_changed, "expected WM_CAPTURECHANGED message\n");
On 11/18/2015 11:00 PM, Ken Thomases wrote:
> On Nov 18, 2015, at 8:59 PM, Christopher Thielen <cthielen at gmail.com> wrote:
>> Thanks Ken. I do have a test in mind that I'll submit with my patch but first ... do all the tests in dlls/user32/tests/ pass normally?
> Well, not for everybody. ;) It can be sensitive to things like desktop environment, window manager, and even graphics driver.
> However, it seems that the user32:win tests generally pass pretty widely on Linux: https://test.winehq.org/data/7f6634b2bd916b530e30ef8a850fefbc0dbdf687/index_Linux.html#user32:win
> In your results, this:
>> win.c:5852: Test failed: got wrong window text 'Default - Wine desktop'
> makes me think you're running the tests in an unclean wineprefix. In particular, it seems it's set to use virtual desktop mode. Try setting WINEPREFIX to a fresh directory.
More information about the wine-devel