user32: Set WM_CONTEXTMENU's wparam to the child window's handle.
DefWindowProc() does not propagate the wparam; it updates it instead.
Spotted by YAL.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52327
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 3af8415ca9
)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
parent
3ce2336788
commit
149284628d
|
@ -311,7 +311,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case WM_CONTEXTMENU:
|
case WM_CONTEXTMENU:
|
||||||
if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD)
|
if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD)
|
||||||
SendMessageW( GetParent(hwnd), msg, wParam, lParam );
|
SendMessageW( GetParent(hwnd), msg, (WPARAM)hwnd, lParam );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LONG hitcode;
|
LONG hitcode;
|
||||||
|
|
|
@ -106,6 +106,7 @@ typedef struct
|
||||||
} MEASURE_ITEM_STRUCT;
|
} MEASURE_ITEM_STRUCT;
|
||||||
|
|
||||||
static BOOL test_DestroyWindow_flag;
|
static BOOL test_DestroyWindow_flag;
|
||||||
|
static BOOL test_context_menu;
|
||||||
static HWINEVENTHOOK hEvent_hook;
|
static HWINEVENTHOOK hEvent_hook;
|
||||||
static HHOOK hKBD_hook;
|
static HHOOK hKBD_hook;
|
||||||
static HHOOK hCBT_hook;
|
static HHOOK hCBT_hook;
|
||||||
|
@ -9787,7 +9788,7 @@ static LRESULT MsgCheckProc (BOOL unicode, HWND hwnd, UINT message,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message == WM_CONTEXTMENU)
|
if (!test_context_menu && message == WM_CONTEXTMENU)
|
||||||
{
|
{
|
||||||
/* don't create context menu */
|
/* don't create context menu */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -15765,6 +15766,13 @@ static const struct message WmRestoreActiveMinimizedOverlappedSeq[] =
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct message WmContextMenuSeq[] = {
|
||||||
|
{ WM_CONTEXTMENU, sent|wparam, 0 }, /* wparams set in the code */
|
||||||
|
{ WM_CONTEXTMENU, sent|wparam|defwinproc, 0 },
|
||||||
|
{ WM_CONTEXTMENU, sent|wparam|defwinproc, 0 },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
struct rbuttonup_thread_data
|
struct rbuttonup_thread_data
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
@ -15786,7 +15794,7 @@ static DWORD CALLBACK post_rbuttonup_msg( void *arg )
|
||||||
|
|
||||||
static void test_defwinproc(void)
|
static void test_defwinproc(void)
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd, child[3];
|
||||||
MSG msg;
|
MSG msg;
|
||||||
BOOL gotwmquit = FALSE;
|
BOOL gotwmquit = FALSE;
|
||||||
POINT pos;
|
POINT pos;
|
||||||
|
@ -15836,6 +15844,23 @@ static void test_defwinproc(void)
|
||||||
flush_events();
|
flush_events();
|
||||||
ok_sequence(WmRestoreActiveMinimizedOverlappedSeq, "DefWindowProcA(SC_RESTORE):active minimized overlapped", TRUE);
|
ok_sequence(WmRestoreActiveMinimizedOverlappedSeq, "DefWindowProcA(SC_RESTORE):active minimized overlapped", TRUE);
|
||||||
|
|
||||||
|
child[0] = CreateWindowExA(0, "TestWindowClass", "1st child",
|
||||||
|
WS_VISIBLE | WS_CHILD, 0,0,500,100, hwnd, 0, 0, NULL);
|
||||||
|
child[1] = CreateWindowExA(0, "TestWindowClass", "2nd child",
|
||||||
|
WS_VISIBLE | WS_CHILD, 0,0,500,100, child[0], 0, 0, NULL);
|
||||||
|
child[2] = CreateWindowExA(0, "TestWindowClass", "3rd child",
|
||||||
|
WS_VISIBLE | WS_CHILD, 0,0,500,100, child[1], 0, 0, NULL);
|
||||||
|
flush_events();
|
||||||
|
flush_sequence();
|
||||||
|
test_context_menu = TRUE;
|
||||||
|
DefWindowProcA(child[2], WM_CONTEXTMENU, 0xcafe, 0);
|
||||||
|
test_context_menu = FALSE;
|
||||||
|
WmContextMenuSeq[0].wParam = (WPARAM)child[2];
|
||||||
|
WmContextMenuSeq[1].wParam = (WPARAM)child[1];
|
||||||
|
WmContextMenuSeq[2].wParam = (WPARAM)child[0];
|
||||||
|
ok_sequence(WmContextMenuSeq, "DefWindowProcA(WM_CONTEXTMENU)", FALSE);
|
||||||
|
DestroyWindow(child[0]);
|
||||||
|
|
||||||
GetCursorPos(&pos);
|
GetCursorPos(&pos);
|
||||||
GetWindowRect(hwnd, &rect);
|
GetWindowRect(hwnd, &rect);
|
||||||
x = (rect.left+rect.right) / 2;
|
x = (rect.left+rect.right) / 2;
|
||||||
|
|
Loading…
Reference in New Issue