comctl32/listview: Draw focus rectangle only when visible.

This commit is contained in:
Nikolay Sivov 2009-05-24 22:36:14 +04:00 committed by Alexandre Julliard
parent 88f7fd5dea
commit c46a5141da
1 changed files with 6 additions and 4 deletions

View File

@ -4305,6 +4305,7 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcEra
ITERATOR i; ITERATOR i;
HDC hdcOrig = hdc; HDC hdcOrig = hdc;
HBITMAP hbmp = NULL; HBITMAP hbmp = NULL;
RANGE range;
LISTVIEW_DUMP(infoPtr); LISTVIEW_DUMP(infoPtr);
@ -4370,11 +4371,11 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcEra
/* figure out what we need to draw */ /* figure out what we need to draw */
iterator_visibleitems(&i, infoPtr, hdc); iterator_visibleitems(&i, infoPtr, hdc);
range = iterator_range(&i);
/* send cache hint notification */ /* send cache hint notification */
if (infoPtr->dwStyle & LVS_OWNERDATA) if (infoPtr->dwStyle & LVS_OWNERDATA)
{ {
RANGE range = iterator_range(&i);
NMLVCACHEHINT nmlv; NMLVCACHEHINT nmlv;
ZeroMemory(&nmlv, sizeof(NMLVCACHEHINT)); ZeroMemory(&nmlv, sizeof(NMLVCACHEHINT));
@ -4392,8 +4393,9 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcEra
else /* LVS_LIST, LVS_ICON or LVS_SMALLICON */ else /* LVS_LIST, LVS_ICON or LVS_SMALLICON */
LISTVIEW_RefreshList(infoPtr, &i, hdc, cdmode); LISTVIEW_RefreshList(infoPtr, &i, hdc, cdmode);
/* if we have a focus rect, draw it */ /* if we have a focus rect and it's visible, draw it */
if (infoPtr->bFocus) if (infoPtr->bFocus && range.lower <= infoPtr->nFocusedItem &&
(range.upper - 1) >= infoPtr->nFocusedItem)
LISTVIEW_DrawFocusRect(infoPtr, hdc); LISTVIEW_DrawFocusRect(infoPtr, hdc);
} }
iterator_destroy(&i); iterator_destroy(&i);