Commit 5d1a1471 authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Add mouse tracking on caption right-clicks to avoid messing with the capture.

parent 64e2d263
......@@ -170,6 +170,7 @@ extern LRESULT NC_HandleNCActivate( HWND hwnd, WPARAM wParam, LPARAM lParam ) DE
extern LRESULT NC_HandleNCCalcSize( HWND hwnd, WPARAM wParam, RECT *winRect ) DECLSPEC_HIDDEN;
extern LRESULT NC_HandleNCHitTest( HWND hwnd, POINT pt ) DECLSPEC_HIDDEN;
extern LRESULT NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
extern LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
extern LRESULT NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN;
extern LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
extern LRESULT NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
......
......@@ -334,21 +334,11 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
return NC_HandleNCLButtonDblClk( hwnd, wParam, lParam );
case WM_NCRBUTTONDOWN:
/* in Windows, capture is taken when right-clicking on the caption bar */
if (wParam==HTCAPTION)
{
SetCapture(hwnd);
}
break;
return NC_HandleNCRButtonDown( hwnd, wParam, lParam );
case WM_RBUTTONUP:
{
POINT pt;
if (hwnd == GetCapture())
/* release capture if we took it on WM_NCRBUTTONDOWN */
ReleaseCapture();
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
ClientToScreen(hwnd, &pt);
......
......@@ -1462,6 +1462,44 @@ LRESULT NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
/***********************************************************************
* NC_HandleNCRButtonDown
*
* Handle a WM_NCRBUTTONDOWN message. Called from DefWindowProc().
*/
LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
{
MSG msg;
INT hittest = wParam;
HMENU hSysMenu = GetSystemMenu(hwnd, FALSE);
switch (hittest)
{
case HTCAPTION:
case HTSYSMENU:
hSysMenu = GetSystemMenu(hwnd, FALSE);
if (!hSysMenu) break;
SetCapture( hwnd );
for (;;)
{
if (!GetMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST )) break;
if (CallMsgFilterW( &msg, MSGF_MAX )) continue;
if (msg.message == WM_RBUTTONUP)
{
hittest = NC_HandleNCHitTest( hwnd, msg.pt );
break;
}
}
ReleaseCapture();
if (hittest == HTCAPTION || hittest == HTSYSMENU)
SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, msg.lParam );
break;
}
return 0;
}
/***********************************************************************
* NC_HandleNCLButtonDblClk
*
* Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment