Jeremy White : sane.ds: Fix a subtle bug that prevented the float scrollbar from incrementing by one .
Alexandre Julliard
julliard at winehq.org
Fri Mar 6 09:49:40 CST 2009
Module: wine
Branch: master
Commit: 956c296a32e60253f1cbdd7dd937e6f9a2ee3662
URL: http://source.winehq.org/git/wine.git/?a=commit;h=956c296a32e60253f1cbdd7dd937e6f9a2ee3662
Author: Jeremy White <jwhite at codeweavers.com>
Date: Thu Mar 5 17:13:45 2009 -0600
sane.ds: Fix a subtle bug that prevented the float scrollbar from incrementing by one.
---
dlls/sane.ds/ui.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/sane.ds/ui.c b/dlls/sane.ds/ui.c
index 31b5152..147c759 100644
--- a/dlls/sane.ds/ui.c
+++ b/dlls/sane.ds/ui.c
@@ -853,10 +853,14 @@ static INT_PTR InitializeDialog(HWND hwnd)
dd = SANE_UNFIX(*sf);
HeapFree(GetProcessHeap(),0,sf);
+ /* Note that conversion of float -> SANE_Fixed is lossy;
+ * and when you truncate it into an integer, you can get
+ * unfortunate results. This calculation attempts
+ * to mitigate that harm */
if (s_quant)
- pos = (dd / s_quant);
+ pos = ((dd + (s_quant/2.0)) / s_quant);
else
- pos = dd / 0.01;
+ pos = (dd + 0.005) / 0.01;
SendMessageW(control, SBM_SETPOS, pos, TRUE);
More information about the wine-cvs
mailing list