When shifting the list's indices, we must not send notify messages if
we have to refocus. Item modification handlers are not supposed to be called here.
This commit is contained in:
parent
636725f2f0
commit
64eff97f51
|
@ -253,6 +253,7 @@ typedef struct tagLISTVIEW_INFO
|
||||||
BOOL bFirstPaint; /* Flags if the control has never painted before */
|
BOOL bFirstPaint; /* Flags if the control has never painted before */
|
||||||
BOOL bAutoarrange; /* Autoarrange flag when NOT in LVS_AUTOARRANGE */
|
BOOL bAutoarrange; /* Autoarrange flag when NOT in LVS_AUTOARRANGE */
|
||||||
BOOL bFocus;
|
BOOL bFocus;
|
||||||
|
BOOL bDoChangeNotify; /* send change notification messages? */
|
||||||
INT nFocusedItem;
|
INT nFocusedItem;
|
||||||
RECT rcFocus;
|
RECT rcFocus;
|
||||||
DWORD dwStyle; /* the cached window GWL_STYLE */
|
DWORD dwStyle; /* the cached window GWL_STYLE */
|
||||||
|
@ -2827,6 +2828,11 @@ static INT shift_item(LISTVIEW_INFO *infoPtr, INT nShiftItem, INT nItem, INT dir
|
||||||
static void LISTVIEW_ShiftIndices(LISTVIEW_INFO *infoPtr, INT nItem, INT direction)
|
static void LISTVIEW_ShiftIndices(LISTVIEW_INFO *infoPtr, INT nItem, INT direction)
|
||||||
{
|
{
|
||||||
INT nNewFocus;
|
INT nNewFocus;
|
||||||
|
BOOL bOldChange;
|
||||||
|
|
||||||
|
/* temporarily disable change notification while shifting items */
|
||||||
|
bOldChange = infoPtr->bDoChangeNotify;
|
||||||
|
infoPtr->bDoChangeNotify = FALSE;
|
||||||
|
|
||||||
TRACE("Shifting %iu, %i steps\n", nItem, direction);
|
TRACE("Shifting %iu, %i steps\n", nItem, direction);
|
||||||
|
|
||||||
|
@ -2841,6 +2847,8 @@ static void LISTVIEW_ShiftIndices(LISTVIEW_INFO *infoPtr, INT nItem, INT directi
|
||||||
LISTVIEW_SetItemFocus(infoPtr, nNewFocus);
|
LISTVIEW_SetItemFocus(infoPtr, nNewFocus);
|
||||||
|
|
||||||
/* But we are not supposed to modify nHotItem! */
|
/* But we are not supposed to modify nHotItem! */
|
||||||
|
|
||||||
|
infoPtr->bDoChangeNotify = bOldChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3183,8 +3191,10 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
|
||||||
nmlv.lParam = item.lParam;
|
nmlv.lParam = item.lParam;
|
||||||
|
|
||||||
/* send LVN_ITEMCHANGING notification, if the item is not being inserted */
|
/* send LVN_ITEMCHANGING notification, if the item is not being inserted */
|
||||||
/* and we are _NOT_ virtual (LVS_OWERNDATA) */
|
/* and we are _NOT_ virtual (LVS_OWERNDATA), and change notifications */
|
||||||
if(lpItem && !isNew && notify_listview(infoPtr, LVN_ITEMCHANGING, &nmlv))
|
/* are enabled */
|
||||||
|
if(lpItem && !isNew && infoPtr->bDoChangeNotify &&
|
||||||
|
notify_listview(infoPtr, LVN_ITEMCHANGING, &nmlv))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* copy information */
|
/* copy information */
|
||||||
|
@ -3234,7 +3244,7 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
|
||||||
|
|
||||||
/* send LVN_ITEMCHANGED notification */
|
/* send LVN_ITEMCHANGED notification */
|
||||||
if (lpLVItem->mask & LVIF_PARAM) nmlv.lParam = lpLVItem->lParam;
|
if (lpLVItem->mask & LVIF_PARAM) nmlv.lParam = lpLVItem->lParam;
|
||||||
notify_listview(infoPtr, LVN_ITEMCHANGED, &nmlv);
|
if (infoPtr->bDoChangeNotify) notify_listview(infoPtr, LVN_ITEMCHANGED, &nmlv);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -7049,6 +7059,7 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
|
||||||
infoPtr->bRedraw = TRUE;
|
infoPtr->bRedraw = TRUE;
|
||||||
infoPtr->bFirstPaint = TRUE;
|
infoPtr->bFirstPaint = TRUE;
|
||||||
infoPtr->bNoItemMetrics = TRUE;
|
infoPtr->bNoItemMetrics = TRUE;
|
||||||
|
infoPtr->bDoChangeNotify = TRUE;
|
||||||
infoPtr->iconSpacing.cx = GetSystemMetrics(SM_CXICONSPACING);
|
infoPtr->iconSpacing.cx = GetSystemMetrics(SM_CXICONSPACING);
|
||||||
infoPtr->iconSpacing.cy = GetSystemMetrics(SM_CYICONSPACING);
|
infoPtr->iconSpacing.cy = GetSystemMetrics(SM_CYICONSPACING);
|
||||||
infoPtr->nEditLabelItem = -1;
|
infoPtr->nEditLabelItem = -1;
|
||||||
|
|
Loading…
Reference in New Issue