fix creation of emboss object on linux

This commit is contained in:
Filip Sykala 2022-01-05 10:30:45 +01:00
parent 4e559daece
commit 7b70083c78

View File

@ -4188,13 +4188,17 @@ void Plater::priv::on_right_click(RBtnEvent& evt)
} }
if (q != nullptr && menu) { if (q != nullptr && menu) {
const Vec2d& mouse_position = evt.data.first;
wxPoint position(static_cast<int>(mouse_position.x()),
static_cast<int>(mouse_position.y()));
#ifdef __linux__ #ifdef __linux__
// For some reason on Linux the menu isn't displayed if position is specified // For some reason on Linux the menu isn't displayed if position is
// (even though the position is sane). // specified (even though the position is sane).
q->PopupMenu(menu); position = wxDefaultPosition;
#else
q->PopupMenu(menu, (int)evt.data.first.x(), (int)evt.data.first.y());
#endif #endif
q->canvas3D()->set_popup_menu_position(mouse_position);
q->PopupMenu(menu, position);
q->canvas3D()->clear_popup_menu_position();
} }
} }
@ -6835,9 +6839,7 @@ bool Plater::PopupMenu(wxMenu *menu, const wxPoint& pos)
SuppressBackgroundProcessingUpdate sbpu; SuppressBackgroundProcessingUpdate sbpu;
// When tracking a pop-up menu, postpone error messages from the slicing result. // When tracking a pop-up menu, postpone error messages from the slicing result.
m_tracking_popup_menu = true; m_tracking_popup_menu = true;
canvas3D()->set_popup_menu_position(Vec2d(pos.x, pos.y));
bool out = this->wxPanel::PopupMenu(menu, pos); bool out = this->wxPanel::PopupMenu(menu, pos);
canvas3D()->clear_popup_menu_position();
m_tracking_popup_menu = false; m_tracking_popup_menu = false;
if (! m_tracking_popup_menu_error_message.empty()) { if (! m_tracking_popup_menu_error_message.empty()) {
// Don't know whether the CallAfter is necessary, but it should not hurt. // Don't know whether the CallAfter is necessary, but it should not hurt.