Dylan Smith : user32: Increased area for scrolling via mouse drag outside scrollbar.

Alexandre Julliard julliard at winehq.org
Fri Jul 4 13:59:22 CDT 2008


Module: wine
Branch: master
Commit: 2f1c7b1610498e54cbd9a4dd3fdf4408e98ac7c4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2f1c7b1610498e54cbd9a4dd3fdf4408e98ac7c4

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Thu Jul  3 11:03:12 2008 -0400

user32: Increased area for scrolling via mouse drag outside scrollbar.

When dragging the scrollbar thumb with the mouse, the mouse is able to
move away from the scrollbar and keep scrolling so long as it isn't too
far away from the scrollbar.  This makes it easier to quickly scroll
with the mouse.

All that this patch changes is the distance that the mouse can be moved
away from the scrollbar before it is consider outside of the scrollbar
and returns to its original position.  The distances are proportional to
the size of the scrollbar.

---

 dlls/user32/scroll.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index ddfacd6..af35c97 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -328,16 +328,25 @@ static UINT SCROLL_GetThumbVal( SCROLLBAR_INFO *infoPtr, RECT *rect,
 static BOOL SCROLL_PtInRectEx( LPRECT lpRect, POINT pt, BOOL vertical )
 {
     RECT rect = *lpRect;
+    int scrollbarWidth;
 
+    /* Pad hit rect to allow mouse to be dragged outside of scrollbar and
+     * still be considered in the scrollbar. */
     if (vertical)
     {
-	rect.left -= lpRect->right - lpRect->left;
-	rect.right += lpRect->right - lpRect->left;
+        scrollbarWidth = lpRect->right - lpRect->left;
+        rect.left -= scrollbarWidth*8;
+        rect.right += scrollbarWidth*8;
+        rect.top -= scrollbarWidth*2;
+        rect.bottom += scrollbarWidth*2;
     }
     else
     {
-	rect.top -= lpRect->bottom - lpRect->top;
-	rect.bottom += lpRect->bottom - lpRect->top;
+        scrollbarWidth = lpRect->bottom - lpRect->top;
+        rect.left -= scrollbarWidth*2;
+        rect.right += scrollbarWidth*2;
+        rect.top -= scrollbarWidth*8;
+        rect.bottom += scrollbarWidth*8;
     }
     return PtInRect( &rect, pt );
 }




More information about the wine-cvs mailing list