Fix for #10576 - Context menu doesn't show on right click of objects on Mac 2.6 Beta 1

This commit is contained in:
YuSanka 2023-05-17 12:49:52 +02:00 committed by Oleksandra Yushchenko
parent 32d72cceed
commit 7a0b226f5c

View File

@ -955,7 +955,7 @@ void ObjectList::list_manipulation(const wxPoint& mouse_pos, bool evt_context_me
if (!item) { if (!item) {
if (col == nullptr) { if (col == nullptr) {
if (wxOSX && !multiple_selection()) if (wxOSX)
UnselectAll(); UnselectAll();
else if (!evt_context_menu) else if (!evt_context_menu)
// Case, when last item was deleted and under GTK was called wxEVT_DATAVIEW_SELECTION_CHANGED, // Case, when last item was deleted and under GTK was called wxEVT_DATAVIEW_SELECTION_CHANGED,
@ -972,11 +972,17 @@ void ObjectList::list_manipulation(const wxPoint& mouse_pos, bool evt_context_me
if (wxOSX && item && col) { if (wxOSX && item && col) {
wxDataViewItemArray sels; wxDataViewItemArray sels;
GetSelections(sels); GetSelections(sels);
UnselectAll(); bool is_selection_changed = true;
if (sels.Count() > 1) for (const auto& sel_item : sels)
SetSelections(sels); if (sel_item == item) {
else // item is one oth the already selected items, so resection is no needed
is_selection_changed = false;
break;
}
if (is_selection_changed) {
UnselectAll();
Select(item); Select(item);
}
} }
if (col != nullptr) if (col != nullptr)