diff --git a/Libraries/LibGUI/GItemView.cpp b/Libraries/LibGUI/GItemView.cpp index e4fd104400c..8f025c06099 100644 --- a/Libraries/LibGUI/GItemView.cpp +++ b/Libraries/LibGUI/GItemView.cpp @@ -130,6 +130,8 @@ void GItemView::mousedown_event(GMouseEvent& event) auto index = model()->index(item_index, m_model_column); if (event.modifiers() & Mod_Ctrl) selection().toggle(index); + else if (selection().size() > 1) + m_might_drag = true; else selection().set(index); } @@ -146,6 +148,12 @@ void GItemView::mouseup_event(GMouseEvent& event) update(); return; } + int item_index = item_at_event_position(event.position()); + auto index = model()->index(item_index, m_model_column); + if((selection().size() > 1) & m_might_drag) { + selection().set(index); + m_might_drag = false; + } GAbstractView::mouseup_event(event); } diff --git a/Libraries/LibGUI/GItemView.h b/Libraries/LibGUI/GItemView.h index 25986d5ea16..ee81ab87d0f 100644 --- a/Libraries/LibGUI/GItemView.h +++ b/Libraries/LibGUI/GItemView.h @@ -48,6 +48,8 @@ private: int m_visual_column_count { 0 }; int m_visual_row_count { 0 }; + bool m_might_drag { false }; + Point m_left_mousedown_position; Size m_effective_item_size { 80, 80 };