https://git.reactos.org/?p=reactos.git;a=commitdiff;h=758fff284d3239d965bdb…
commit 758fff284d3239d965bdb1d65ec01d5ccfd64d18
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Dec 24 22:10:26 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Dec 24 22:10:26 2023 +0900
[COMDLG32] Color Picker: Fix cursor clipping (#6219)
- ClipCursor(NULL) for WM_LBUTTONUP
and WM_NCDESTROY.
- ClipCursor(...) for WM_LBUTTONDOWN.
CORE-17002
---
dll/win32/comdlg32/colordlg.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/dll/win32/comdlg32/colordlg.c b/dll/win32/comdlg32/colordlg.c
index 1e8c26bf324..517cb4ea627 100644
--- a/dll/win32/comdlg32/colordlg.c
+++ b/dll/win32/comdlg32/colordlg.c
@@ -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;