LibGUI: Only consider starting a drag from an already selected item

This means we can deselect other items immediately when performing a mouse-down
on an unselected item.
This commit is contained in:
Sergey Bugaev 2020-01-28 16:25:46 +03:00 committed by Andreas Kling
parent f9b4d981a8
commit 831ff2d0ac
Notes: sideshowbarker 2024-07-19 09:45:35 +09:00

View File

@ -191,10 +191,9 @@ void GAbstractView::mousedown_event(GMouseEvent& event)
m_selection.clear();
} else if (event.modifiers() & Mod_Ctrl) {
m_selection.toggle(index);
} else if (event.button() == GMouseButton::Left && !m_model->drag_data_type().is_null()) {
} else if (event.button() == GMouseButton::Left && m_selection.contains(index) && !m_model->drag_data_type().is_null()) {
// We might be starting a drag, so don't throw away other selected items yet.
m_might_drag = true;
m_selection.add(index);
} else {
m_selection.set(index);
}