Slightly optimize Shift/Control-clicking in wxTR_MULTIPLE case

Don't call GetSelections() unnecessarily if we're not going to use its
result in any case because either Shift or Command/Control key was
pressed when the mouse button was released.

See #18680.
This commit is contained in:
Vadim Zeitlin
2020-03-16 00:27:12 +01:00
parent 2f05f5e2eb
commit 8bc830337c

View File

@@ -3790,14 +3790,10 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
}
// this facilitates multiple-item drag-and-drop
if ( HasFlag(wxTR_MULTIPLE))
if ( HasFlag(wxTR_MULTIPLE) && !(event.CmdDown() || event.ShiftDown()) )
{
wxArrayTreeItemIds selections;
size_t count = GetSelections(selections);
if (count > 1 &&
!event.CmdDown() &&
!event.ShiftDown())
if ( GetSelections(selections) > 1 )
{
DoSelectItem(item, true, false);
}