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,12 +972,18 @@ 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);
bool is_selection_changed = true;
for (const auto& sel_item : sels)
if (sel_item == item) {
// item is one oth the already selected items, so resection is no needed
is_selection_changed = false;
break;
}
if (is_selection_changed) {
UnselectAll(); UnselectAll();
if (sels.Count() > 1)
SetSelections(sels);
else
Select(item); Select(item);
} }
}
if (col != nullptr) if (col != nullptr)
{ {