[COMDLG32] Color Picker: Fix cursor clipping (#6219)

- ClipCursor(NULL) for WM_LBUTTONUP
  and WM_NCDESTROY.
- ClipCursor(...) for WM_LBUTTONDOWN.
CORE-17002
This commit is contained in:
Katayama Hirofumi MZ 2023-12-24 22:10:26 +09:00 committed by GitHub
parent 4a3a78857f
commit 758fff284d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1096,6 +1096,9 @@ static LRESULT CC_WMLButtonUp( CCPRIV *infoPtr )
{
if (infoPtr->capturedGraph)
{
#ifdef __REACTOS__
ClipCursor(NULL);
#endif
infoPtr->capturedGraph = 0;
ReleaseCapture();
CC_PaintCross(infoPtr);
@ -1173,6 +1176,14 @@ static LRESULT CC_WMLButtonDown( CCPRIV *infoPtr, LPARAM lParam )
}
if (i)
{
#ifdef __REACTOS__
if (infoPtr->capturedGraph)
{
RECT rect;
GetWindowRect(GetDlgItem(infoPtr->hwndSelf, infoPtr->capturedGraph), &rect);
ClipCursor(&rect);
}
#endif
CC_EditSetRGB(infoPtr);
CC_EditSetHSL(infoPtr);
CC_PaintCross(infoPtr);
@ -1215,6 +1226,10 @@ static INT_PTR CALLBACK ColorDlgProc( HWND hDlg, UINT message,
case WM_INITDIALOG:
return CC_WMInitDialog(hDlg, wParam, lParam);
case WM_NCDESTROY:
#ifdef __REACTOS__
// Ensure clipping is released, in case the dialog is closed before WM_LBUTTONUP is received.
ClipCursor(NULL);
#endif
DeleteDC(lpp->hdcMem);
DeleteObject(lpp->hbmMem);
heap_free(lpp);
@ -1236,10 +1251,16 @@ static INT_PTR CALLBACK ColorDlgProc( HWND hDlg, UINT message,
if (CC_WMMouseMove(lpp, lParam))
return TRUE;
break;
#ifdef __REACTOS__
/* ReactOS: The following comment doesn't apply */
#endif
case WM_LBUTTONUP: /* FIXME: ClipCursor off (if in color graph)*/
if (CC_WMLButtonUp(lpp))
return TRUE;
break;
#ifdef __REACTOS__
/* ReactOS: The following comment doesn't apply */
#endif
case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/
if (CC_WMLButtonDown(lpp, lParam))
return TRUE;