Commit 24dc6600 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32: Fix item selection with VK_SPACE when Ctrl is pressed.

parent 1a2ccfe9
...@@ -425,7 +425,7 @@ static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *, INT, BOOL); ...@@ -425,7 +425,7 @@ static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *, INT, BOOL);
static LRESULT LISTVIEW_Command(const LISTVIEW_INFO *, WPARAM, LPARAM); static LRESULT LISTVIEW_Command(const LISTVIEW_INFO *, WPARAM, LPARAM);
static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *, PFNLVCOMPARE, LPARAM); static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *, PFNLVCOMPARE, LPARAM);
static INT LISTVIEW_GetStringWidthT(const LISTVIEW_INFO *, LPCWSTR, BOOL); static INT LISTVIEW_GetStringWidthT(const LISTVIEW_INFO *, LPCWSTR, BOOL);
static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *, INT); static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *, INT, BOOL);
static UINT LISTVIEW_GetItemState(const LISTVIEW_INFO *, INT, UINT); static UINT LISTVIEW_GetItemState(const LISTVIEW_INFO *, INT, UINT);
static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *, INT, const LVITEMW *); static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *, INT, const LVITEMW *);
static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *, INT, INT, HWND); static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *, INT, INT, HWND);
...@@ -1590,7 +1590,7 @@ static INT LISTVIEW_ProcessLetterKeys(LISTVIEW_INFO *infoPtr, WPARAM charCode, L ...@@ -1590,7 +1590,7 @@ static INT LISTVIEW_ProcessLetterKeys(LISTVIEW_INFO *infoPtr, WPARAM charCode, L
nItem = notify_hdr(infoPtr, LVN_ODFINDITEMW, (LPNMHDR)&nmlv.hdr); nItem = notify_hdr(infoPtr, LVN_ODFINDITEMW, (LPNMHDR)&nmlv.hdr);
if (nItem != -1) if (nItem != -1)
LISTVIEW_KeySelection(infoPtr, nItem); LISTVIEW_KeySelection(infoPtr, nItem, FALSE);
return 0; return 0;
} }
...@@ -1623,7 +1623,7 @@ static INT LISTVIEW_ProcessLetterKeys(LISTVIEW_INFO *infoPtr, WPARAM charCode, L ...@@ -1623,7 +1623,7 @@ static INT LISTVIEW_ProcessLetterKeys(LISTVIEW_INFO *infoPtr, WPARAM charCode, L
} while (idx != endidx); } while (idx != endidx);
if (nItem != -1) if (nItem != -1)
LISTVIEW_KeySelection(infoPtr, nItem); LISTVIEW_KeySelection(infoPtr, nItem, FALSE);
return 0; return 0;
} }
...@@ -3220,12 +3220,13 @@ static void LISTVIEW_SetSelection(LISTVIEW_INFO *infoPtr, INT nItem) ...@@ -3220,12 +3220,13 @@ static void LISTVIEW_SetSelection(LISTVIEW_INFO *infoPtr, INT nItem)
* PARAMETER(S): * PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure * [I] infoPtr : valid pointer to the listview structure
* [I] nItem : item index * [I] nItem : item index
* [I] space : VK_SPACE code sent
* *
* RETURN: * RETURN:
* SUCCESS : TRUE (needs to be repainted) * SUCCESS : TRUE (needs to be repainted)
* FAILURE : FALSE (nothing has changed) * FAILURE : FALSE (nothing has changed)
*/ */
static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem) static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem, BOOL space)
{ {
/* FIXME: pass in the state */ /* FIXME: pass in the state */
WORD wShift = HIWORD(GetKeyState(VK_SHIFT)); WORD wShift = HIWORD(GetKeyState(VK_SHIFT));
...@@ -3252,11 +3253,12 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem) ...@@ -3252,11 +3253,12 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem)
LVITEMW lvItem; LVITEMW lvItem;
lvItem.state = ~LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED); lvItem.state = ~LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED);
lvItem.stateMask = LVIS_SELECTED; lvItem.stateMask = LVIS_SELECTED;
LISTVIEW_SetItemState(infoPtr, nItem, &lvItem); if (space)
{
if (lvItem.state & LVIS_SELECTED) LISTVIEW_SetItemState(infoPtr, nItem, &lvItem);
infoPtr->nSelectionMark = nItem; if (lvItem.state & LVIS_SELECTED)
infoPtr->nSelectionMark = nItem;
}
bResult = LISTVIEW_SetItemFocus(infoPtr, nItem); bResult = LISTVIEW_SetItemFocus(infoPtr, nItem);
} }
else else
...@@ -8560,7 +8562,7 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK ...@@ -8560,7 +8562,7 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK
} }
if ((nItem != -1) && (nItem != infoPtr->nFocusedItem || nVirtualKey == VK_SPACE)) if ((nItem != -1) && (nItem != infoPtr->nFocusedItem || nVirtualKey == VK_SPACE))
LISTVIEW_KeySelection(infoPtr, nItem); LISTVIEW_KeySelection(infoPtr, nItem, nVirtualKey == VK_SPACE);
return 0; return 0;
} }
......
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