Commit 89b62b48 authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

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

parent 7e461db2
...@@ -199,6 +199,12 @@ HEADER_NextItem(HWND hwnd, INT iItem) ...@@ -199,6 +199,12 @@ HEADER_NextItem(HWND hwnd, INT iItem)
return HEADER_OrderToIndex(hwnd, HEADER_IndexToOrder(hwnd, iItem)+1); 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 static void
HEADER_SetItemBounds (HWND hwnd) HEADER_SetItemBounds (HWND hwnd)
{ {
...@@ -594,19 +600,19 @@ HEADER_InternalHitTest (HWND hwnd, LPPOINT lpPt, UINT *pFlags, INT *pItem) ...@@ -594,19 +600,19 @@ HEADER_InternalHitTest (HWND hwnd, LPPOINT lpPt, UINT *pFlags, INT *pItem)
TRACE("ON HEADER %d\n", iCount); TRACE("ON HEADER %d\n", iCount);
return; return;
} }
if (iCount > 0) { if (HEADER_IndexToOrder(hwnd, iCount) > 0) {
rcTest = rect; rcTest = rect;
rcTest.right = rcTest.left + DIVIDER_WIDTH; rcTest.right = rcTest.left + DIVIDER_WIDTH;
if (PtInRect (&rcTest, *lpPt)) { if (PtInRect (&rcTest, *lpPt)) {
if (bNoWidth) { if (bNoWidth) {
*pFlags |= HHT_ONDIVOPEN; *pFlags |= HHT_ONDIVOPEN;
*pItem = iCount - 1; *pItem = HEADER_PrevItem(hwnd, iCount);
TRACE("ON DIVOPEN %d\n", *pItem); TRACE("ON DIVOPEN %d\n", *pItem);
return; return;
} }
else { else {
*pFlags |= HHT_ONDIVIDER; *pFlags |= HHT_ONDIVIDER;
*pItem = iCount - 1; *pItem = HEADER_PrevItem(hwnd, iCount);
TRACE("ON DIVIDER %d\n", *pItem); TRACE("ON DIVIDER %d\n", *pItem);
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment