Divan Burger : comdlg32: Clamp hue and saturation when clicking in colour graph in colour dialog.
Alexandre Julliard
julliard at winehq.org
Wed Jan 9 07:02:11 CST 2008
Module: wine
Branch: master
Commit: 8a0dab38c8fd0779ec26661ddc511cc41149cfe0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8a0dab38c8fd0779ec26661ddc511cc41149cfe0
Author: Divan Burger <divan.burger at gmail.com>
Date: Mon Jan 7 18:44:10 2008 +0200
comdlg32: Clamp hue and saturation when clicking in colour graph in colour dialog.
---
dlls/comdlg32/colordlg.c | 37 +++++++++++++++++++++----------------
1 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/dlls/comdlg32/colordlg.c b/dlls/comdlg32/colordlg.c
index a955650..aa7bca4 100644
--- a/dlls/comdlg32/colordlg.c
+++ b/dlls/comdlg32/colordlg.c
@@ -337,24 +337,29 @@ static int CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert
ClientToScreen(hDlg, &point);
hwnd = GetDlgItem( hDlg, dlgitem );
GetWindowRect(hwnd, &rect);
- if (PtInRect(&rect, point))
- {
- GetClientRect(hwnd, &rect);
- ScreenToClient(hwnd, &point);
- x = (long) point.x * MAXHORI;
- x /= rect.right;
- y = (long) (rect.bottom - point.y) * MAXVERT;
- y /= rect.bottom;
-
- if (hori)
- *hori = x;
- if (vert)
- *vert = y;
- return 1;
- }
- else
+ if (!PtInRect(&rect, point))
return 0;
+
+ GetClientRect(hwnd, &rect);
+ ScreenToClient(hwnd, &point);
+
+ x = (long) point.x * MAXHORI;
+ x /= rect.right;
+ y = (long) (rect.bottom - point.y) * MAXVERT;
+ y /= rect.bottom;
+
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+ if (x > MAXHORI) x = MAXHORI;
+ if (y > MAXVERT) y = MAXVERT;
+
+ if (hori)
+ *hori = x;
+ if (vert)
+ *vert = y;
+
+ return 1;
}
/***********************************************************************
* CC_MouseCheckResultWindow [internal]
More information about the wine-cvs
mailing list