Mikołaj Zalewski : comctl32: header: Fix an order-related bug in HEADER_InternalHitTest.

Alexandre Julliard julliard at wine.codeweavers.com
Fri May 26 05:42:14 CDT 2006


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

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Thu May 25 23:51:03 2006 +0200

comctl32: header: Fix an order-related bug in HEADER_InternalHitTest.

---

 dlls/comctl32/header.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index fb37923..3242bbd 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -199,6 +199,12 @@ HEADER_NextItem(HWND hwnd, INT iItem)
     return HEADER_OrderToIndex(hwnd, HEADER_IndexToOrder(hwnd, iItem)+1);
 }
 
+static INT
+HEADER_PrevItem(HWND hwnd, INT iItem)
+{
+    return HEADER_OrderToIndex(hwnd, HEADER_IndexToOrder(hwnd, iItem)-1);
+}
+
 static void
 HEADER_SetItemBounds (HWND hwnd)
 {
@@ -594,19 +600,19 @@ HEADER_InternalHitTest (HWND hwnd, LPPOI
 			TRACE("ON HEADER %d\n", iCount);
 			return;
 		    }
-		    if (iCount > 0) {
+                    if (HEADER_IndexToOrder(hwnd, iCount) > 0) {
 			rcTest = rect;
 			rcTest.right = rcTest.left + DIVIDER_WIDTH;
 			if (PtInRect (&rcTest, *lpPt)) {
 			    if (bNoWidth) {
 				*pFlags |= HHT_ONDIVOPEN;
-				*pItem = iCount - 1;
+                                *pItem = HEADER_PrevItem(hwnd, iCount);
 				TRACE("ON DIVOPEN %d\n", *pItem);
 				return;
 			    }
 			    else {
 				*pFlags |= HHT_ONDIVIDER;
-				*pItem = iCount - 1;
+                                *pItem = HEADER_PrevItem(hwnd, iCount);
 				TRACE("ON DIVIDER %d\n", *pItem);
 				return;
 			    }




More information about the wine-cvs mailing list