From 7b70083c7872f6eabdbba668ecd5cd38c7928b93 Mon Sep 17 00:00:00 2001 From: Filip Sykala Date: Wed, 5 Jan 2022 10:30:45 +0100 Subject: [PATCH] fix creation of emboss object on linux --- src/slic3r/GUI/Plater.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 7ad40d7b88..f469f40f3f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4188,13 +4188,17 @@ void Plater::priv::on_right_click(RBtnEvent& evt) } if (q != nullptr && menu) { + const Vec2d& mouse_position = evt.data.first; + wxPoint position(static_cast(mouse_position.x()), + static_cast(mouse_position.y())); #ifdef __linux__ - // For some reason on Linux the menu isn't displayed if position is specified - // (even though the position is sane). - q->PopupMenu(menu); -#else - q->PopupMenu(menu, (int)evt.data.first.x(), (int)evt.data.first.y()); + // For some reason on Linux the menu isn't displayed if position is + // specified (even though the position is sane). + position = wxDefaultPosition; #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; // When tracking a pop-up menu, postpone error messages from the slicing result. m_tracking_popup_menu = true; - canvas3D()->set_popup_menu_position(Vec2d(pos.x, pos.y)); - bool out = this->wxPanel::PopupMenu(menu, pos); - canvas3D()->clear_popup_menu_position(); + bool out = this->wxPanel::PopupMenu(menu, pos); m_tracking_popup_menu = false; if (! m_tracking_popup_menu_error_message.empty()) { // Don't know whether the CallAfter is necessary, but it should not hurt.