mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-04 15:57:09 +00:00
Fix Linux data-view dropdown popup parenting (#13721)
Delay opening the object-list filament dropdown on wxGTK until the editor window is mapped, avoiding popup creation without a valid native toplevel. Also set the GTK transient parent for dropdown popups created from data-view cell editors.
This commit is contained in:
@@ -167,6 +167,30 @@ bool DropDown::HasDismissLongTime()
|
||||
(now - dismissTime).total_milliseconds() >= 20;
|
||||
}
|
||||
|
||||
void DropDown::Popup(wxWindow *focus)
|
||||
{
|
||||
#ifdef __WXGTK__
|
||||
if (!mainDropDown && m_widget) {
|
||||
// Data-view cell editors can receive focus before wxGTK infers a
|
||||
// native popup parent, so provide the current toplevel explicitly.
|
||||
GtkWindow *transient_parent = nullptr;
|
||||
for (wxWindow *win = GetParent(); win; win = win->GetParent()) {
|
||||
GtkWidget *widget = static_cast<GtkWidget *>(win->GetHandle());
|
||||
if (!widget)
|
||||
continue;
|
||||
GtkWidget *top = gtk_widget_get_toplevel(widget);
|
||||
if (GTK_IS_WINDOW(top)) {
|
||||
transient_parent = GTK_WINDOW(top);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (transient_parent)
|
||||
gtk_window_set_transient_for(GTK_WINDOW(m_widget), transient_parent);
|
||||
}
|
||||
#endif
|
||||
PopupWindow::Popup(focus);
|
||||
}
|
||||
|
||||
void DropDown::paintEvent(wxPaintEvent& evt)
|
||||
{
|
||||
// depending on your system you may need to look at double-buffered dcs
|
||||
|
||||
Reference in New Issue
Block a user