[patch] Fix listview scrolling

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

 



This patch fixes some problems related to keyboard scrolling in listviews.  
First, pressing Home incorrectly put the third or fourth item at the top of 
the view rather than the first.  Second, PgDn would usually scroll down an 
extra row so that the selected item became the second from the bottom instead 
of the very bottom.  Lastly, I'm pretty sure there should be separate 
nPartialAdjust variables for horz and vert scrolling.  Dimitrie, feel free to 
look over this and make sure I didn't misunderstand anything you did.

Patch is relative to Dimitrie's Listview K10 patch.

File: dlls/comctl32/listview.c
Changelog:
  Paul Rupe <prupe@myrealbox.com>
  Fix inaccurate listview scrolling with PgUp/Down and Home/End keys


-- 
Paul Rupe   <prupe@myrealbox.com>                "She smiled, in the end."

| Oppose government police-ware on your PC!
| Stop the Consumer Broadband and Digital Television Promotion Act!
| <http://www.eff.org/alerts/20020322_eff_cbdtpa_alert.html>
--- listview.c.exp	Sat Oct  5 11:01:13 2002
+++ listview.c	Sat Oct  5 12:05:26 2002
@@ -4212,7 +4212,8 @@
     UINT uView = LISTVIEW_GetType(infoPtr);
     INT nScrollPosHeight = 0;
     INT nScrollPosWidth = 0;
-    INT nPartialAdjust = 0;
+    INT nHorzAdjust = 0;
+    INT nVertAdjust = 0;
     INT nHorzDiff = 0;
     INT nVertDiff = 0;
     RECT rcItem;
@@ -4232,12 +4233,12 @@
 
 	if (rcItem.left < infoPtr->rcList.left)
 	{
-	    nPartialAdjust = -1;
-	    if (uView != LVS_REPORT) nHorzDiff = rcItem.left + infoPtr->rcList.left;
+	    nHorzAdjust = -1;
+	    if (uView != LVS_REPORT) nHorzDiff = rcItem.left - infoPtr->rcList.left;
 	}
 	else
 	{
-	    nPartialAdjust = 1;
+	    nHorzAdjust = 1;
 	    if (uView != LVS_REPORT) nHorzDiff = rcItem.right - infoPtr->rcList.right;
 	}
     }
@@ -4252,12 +4253,12 @@
 
 	if (rcItem.top < infoPtr->rcList.top)
 	{
-	    nPartialAdjust = -1;
-	    if (uView != LVS_LIST) nVertDiff = rcItem.top + infoPtr->rcList.top;
+	    nVertAdjust = -1;
+	    if (uView != LVS_LIST) nVertDiff = rcItem.top - infoPtr->rcList.top;
 	}
 	else
 	{
-	    nPartialAdjust = 1;
+	    nVertAdjust = 1;
 	    if (uView != LVS_LIST) nVertDiff = rcItem.bottom - infoPtr->rcList.bottom;
 	}
     }
@@ -4267,14 +4268,14 @@
     if (nScrollPosWidth)
     {
 	INT diff = nHorzDiff / nScrollPosWidth;
-	if (rcItem.left % nScrollPosWidth) diff += nPartialAdjust;
+	if (nHorzDiff % nScrollPosWidth) diff += nHorzAdjust;
 	LISTVIEW_HScroll(infoPtr, SB_INTERNAL, diff, 0);
     }
 
     if (nScrollPosHeight)
     {
 	INT diff = nVertDiff / nScrollPosHeight;
-	if (rcItem.top % nScrollPosHeight) diff += nPartialAdjust;
+	if (nVertDiff % nScrollPosHeight) diff += nVertAdjust;
 	LISTVIEW_VScroll(infoPtr, SB_INTERNAL, diff, 0);
     }
 

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

  Powered by Linux