comctl32/listview: Simplify key selection handler a bit.

This commit is contained in:
Nikolay Sivov 2009-05-25 00:26:30 +04:00 committed by Alexandre Julliard
parent 4527d02a44
commit 28bffafdf6
1 changed files with 3 additions and 12 deletions

View File

@ -3269,18 +3269,14 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem, BOOL space)
TRACE("nItem=%d, wShift=%d, wCtrl=%d\n", nItem, wShift, wCtrl); TRACE("nItem=%d, wShift=%d, wCtrl=%d\n", nItem, wShift, wCtrl);
if ((nItem >= 0) && (nItem < infoPtr->nItemCount)) if ((nItem >= 0) && (nItem < infoPtr->nItemCount))
{ {
if (infoPtr->dwStyle & LVS_SINGLESEL) bResult = TRUE;
{
bResult = TRUE; if (infoPtr->dwStyle & LVS_SINGLESEL || (wShift == 0 && wCtrl == 0))
LISTVIEW_SetSelection(infoPtr, nItem); LISTVIEW_SetSelection(infoPtr, nItem);
}
else else
{ {
if (wShift) if (wShift)
{
bResult = TRUE;
LISTVIEW_SetGroupSelection(infoPtr, nItem); LISTVIEW_SetGroupSelection(infoPtr, nItem);
}
else if (wCtrl) else if (wCtrl)
{ {
LVITEMW lvItem; LVITEMW lvItem;
@ -3294,11 +3290,6 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem, BOOL space)
} }
bResult = LISTVIEW_SetItemFocus(infoPtr, nItem); bResult = LISTVIEW_SetItemFocus(infoPtr, nItem);
} }
else
{
bResult = TRUE;
LISTVIEW_SetSelection(infoPtr, nItem);
}
} }
LISTVIEW_EnsureVisible(infoPtr, nItem, FALSE); LISTVIEW_EnsureVisible(infoPtr, nItem, FALSE);
} }