Scrollbar Fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

	This fixes fixes the scrollbar when 'info->MaxVal' is close to
MAX_RANGE for scrollbars. (MAX_RANGE=0x7fffffff)

	It converts the intermediate variables to floats instead of
int, which guarantees that multiplication of large values of don't
overflow.  (with a small sacrifice of accuracy)

This fixes one of the problems found in the MSDN scrollbar example (in
1902.exe) at:
http://msdn.microsoft.com/library/en-us/dnwui/html/msdn_scroll32.asp?frame=true

Formerly, the multiplication would cause the truncations of thumbpos, and the
thumb would remain fixed at zero.  (No matter what the position was set to.)

The fixed behavior is how Windows NT behaves.

(There are still some scrollbar behavior differences, but this patch gets it
closer.)

Cheers,
--Phil

Compaq:   High Performance Server Systems Quality & Performance Engineering
---------------------------------------------------------------------------
Phillip.Ezolt@compaq.com                         Performance Tools/Analysis

--- controls/scroll.c.orig	Wed Feb 13 11:24:41 2002
+++ controls/scroll.c	Wed Feb 13 11:25:08 2002
@@ -195,7 +195,7 @@
                                        INT *arrowSize, INT *thumbSize,
                                        INT *thumbPos )
 {
-    INT pixels;
+    FLOAT pixels;
     BOOL vertical;
     WND *wndPtr = WIN_FindWndPtr( hwnd );
 
@@ -293,7 +293,7 @@
                                   BOOL vertical, INT pos )
 {
     INT thumbSize;
-    INT pixels = vertical ? rect->bottom-rect->top : rect->right-rect->left;
+    FLOAT pixels = vertical ? rect->bottom-rect->top : rect->right-rect->left;
 
     if ((pixels -= 2*(GetSystemMetrics(SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP)) <= 0)
         return infoPtr->MinVal;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux