Scrolling form bug fix

Duane Clark dclark at akamail.com
Mon Dec 23 18:52:25 CST 2002


The patch several months ago:
  http://www.winehq.com/hypermail/wine-cvs/2002/09/0164.html

broke scrolling of forms with controls in them.
 
http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&selm=ncenta.god.ln%40dt2.swe-home.de

It turns out this is because the change caused the variable "rect" in 
X11DRV_ScrollWindowEx to always be valid, which causes the first part of 
the test at line ~180 to always fail:
            if (!rect || IntersectRect(&dummy, &r, &rc))

According to the MSDN, a NULL prcScroll parameter means that the entire 
client area needs to be scrolled, which is what the first part of that 
"if" was supposed to accomplish.

Changelog:
	If prcScroll is NULL, scroll entire client area.

-------------- next part --------------
Index: dlls/x11drv/scroll.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/scroll.c,v
retrieving revision 1.11
diff -u -r1.11 scroll.c
--- dlls/x11drv/scroll.c	31 Oct 2002 02:38:20 -0000	1.11
+++ dlls/x11drv/scroll.c	24 Dec 2002 00:36:29 -0000
@@ -127,10 +127,14 @@
     HRGN  hrgnClip = CreateRectRgnIndirect(clipRect);
     HRGN  hrgnTemp;
     HDC   hDC;
+    RECT  rc;
 
-    TRACE( "%p, %d,%d hrgnUpdate=%p rcUpdate = %p rect=(%d,%d-%d,%d) %04x\n",
+    GetClientRect(hwnd, &rc);
+    if (rect) IntersectRect(&rc, &rc, rect);
+
+    TRACE( "%p, %d,%d hrgnUpdate=%p rcUpdate = %p rc=(%d,%d-%d,%d) %04x\n",
            hwnd, dx, dy, hrgnUpdate, rcUpdate,
-           rect->left, rect->top, rect->right, rect->bottom, flags );
+           rc.left, rc.top, rc.right, rc.bottom, flags );
     TRACE( "clipRect = (%d,%d,%d,%d)\n",
            clipRect->left, clipRect->top, clipRect->right, clipRect->bottom );
 
@@ -142,7 +146,7 @@
     {
         HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
         X11DRV_StartGraphicsExposures( hDC );
-        X11DRV_ScrollDC( hDC, dx, dy, rect, clipRect, hrgnUpdate, rcUpdate );
+        X11DRV_ScrollDC( hDC, dx, dy, &rc, clipRect, hrgnUpdate, rcUpdate );
         X11DRV_EndGraphicsExposures( hDC, hrgn );
         ReleaseDC( hwnd, hDC );
         if (bUpdate) CombineRgn( hrgnUpdate, hrgnUpdate, hrgn, RGN_OR );
@@ -172,7 +176,7 @@
             {
                 GetWindowRect( list[i], &r );
                 MapWindowPoints( 0, hwnd, (POINT *)&r, 2 );
-                if (!rect || IntersectRect(&dummy, &r, rect))
+                if (!rect || IntersectRect(&dummy, &r, &rc))
                     SetWindowPos( list[i], 0, r.left + dx, r.top  + dy, 0, 0,
                                   SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE |
                                   SWP_NOREDRAW | SWP_DEFERERASE );
Index: windows/scroll.c
===================================================================
RCS file: /home/wine/wine/windows/scroll.c,v
retrieving revision 1.39
diff -u -r1.39 scroll.c
--- windows/scroll.c	30 Oct 2002 23:45:38 -0000	1.39
+++ windows/scroll.c	24 Dec 2002 00:36:29 -0000
@@ -117,7 +117,7 @@
         HWND hwndCaret = fix_caret(hwnd, &caretrc, flags);
 
 	if (USER_Driver.pScrollWindowEx)
-            result = USER_Driver.pScrollWindowEx( hwnd, dx, dy, &rc, &cliprc,
+            result = USER_Driver.pScrollWindowEx( hwnd, dx, dy, rect, &cliprc,
                                                   hrgnUpdate, rcUpdate, flags );
 	else
 	    result = ERROR; /* FIXME: we should have a fallback implementation */


More information about the wine-patches mailing list