user32: Add mouse tracking on caption right-clicks to avoid messing with the capture.
This commit is contained in:
parent
64e2d263d9
commit
5d1a147163
|
@ -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);
|
||||
|
|
|
@ -1461,6 +1461,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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue