user32: Translate WM_(NC)XBUTTONUP to WM_APPCOMMAND in DefWindowProc.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alex Henrie 2017-02-22 23:17:07 -07:00 committed by Alexandre Julliard
parent fef10cbe9a
commit 2799be1804
2 changed files with 37 additions and 0 deletions

View File

@ -291,6 +291,15 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
*/
break;
case WM_XBUTTONUP:
case WM_NCXBUTTONUP:
if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
{
SendMessageW(hwnd, WM_APPCOMMAND, (WPARAM)hwnd,
MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
}
break;
case WM_CONTEXTMENU:
if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD)
SendMessageW( GetParent(hwnd), msg, wParam, lParam );

View File

@ -14378,6 +14378,18 @@ static const struct message NCRBUTTONDOWNSeq[] =
{ 0 }
};
static const struct message NCXBUTTONUPSeq1[] =
{
{ WM_APPCOMMAND, sent|lparam, /*hwnd*/0, MAKELPARAM(0, FAPPCOMMAND_MOUSE | APPCOMMAND_BROWSER_BACKWARD) },
{ 0 }
};
static const struct message NCXBUTTONUPSeq2[] =
{
{ WM_APPCOMMAND, sent|lparam, /*hwnd*/0, MAKELPARAM(0, FAPPCOMMAND_MOUSE | APPCOMMAND_BROWSER_FORWARD) },
{ 0 }
};
struct rbuttonup_thread_data
{
HWND hwnd;
@ -14437,6 +14449,22 @@ static void test_defwinproc(void)
DefWindowProcA( hwnd, WM_NCRBUTTONDOWN, HTCAPTION, MAKELPARAM(x, y));
ok_sequence(NCRBUTTONDOWNSeq, "WM_NCRBUTTONDOWN on caption", FALSE);
res = DefWindowProcA(hwnd, WM_NCXBUTTONUP, 0, MAKELPARAM(x, y));
ok(!res, "WM_NCXBUTTONUP returned %ld\n", res);
ok_sequence(WmEmptySeq, "WM_NCXBUTTONUP without button", FALSE);
res = DefWindowProcA(hwnd, WM_NCXBUTTONUP, MAKEWPARAM(0, XBUTTON1), MAKELPARAM(x, y));
ok(!res, "WM_NCXBUTTONUP returned %ld\n", res);
ok_sequence(NCXBUTTONUPSeq1, "WM_NCXBUTTONUP with XBUTTON1", FALSE);
res = DefWindowProcA(hwnd, WM_NCXBUTTONUP, MAKEWPARAM(0, XBUTTON2), MAKELPARAM(x, y));
ok(!res, "WM_NCXBUTTONUP returned %ld\n", res);
ok_sequence(NCXBUTTONUPSeq2, "WM_NCXBUTTONUP with XBUTTON2", FALSE);
res = DefWindowProcA(hwnd, WM_NCXBUTTONUP, MAKEWPARAM(0, 3), MAKELPARAM(x, y));
ok(!res, "WM_NCXBUTTONUP returned %ld\n", res);
ok_sequence(WmEmptySeq, "WM_NCXBUTTONUP with invalid button", FALSE);
SetEvent( data.wndproc_finished );
WaitForSingleObject( thread, 1000 );
CloseHandle( data.wndproc_finished );