user32: Fix DefWindowProc(WM_NCRBUTTONDOWN) tests on Win 8 and 10.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2016-09-14 12:19:47 +02:00 committed by Alexandre Julliard
parent ec6a17fa9c
commit 80a222a8cd
1 changed files with 36 additions and 1 deletions

View File

@ -13909,6 +13909,25 @@ static const struct message NCRBUTTONDOWNSeq[] =
{ 0 }
};
struct rbuttonup_thread_data
{
HWND hwnd;
HANDLE wndproc_finished;
};
static DWORD CALLBACK post_rbuttonup_msg( void *arg )
{
struct rbuttonup_thread_data *data = arg;
DWORD ret;
ret = WaitForSingleObject( data->wndproc_finished, 500 );
todo_wine ok( ret == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", ret );
if( ret == WAIT_OBJECT_0 ) return 0;
PostMessageA( data->hwnd, WM_RBUTTONUP, 0, 0 );
return 0;
}
static void test_defwinproc(void)
{
HWND hwnd;
@ -13918,6 +13937,8 @@ static void test_defwinproc(void)
RECT rect;
INT x, y;
LRESULT res;
struct rbuttonup_thread_data data;
HANDLE thread;
hwnd = CreateWindowExA(0, "TestWindowClass", "test_defwndproc",
WS_VISIBLE | WS_CAPTION | WS_OVERLAPPEDWINDOW, 0,0,500,100,0,0,0, NULL);
@ -13933,11 +13954,25 @@ static void test_defwinproc(void)
res = DefWindowProcA( hwnd, WM_NCHITTEST, 0, MAKELPARAM(x, y));
ok(res == HTCAPTION, "WM_NCHITTEST returned %ld\n", res);
mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
flush_events();
flush_sequence();
PostMessageA( hwnd, WM_RBUTTONUP, 0, 0);
mouse_event( MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0 );
/* workaround for missing support for clicking on window frame */
data.hwnd = hwnd;
data.wndproc_finished = CreateEventA( NULL, FALSE, FALSE, NULL );
thread = CreateThread( NULL, 0, post_rbuttonup_msg, (void*)&data, 0, NULL );
DefWindowProcA( hwnd, WM_NCRBUTTONDOWN, HTCAPTION, MAKELPARAM(x, y));
ok_sequence(NCRBUTTONDOWNSeq, "WM_NCRBUTTONDOWN on caption", FALSE);
SetEvent( data.wndproc_finished );
WaitForSingleObject( thread, 1000 );
CloseHandle( data.wndproc_finished );
CloseHandle( thread );
SetCursorPos(pos.x, pos.y);
DefWindowProcA( hwnd, WM_ENDSESSION, 1, 0);