Scrollbar thumb behavior

Duane Clark dclark at akamail.com
Tue Mar 26 20:58:43 CST 2002


One of my apps (Xilinx fpga_editor yet again) has a "world view" that 
was not being activated and deactivated correctly. When the mouse is 
pressed in a scrollbar thumb, it should have been immediately activated, 
but activation did not occur until the thumb was moved. And upon 
releasing the mouse button, the world view was not being deactivated. A 
similar behavior occurs with MS Word, where a tooltip style window 
should pop up immediately when the mouse is pressed in the thumb. 
Instead, it did not get activated until the thumb was moved.

Testing with control spy, the correct behavior is that on mouse down, a 
SB_THUMBTRACK message with the current position should be sent, and on 
mouse up, a SB_THUMBPOSITION immediately followed by SB_ENDSCROLL. This 
patch adds that behavior, and fixes both of the applications.

As usual, this patch is released under the old X11 style wine license.

Log message:
	On mouse down in thumb, issue SB_THUMBTRACK with current
	position.
	On mouse up in thumb, issue SB_THUMBPOSITION followed
	by SB_ENDSCROLL


-------------- next part --------------
Index: controls/scroll.c
===================================================================
RCS file: /home/wine/wine/controls/scroll.c,v
retrieving revision 1.52
diff -u -r1.52 scroll.c
--- controls/scroll.c	9 Mar 2002 23:50:37 -0000	1.52
+++ controls/scroll.c	27 Mar 2002 02:39:25 -0000
@@ -1102,6 +1102,18 @@
         break;
     }
 
+    if (msg == WM_LBUTTONDOWN)
+    {
+
+        if (hittest == SCROLL_THUMB)
+        {
+            UINT val = SCROLL_GetThumbVal( infoPtr, &rect, vertical,
+                                 trackThumbPos + lastMousePos - lastClickPos );
+            SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
+                            MAKEWPARAM( SB_THUMBTRACK, val ), (LPARAM)hwndCtl );
+        }
+    }
+
     if (msg == WM_LBUTTONUP)
     {
 	hittest = SCROLL_trackHitTest;
@@ -1114,8 +1126,7 @@
             SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                             MAKEWPARAM( SB_THUMBPOSITION, val ), (LPARAM)hwndCtl );
         }
-        else
-            SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
+        SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                           SB_ENDSCROLL, (LPARAM)hwndCtl );
     }
 


More information about the wine-patches mailing list